app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014
  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/notes.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/notes.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. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. /* harmony default export */ __webpack_exports__["default"] = ({
  1722. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1723. props: ['initialnotes', 'authusername'],
  1724. data: function data() {
  1725. return {
  1726. notes: this.initialnotes
  1727. };
  1728. }
  1729. });
  1730. /***/ }),
  1731. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1732. /*!*****************************************************************************************************************************************************************!*\
  1733. !*** ./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& ***!
  1734. \*****************************************************************************************************************************************************************/
  1735. /*! exports provided: default */
  1736. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1737. "use strict";
  1738. __webpack_require__.r(__webpack_exports__);
  1739. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. //
  1751. //
  1752. //
  1753. //
  1754. //
  1755. //
  1756. //
  1757. //
  1758. //
  1759. //
  1760. //
  1761. //
  1762. //
  1763. //
  1764. //
  1765. //
  1766. //
  1767. //
  1768. //
  1769. //
  1770. //
  1771. //
  1772. //
  1773. //
  1774. //
  1775. //
  1776. //
  1777. //
  1778. //
  1779. /* harmony default export */ __webpack_exports__["default"] = ({
  1780. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1781. props: ['workOrder'],
  1782. data: function data() {
  1783. return {
  1784. data: JSON.parse(this.workOrder),
  1785. showModal: false
  1786. };
  1787. },
  1788. mounted: function mounted() {
  1789. var _this = this;
  1790. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1791. _this.data = JSON.parse(e.data);
  1792. });
  1793. },
  1794. methods: {
  1795. updateWorkOrder: function updateWorkOrder() {
  1796. axios.put('/api/workorder/' + this.data.woid, this.data).then(function (response) {})["catch"](function (error) {});
  1797. $('#workordereditModal').modal('hide');
  1798. }
  1799. }
  1800. });
  1801. /***/ }),
  1802. /***/ "./node_modules/base64-js/index.js":
  1803. /*!*****************************************!*\
  1804. !*** ./node_modules/base64-js/index.js ***!
  1805. \*****************************************/
  1806. /*! no static exports found */
  1807. /***/ (function(module, exports, __webpack_require__) {
  1808. "use strict";
  1809. exports.byteLength = byteLength
  1810. exports.toByteArray = toByteArray
  1811. exports.fromByteArray = fromByteArray
  1812. var lookup = []
  1813. var revLookup = []
  1814. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1815. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1816. for (var i = 0, len = code.length; i < len; ++i) {
  1817. lookup[i] = code[i]
  1818. revLookup[code.charCodeAt(i)] = i
  1819. }
  1820. // Support decoding URL-safe base64 strings, as Node.js does.
  1821. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1822. revLookup['-'.charCodeAt(0)] = 62
  1823. revLookup['_'.charCodeAt(0)] = 63
  1824. function getLens (b64) {
  1825. var len = b64.length
  1826. if (len % 4 > 0) {
  1827. throw new Error('Invalid string. Length must be a multiple of 4')
  1828. }
  1829. // Trim off extra bytes after placeholder bytes are found
  1830. // See: https://github.com/beatgammit/base64-js/issues/42
  1831. var validLen = b64.indexOf('=')
  1832. if (validLen === -1) validLen = len
  1833. var placeHoldersLen = validLen === len
  1834. ? 0
  1835. : 4 - (validLen % 4)
  1836. return [validLen, placeHoldersLen]
  1837. }
  1838. // base64 is 4/3 + up to two characters of the original data
  1839. function byteLength (b64) {
  1840. var lens = getLens(b64)
  1841. var validLen = lens[0]
  1842. var placeHoldersLen = lens[1]
  1843. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1844. }
  1845. function _byteLength (b64, validLen, placeHoldersLen) {
  1846. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1847. }
  1848. function toByteArray (b64) {
  1849. var tmp
  1850. var lens = getLens(b64)
  1851. var validLen = lens[0]
  1852. var placeHoldersLen = lens[1]
  1853. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1854. var curByte = 0
  1855. // if there are placeholders, only get up to the last complete 4 chars
  1856. var len = placeHoldersLen > 0
  1857. ? validLen - 4
  1858. : validLen
  1859. var i
  1860. for (i = 0; i < len; i += 4) {
  1861. tmp =
  1862. (revLookup[b64.charCodeAt(i)] << 18) |
  1863. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1864. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1865. revLookup[b64.charCodeAt(i + 3)]
  1866. arr[curByte++] = (tmp >> 16) & 0xFF
  1867. arr[curByte++] = (tmp >> 8) & 0xFF
  1868. arr[curByte++] = tmp & 0xFF
  1869. }
  1870. if (placeHoldersLen === 2) {
  1871. tmp =
  1872. (revLookup[b64.charCodeAt(i)] << 2) |
  1873. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1874. arr[curByte++] = tmp & 0xFF
  1875. }
  1876. if (placeHoldersLen === 1) {
  1877. tmp =
  1878. (revLookup[b64.charCodeAt(i)] << 10) |
  1879. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1880. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1881. arr[curByte++] = (tmp >> 8) & 0xFF
  1882. arr[curByte++] = tmp & 0xFF
  1883. }
  1884. return arr
  1885. }
  1886. function tripletToBase64 (num) {
  1887. return lookup[num >> 18 & 0x3F] +
  1888. lookup[num >> 12 & 0x3F] +
  1889. lookup[num >> 6 & 0x3F] +
  1890. lookup[num & 0x3F]
  1891. }
  1892. function encodeChunk (uint8, start, end) {
  1893. var tmp
  1894. var output = []
  1895. for (var i = start; i < end; i += 3) {
  1896. tmp =
  1897. ((uint8[i] << 16) & 0xFF0000) +
  1898. ((uint8[i + 1] << 8) & 0xFF00) +
  1899. (uint8[i + 2] & 0xFF)
  1900. output.push(tripletToBase64(tmp))
  1901. }
  1902. return output.join('')
  1903. }
  1904. function fromByteArray (uint8) {
  1905. var tmp
  1906. var len = uint8.length
  1907. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1908. var parts = []
  1909. var maxChunkLength = 16383 // must be multiple of 3
  1910. // go through the array every three bytes, we'll deal with trailing stuff later
  1911. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1912. parts.push(encodeChunk(
  1913. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1914. ))
  1915. }
  1916. // pad the end with zeros, but make sure to not forget the extra bytes
  1917. if (extraBytes === 1) {
  1918. tmp = uint8[len - 1]
  1919. parts.push(
  1920. lookup[tmp >> 2] +
  1921. lookup[(tmp << 4) & 0x3F] +
  1922. '=='
  1923. )
  1924. } else if (extraBytes === 2) {
  1925. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  1926. parts.push(
  1927. lookup[tmp >> 10] +
  1928. lookup[(tmp >> 4) & 0x3F] +
  1929. lookup[(tmp << 2) & 0x3F] +
  1930. '='
  1931. )
  1932. }
  1933. return parts.join('')
  1934. }
  1935. /***/ }),
  1936. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1937. /*!*****************************************************!*\
  1938. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1939. \*****************************************************/
  1940. /*! no static exports found */
  1941. /***/ (function(module, exports, __webpack_require__) {
  1942. /*!
  1943. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  1944. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1945. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1946. */
  1947. (function (global, factory) {
  1948. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1949. undefined;
  1950. }(this, (function (exports, $, Popper) { 'use strict';
  1951. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1952. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1953. function _defineProperties(target, props) {
  1954. for (var i = 0; i < props.length; i++) {
  1955. var descriptor = props[i];
  1956. descriptor.enumerable = descriptor.enumerable || false;
  1957. descriptor.configurable = true;
  1958. if ("value" in descriptor) descriptor.writable = true;
  1959. Object.defineProperty(target, descriptor.key, descriptor);
  1960. }
  1961. }
  1962. function _createClass(Constructor, protoProps, staticProps) {
  1963. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1964. if (staticProps) _defineProperties(Constructor, staticProps);
  1965. return Constructor;
  1966. }
  1967. function _defineProperty(obj, key, value) {
  1968. if (key in obj) {
  1969. Object.defineProperty(obj, key, {
  1970. value: value,
  1971. enumerable: true,
  1972. configurable: true,
  1973. writable: true
  1974. });
  1975. } else {
  1976. obj[key] = value;
  1977. }
  1978. return obj;
  1979. }
  1980. function ownKeys(object, enumerableOnly) {
  1981. var keys = Object.keys(object);
  1982. if (Object.getOwnPropertySymbols) {
  1983. var symbols = Object.getOwnPropertySymbols(object);
  1984. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  1985. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  1986. });
  1987. keys.push.apply(keys, symbols);
  1988. }
  1989. return keys;
  1990. }
  1991. function _objectSpread2(target) {
  1992. for (var i = 1; i < arguments.length; i++) {
  1993. var source = arguments[i] != null ? arguments[i] : {};
  1994. if (i % 2) {
  1995. ownKeys(Object(source), true).forEach(function (key) {
  1996. _defineProperty(target, key, source[key]);
  1997. });
  1998. } else if (Object.getOwnPropertyDescriptors) {
  1999. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2000. } else {
  2001. ownKeys(Object(source)).forEach(function (key) {
  2002. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2003. });
  2004. }
  2005. }
  2006. return target;
  2007. }
  2008. function _inheritsLoose(subClass, superClass) {
  2009. subClass.prototype = Object.create(superClass.prototype);
  2010. subClass.prototype.constructor = subClass;
  2011. subClass.__proto__ = superClass;
  2012. }
  2013. /**
  2014. * --------------------------------------------------------------------------
  2015. * Bootstrap (v4.4.1): util.js
  2016. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2017. * --------------------------------------------------------------------------
  2018. */
  2019. /**
  2020. * ------------------------------------------------------------------------
  2021. * Private TransitionEnd Helpers
  2022. * ------------------------------------------------------------------------
  2023. */
  2024. var TRANSITION_END = 'transitionend';
  2025. var MAX_UID = 1000000;
  2026. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2027. function toType(obj) {
  2028. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2029. }
  2030. function getSpecialTransitionEndEvent() {
  2031. return {
  2032. bindType: TRANSITION_END,
  2033. delegateType: TRANSITION_END,
  2034. handle: function handle(event) {
  2035. if ($(event.target).is(this)) {
  2036. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2037. }
  2038. return undefined; // eslint-disable-line no-undefined
  2039. }
  2040. };
  2041. }
  2042. function transitionEndEmulator(duration) {
  2043. var _this = this;
  2044. var called = false;
  2045. $(this).one(Util.TRANSITION_END, function () {
  2046. called = true;
  2047. });
  2048. setTimeout(function () {
  2049. if (!called) {
  2050. Util.triggerTransitionEnd(_this);
  2051. }
  2052. }, duration);
  2053. return this;
  2054. }
  2055. function setTransitionEndSupport() {
  2056. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2057. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2058. }
  2059. /**
  2060. * --------------------------------------------------------------------------
  2061. * Public Util Api
  2062. * --------------------------------------------------------------------------
  2063. */
  2064. var Util = {
  2065. TRANSITION_END: 'bsTransitionEnd',
  2066. getUID: function getUID(prefix) {
  2067. do {
  2068. // eslint-disable-next-line no-bitwise
  2069. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2070. } while (document.getElementById(prefix));
  2071. return prefix;
  2072. },
  2073. getSelectorFromElement: function getSelectorFromElement(element) {
  2074. var selector = element.getAttribute('data-target');
  2075. if (!selector || selector === '#') {
  2076. var hrefAttr = element.getAttribute('href');
  2077. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2078. }
  2079. try {
  2080. return document.querySelector(selector) ? selector : null;
  2081. } catch (err) {
  2082. return null;
  2083. }
  2084. },
  2085. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2086. if (!element) {
  2087. return 0;
  2088. } // Get transition-duration of the element
  2089. var transitionDuration = $(element).css('transition-duration');
  2090. var transitionDelay = $(element).css('transition-delay');
  2091. var floatTransitionDuration = parseFloat(transitionDuration);
  2092. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2093. if (!floatTransitionDuration && !floatTransitionDelay) {
  2094. return 0;
  2095. } // If multiple durations are defined, take the first
  2096. transitionDuration = transitionDuration.split(',')[0];
  2097. transitionDelay = transitionDelay.split(',')[0];
  2098. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2099. },
  2100. reflow: function reflow(element) {
  2101. return element.offsetHeight;
  2102. },
  2103. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2104. $(element).trigger(TRANSITION_END);
  2105. },
  2106. // TODO: Remove in v5
  2107. supportsTransitionEnd: function supportsTransitionEnd() {
  2108. return Boolean(TRANSITION_END);
  2109. },
  2110. isElement: function isElement(obj) {
  2111. return (obj[0] || obj).nodeType;
  2112. },
  2113. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2114. for (var property in configTypes) {
  2115. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2116. var expectedTypes = configTypes[property];
  2117. var value = config[property];
  2118. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2119. if (!new RegExp(expectedTypes).test(valueType)) {
  2120. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2121. }
  2122. }
  2123. }
  2124. },
  2125. findShadowRoot: function findShadowRoot(element) {
  2126. if (!document.documentElement.attachShadow) {
  2127. return null;
  2128. } // Can find the shadow root otherwise it'll return the document
  2129. if (typeof element.getRootNode === 'function') {
  2130. var root = element.getRootNode();
  2131. return root instanceof ShadowRoot ? root : null;
  2132. }
  2133. if (element instanceof ShadowRoot) {
  2134. return element;
  2135. } // when we don't find a shadow root
  2136. if (!element.parentNode) {
  2137. return null;
  2138. }
  2139. return Util.findShadowRoot(element.parentNode);
  2140. },
  2141. jQueryDetection: function jQueryDetection() {
  2142. if (typeof $ === 'undefined') {
  2143. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2144. }
  2145. var version = $.fn.jquery.split(' ')[0].split('.');
  2146. var minMajor = 1;
  2147. var ltMajor = 2;
  2148. var minMinor = 9;
  2149. var minPatch = 1;
  2150. var maxMajor = 4;
  2151. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2152. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2153. }
  2154. }
  2155. };
  2156. Util.jQueryDetection();
  2157. setTransitionEndSupport();
  2158. /**
  2159. * ------------------------------------------------------------------------
  2160. * Constants
  2161. * ------------------------------------------------------------------------
  2162. */
  2163. var NAME = 'alert';
  2164. var VERSION = '4.4.1';
  2165. var DATA_KEY = 'bs.alert';
  2166. var EVENT_KEY = "." + DATA_KEY;
  2167. var DATA_API_KEY = '.data-api';
  2168. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2169. var Selector = {
  2170. DISMISS: '[data-dismiss="alert"]'
  2171. };
  2172. var Event = {
  2173. CLOSE: "close" + EVENT_KEY,
  2174. CLOSED: "closed" + EVENT_KEY,
  2175. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2176. };
  2177. var ClassName = {
  2178. ALERT: 'alert',
  2179. FADE: 'fade',
  2180. SHOW: 'show'
  2181. };
  2182. /**
  2183. * ------------------------------------------------------------------------
  2184. * Class Definition
  2185. * ------------------------------------------------------------------------
  2186. */
  2187. var Alert =
  2188. /*#__PURE__*/
  2189. function () {
  2190. function Alert(element) {
  2191. this._element = element;
  2192. } // Getters
  2193. var _proto = Alert.prototype;
  2194. // Public
  2195. _proto.close = function close(element) {
  2196. var rootElement = this._element;
  2197. if (element) {
  2198. rootElement = this._getRootElement(element);
  2199. }
  2200. var customEvent = this._triggerCloseEvent(rootElement);
  2201. if (customEvent.isDefaultPrevented()) {
  2202. return;
  2203. }
  2204. this._removeElement(rootElement);
  2205. };
  2206. _proto.dispose = function dispose() {
  2207. $.removeData(this._element, DATA_KEY);
  2208. this._element = null;
  2209. } // Private
  2210. ;
  2211. _proto._getRootElement = function _getRootElement(element) {
  2212. var selector = Util.getSelectorFromElement(element);
  2213. var parent = false;
  2214. if (selector) {
  2215. parent = document.querySelector(selector);
  2216. }
  2217. if (!parent) {
  2218. parent = $(element).closest("." + ClassName.ALERT)[0];
  2219. }
  2220. return parent;
  2221. };
  2222. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2223. var closeEvent = $.Event(Event.CLOSE);
  2224. $(element).trigger(closeEvent);
  2225. return closeEvent;
  2226. };
  2227. _proto._removeElement = function _removeElement(element) {
  2228. var _this = this;
  2229. $(element).removeClass(ClassName.SHOW);
  2230. if (!$(element).hasClass(ClassName.FADE)) {
  2231. this._destroyElement(element);
  2232. return;
  2233. }
  2234. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2235. $(element).one(Util.TRANSITION_END, function (event) {
  2236. return _this._destroyElement(element, event);
  2237. }).emulateTransitionEnd(transitionDuration);
  2238. };
  2239. _proto._destroyElement = function _destroyElement(element) {
  2240. $(element).detach().trigger(Event.CLOSED).remove();
  2241. } // Static
  2242. ;
  2243. Alert._jQueryInterface = function _jQueryInterface(config) {
  2244. return this.each(function () {
  2245. var $element = $(this);
  2246. var data = $element.data(DATA_KEY);
  2247. if (!data) {
  2248. data = new Alert(this);
  2249. $element.data(DATA_KEY, data);
  2250. }
  2251. if (config === 'close') {
  2252. data[config](this);
  2253. }
  2254. });
  2255. };
  2256. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2257. return function (event) {
  2258. if (event) {
  2259. event.preventDefault();
  2260. }
  2261. alertInstance.close(this);
  2262. };
  2263. };
  2264. _createClass(Alert, null, [{
  2265. key: "VERSION",
  2266. get: function get() {
  2267. return VERSION;
  2268. }
  2269. }]);
  2270. return Alert;
  2271. }();
  2272. /**
  2273. * ------------------------------------------------------------------------
  2274. * Data Api implementation
  2275. * ------------------------------------------------------------------------
  2276. */
  2277. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2278. /**
  2279. * ------------------------------------------------------------------------
  2280. * jQuery
  2281. * ------------------------------------------------------------------------
  2282. */
  2283. $.fn[NAME] = Alert._jQueryInterface;
  2284. $.fn[NAME].Constructor = Alert;
  2285. $.fn[NAME].noConflict = function () {
  2286. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2287. return Alert._jQueryInterface;
  2288. };
  2289. /**
  2290. * ------------------------------------------------------------------------
  2291. * Constants
  2292. * ------------------------------------------------------------------------
  2293. */
  2294. var NAME$1 = 'button';
  2295. var VERSION$1 = '4.4.1';
  2296. var DATA_KEY$1 = 'bs.button';
  2297. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2298. var DATA_API_KEY$1 = '.data-api';
  2299. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2300. var ClassName$1 = {
  2301. ACTIVE: 'active',
  2302. BUTTON: 'btn',
  2303. FOCUS: 'focus'
  2304. };
  2305. var Selector$1 = {
  2306. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2307. DATA_TOGGLES: '[data-toggle="buttons"]',
  2308. DATA_TOGGLE: '[data-toggle="button"]',
  2309. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2310. INPUT: 'input:not([type="hidden"])',
  2311. ACTIVE: '.active',
  2312. BUTTON: '.btn'
  2313. };
  2314. var Event$1 = {
  2315. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2316. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2317. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2318. };
  2319. /**
  2320. * ------------------------------------------------------------------------
  2321. * Class Definition
  2322. * ------------------------------------------------------------------------
  2323. */
  2324. var Button =
  2325. /*#__PURE__*/
  2326. function () {
  2327. function Button(element) {
  2328. this._element = element;
  2329. } // Getters
  2330. var _proto = Button.prototype;
  2331. // Public
  2332. _proto.toggle = function toggle() {
  2333. var triggerChangeEvent = true;
  2334. var addAriaPressed = true;
  2335. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2336. if (rootElement) {
  2337. var input = this._element.querySelector(Selector$1.INPUT);
  2338. if (input) {
  2339. if (input.type === 'radio') {
  2340. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2341. triggerChangeEvent = false;
  2342. } else {
  2343. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2344. if (activeElement) {
  2345. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2346. }
  2347. }
  2348. } else if (input.type === 'checkbox') {
  2349. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2350. triggerChangeEvent = false;
  2351. }
  2352. } else {
  2353. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2354. triggerChangeEvent = false;
  2355. }
  2356. if (triggerChangeEvent) {
  2357. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2358. $(input).trigger('change');
  2359. }
  2360. input.focus();
  2361. addAriaPressed = false;
  2362. }
  2363. }
  2364. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2365. if (addAriaPressed) {
  2366. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2367. }
  2368. if (triggerChangeEvent) {
  2369. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2370. }
  2371. }
  2372. };
  2373. _proto.dispose = function dispose() {
  2374. $.removeData(this._element, DATA_KEY$1);
  2375. this._element = null;
  2376. } // Static
  2377. ;
  2378. Button._jQueryInterface = function _jQueryInterface(config) {
  2379. return this.each(function () {
  2380. var data = $(this).data(DATA_KEY$1);
  2381. if (!data) {
  2382. data = new Button(this);
  2383. $(this).data(DATA_KEY$1, data);
  2384. }
  2385. if (config === 'toggle') {
  2386. data[config]();
  2387. }
  2388. });
  2389. };
  2390. _createClass(Button, null, [{
  2391. key: "VERSION",
  2392. get: function get() {
  2393. return VERSION$1;
  2394. }
  2395. }]);
  2396. return Button;
  2397. }();
  2398. /**
  2399. * ------------------------------------------------------------------------
  2400. * Data Api implementation
  2401. * ------------------------------------------------------------------------
  2402. */
  2403. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2404. var button = event.target;
  2405. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2406. button = $(button).closest(Selector$1.BUTTON)[0];
  2407. }
  2408. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2409. event.preventDefault(); // work around Firefox bug #1540995
  2410. } else {
  2411. var inputBtn = button.querySelector(Selector$1.INPUT);
  2412. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2413. event.preventDefault(); // work around Firefox bug #1540995
  2414. return;
  2415. }
  2416. Button._jQueryInterface.call($(button), 'toggle');
  2417. }
  2418. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2419. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2420. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2421. });
  2422. $(window).on(Event$1.LOAD_DATA_API, function () {
  2423. // ensure correct active class is set to match the controls' actual values/states
  2424. // find all checkboxes/readio buttons inside data-toggle groups
  2425. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2426. for (var i = 0, len = buttons.length; i < len; i++) {
  2427. var button = buttons[i];
  2428. var input = button.querySelector(Selector$1.INPUT);
  2429. if (input.checked || input.hasAttribute('checked')) {
  2430. button.classList.add(ClassName$1.ACTIVE);
  2431. } else {
  2432. button.classList.remove(ClassName$1.ACTIVE);
  2433. }
  2434. } // find all button toggles
  2435. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2436. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2437. var _button = buttons[_i];
  2438. if (_button.getAttribute('aria-pressed') === 'true') {
  2439. _button.classList.add(ClassName$1.ACTIVE);
  2440. } else {
  2441. _button.classList.remove(ClassName$1.ACTIVE);
  2442. }
  2443. }
  2444. });
  2445. /**
  2446. * ------------------------------------------------------------------------
  2447. * jQuery
  2448. * ------------------------------------------------------------------------
  2449. */
  2450. $.fn[NAME$1] = Button._jQueryInterface;
  2451. $.fn[NAME$1].Constructor = Button;
  2452. $.fn[NAME$1].noConflict = function () {
  2453. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2454. return Button._jQueryInterface;
  2455. };
  2456. /**
  2457. * ------------------------------------------------------------------------
  2458. * Constants
  2459. * ------------------------------------------------------------------------
  2460. */
  2461. var NAME$2 = 'carousel';
  2462. var VERSION$2 = '4.4.1';
  2463. var DATA_KEY$2 = 'bs.carousel';
  2464. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2465. var DATA_API_KEY$2 = '.data-api';
  2466. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2467. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2468. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2469. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2470. var SWIPE_THRESHOLD = 40;
  2471. var Default = {
  2472. interval: 5000,
  2473. keyboard: true,
  2474. slide: false,
  2475. pause: 'hover',
  2476. wrap: true,
  2477. touch: true
  2478. };
  2479. var DefaultType = {
  2480. interval: '(number|boolean)',
  2481. keyboard: 'boolean',
  2482. slide: '(boolean|string)',
  2483. pause: '(string|boolean)',
  2484. wrap: 'boolean',
  2485. touch: 'boolean'
  2486. };
  2487. var Direction = {
  2488. NEXT: 'next',
  2489. PREV: 'prev',
  2490. LEFT: 'left',
  2491. RIGHT: 'right'
  2492. };
  2493. var Event$2 = {
  2494. SLIDE: "slide" + EVENT_KEY$2,
  2495. SLID: "slid" + EVENT_KEY$2,
  2496. KEYDOWN: "keydown" + EVENT_KEY$2,
  2497. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2498. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2499. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2500. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2501. TOUCHEND: "touchend" + EVENT_KEY$2,
  2502. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2503. POINTERUP: "pointerup" + EVENT_KEY$2,
  2504. DRAG_START: "dragstart" + EVENT_KEY$2,
  2505. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2506. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2507. };
  2508. var ClassName$2 = {
  2509. CAROUSEL: 'carousel',
  2510. ACTIVE: 'active',
  2511. SLIDE: 'slide',
  2512. RIGHT: 'carousel-item-right',
  2513. LEFT: 'carousel-item-left',
  2514. NEXT: 'carousel-item-next',
  2515. PREV: 'carousel-item-prev',
  2516. ITEM: 'carousel-item',
  2517. POINTER_EVENT: 'pointer-event'
  2518. };
  2519. var Selector$2 = {
  2520. ACTIVE: '.active',
  2521. ACTIVE_ITEM: '.active.carousel-item',
  2522. ITEM: '.carousel-item',
  2523. ITEM_IMG: '.carousel-item img',
  2524. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2525. INDICATORS: '.carousel-indicators',
  2526. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2527. DATA_RIDE: '[data-ride="carousel"]'
  2528. };
  2529. var PointerType = {
  2530. TOUCH: 'touch',
  2531. PEN: 'pen'
  2532. };
  2533. /**
  2534. * ------------------------------------------------------------------------
  2535. * Class Definition
  2536. * ------------------------------------------------------------------------
  2537. */
  2538. var Carousel =
  2539. /*#__PURE__*/
  2540. function () {
  2541. function Carousel(element, config) {
  2542. this._items = null;
  2543. this._interval = null;
  2544. this._activeElement = null;
  2545. this._isPaused = false;
  2546. this._isSliding = false;
  2547. this.touchTimeout = null;
  2548. this.touchStartX = 0;
  2549. this.touchDeltaX = 0;
  2550. this._config = this._getConfig(config);
  2551. this._element = element;
  2552. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2553. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2554. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2555. this._addEventListeners();
  2556. } // Getters
  2557. var _proto = Carousel.prototype;
  2558. // Public
  2559. _proto.next = function next() {
  2560. if (!this._isSliding) {
  2561. this._slide(Direction.NEXT);
  2562. }
  2563. };
  2564. _proto.nextWhenVisible = function nextWhenVisible() {
  2565. // Don't call next when the page isn't visible
  2566. // or the carousel or its parent isn't visible
  2567. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2568. this.next();
  2569. }
  2570. };
  2571. _proto.prev = function prev() {
  2572. if (!this._isSliding) {
  2573. this._slide(Direction.PREV);
  2574. }
  2575. };
  2576. _proto.pause = function pause(event) {
  2577. if (!event) {
  2578. this._isPaused = true;
  2579. }
  2580. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2581. Util.triggerTransitionEnd(this._element);
  2582. this.cycle(true);
  2583. }
  2584. clearInterval(this._interval);
  2585. this._interval = null;
  2586. };
  2587. _proto.cycle = function cycle(event) {
  2588. if (!event) {
  2589. this._isPaused = false;
  2590. }
  2591. if (this._interval) {
  2592. clearInterval(this._interval);
  2593. this._interval = null;
  2594. }
  2595. if (this._config.interval && !this._isPaused) {
  2596. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2597. }
  2598. };
  2599. _proto.to = function to(index) {
  2600. var _this = this;
  2601. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2602. var activeIndex = this._getItemIndex(this._activeElement);
  2603. if (index > this._items.length - 1 || index < 0) {
  2604. return;
  2605. }
  2606. if (this._isSliding) {
  2607. $(this._element).one(Event$2.SLID, function () {
  2608. return _this.to(index);
  2609. });
  2610. return;
  2611. }
  2612. if (activeIndex === index) {
  2613. this.pause();
  2614. this.cycle();
  2615. return;
  2616. }
  2617. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2618. this._slide(direction, this._items[index]);
  2619. };
  2620. _proto.dispose = function dispose() {
  2621. $(this._element).off(EVENT_KEY$2);
  2622. $.removeData(this._element, DATA_KEY$2);
  2623. this._items = null;
  2624. this._config = null;
  2625. this._element = null;
  2626. this._interval = null;
  2627. this._isPaused = null;
  2628. this._isSliding = null;
  2629. this._activeElement = null;
  2630. this._indicatorsElement = null;
  2631. } // Private
  2632. ;
  2633. _proto._getConfig = function _getConfig(config) {
  2634. config = _objectSpread2({}, Default, {}, config);
  2635. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2636. return config;
  2637. };
  2638. _proto._handleSwipe = function _handleSwipe() {
  2639. var absDeltax = Math.abs(this.touchDeltaX);
  2640. if (absDeltax <= SWIPE_THRESHOLD) {
  2641. return;
  2642. }
  2643. var direction = absDeltax / this.touchDeltaX;
  2644. this.touchDeltaX = 0; // swipe left
  2645. if (direction > 0) {
  2646. this.prev();
  2647. } // swipe right
  2648. if (direction < 0) {
  2649. this.next();
  2650. }
  2651. };
  2652. _proto._addEventListeners = function _addEventListeners() {
  2653. var _this2 = this;
  2654. if (this._config.keyboard) {
  2655. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2656. return _this2._keydown(event);
  2657. });
  2658. }
  2659. if (this._config.pause === 'hover') {
  2660. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2661. return _this2.pause(event);
  2662. }).on(Event$2.MOUSELEAVE, function (event) {
  2663. return _this2.cycle(event);
  2664. });
  2665. }
  2666. if (this._config.touch) {
  2667. this._addTouchEventListeners();
  2668. }
  2669. };
  2670. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2671. var _this3 = this;
  2672. if (!this._touchSupported) {
  2673. return;
  2674. }
  2675. var start = function start(event) {
  2676. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2677. _this3.touchStartX = event.originalEvent.clientX;
  2678. } else if (!_this3._pointerEvent) {
  2679. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2680. }
  2681. };
  2682. var move = function move(event) {
  2683. // ensure swiping with one touch and not pinching
  2684. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2685. _this3.touchDeltaX = 0;
  2686. } else {
  2687. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2688. }
  2689. };
  2690. var end = function end(event) {
  2691. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2692. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2693. }
  2694. _this3._handleSwipe();
  2695. if (_this3._config.pause === 'hover') {
  2696. // If it's a touch-enabled device, mouseenter/leave are fired as
  2697. // part of the mouse compatibility events on first tap - the carousel
  2698. // would stop cycling until user tapped out of it;
  2699. // here, we listen for touchend, explicitly pause the carousel
  2700. // (as if it's the second time we tap on it, mouseenter compat event
  2701. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2702. // events to fire) we explicitly restart cycling
  2703. _this3.pause();
  2704. if (_this3.touchTimeout) {
  2705. clearTimeout(_this3.touchTimeout);
  2706. }
  2707. _this3.touchTimeout = setTimeout(function (event) {
  2708. return _this3.cycle(event);
  2709. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2710. }
  2711. };
  2712. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2713. return e.preventDefault();
  2714. });
  2715. if (this._pointerEvent) {
  2716. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2717. return start(event);
  2718. });
  2719. $(this._element).on(Event$2.POINTERUP, function (event) {
  2720. return end(event);
  2721. });
  2722. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2723. } else {
  2724. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2725. return start(event);
  2726. });
  2727. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2728. return move(event);
  2729. });
  2730. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2731. return end(event);
  2732. });
  2733. }
  2734. };
  2735. _proto._keydown = function _keydown(event) {
  2736. if (/input|textarea/i.test(event.target.tagName)) {
  2737. return;
  2738. }
  2739. switch (event.which) {
  2740. case ARROW_LEFT_KEYCODE:
  2741. event.preventDefault();
  2742. this.prev();
  2743. break;
  2744. case ARROW_RIGHT_KEYCODE:
  2745. event.preventDefault();
  2746. this.next();
  2747. break;
  2748. }
  2749. };
  2750. _proto._getItemIndex = function _getItemIndex(element) {
  2751. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2752. return this._items.indexOf(element);
  2753. };
  2754. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2755. var isNextDirection = direction === Direction.NEXT;
  2756. var isPrevDirection = direction === Direction.PREV;
  2757. var activeIndex = this._getItemIndex(activeElement);
  2758. var lastItemIndex = this._items.length - 1;
  2759. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2760. if (isGoingToWrap && !this._config.wrap) {
  2761. return activeElement;
  2762. }
  2763. var delta = direction === Direction.PREV ? -1 : 1;
  2764. var itemIndex = (activeIndex + delta) % this._items.length;
  2765. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2766. };
  2767. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2768. var targetIndex = this._getItemIndex(relatedTarget);
  2769. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2770. var slideEvent = $.Event(Event$2.SLIDE, {
  2771. relatedTarget: relatedTarget,
  2772. direction: eventDirectionName,
  2773. from: fromIndex,
  2774. to: targetIndex
  2775. });
  2776. $(this._element).trigger(slideEvent);
  2777. return slideEvent;
  2778. };
  2779. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2780. if (this._indicatorsElement) {
  2781. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2782. $(indicators).removeClass(ClassName$2.ACTIVE);
  2783. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2784. if (nextIndicator) {
  2785. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2786. }
  2787. }
  2788. };
  2789. _proto._slide = function _slide(direction, element) {
  2790. var _this4 = this;
  2791. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2792. var activeElementIndex = this._getItemIndex(activeElement);
  2793. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2794. var nextElementIndex = this._getItemIndex(nextElement);
  2795. var isCycling = Boolean(this._interval);
  2796. var directionalClassName;
  2797. var orderClassName;
  2798. var eventDirectionName;
  2799. if (direction === Direction.NEXT) {
  2800. directionalClassName = ClassName$2.LEFT;
  2801. orderClassName = ClassName$2.NEXT;
  2802. eventDirectionName = Direction.LEFT;
  2803. } else {
  2804. directionalClassName = ClassName$2.RIGHT;
  2805. orderClassName = ClassName$2.PREV;
  2806. eventDirectionName = Direction.RIGHT;
  2807. }
  2808. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2809. this._isSliding = false;
  2810. return;
  2811. }
  2812. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2813. if (slideEvent.isDefaultPrevented()) {
  2814. return;
  2815. }
  2816. if (!activeElement || !nextElement) {
  2817. // Some weirdness is happening, so we bail
  2818. return;
  2819. }
  2820. this._isSliding = true;
  2821. if (isCycling) {
  2822. this.pause();
  2823. }
  2824. this._setActiveIndicatorElement(nextElement);
  2825. var slidEvent = $.Event(Event$2.SLID, {
  2826. relatedTarget: nextElement,
  2827. direction: eventDirectionName,
  2828. from: activeElementIndex,
  2829. to: nextElementIndex
  2830. });
  2831. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2832. $(nextElement).addClass(orderClassName);
  2833. Util.reflow(nextElement);
  2834. $(activeElement).addClass(directionalClassName);
  2835. $(nextElement).addClass(directionalClassName);
  2836. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2837. if (nextElementInterval) {
  2838. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2839. this._config.interval = nextElementInterval;
  2840. } else {
  2841. this._config.interval = this._config.defaultInterval || this._config.interval;
  2842. }
  2843. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2844. $(activeElement).one(Util.TRANSITION_END, function () {
  2845. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2846. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2847. _this4._isSliding = false;
  2848. setTimeout(function () {
  2849. return $(_this4._element).trigger(slidEvent);
  2850. }, 0);
  2851. }).emulateTransitionEnd(transitionDuration);
  2852. } else {
  2853. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2854. $(nextElement).addClass(ClassName$2.ACTIVE);
  2855. this._isSliding = false;
  2856. $(this._element).trigger(slidEvent);
  2857. }
  2858. if (isCycling) {
  2859. this.cycle();
  2860. }
  2861. } // Static
  2862. ;
  2863. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2864. return this.each(function () {
  2865. var data = $(this).data(DATA_KEY$2);
  2866. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2867. if (typeof config === 'object') {
  2868. _config = _objectSpread2({}, _config, {}, config);
  2869. }
  2870. var action = typeof config === 'string' ? config : _config.slide;
  2871. if (!data) {
  2872. data = new Carousel(this, _config);
  2873. $(this).data(DATA_KEY$2, data);
  2874. }
  2875. if (typeof config === 'number') {
  2876. data.to(config);
  2877. } else if (typeof action === 'string') {
  2878. if (typeof data[action] === 'undefined') {
  2879. throw new TypeError("No method named \"" + action + "\"");
  2880. }
  2881. data[action]();
  2882. } else if (_config.interval && _config.ride) {
  2883. data.pause();
  2884. data.cycle();
  2885. }
  2886. });
  2887. };
  2888. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2889. var selector = Util.getSelectorFromElement(this);
  2890. if (!selector) {
  2891. return;
  2892. }
  2893. var target = $(selector)[0];
  2894. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2895. return;
  2896. }
  2897. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2898. var slideIndex = this.getAttribute('data-slide-to');
  2899. if (slideIndex) {
  2900. config.interval = false;
  2901. }
  2902. Carousel._jQueryInterface.call($(target), config);
  2903. if (slideIndex) {
  2904. $(target).data(DATA_KEY$2).to(slideIndex);
  2905. }
  2906. event.preventDefault();
  2907. };
  2908. _createClass(Carousel, null, [{
  2909. key: "VERSION",
  2910. get: function get() {
  2911. return VERSION$2;
  2912. }
  2913. }, {
  2914. key: "Default",
  2915. get: function get() {
  2916. return Default;
  2917. }
  2918. }]);
  2919. return Carousel;
  2920. }();
  2921. /**
  2922. * ------------------------------------------------------------------------
  2923. * Data Api implementation
  2924. * ------------------------------------------------------------------------
  2925. */
  2926. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2927. $(window).on(Event$2.LOAD_DATA_API, function () {
  2928. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2929. for (var i = 0, len = carousels.length; i < len; i++) {
  2930. var $carousel = $(carousels[i]);
  2931. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2932. }
  2933. });
  2934. /**
  2935. * ------------------------------------------------------------------------
  2936. * jQuery
  2937. * ------------------------------------------------------------------------
  2938. */
  2939. $.fn[NAME$2] = Carousel._jQueryInterface;
  2940. $.fn[NAME$2].Constructor = Carousel;
  2941. $.fn[NAME$2].noConflict = function () {
  2942. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2943. return Carousel._jQueryInterface;
  2944. };
  2945. /**
  2946. * ------------------------------------------------------------------------
  2947. * Constants
  2948. * ------------------------------------------------------------------------
  2949. */
  2950. var NAME$3 = 'collapse';
  2951. var VERSION$3 = '4.4.1';
  2952. var DATA_KEY$3 = 'bs.collapse';
  2953. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2954. var DATA_API_KEY$3 = '.data-api';
  2955. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2956. var Default$1 = {
  2957. toggle: true,
  2958. parent: ''
  2959. };
  2960. var DefaultType$1 = {
  2961. toggle: 'boolean',
  2962. parent: '(string|element)'
  2963. };
  2964. var Event$3 = {
  2965. SHOW: "show" + EVENT_KEY$3,
  2966. SHOWN: "shown" + EVENT_KEY$3,
  2967. HIDE: "hide" + EVENT_KEY$3,
  2968. HIDDEN: "hidden" + EVENT_KEY$3,
  2969. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2970. };
  2971. var ClassName$3 = {
  2972. SHOW: 'show',
  2973. COLLAPSE: 'collapse',
  2974. COLLAPSING: 'collapsing',
  2975. COLLAPSED: 'collapsed'
  2976. };
  2977. var Dimension = {
  2978. WIDTH: 'width',
  2979. HEIGHT: 'height'
  2980. };
  2981. var Selector$3 = {
  2982. ACTIVES: '.show, .collapsing',
  2983. DATA_TOGGLE: '[data-toggle="collapse"]'
  2984. };
  2985. /**
  2986. * ------------------------------------------------------------------------
  2987. * Class Definition
  2988. * ------------------------------------------------------------------------
  2989. */
  2990. var Collapse =
  2991. /*#__PURE__*/
  2992. function () {
  2993. function Collapse(element, config) {
  2994. this._isTransitioning = false;
  2995. this._element = element;
  2996. this._config = this._getConfig(config);
  2997. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2998. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  2999. for (var i = 0, len = toggleList.length; i < len; i++) {
  3000. var elem = toggleList[i];
  3001. var selector = Util.getSelectorFromElement(elem);
  3002. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3003. return foundElem === element;
  3004. });
  3005. if (selector !== null && filterElement.length > 0) {
  3006. this._selector = selector;
  3007. this._triggerArray.push(elem);
  3008. }
  3009. }
  3010. this._parent = this._config.parent ? this._getParent() : null;
  3011. if (!this._config.parent) {
  3012. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3013. }
  3014. if (this._config.toggle) {
  3015. this.toggle();
  3016. }
  3017. } // Getters
  3018. var _proto = Collapse.prototype;
  3019. // Public
  3020. _proto.toggle = function toggle() {
  3021. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3022. this.hide();
  3023. } else {
  3024. this.show();
  3025. }
  3026. };
  3027. _proto.show = function show() {
  3028. var _this = this;
  3029. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3030. return;
  3031. }
  3032. var actives;
  3033. var activesData;
  3034. if (this._parent) {
  3035. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3036. if (typeof _this._config.parent === 'string') {
  3037. return elem.getAttribute('data-parent') === _this._config.parent;
  3038. }
  3039. return elem.classList.contains(ClassName$3.COLLAPSE);
  3040. });
  3041. if (actives.length === 0) {
  3042. actives = null;
  3043. }
  3044. }
  3045. if (actives) {
  3046. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3047. if (activesData && activesData._isTransitioning) {
  3048. return;
  3049. }
  3050. }
  3051. var startEvent = $.Event(Event$3.SHOW);
  3052. $(this._element).trigger(startEvent);
  3053. if (startEvent.isDefaultPrevented()) {
  3054. return;
  3055. }
  3056. if (actives) {
  3057. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3058. if (!activesData) {
  3059. $(actives).data(DATA_KEY$3, null);
  3060. }
  3061. }
  3062. var dimension = this._getDimension();
  3063. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3064. this._element.style[dimension] = 0;
  3065. if (this._triggerArray.length) {
  3066. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3067. }
  3068. this.setTransitioning(true);
  3069. var complete = function complete() {
  3070. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3071. _this._element.style[dimension] = '';
  3072. _this.setTransitioning(false);
  3073. $(_this._element).trigger(Event$3.SHOWN);
  3074. };
  3075. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3076. var scrollSize = "scroll" + capitalizedDimension;
  3077. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3078. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3079. this._element.style[dimension] = this._element[scrollSize] + "px";
  3080. };
  3081. _proto.hide = function hide() {
  3082. var _this2 = this;
  3083. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3084. return;
  3085. }
  3086. var startEvent = $.Event(Event$3.HIDE);
  3087. $(this._element).trigger(startEvent);
  3088. if (startEvent.isDefaultPrevented()) {
  3089. return;
  3090. }
  3091. var dimension = this._getDimension();
  3092. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3093. Util.reflow(this._element);
  3094. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3095. var triggerArrayLength = this._triggerArray.length;
  3096. if (triggerArrayLength > 0) {
  3097. for (var i = 0; i < triggerArrayLength; i++) {
  3098. var trigger = this._triggerArray[i];
  3099. var selector = Util.getSelectorFromElement(trigger);
  3100. if (selector !== null) {
  3101. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3102. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3103. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3104. }
  3105. }
  3106. }
  3107. }
  3108. this.setTransitioning(true);
  3109. var complete = function complete() {
  3110. _this2.setTransitioning(false);
  3111. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3112. };
  3113. this._element.style[dimension] = '';
  3114. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3115. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3116. };
  3117. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3118. this._isTransitioning = isTransitioning;
  3119. };
  3120. _proto.dispose = function dispose() {
  3121. $.removeData(this._element, DATA_KEY$3);
  3122. this._config = null;
  3123. this._parent = null;
  3124. this._element = null;
  3125. this._triggerArray = null;
  3126. this._isTransitioning = null;
  3127. } // Private
  3128. ;
  3129. _proto._getConfig = function _getConfig(config) {
  3130. config = _objectSpread2({}, Default$1, {}, config);
  3131. config.toggle = Boolean(config.toggle); // Coerce string values
  3132. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3133. return config;
  3134. };
  3135. _proto._getDimension = function _getDimension() {
  3136. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3137. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3138. };
  3139. _proto._getParent = function _getParent() {
  3140. var _this3 = this;
  3141. var parent;
  3142. if (Util.isElement(this._config.parent)) {
  3143. parent = this._config.parent; // It's a jQuery object
  3144. if (typeof this._config.parent.jquery !== 'undefined') {
  3145. parent = this._config.parent[0];
  3146. }
  3147. } else {
  3148. parent = document.querySelector(this._config.parent);
  3149. }
  3150. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3151. var children = [].slice.call(parent.querySelectorAll(selector));
  3152. $(children).each(function (i, element) {
  3153. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3154. });
  3155. return parent;
  3156. };
  3157. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3158. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3159. if (triggerArray.length) {
  3160. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3161. }
  3162. } // Static
  3163. ;
  3164. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3165. var selector = Util.getSelectorFromElement(element);
  3166. return selector ? document.querySelector(selector) : null;
  3167. };
  3168. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3169. return this.each(function () {
  3170. var $this = $(this);
  3171. var data = $this.data(DATA_KEY$3);
  3172. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3173. if (!data && _config.toggle && /show|hide/.test(config)) {
  3174. _config.toggle = false;
  3175. }
  3176. if (!data) {
  3177. data = new Collapse(this, _config);
  3178. $this.data(DATA_KEY$3, data);
  3179. }
  3180. if (typeof config === 'string') {
  3181. if (typeof data[config] === 'undefined') {
  3182. throw new TypeError("No method named \"" + config + "\"");
  3183. }
  3184. data[config]();
  3185. }
  3186. });
  3187. };
  3188. _createClass(Collapse, null, [{
  3189. key: "VERSION",
  3190. get: function get() {
  3191. return VERSION$3;
  3192. }
  3193. }, {
  3194. key: "Default",
  3195. get: function get() {
  3196. return Default$1;
  3197. }
  3198. }]);
  3199. return Collapse;
  3200. }();
  3201. /**
  3202. * ------------------------------------------------------------------------
  3203. * Data Api implementation
  3204. * ------------------------------------------------------------------------
  3205. */
  3206. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3207. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3208. if (event.currentTarget.tagName === 'A') {
  3209. event.preventDefault();
  3210. }
  3211. var $trigger = $(this);
  3212. var selector = Util.getSelectorFromElement(this);
  3213. var selectors = [].slice.call(document.querySelectorAll(selector));
  3214. $(selectors).each(function () {
  3215. var $target = $(this);
  3216. var data = $target.data(DATA_KEY$3);
  3217. var config = data ? 'toggle' : $trigger.data();
  3218. Collapse._jQueryInterface.call($target, config);
  3219. });
  3220. });
  3221. /**
  3222. * ------------------------------------------------------------------------
  3223. * jQuery
  3224. * ------------------------------------------------------------------------
  3225. */
  3226. $.fn[NAME$3] = Collapse._jQueryInterface;
  3227. $.fn[NAME$3].Constructor = Collapse;
  3228. $.fn[NAME$3].noConflict = function () {
  3229. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3230. return Collapse._jQueryInterface;
  3231. };
  3232. /**
  3233. * ------------------------------------------------------------------------
  3234. * Constants
  3235. * ------------------------------------------------------------------------
  3236. */
  3237. var NAME$4 = 'dropdown';
  3238. var VERSION$4 = '4.4.1';
  3239. var DATA_KEY$4 = 'bs.dropdown';
  3240. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3241. var DATA_API_KEY$4 = '.data-api';
  3242. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3243. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3244. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3245. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3246. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3247. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3248. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3249. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3250. var Event$4 = {
  3251. HIDE: "hide" + EVENT_KEY$4,
  3252. HIDDEN: "hidden" + EVENT_KEY$4,
  3253. SHOW: "show" + EVENT_KEY$4,
  3254. SHOWN: "shown" + EVENT_KEY$4,
  3255. CLICK: "click" + EVENT_KEY$4,
  3256. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3257. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3258. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3259. };
  3260. var ClassName$4 = {
  3261. DISABLED: 'disabled',
  3262. SHOW: 'show',
  3263. DROPUP: 'dropup',
  3264. DROPRIGHT: 'dropright',
  3265. DROPLEFT: 'dropleft',
  3266. MENURIGHT: 'dropdown-menu-right',
  3267. MENULEFT: 'dropdown-menu-left',
  3268. POSITION_STATIC: 'position-static'
  3269. };
  3270. var Selector$4 = {
  3271. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3272. FORM_CHILD: '.dropdown form',
  3273. MENU: '.dropdown-menu',
  3274. NAVBAR_NAV: '.navbar-nav',
  3275. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3276. };
  3277. var AttachmentMap = {
  3278. TOP: 'top-start',
  3279. TOPEND: 'top-end',
  3280. BOTTOM: 'bottom-start',
  3281. BOTTOMEND: 'bottom-end',
  3282. RIGHT: 'right-start',
  3283. RIGHTEND: 'right-end',
  3284. LEFT: 'left-start',
  3285. LEFTEND: 'left-end'
  3286. };
  3287. var Default$2 = {
  3288. offset: 0,
  3289. flip: true,
  3290. boundary: 'scrollParent',
  3291. reference: 'toggle',
  3292. display: 'dynamic',
  3293. popperConfig: null
  3294. };
  3295. var DefaultType$2 = {
  3296. offset: '(number|string|function)',
  3297. flip: 'boolean',
  3298. boundary: '(string|element)',
  3299. reference: '(string|element)',
  3300. display: 'string',
  3301. popperConfig: '(null|object)'
  3302. };
  3303. /**
  3304. * ------------------------------------------------------------------------
  3305. * Class Definition
  3306. * ------------------------------------------------------------------------
  3307. */
  3308. var Dropdown =
  3309. /*#__PURE__*/
  3310. function () {
  3311. function Dropdown(element, config) {
  3312. this._element = element;
  3313. this._popper = null;
  3314. this._config = this._getConfig(config);
  3315. this._menu = this._getMenuElement();
  3316. this._inNavbar = this._detectNavbar();
  3317. this._addEventListeners();
  3318. } // Getters
  3319. var _proto = Dropdown.prototype;
  3320. // Public
  3321. _proto.toggle = function toggle() {
  3322. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3323. return;
  3324. }
  3325. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3326. Dropdown._clearMenus();
  3327. if (isActive) {
  3328. return;
  3329. }
  3330. this.show(true);
  3331. };
  3332. _proto.show = function show(usePopper) {
  3333. if (usePopper === void 0) {
  3334. usePopper = false;
  3335. }
  3336. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3337. return;
  3338. }
  3339. var relatedTarget = {
  3340. relatedTarget: this._element
  3341. };
  3342. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3343. var parent = Dropdown._getParentFromElement(this._element);
  3344. $(parent).trigger(showEvent);
  3345. if (showEvent.isDefaultPrevented()) {
  3346. return;
  3347. } // Disable totally Popper.js for Dropdown in Navbar
  3348. if (!this._inNavbar && usePopper) {
  3349. /**
  3350. * Check for Popper dependency
  3351. * Popper - https://popper.js.org
  3352. */
  3353. if (typeof Popper === 'undefined') {
  3354. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3355. }
  3356. var referenceElement = this._element;
  3357. if (this._config.reference === 'parent') {
  3358. referenceElement = parent;
  3359. } else if (Util.isElement(this._config.reference)) {
  3360. referenceElement = this._config.reference; // Check if it's jQuery element
  3361. if (typeof this._config.reference.jquery !== 'undefined') {
  3362. referenceElement = this._config.reference[0];
  3363. }
  3364. } // If boundary is not `scrollParent`, then set position to `static`
  3365. // to allow the menu to "escape" the scroll parent's boundaries
  3366. // https://github.com/twbs/bootstrap/issues/24251
  3367. if (this._config.boundary !== 'scrollParent') {
  3368. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3369. }
  3370. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3371. } // If this is a touch-enabled device we add extra
  3372. // empty mouseover listeners to the body's immediate children;
  3373. // only needed because of broken event delegation on iOS
  3374. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3375. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3376. $(document.body).children().on('mouseover', null, $.noop);
  3377. }
  3378. this._element.focus();
  3379. this._element.setAttribute('aria-expanded', true);
  3380. $(this._menu).toggleClass(ClassName$4.SHOW);
  3381. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3382. };
  3383. _proto.hide = function hide() {
  3384. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3385. return;
  3386. }
  3387. var relatedTarget = {
  3388. relatedTarget: this._element
  3389. };
  3390. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3391. var parent = Dropdown._getParentFromElement(this._element);
  3392. $(parent).trigger(hideEvent);
  3393. if (hideEvent.isDefaultPrevented()) {
  3394. return;
  3395. }
  3396. if (this._popper) {
  3397. this._popper.destroy();
  3398. }
  3399. $(this._menu).toggleClass(ClassName$4.SHOW);
  3400. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3401. };
  3402. _proto.dispose = function dispose() {
  3403. $.removeData(this._element, DATA_KEY$4);
  3404. $(this._element).off(EVENT_KEY$4);
  3405. this._element = null;
  3406. this._menu = null;
  3407. if (this._popper !== null) {
  3408. this._popper.destroy();
  3409. this._popper = null;
  3410. }
  3411. };
  3412. _proto.update = function update() {
  3413. this._inNavbar = this._detectNavbar();
  3414. if (this._popper !== null) {
  3415. this._popper.scheduleUpdate();
  3416. }
  3417. } // Private
  3418. ;
  3419. _proto._addEventListeners = function _addEventListeners() {
  3420. var _this = this;
  3421. $(this._element).on(Event$4.CLICK, function (event) {
  3422. event.preventDefault();
  3423. event.stopPropagation();
  3424. _this.toggle();
  3425. });
  3426. };
  3427. _proto._getConfig = function _getConfig(config) {
  3428. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3429. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3430. return config;
  3431. };
  3432. _proto._getMenuElement = function _getMenuElement() {
  3433. if (!this._menu) {
  3434. var parent = Dropdown._getParentFromElement(this._element);
  3435. if (parent) {
  3436. this._menu = parent.querySelector(Selector$4.MENU);
  3437. }
  3438. }
  3439. return this._menu;
  3440. };
  3441. _proto._getPlacement = function _getPlacement() {
  3442. var $parentDropdown = $(this._element.parentNode);
  3443. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3444. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3445. placement = AttachmentMap.TOP;
  3446. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3447. placement = AttachmentMap.TOPEND;
  3448. }
  3449. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3450. placement = AttachmentMap.RIGHT;
  3451. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3452. placement = AttachmentMap.LEFT;
  3453. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3454. placement = AttachmentMap.BOTTOMEND;
  3455. }
  3456. return placement;
  3457. };
  3458. _proto._detectNavbar = function _detectNavbar() {
  3459. return $(this._element).closest('.navbar').length > 0;
  3460. };
  3461. _proto._getOffset = function _getOffset() {
  3462. var _this2 = this;
  3463. var offset = {};
  3464. if (typeof this._config.offset === 'function') {
  3465. offset.fn = function (data) {
  3466. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3467. return data;
  3468. };
  3469. } else {
  3470. offset.offset = this._config.offset;
  3471. }
  3472. return offset;
  3473. };
  3474. _proto._getPopperConfig = function _getPopperConfig() {
  3475. var popperConfig = {
  3476. placement: this._getPlacement(),
  3477. modifiers: {
  3478. offset: this._getOffset(),
  3479. flip: {
  3480. enabled: this._config.flip
  3481. },
  3482. preventOverflow: {
  3483. boundariesElement: this._config.boundary
  3484. }
  3485. }
  3486. }; // Disable Popper.js if we have a static display
  3487. if (this._config.display === 'static') {
  3488. popperConfig.modifiers.applyStyle = {
  3489. enabled: false
  3490. };
  3491. }
  3492. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3493. } // Static
  3494. ;
  3495. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3496. return this.each(function () {
  3497. var data = $(this).data(DATA_KEY$4);
  3498. var _config = typeof config === 'object' ? config : null;
  3499. if (!data) {
  3500. data = new Dropdown(this, _config);
  3501. $(this).data(DATA_KEY$4, data);
  3502. }
  3503. if (typeof config === 'string') {
  3504. if (typeof data[config] === 'undefined') {
  3505. throw new TypeError("No method named \"" + config + "\"");
  3506. }
  3507. data[config]();
  3508. }
  3509. });
  3510. };
  3511. Dropdown._clearMenus = function _clearMenus(event) {
  3512. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3513. return;
  3514. }
  3515. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3516. for (var i = 0, len = toggles.length; i < len; i++) {
  3517. var parent = Dropdown._getParentFromElement(toggles[i]);
  3518. var context = $(toggles[i]).data(DATA_KEY$4);
  3519. var relatedTarget = {
  3520. relatedTarget: toggles[i]
  3521. };
  3522. if (event && event.type === 'click') {
  3523. relatedTarget.clickEvent = event;
  3524. }
  3525. if (!context) {
  3526. continue;
  3527. }
  3528. var dropdownMenu = context._menu;
  3529. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3530. continue;
  3531. }
  3532. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3533. continue;
  3534. }
  3535. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3536. $(parent).trigger(hideEvent);
  3537. if (hideEvent.isDefaultPrevented()) {
  3538. continue;
  3539. } // If this is a touch-enabled device we remove the extra
  3540. // empty mouseover listeners we added for iOS support
  3541. if ('ontouchstart' in document.documentElement) {
  3542. $(document.body).children().off('mouseover', null, $.noop);
  3543. }
  3544. toggles[i].setAttribute('aria-expanded', 'false');
  3545. if (context._popper) {
  3546. context._popper.destroy();
  3547. }
  3548. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3549. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3550. }
  3551. };
  3552. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3553. var parent;
  3554. var selector = Util.getSelectorFromElement(element);
  3555. if (selector) {
  3556. parent = document.querySelector(selector);
  3557. }
  3558. return parent || element.parentNode;
  3559. } // eslint-disable-next-line complexity
  3560. ;
  3561. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3562. // If not input/textarea:
  3563. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3564. // If input/textarea:
  3565. // - If space key => not a dropdown command
  3566. // - If key is other than escape
  3567. // - If key is not up or down => not a dropdown command
  3568. // - If trigger inside the menu => not a dropdown command
  3569. 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)) {
  3570. return;
  3571. }
  3572. event.preventDefault();
  3573. event.stopPropagation();
  3574. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3575. return;
  3576. }
  3577. var parent = Dropdown._getParentFromElement(this);
  3578. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3579. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3580. return;
  3581. }
  3582. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3583. if (event.which === ESCAPE_KEYCODE) {
  3584. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3585. $(toggle).trigger('focus');
  3586. }
  3587. $(this).trigger('click');
  3588. return;
  3589. }
  3590. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3591. return $(item).is(':visible');
  3592. });
  3593. if (items.length === 0) {
  3594. return;
  3595. }
  3596. var index = items.indexOf(event.target);
  3597. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3598. // Up
  3599. index--;
  3600. }
  3601. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3602. // Down
  3603. index++;
  3604. }
  3605. if (index < 0) {
  3606. index = 0;
  3607. }
  3608. items[index].focus();
  3609. };
  3610. _createClass(Dropdown, null, [{
  3611. key: "VERSION",
  3612. get: function get() {
  3613. return VERSION$4;
  3614. }
  3615. }, {
  3616. key: "Default",
  3617. get: function get() {
  3618. return Default$2;
  3619. }
  3620. }, {
  3621. key: "DefaultType",
  3622. get: function get() {
  3623. return DefaultType$2;
  3624. }
  3625. }]);
  3626. return Dropdown;
  3627. }();
  3628. /**
  3629. * ------------------------------------------------------------------------
  3630. * Data Api implementation
  3631. * ------------------------------------------------------------------------
  3632. */
  3633. $(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) {
  3634. event.preventDefault();
  3635. event.stopPropagation();
  3636. Dropdown._jQueryInterface.call($(this), 'toggle');
  3637. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3638. e.stopPropagation();
  3639. });
  3640. /**
  3641. * ------------------------------------------------------------------------
  3642. * jQuery
  3643. * ------------------------------------------------------------------------
  3644. */
  3645. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3646. $.fn[NAME$4].Constructor = Dropdown;
  3647. $.fn[NAME$4].noConflict = function () {
  3648. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3649. return Dropdown._jQueryInterface;
  3650. };
  3651. /**
  3652. * ------------------------------------------------------------------------
  3653. * Constants
  3654. * ------------------------------------------------------------------------
  3655. */
  3656. var NAME$5 = 'modal';
  3657. var VERSION$5 = '4.4.1';
  3658. var DATA_KEY$5 = 'bs.modal';
  3659. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3660. var DATA_API_KEY$5 = '.data-api';
  3661. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3662. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3663. var Default$3 = {
  3664. backdrop: true,
  3665. keyboard: true,
  3666. focus: true,
  3667. show: true
  3668. };
  3669. var DefaultType$3 = {
  3670. backdrop: '(boolean|string)',
  3671. keyboard: 'boolean',
  3672. focus: 'boolean',
  3673. show: 'boolean'
  3674. };
  3675. var Event$5 = {
  3676. HIDE: "hide" + EVENT_KEY$5,
  3677. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3678. HIDDEN: "hidden" + EVENT_KEY$5,
  3679. SHOW: "show" + EVENT_KEY$5,
  3680. SHOWN: "shown" + EVENT_KEY$5,
  3681. FOCUSIN: "focusin" + EVENT_KEY$5,
  3682. RESIZE: "resize" + EVENT_KEY$5,
  3683. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3684. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3685. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3686. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3687. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3688. };
  3689. var ClassName$5 = {
  3690. SCROLLABLE: 'modal-dialog-scrollable',
  3691. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3692. BACKDROP: 'modal-backdrop',
  3693. OPEN: 'modal-open',
  3694. FADE: 'fade',
  3695. SHOW: 'show',
  3696. STATIC: 'modal-static'
  3697. };
  3698. var Selector$5 = {
  3699. DIALOG: '.modal-dialog',
  3700. MODAL_BODY: '.modal-body',
  3701. DATA_TOGGLE: '[data-toggle="modal"]',
  3702. DATA_DISMISS: '[data-dismiss="modal"]',
  3703. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3704. STICKY_CONTENT: '.sticky-top'
  3705. };
  3706. /**
  3707. * ------------------------------------------------------------------------
  3708. * Class Definition
  3709. * ------------------------------------------------------------------------
  3710. */
  3711. var Modal =
  3712. /*#__PURE__*/
  3713. function () {
  3714. function Modal(element, config) {
  3715. this._config = this._getConfig(config);
  3716. this._element = element;
  3717. this._dialog = element.querySelector(Selector$5.DIALOG);
  3718. this._backdrop = null;
  3719. this._isShown = false;
  3720. this._isBodyOverflowing = false;
  3721. this._ignoreBackdropClick = false;
  3722. this._isTransitioning = false;
  3723. this._scrollbarWidth = 0;
  3724. } // Getters
  3725. var _proto = Modal.prototype;
  3726. // Public
  3727. _proto.toggle = function toggle(relatedTarget) {
  3728. return this._isShown ? this.hide() : this.show(relatedTarget);
  3729. };
  3730. _proto.show = function show(relatedTarget) {
  3731. var _this = this;
  3732. if (this._isShown || this._isTransitioning) {
  3733. return;
  3734. }
  3735. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3736. this._isTransitioning = true;
  3737. }
  3738. var showEvent = $.Event(Event$5.SHOW, {
  3739. relatedTarget: relatedTarget
  3740. });
  3741. $(this._element).trigger(showEvent);
  3742. if (this._isShown || showEvent.isDefaultPrevented()) {
  3743. return;
  3744. }
  3745. this._isShown = true;
  3746. this._checkScrollbar();
  3747. this._setScrollbar();
  3748. this._adjustDialog();
  3749. this._setEscapeEvent();
  3750. this._setResizeEvent();
  3751. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3752. return _this.hide(event);
  3753. });
  3754. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3755. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3756. if ($(event.target).is(_this._element)) {
  3757. _this._ignoreBackdropClick = true;
  3758. }
  3759. });
  3760. });
  3761. this._showBackdrop(function () {
  3762. return _this._showElement(relatedTarget);
  3763. });
  3764. };
  3765. _proto.hide = function hide(event) {
  3766. var _this2 = this;
  3767. if (event) {
  3768. event.preventDefault();
  3769. }
  3770. if (!this._isShown || this._isTransitioning) {
  3771. return;
  3772. }
  3773. var hideEvent = $.Event(Event$5.HIDE);
  3774. $(this._element).trigger(hideEvent);
  3775. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3776. return;
  3777. }
  3778. this._isShown = false;
  3779. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3780. if (transition) {
  3781. this._isTransitioning = true;
  3782. }
  3783. this._setEscapeEvent();
  3784. this._setResizeEvent();
  3785. $(document).off(Event$5.FOCUSIN);
  3786. $(this._element).removeClass(ClassName$5.SHOW);
  3787. $(this._element).off(Event$5.CLICK_DISMISS);
  3788. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3789. if (transition) {
  3790. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3791. $(this._element).one(Util.TRANSITION_END, function (event) {
  3792. return _this2._hideModal(event);
  3793. }).emulateTransitionEnd(transitionDuration);
  3794. } else {
  3795. this._hideModal();
  3796. }
  3797. };
  3798. _proto.dispose = function dispose() {
  3799. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3800. return $(htmlElement).off(EVENT_KEY$5);
  3801. });
  3802. /**
  3803. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3804. * Do not move `document` in `htmlElements` array
  3805. * It will remove `Event.CLICK_DATA_API` event that should remain
  3806. */
  3807. $(document).off(Event$5.FOCUSIN);
  3808. $.removeData(this._element, DATA_KEY$5);
  3809. this._config = null;
  3810. this._element = null;
  3811. this._dialog = null;
  3812. this._backdrop = null;
  3813. this._isShown = null;
  3814. this._isBodyOverflowing = null;
  3815. this._ignoreBackdropClick = null;
  3816. this._isTransitioning = null;
  3817. this._scrollbarWidth = null;
  3818. };
  3819. _proto.handleUpdate = function handleUpdate() {
  3820. this._adjustDialog();
  3821. } // Private
  3822. ;
  3823. _proto._getConfig = function _getConfig(config) {
  3824. config = _objectSpread2({}, Default$3, {}, config);
  3825. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3826. return config;
  3827. };
  3828. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3829. var _this3 = this;
  3830. if (this._config.backdrop === 'static') {
  3831. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3832. $(this._element).trigger(hideEventPrevented);
  3833. if (hideEventPrevented.defaultPrevented) {
  3834. return;
  3835. }
  3836. this._element.classList.add(ClassName$5.STATIC);
  3837. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3838. $(this._element).one(Util.TRANSITION_END, function () {
  3839. _this3._element.classList.remove(ClassName$5.STATIC);
  3840. }).emulateTransitionEnd(modalTransitionDuration);
  3841. this._element.focus();
  3842. } else {
  3843. this.hide();
  3844. }
  3845. };
  3846. _proto._showElement = function _showElement(relatedTarget) {
  3847. var _this4 = this;
  3848. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3849. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3850. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3851. // Don't move modal's DOM position
  3852. document.body.appendChild(this._element);
  3853. }
  3854. this._element.style.display = 'block';
  3855. this._element.removeAttribute('aria-hidden');
  3856. this._element.setAttribute('aria-modal', true);
  3857. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3858. modalBody.scrollTop = 0;
  3859. } else {
  3860. this._element.scrollTop = 0;
  3861. }
  3862. if (transition) {
  3863. Util.reflow(this._element);
  3864. }
  3865. $(this._element).addClass(ClassName$5.SHOW);
  3866. if (this._config.focus) {
  3867. this._enforceFocus();
  3868. }
  3869. var shownEvent = $.Event(Event$5.SHOWN, {
  3870. relatedTarget: relatedTarget
  3871. });
  3872. var transitionComplete = function transitionComplete() {
  3873. if (_this4._config.focus) {
  3874. _this4._element.focus();
  3875. }
  3876. _this4._isTransitioning = false;
  3877. $(_this4._element).trigger(shownEvent);
  3878. };
  3879. if (transition) {
  3880. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3881. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3882. } else {
  3883. transitionComplete();
  3884. }
  3885. };
  3886. _proto._enforceFocus = function _enforceFocus() {
  3887. var _this5 = this;
  3888. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3889. .on(Event$5.FOCUSIN, function (event) {
  3890. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3891. _this5._element.focus();
  3892. }
  3893. });
  3894. };
  3895. _proto._setEscapeEvent = function _setEscapeEvent() {
  3896. var _this6 = this;
  3897. if (this._isShown && this._config.keyboard) {
  3898. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3899. if (event.which === ESCAPE_KEYCODE$1) {
  3900. _this6._triggerBackdropTransition();
  3901. }
  3902. });
  3903. } else if (!this._isShown) {
  3904. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3905. }
  3906. };
  3907. _proto._setResizeEvent = function _setResizeEvent() {
  3908. var _this7 = this;
  3909. if (this._isShown) {
  3910. $(window).on(Event$5.RESIZE, function (event) {
  3911. return _this7.handleUpdate(event);
  3912. });
  3913. } else {
  3914. $(window).off(Event$5.RESIZE);
  3915. }
  3916. };
  3917. _proto._hideModal = function _hideModal() {
  3918. var _this8 = this;
  3919. this._element.style.display = 'none';
  3920. this._element.setAttribute('aria-hidden', true);
  3921. this._element.removeAttribute('aria-modal');
  3922. this._isTransitioning = false;
  3923. this._showBackdrop(function () {
  3924. $(document.body).removeClass(ClassName$5.OPEN);
  3925. _this8._resetAdjustments();
  3926. _this8._resetScrollbar();
  3927. $(_this8._element).trigger(Event$5.HIDDEN);
  3928. });
  3929. };
  3930. _proto._removeBackdrop = function _removeBackdrop() {
  3931. if (this._backdrop) {
  3932. $(this._backdrop).remove();
  3933. this._backdrop = null;
  3934. }
  3935. };
  3936. _proto._showBackdrop = function _showBackdrop(callback) {
  3937. var _this9 = this;
  3938. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3939. if (this._isShown && this._config.backdrop) {
  3940. this._backdrop = document.createElement('div');
  3941. this._backdrop.className = ClassName$5.BACKDROP;
  3942. if (animate) {
  3943. this._backdrop.classList.add(animate);
  3944. }
  3945. $(this._backdrop).appendTo(document.body);
  3946. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3947. if (_this9._ignoreBackdropClick) {
  3948. _this9._ignoreBackdropClick = false;
  3949. return;
  3950. }
  3951. if (event.target !== event.currentTarget) {
  3952. return;
  3953. }
  3954. _this9._triggerBackdropTransition();
  3955. });
  3956. if (animate) {
  3957. Util.reflow(this._backdrop);
  3958. }
  3959. $(this._backdrop).addClass(ClassName$5.SHOW);
  3960. if (!callback) {
  3961. return;
  3962. }
  3963. if (!animate) {
  3964. callback();
  3965. return;
  3966. }
  3967. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3968. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3969. } else if (!this._isShown && this._backdrop) {
  3970. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3971. var callbackRemove = function callbackRemove() {
  3972. _this9._removeBackdrop();
  3973. if (callback) {
  3974. callback();
  3975. }
  3976. };
  3977. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3978. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3979. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3980. } else {
  3981. callbackRemove();
  3982. }
  3983. } else if (callback) {
  3984. callback();
  3985. }
  3986. } // ----------------------------------------------------------------------
  3987. // the following methods are used to handle overflowing modals
  3988. // todo (fat): these should probably be refactored out of modal.js
  3989. // ----------------------------------------------------------------------
  3990. ;
  3991. _proto._adjustDialog = function _adjustDialog() {
  3992. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3993. if (!this._isBodyOverflowing && isModalOverflowing) {
  3994. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3995. }
  3996. if (this._isBodyOverflowing && !isModalOverflowing) {
  3997. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3998. }
  3999. };
  4000. _proto._resetAdjustments = function _resetAdjustments() {
  4001. this._element.style.paddingLeft = '';
  4002. this._element.style.paddingRight = '';
  4003. };
  4004. _proto._checkScrollbar = function _checkScrollbar() {
  4005. var rect = document.body.getBoundingClientRect();
  4006. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4007. this._scrollbarWidth = this._getScrollbarWidth();
  4008. };
  4009. _proto._setScrollbar = function _setScrollbar() {
  4010. var _this10 = this;
  4011. if (this._isBodyOverflowing) {
  4012. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4013. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4014. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4015. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4016. $(fixedContent).each(function (index, element) {
  4017. var actualPadding = element.style.paddingRight;
  4018. var calculatedPadding = $(element).css('padding-right');
  4019. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4020. }); // Adjust sticky content margin
  4021. $(stickyContent).each(function (index, element) {
  4022. var actualMargin = element.style.marginRight;
  4023. var calculatedMargin = $(element).css('margin-right');
  4024. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4025. }); // Adjust body padding
  4026. var actualPadding = document.body.style.paddingRight;
  4027. var calculatedPadding = $(document.body).css('padding-right');
  4028. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4029. }
  4030. $(document.body).addClass(ClassName$5.OPEN);
  4031. };
  4032. _proto._resetScrollbar = function _resetScrollbar() {
  4033. // Restore fixed content padding
  4034. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4035. $(fixedContent).each(function (index, element) {
  4036. var padding = $(element).data('padding-right');
  4037. $(element).removeData('padding-right');
  4038. element.style.paddingRight = padding ? padding : '';
  4039. }); // Restore sticky content
  4040. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4041. $(elements).each(function (index, element) {
  4042. var margin = $(element).data('margin-right');
  4043. if (typeof margin !== 'undefined') {
  4044. $(element).css('margin-right', margin).removeData('margin-right');
  4045. }
  4046. }); // Restore body padding
  4047. var padding = $(document.body).data('padding-right');
  4048. $(document.body).removeData('padding-right');
  4049. document.body.style.paddingRight = padding ? padding : '';
  4050. };
  4051. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4052. // thx d.walsh
  4053. var scrollDiv = document.createElement('div');
  4054. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4055. document.body.appendChild(scrollDiv);
  4056. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4057. document.body.removeChild(scrollDiv);
  4058. return scrollbarWidth;
  4059. } // Static
  4060. ;
  4061. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4062. return this.each(function () {
  4063. var data = $(this).data(DATA_KEY$5);
  4064. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4065. if (!data) {
  4066. data = new Modal(this, _config);
  4067. $(this).data(DATA_KEY$5, data);
  4068. }
  4069. if (typeof config === 'string') {
  4070. if (typeof data[config] === 'undefined') {
  4071. throw new TypeError("No method named \"" + config + "\"");
  4072. }
  4073. data[config](relatedTarget);
  4074. } else if (_config.show) {
  4075. data.show(relatedTarget);
  4076. }
  4077. });
  4078. };
  4079. _createClass(Modal, null, [{
  4080. key: "VERSION",
  4081. get: function get() {
  4082. return VERSION$5;
  4083. }
  4084. }, {
  4085. key: "Default",
  4086. get: function get() {
  4087. return Default$3;
  4088. }
  4089. }]);
  4090. return Modal;
  4091. }();
  4092. /**
  4093. * ------------------------------------------------------------------------
  4094. * Data Api implementation
  4095. * ------------------------------------------------------------------------
  4096. */
  4097. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4098. var _this11 = this;
  4099. var target;
  4100. var selector = Util.getSelectorFromElement(this);
  4101. if (selector) {
  4102. target = document.querySelector(selector);
  4103. }
  4104. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4105. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4106. event.preventDefault();
  4107. }
  4108. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4109. if (showEvent.isDefaultPrevented()) {
  4110. // Only register focus restorer if modal will actually get shown
  4111. return;
  4112. }
  4113. $target.one(Event$5.HIDDEN, function () {
  4114. if ($(_this11).is(':visible')) {
  4115. _this11.focus();
  4116. }
  4117. });
  4118. });
  4119. Modal._jQueryInterface.call($(target), config, this);
  4120. });
  4121. /**
  4122. * ------------------------------------------------------------------------
  4123. * jQuery
  4124. * ------------------------------------------------------------------------
  4125. */
  4126. $.fn[NAME$5] = Modal._jQueryInterface;
  4127. $.fn[NAME$5].Constructor = Modal;
  4128. $.fn[NAME$5].noConflict = function () {
  4129. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4130. return Modal._jQueryInterface;
  4131. };
  4132. /**
  4133. * --------------------------------------------------------------------------
  4134. * Bootstrap (v4.4.1): tools/sanitizer.js
  4135. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4136. * --------------------------------------------------------------------------
  4137. */
  4138. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4139. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4140. var DefaultWhitelist = {
  4141. // Global attributes allowed on any supplied element below.
  4142. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4143. a: ['target', 'href', 'title', 'rel'],
  4144. area: [],
  4145. b: [],
  4146. br: [],
  4147. col: [],
  4148. code: [],
  4149. div: [],
  4150. em: [],
  4151. hr: [],
  4152. h1: [],
  4153. h2: [],
  4154. h3: [],
  4155. h4: [],
  4156. h5: [],
  4157. h6: [],
  4158. i: [],
  4159. img: ['src', 'alt', 'title', 'width', 'height'],
  4160. li: [],
  4161. ol: [],
  4162. p: [],
  4163. pre: [],
  4164. s: [],
  4165. small: [],
  4166. span: [],
  4167. sub: [],
  4168. sup: [],
  4169. strong: [],
  4170. u: [],
  4171. ul: []
  4172. };
  4173. /**
  4174. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4175. *
  4176. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4177. */
  4178. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4179. /**
  4180. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4181. *
  4182. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4183. */
  4184. 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;
  4185. function allowedAttribute(attr, allowedAttributeList) {
  4186. var attrName = attr.nodeName.toLowerCase();
  4187. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4188. if (uriAttrs.indexOf(attrName) !== -1) {
  4189. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4190. }
  4191. return true;
  4192. }
  4193. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4194. return attrRegex instanceof RegExp;
  4195. }); // Check if a regular expression validates the attribute.
  4196. for (var i = 0, l = regExp.length; i < l; i++) {
  4197. if (attrName.match(regExp[i])) {
  4198. return true;
  4199. }
  4200. }
  4201. return false;
  4202. }
  4203. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4204. if (unsafeHtml.length === 0) {
  4205. return unsafeHtml;
  4206. }
  4207. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4208. return sanitizeFn(unsafeHtml);
  4209. }
  4210. var domParser = new window.DOMParser();
  4211. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4212. var whitelistKeys = Object.keys(whiteList);
  4213. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4214. var _loop = function _loop(i, len) {
  4215. var el = elements[i];
  4216. var elName = el.nodeName.toLowerCase();
  4217. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4218. el.parentNode.removeChild(el);
  4219. return "continue";
  4220. }
  4221. var attributeList = [].slice.call(el.attributes);
  4222. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4223. attributeList.forEach(function (attr) {
  4224. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4225. el.removeAttribute(attr.nodeName);
  4226. }
  4227. });
  4228. };
  4229. for (var i = 0, len = elements.length; i < len; i++) {
  4230. var _ret = _loop(i);
  4231. if (_ret === "continue") continue;
  4232. }
  4233. return createdDocument.body.innerHTML;
  4234. }
  4235. /**
  4236. * ------------------------------------------------------------------------
  4237. * Constants
  4238. * ------------------------------------------------------------------------
  4239. */
  4240. var NAME$6 = 'tooltip';
  4241. var VERSION$6 = '4.4.1';
  4242. var DATA_KEY$6 = 'bs.tooltip';
  4243. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4244. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4245. var CLASS_PREFIX = 'bs-tooltip';
  4246. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4247. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4248. var DefaultType$4 = {
  4249. animation: 'boolean',
  4250. template: 'string',
  4251. title: '(string|element|function)',
  4252. trigger: 'string',
  4253. delay: '(number|object)',
  4254. html: 'boolean',
  4255. selector: '(string|boolean)',
  4256. placement: '(string|function)',
  4257. offset: '(number|string|function)',
  4258. container: '(string|element|boolean)',
  4259. fallbackPlacement: '(string|array)',
  4260. boundary: '(string|element)',
  4261. sanitize: 'boolean',
  4262. sanitizeFn: '(null|function)',
  4263. whiteList: 'object',
  4264. popperConfig: '(null|object)'
  4265. };
  4266. var AttachmentMap$1 = {
  4267. AUTO: 'auto',
  4268. TOP: 'top',
  4269. RIGHT: 'right',
  4270. BOTTOM: 'bottom',
  4271. LEFT: 'left'
  4272. };
  4273. var Default$4 = {
  4274. animation: true,
  4275. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4276. trigger: 'hover focus',
  4277. title: '',
  4278. delay: 0,
  4279. html: false,
  4280. selector: false,
  4281. placement: 'top',
  4282. offset: 0,
  4283. container: false,
  4284. fallbackPlacement: 'flip',
  4285. boundary: 'scrollParent',
  4286. sanitize: true,
  4287. sanitizeFn: null,
  4288. whiteList: DefaultWhitelist,
  4289. popperConfig: null
  4290. };
  4291. var HoverState = {
  4292. SHOW: 'show',
  4293. OUT: 'out'
  4294. };
  4295. var Event$6 = {
  4296. HIDE: "hide" + EVENT_KEY$6,
  4297. HIDDEN: "hidden" + EVENT_KEY$6,
  4298. SHOW: "show" + EVENT_KEY$6,
  4299. SHOWN: "shown" + EVENT_KEY$6,
  4300. INSERTED: "inserted" + EVENT_KEY$6,
  4301. CLICK: "click" + EVENT_KEY$6,
  4302. FOCUSIN: "focusin" + EVENT_KEY$6,
  4303. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4304. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4305. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4306. };
  4307. var ClassName$6 = {
  4308. FADE: 'fade',
  4309. SHOW: 'show'
  4310. };
  4311. var Selector$6 = {
  4312. TOOLTIP: '.tooltip',
  4313. TOOLTIP_INNER: '.tooltip-inner',
  4314. ARROW: '.arrow'
  4315. };
  4316. var Trigger = {
  4317. HOVER: 'hover',
  4318. FOCUS: 'focus',
  4319. CLICK: 'click',
  4320. MANUAL: 'manual'
  4321. };
  4322. /**
  4323. * ------------------------------------------------------------------------
  4324. * Class Definition
  4325. * ------------------------------------------------------------------------
  4326. */
  4327. var Tooltip =
  4328. /*#__PURE__*/
  4329. function () {
  4330. function Tooltip(element, config) {
  4331. if (typeof Popper === 'undefined') {
  4332. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4333. } // private
  4334. this._isEnabled = true;
  4335. this._timeout = 0;
  4336. this._hoverState = '';
  4337. this._activeTrigger = {};
  4338. this._popper = null; // Protected
  4339. this.element = element;
  4340. this.config = this._getConfig(config);
  4341. this.tip = null;
  4342. this._setListeners();
  4343. } // Getters
  4344. var _proto = Tooltip.prototype;
  4345. // Public
  4346. _proto.enable = function enable() {
  4347. this._isEnabled = true;
  4348. };
  4349. _proto.disable = function disable() {
  4350. this._isEnabled = false;
  4351. };
  4352. _proto.toggleEnabled = function toggleEnabled() {
  4353. this._isEnabled = !this._isEnabled;
  4354. };
  4355. _proto.toggle = function toggle(event) {
  4356. if (!this._isEnabled) {
  4357. return;
  4358. }
  4359. if (event) {
  4360. var dataKey = this.constructor.DATA_KEY;
  4361. var context = $(event.currentTarget).data(dataKey);
  4362. if (!context) {
  4363. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4364. $(event.currentTarget).data(dataKey, context);
  4365. }
  4366. context._activeTrigger.click = !context._activeTrigger.click;
  4367. if (context._isWithActiveTrigger()) {
  4368. context._enter(null, context);
  4369. } else {
  4370. context._leave(null, context);
  4371. }
  4372. } else {
  4373. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4374. this._leave(null, this);
  4375. return;
  4376. }
  4377. this._enter(null, this);
  4378. }
  4379. };
  4380. _proto.dispose = function dispose() {
  4381. clearTimeout(this._timeout);
  4382. $.removeData(this.element, this.constructor.DATA_KEY);
  4383. $(this.element).off(this.constructor.EVENT_KEY);
  4384. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4385. if (this.tip) {
  4386. $(this.tip).remove();
  4387. }
  4388. this._isEnabled = null;
  4389. this._timeout = null;
  4390. this._hoverState = null;
  4391. this._activeTrigger = null;
  4392. if (this._popper) {
  4393. this._popper.destroy();
  4394. }
  4395. this._popper = null;
  4396. this.element = null;
  4397. this.config = null;
  4398. this.tip = null;
  4399. };
  4400. _proto.show = function show() {
  4401. var _this = this;
  4402. if ($(this.element).css('display') === 'none') {
  4403. throw new Error('Please use show on visible elements');
  4404. }
  4405. var showEvent = $.Event(this.constructor.Event.SHOW);
  4406. if (this.isWithContent() && this._isEnabled) {
  4407. $(this.element).trigger(showEvent);
  4408. var shadowRoot = Util.findShadowRoot(this.element);
  4409. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4410. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4411. return;
  4412. }
  4413. var tip = this.getTipElement();
  4414. var tipId = Util.getUID(this.constructor.NAME);
  4415. tip.setAttribute('id', tipId);
  4416. this.element.setAttribute('aria-describedby', tipId);
  4417. this.setContent();
  4418. if (this.config.animation) {
  4419. $(tip).addClass(ClassName$6.FADE);
  4420. }
  4421. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4422. var attachment = this._getAttachment(placement);
  4423. this.addAttachmentClass(attachment);
  4424. var container = this._getContainer();
  4425. $(tip).data(this.constructor.DATA_KEY, this);
  4426. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4427. $(tip).appendTo(container);
  4428. }
  4429. $(this.element).trigger(this.constructor.Event.INSERTED);
  4430. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4431. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4432. // empty mouseover listeners to the body's immediate children;
  4433. // only needed because of broken event delegation on iOS
  4434. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4435. if ('ontouchstart' in document.documentElement) {
  4436. $(document.body).children().on('mouseover', null, $.noop);
  4437. }
  4438. var complete = function complete() {
  4439. if (_this.config.animation) {
  4440. _this._fixTransition();
  4441. }
  4442. var prevHoverState = _this._hoverState;
  4443. _this._hoverState = null;
  4444. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4445. if (prevHoverState === HoverState.OUT) {
  4446. _this._leave(null, _this);
  4447. }
  4448. };
  4449. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4450. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4451. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4452. } else {
  4453. complete();
  4454. }
  4455. }
  4456. };
  4457. _proto.hide = function hide(callback) {
  4458. var _this2 = this;
  4459. var tip = this.getTipElement();
  4460. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4461. var complete = function complete() {
  4462. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4463. tip.parentNode.removeChild(tip);
  4464. }
  4465. _this2._cleanTipClass();
  4466. _this2.element.removeAttribute('aria-describedby');
  4467. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4468. if (_this2._popper !== null) {
  4469. _this2._popper.destroy();
  4470. }
  4471. if (callback) {
  4472. callback();
  4473. }
  4474. };
  4475. $(this.element).trigger(hideEvent);
  4476. if (hideEvent.isDefaultPrevented()) {
  4477. return;
  4478. }
  4479. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4480. // empty mouseover listeners we added for iOS support
  4481. if ('ontouchstart' in document.documentElement) {
  4482. $(document.body).children().off('mouseover', null, $.noop);
  4483. }
  4484. this._activeTrigger[Trigger.CLICK] = false;
  4485. this._activeTrigger[Trigger.FOCUS] = false;
  4486. this._activeTrigger[Trigger.HOVER] = false;
  4487. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4488. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4489. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4490. } else {
  4491. complete();
  4492. }
  4493. this._hoverState = '';
  4494. };
  4495. _proto.update = function update() {
  4496. if (this._popper !== null) {
  4497. this._popper.scheduleUpdate();
  4498. }
  4499. } // Protected
  4500. ;
  4501. _proto.isWithContent = function isWithContent() {
  4502. return Boolean(this.getTitle());
  4503. };
  4504. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4505. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4506. };
  4507. _proto.getTipElement = function getTipElement() {
  4508. this.tip = this.tip || $(this.config.template)[0];
  4509. return this.tip;
  4510. };
  4511. _proto.setContent = function setContent() {
  4512. var tip = this.getTipElement();
  4513. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4514. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4515. };
  4516. _proto.setElementContent = function setElementContent($element, content) {
  4517. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4518. // Content is a DOM node or a jQuery
  4519. if (this.config.html) {
  4520. if (!$(content).parent().is($element)) {
  4521. $element.empty().append(content);
  4522. }
  4523. } else {
  4524. $element.text($(content).text());
  4525. }
  4526. return;
  4527. }
  4528. if (this.config.html) {
  4529. if (this.config.sanitize) {
  4530. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4531. }
  4532. $element.html(content);
  4533. } else {
  4534. $element.text(content);
  4535. }
  4536. };
  4537. _proto.getTitle = function getTitle() {
  4538. var title = this.element.getAttribute('data-original-title');
  4539. if (!title) {
  4540. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4541. }
  4542. return title;
  4543. } // Private
  4544. ;
  4545. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4546. var _this3 = this;
  4547. var defaultBsConfig = {
  4548. placement: attachment,
  4549. modifiers: {
  4550. offset: this._getOffset(),
  4551. flip: {
  4552. behavior: this.config.fallbackPlacement
  4553. },
  4554. arrow: {
  4555. element: Selector$6.ARROW
  4556. },
  4557. preventOverflow: {
  4558. boundariesElement: this.config.boundary
  4559. }
  4560. },
  4561. onCreate: function onCreate(data) {
  4562. if (data.originalPlacement !== data.placement) {
  4563. _this3._handlePopperPlacementChange(data);
  4564. }
  4565. },
  4566. onUpdate: function onUpdate(data) {
  4567. return _this3._handlePopperPlacementChange(data);
  4568. }
  4569. };
  4570. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4571. };
  4572. _proto._getOffset = function _getOffset() {
  4573. var _this4 = this;
  4574. var offset = {};
  4575. if (typeof this.config.offset === 'function') {
  4576. offset.fn = function (data) {
  4577. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4578. return data;
  4579. };
  4580. } else {
  4581. offset.offset = this.config.offset;
  4582. }
  4583. return offset;
  4584. };
  4585. _proto._getContainer = function _getContainer() {
  4586. if (this.config.container === false) {
  4587. return document.body;
  4588. }
  4589. if (Util.isElement(this.config.container)) {
  4590. return $(this.config.container);
  4591. }
  4592. return $(document).find(this.config.container);
  4593. };
  4594. _proto._getAttachment = function _getAttachment(placement) {
  4595. return AttachmentMap$1[placement.toUpperCase()];
  4596. };
  4597. _proto._setListeners = function _setListeners() {
  4598. var _this5 = this;
  4599. var triggers = this.config.trigger.split(' ');
  4600. triggers.forEach(function (trigger) {
  4601. if (trigger === 'click') {
  4602. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4603. return _this5.toggle(event);
  4604. });
  4605. } else if (trigger !== Trigger.MANUAL) {
  4606. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4607. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4608. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4609. return _this5._enter(event);
  4610. }).on(eventOut, _this5.config.selector, function (event) {
  4611. return _this5._leave(event);
  4612. });
  4613. }
  4614. });
  4615. this._hideModalHandler = function () {
  4616. if (_this5.element) {
  4617. _this5.hide();
  4618. }
  4619. };
  4620. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4621. if (this.config.selector) {
  4622. this.config = _objectSpread2({}, this.config, {
  4623. trigger: 'manual',
  4624. selector: ''
  4625. });
  4626. } else {
  4627. this._fixTitle();
  4628. }
  4629. };
  4630. _proto._fixTitle = function _fixTitle() {
  4631. var titleType = typeof this.element.getAttribute('data-original-title');
  4632. if (this.element.getAttribute('title') || titleType !== 'string') {
  4633. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4634. this.element.setAttribute('title', '');
  4635. }
  4636. };
  4637. _proto._enter = function _enter(event, context) {
  4638. var dataKey = this.constructor.DATA_KEY;
  4639. context = context || $(event.currentTarget).data(dataKey);
  4640. if (!context) {
  4641. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4642. $(event.currentTarget).data(dataKey, context);
  4643. }
  4644. if (event) {
  4645. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4646. }
  4647. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4648. context._hoverState = HoverState.SHOW;
  4649. return;
  4650. }
  4651. clearTimeout(context._timeout);
  4652. context._hoverState = HoverState.SHOW;
  4653. if (!context.config.delay || !context.config.delay.show) {
  4654. context.show();
  4655. return;
  4656. }
  4657. context._timeout = setTimeout(function () {
  4658. if (context._hoverState === HoverState.SHOW) {
  4659. context.show();
  4660. }
  4661. }, context.config.delay.show);
  4662. };
  4663. _proto._leave = function _leave(event, context) {
  4664. var dataKey = this.constructor.DATA_KEY;
  4665. context = context || $(event.currentTarget).data(dataKey);
  4666. if (!context) {
  4667. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4668. $(event.currentTarget).data(dataKey, context);
  4669. }
  4670. if (event) {
  4671. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4672. }
  4673. if (context._isWithActiveTrigger()) {
  4674. return;
  4675. }
  4676. clearTimeout(context._timeout);
  4677. context._hoverState = HoverState.OUT;
  4678. if (!context.config.delay || !context.config.delay.hide) {
  4679. context.hide();
  4680. return;
  4681. }
  4682. context._timeout = setTimeout(function () {
  4683. if (context._hoverState === HoverState.OUT) {
  4684. context.hide();
  4685. }
  4686. }, context.config.delay.hide);
  4687. };
  4688. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4689. for (var trigger in this._activeTrigger) {
  4690. if (this._activeTrigger[trigger]) {
  4691. return true;
  4692. }
  4693. }
  4694. return false;
  4695. };
  4696. _proto._getConfig = function _getConfig(config) {
  4697. var dataAttributes = $(this.element).data();
  4698. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4699. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4700. delete dataAttributes[dataAttr];
  4701. }
  4702. });
  4703. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4704. if (typeof config.delay === 'number') {
  4705. config.delay = {
  4706. show: config.delay,
  4707. hide: config.delay
  4708. };
  4709. }
  4710. if (typeof config.title === 'number') {
  4711. config.title = config.title.toString();
  4712. }
  4713. if (typeof config.content === 'number') {
  4714. config.content = config.content.toString();
  4715. }
  4716. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4717. if (config.sanitize) {
  4718. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4719. }
  4720. return config;
  4721. };
  4722. _proto._getDelegateConfig = function _getDelegateConfig() {
  4723. var config = {};
  4724. if (this.config) {
  4725. for (var key in this.config) {
  4726. if (this.constructor.Default[key] !== this.config[key]) {
  4727. config[key] = this.config[key];
  4728. }
  4729. }
  4730. }
  4731. return config;
  4732. };
  4733. _proto._cleanTipClass = function _cleanTipClass() {
  4734. var $tip = $(this.getTipElement());
  4735. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4736. if (tabClass !== null && tabClass.length) {
  4737. $tip.removeClass(tabClass.join(''));
  4738. }
  4739. };
  4740. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4741. var popperInstance = popperData.instance;
  4742. this.tip = popperInstance.popper;
  4743. this._cleanTipClass();
  4744. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4745. };
  4746. _proto._fixTransition = function _fixTransition() {
  4747. var tip = this.getTipElement();
  4748. var initConfigAnimation = this.config.animation;
  4749. if (tip.getAttribute('x-placement') !== null) {
  4750. return;
  4751. }
  4752. $(tip).removeClass(ClassName$6.FADE);
  4753. this.config.animation = false;
  4754. this.hide();
  4755. this.show();
  4756. this.config.animation = initConfigAnimation;
  4757. } // Static
  4758. ;
  4759. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4760. return this.each(function () {
  4761. var data = $(this).data(DATA_KEY$6);
  4762. var _config = typeof config === 'object' && config;
  4763. if (!data && /dispose|hide/.test(config)) {
  4764. return;
  4765. }
  4766. if (!data) {
  4767. data = new Tooltip(this, _config);
  4768. $(this).data(DATA_KEY$6, data);
  4769. }
  4770. if (typeof config === 'string') {
  4771. if (typeof data[config] === 'undefined') {
  4772. throw new TypeError("No method named \"" + config + "\"");
  4773. }
  4774. data[config]();
  4775. }
  4776. });
  4777. };
  4778. _createClass(Tooltip, null, [{
  4779. key: "VERSION",
  4780. get: function get() {
  4781. return VERSION$6;
  4782. }
  4783. }, {
  4784. key: "Default",
  4785. get: function get() {
  4786. return Default$4;
  4787. }
  4788. }, {
  4789. key: "NAME",
  4790. get: function get() {
  4791. return NAME$6;
  4792. }
  4793. }, {
  4794. key: "DATA_KEY",
  4795. get: function get() {
  4796. return DATA_KEY$6;
  4797. }
  4798. }, {
  4799. key: "Event",
  4800. get: function get() {
  4801. return Event$6;
  4802. }
  4803. }, {
  4804. key: "EVENT_KEY",
  4805. get: function get() {
  4806. return EVENT_KEY$6;
  4807. }
  4808. }, {
  4809. key: "DefaultType",
  4810. get: function get() {
  4811. return DefaultType$4;
  4812. }
  4813. }]);
  4814. return Tooltip;
  4815. }();
  4816. /**
  4817. * ------------------------------------------------------------------------
  4818. * jQuery
  4819. * ------------------------------------------------------------------------
  4820. */
  4821. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4822. $.fn[NAME$6].Constructor = Tooltip;
  4823. $.fn[NAME$6].noConflict = function () {
  4824. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4825. return Tooltip._jQueryInterface;
  4826. };
  4827. /**
  4828. * ------------------------------------------------------------------------
  4829. * Constants
  4830. * ------------------------------------------------------------------------
  4831. */
  4832. var NAME$7 = 'popover';
  4833. var VERSION$7 = '4.4.1';
  4834. var DATA_KEY$7 = 'bs.popover';
  4835. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4836. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4837. var CLASS_PREFIX$1 = 'bs-popover';
  4838. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4839. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4840. placement: 'right',
  4841. trigger: 'click',
  4842. content: '',
  4843. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4844. });
  4845. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4846. content: '(string|element|function)'
  4847. });
  4848. var ClassName$7 = {
  4849. FADE: 'fade',
  4850. SHOW: 'show'
  4851. };
  4852. var Selector$7 = {
  4853. TITLE: '.popover-header',
  4854. CONTENT: '.popover-body'
  4855. };
  4856. var Event$7 = {
  4857. HIDE: "hide" + EVENT_KEY$7,
  4858. HIDDEN: "hidden" + EVENT_KEY$7,
  4859. SHOW: "show" + EVENT_KEY$7,
  4860. SHOWN: "shown" + EVENT_KEY$7,
  4861. INSERTED: "inserted" + EVENT_KEY$7,
  4862. CLICK: "click" + EVENT_KEY$7,
  4863. FOCUSIN: "focusin" + EVENT_KEY$7,
  4864. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4865. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4866. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4867. };
  4868. /**
  4869. * ------------------------------------------------------------------------
  4870. * Class Definition
  4871. * ------------------------------------------------------------------------
  4872. */
  4873. var Popover =
  4874. /*#__PURE__*/
  4875. function (_Tooltip) {
  4876. _inheritsLoose(Popover, _Tooltip);
  4877. function Popover() {
  4878. return _Tooltip.apply(this, arguments) || this;
  4879. }
  4880. var _proto = Popover.prototype;
  4881. // Overrides
  4882. _proto.isWithContent = function isWithContent() {
  4883. return this.getTitle() || this._getContent();
  4884. };
  4885. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4886. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4887. };
  4888. _proto.getTipElement = function getTipElement() {
  4889. this.tip = this.tip || $(this.config.template)[0];
  4890. return this.tip;
  4891. };
  4892. _proto.setContent = function setContent() {
  4893. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4894. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4895. var content = this._getContent();
  4896. if (typeof content === 'function') {
  4897. content = content.call(this.element);
  4898. }
  4899. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4900. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4901. } // Private
  4902. ;
  4903. _proto._getContent = function _getContent() {
  4904. return this.element.getAttribute('data-content') || this.config.content;
  4905. };
  4906. _proto._cleanTipClass = function _cleanTipClass() {
  4907. var $tip = $(this.getTipElement());
  4908. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4909. if (tabClass !== null && tabClass.length > 0) {
  4910. $tip.removeClass(tabClass.join(''));
  4911. }
  4912. } // Static
  4913. ;
  4914. Popover._jQueryInterface = function _jQueryInterface(config) {
  4915. return this.each(function () {
  4916. var data = $(this).data(DATA_KEY$7);
  4917. var _config = typeof config === 'object' ? config : null;
  4918. if (!data && /dispose|hide/.test(config)) {
  4919. return;
  4920. }
  4921. if (!data) {
  4922. data = new Popover(this, _config);
  4923. $(this).data(DATA_KEY$7, data);
  4924. }
  4925. if (typeof config === 'string') {
  4926. if (typeof data[config] === 'undefined') {
  4927. throw new TypeError("No method named \"" + config + "\"");
  4928. }
  4929. data[config]();
  4930. }
  4931. });
  4932. };
  4933. _createClass(Popover, null, [{
  4934. key: "VERSION",
  4935. // Getters
  4936. get: function get() {
  4937. return VERSION$7;
  4938. }
  4939. }, {
  4940. key: "Default",
  4941. get: function get() {
  4942. return Default$5;
  4943. }
  4944. }, {
  4945. key: "NAME",
  4946. get: function get() {
  4947. return NAME$7;
  4948. }
  4949. }, {
  4950. key: "DATA_KEY",
  4951. get: function get() {
  4952. return DATA_KEY$7;
  4953. }
  4954. }, {
  4955. key: "Event",
  4956. get: function get() {
  4957. return Event$7;
  4958. }
  4959. }, {
  4960. key: "EVENT_KEY",
  4961. get: function get() {
  4962. return EVENT_KEY$7;
  4963. }
  4964. }, {
  4965. key: "DefaultType",
  4966. get: function get() {
  4967. return DefaultType$5;
  4968. }
  4969. }]);
  4970. return Popover;
  4971. }(Tooltip);
  4972. /**
  4973. * ------------------------------------------------------------------------
  4974. * jQuery
  4975. * ------------------------------------------------------------------------
  4976. */
  4977. $.fn[NAME$7] = Popover._jQueryInterface;
  4978. $.fn[NAME$7].Constructor = Popover;
  4979. $.fn[NAME$7].noConflict = function () {
  4980. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4981. return Popover._jQueryInterface;
  4982. };
  4983. /**
  4984. * ------------------------------------------------------------------------
  4985. * Constants
  4986. * ------------------------------------------------------------------------
  4987. */
  4988. var NAME$8 = 'scrollspy';
  4989. var VERSION$8 = '4.4.1';
  4990. var DATA_KEY$8 = 'bs.scrollspy';
  4991. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4992. var DATA_API_KEY$6 = '.data-api';
  4993. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4994. var Default$6 = {
  4995. offset: 10,
  4996. method: 'auto',
  4997. target: ''
  4998. };
  4999. var DefaultType$6 = {
  5000. offset: 'number',
  5001. method: 'string',
  5002. target: '(string|element)'
  5003. };
  5004. var Event$8 = {
  5005. ACTIVATE: "activate" + EVENT_KEY$8,
  5006. SCROLL: "scroll" + EVENT_KEY$8,
  5007. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5008. };
  5009. var ClassName$8 = {
  5010. DROPDOWN_ITEM: 'dropdown-item',
  5011. DROPDOWN_MENU: 'dropdown-menu',
  5012. ACTIVE: 'active'
  5013. };
  5014. var Selector$8 = {
  5015. DATA_SPY: '[data-spy="scroll"]',
  5016. ACTIVE: '.active',
  5017. NAV_LIST_GROUP: '.nav, .list-group',
  5018. NAV_LINKS: '.nav-link',
  5019. NAV_ITEMS: '.nav-item',
  5020. LIST_ITEMS: '.list-group-item',
  5021. DROPDOWN: '.dropdown',
  5022. DROPDOWN_ITEMS: '.dropdown-item',
  5023. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5024. };
  5025. var OffsetMethod = {
  5026. OFFSET: 'offset',
  5027. POSITION: 'position'
  5028. };
  5029. /**
  5030. * ------------------------------------------------------------------------
  5031. * Class Definition
  5032. * ------------------------------------------------------------------------
  5033. */
  5034. var ScrollSpy =
  5035. /*#__PURE__*/
  5036. function () {
  5037. function ScrollSpy(element, config) {
  5038. var _this = this;
  5039. this._element = element;
  5040. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5041. this._config = this._getConfig(config);
  5042. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5043. this._offsets = [];
  5044. this._targets = [];
  5045. this._activeTarget = null;
  5046. this._scrollHeight = 0;
  5047. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5048. return _this._process(event);
  5049. });
  5050. this.refresh();
  5051. this._process();
  5052. } // Getters
  5053. var _proto = ScrollSpy.prototype;
  5054. // Public
  5055. _proto.refresh = function refresh() {
  5056. var _this2 = this;
  5057. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5058. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5059. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5060. this._offsets = [];
  5061. this._targets = [];
  5062. this._scrollHeight = this._getScrollHeight();
  5063. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5064. targets.map(function (element) {
  5065. var target;
  5066. var targetSelector = Util.getSelectorFromElement(element);
  5067. if (targetSelector) {
  5068. target = document.querySelector(targetSelector);
  5069. }
  5070. if (target) {
  5071. var targetBCR = target.getBoundingClientRect();
  5072. if (targetBCR.width || targetBCR.height) {
  5073. // TODO (fat): remove sketch reliance on jQuery position/offset
  5074. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5075. }
  5076. }
  5077. return null;
  5078. }).filter(function (item) {
  5079. return item;
  5080. }).sort(function (a, b) {
  5081. return a[0] - b[0];
  5082. }).forEach(function (item) {
  5083. _this2._offsets.push(item[0]);
  5084. _this2._targets.push(item[1]);
  5085. });
  5086. };
  5087. _proto.dispose = function dispose() {
  5088. $.removeData(this._element, DATA_KEY$8);
  5089. $(this._scrollElement).off(EVENT_KEY$8);
  5090. this._element = null;
  5091. this._scrollElement = null;
  5092. this._config = null;
  5093. this._selector = null;
  5094. this._offsets = null;
  5095. this._targets = null;
  5096. this._activeTarget = null;
  5097. this._scrollHeight = null;
  5098. } // Private
  5099. ;
  5100. _proto._getConfig = function _getConfig(config) {
  5101. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5102. if (typeof config.target !== 'string') {
  5103. var id = $(config.target).attr('id');
  5104. if (!id) {
  5105. id = Util.getUID(NAME$8);
  5106. $(config.target).attr('id', id);
  5107. }
  5108. config.target = "#" + id;
  5109. }
  5110. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5111. return config;
  5112. };
  5113. _proto._getScrollTop = function _getScrollTop() {
  5114. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5115. };
  5116. _proto._getScrollHeight = function _getScrollHeight() {
  5117. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5118. };
  5119. _proto._getOffsetHeight = function _getOffsetHeight() {
  5120. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5121. };
  5122. _proto._process = function _process() {
  5123. var scrollTop = this._getScrollTop() + this._config.offset;
  5124. var scrollHeight = this._getScrollHeight();
  5125. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5126. if (this._scrollHeight !== scrollHeight) {
  5127. this.refresh();
  5128. }
  5129. if (scrollTop >= maxScroll) {
  5130. var target = this._targets[this._targets.length - 1];
  5131. if (this._activeTarget !== target) {
  5132. this._activate(target);
  5133. }
  5134. return;
  5135. }
  5136. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5137. this._activeTarget = null;
  5138. this._clear();
  5139. return;
  5140. }
  5141. var offsetLength = this._offsets.length;
  5142. for (var i = offsetLength; i--;) {
  5143. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5144. if (isActiveTarget) {
  5145. this._activate(this._targets[i]);
  5146. }
  5147. }
  5148. };
  5149. _proto._activate = function _activate(target) {
  5150. this._activeTarget = target;
  5151. this._clear();
  5152. var queries = this._selector.split(',').map(function (selector) {
  5153. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5154. });
  5155. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5156. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5157. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5158. $link.addClass(ClassName$8.ACTIVE);
  5159. } else {
  5160. // Set triggered link as active
  5161. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5162. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5163. $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
  5164. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5165. }
  5166. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5167. relatedTarget: target
  5168. });
  5169. };
  5170. _proto._clear = function _clear() {
  5171. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5172. return node.classList.contains(ClassName$8.ACTIVE);
  5173. }).forEach(function (node) {
  5174. return node.classList.remove(ClassName$8.ACTIVE);
  5175. });
  5176. } // Static
  5177. ;
  5178. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5179. return this.each(function () {
  5180. var data = $(this).data(DATA_KEY$8);
  5181. var _config = typeof config === 'object' && config;
  5182. if (!data) {
  5183. data = new ScrollSpy(this, _config);
  5184. $(this).data(DATA_KEY$8, data);
  5185. }
  5186. if (typeof config === 'string') {
  5187. if (typeof data[config] === 'undefined') {
  5188. throw new TypeError("No method named \"" + config + "\"");
  5189. }
  5190. data[config]();
  5191. }
  5192. });
  5193. };
  5194. _createClass(ScrollSpy, null, [{
  5195. key: "VERSION",
  5196. get: function get() {
  5197. return VERSION$8;
  5198. }
  5199. }, {
  5200. key: "Default",
  5201. get: function get() {
  5202. return Default$6;
  5203. }
  5204. }]);
  5205. return ScrollSpy;
  5206. }();
  5207. /**
  5208. * ------------------------------------------------------------------------
  5209. * Data Api implementation
  5210. * ------------------------------------------------------------------------
  5211. */
  5212. $(window).on(Event$8.LOAD_DATA_API, function () {
  5213. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5214. var scrollSpysLength = scrollSpys.length;
  5215. for (var i = scrollSpysLength; i--;) {
  5216. var $spy = $(scrollSpys[i]);
  5217. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5218. }
  5219. });
  5220. /**
  5221. * ------------------------------------------------------------------------
  5222. * jQuery
  5223. * ------------------------------------------------------------------------
  5224. */
  5225. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5226. $.fn[NAME$8].Constructor = ScrollSpy;
  5227. $.fn[NAME$8].noConflict = function () {
  5228. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5229. return ScrollSpy._jQueryInterface;
  5230. };
  5231. /**
  5232. * ------------------------------------------------------------------------
  5233. * Constants
  5234. * ------------------------------------------------------------------------
  5235. */
  5236. var NAME$9 = 'tab';
  5237. var VERSION$9 = '4.4.1';
  5238. var DATA_KEY$9 = 'bs.tab';
  5239. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5240. var DATA_API_KEY$7 = '.data-api';
  5241. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5242. var Event$9 = {
  5243. HIDE: "hide" + EVENT_KEY$9,
  5244. HIDDEN: "hidden" + EVENT_KEY$9,
  5245. SHOW: "show" + EVENT_KEY$9,
  5246. SHOWN: "shown" + EVENT_KEY$9,
  5247. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5248. };
  5249. var ClassName$9 = {
  5250. DROPDOWN_MENU: 'dropdown-menu',
  5251. ACTIVE: 'active',
  5252. DISABLED: 'disabled',
  5253. FADE: 'fade',
  5254. SHOW: 'show'
  5255. };
  5256. var Selector$9 = {
  5257. DROPDOWN: '.dropdown',
  5258. NAV_LIST_GROUP: '.nav, .list-group',
  5259. ACTIVE: '.active',
  5260. ACTIVE_UL: '> li > .active',
  5261. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5262. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5263. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5264. };
  5265. /**
  5266. * ------------------------------------------------------------------------
  5267. * Class Definition
  5268. * ------------------------------------------------------------------------
  5269. */
  5270. var Tab =
  5271. /*#__PURE__*/
  5272. function () {
  5273. function Tab(element) {
  5274. this._element = element;
  5275. } // Getters
  5276. var _proto = Tab.prototype;
  5277. // Public
  5278. _proto.show = function show() {
  5279. var _this = this;
  5280. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5281. return;
  5282. }
  5283. var target;
  5284. var previous;
  5285. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5286. var selector = Util.getSelectorFromElement(this._element);
  5287. if (listElement) {
  5288. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5289. previous = $.makeArray($(listElement).find(itemSelector));
  5290. previous = previous[previous.length - 1];
  5291. }
  5292. var hideEvent = $.Event(Event$9.HIDE, {
  5293. relatedTarget: this._element
  5294. });
  5295. var showEvent = $.Event(Event$9.SHOW, {
  5296. relatedTarget: previous
  5297. });
  5298. if (previous) {
  5299. $(previous).trigger(hideEvent);
  5300. }
  5301. $(this._element).trigger(showEvent);
  5302. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5303. return;
  5304. }
  5305. if (selector) {
  5306. target = document.querySelector(selector);
  5307. }
  5308. this._activate(this._element, listElement);
  5309. var complete = function complete() {
  5310. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5311. relatedTarget: _this._element
  5312. });
  5313. var shownEvent = $.Event(Event$9.SHOWN, {
  5314. relatedTarget: previous
  5315. });
  5316. $(previous).trigger(hiddenEvent);
  5317. $(_this._element).trigger(shownEvent);
  5318. };
  5319. if (target) {
  5320. this._activate(target, target.parentNode, complete);
  5321. } else {
  5322. complete();
  5323. }
  5324. };
  5325. _proto.dispose = function dispose() {
  5326. $.removeData(this._element, DATA_KEY$9);
  5327. this._element = null;
  5328. } // Private
  5329. ;
  5330. _proto._activate = function _activate(element, container, callback) {
  5331. var _this2 = this;
  5332. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5333. var active = activeElements[0];
  5334. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5335. var complete = function complete() {
  5336. return _this2._transitionComplete(element, active, callback);
  5337. };
  5338. if (active && isTransitioning) {
  5339. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5340. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5341. } else {
  5342. complete();
  5343. }
  5344. };
  5345. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5346. if (active) {
  5347. $(active).removeClass(ClassName$9.ACTIVE);
  5348. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5349. if (dropdownChild) {
  5350. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5351. }
  5352. if (active.getAttribute('role') === 'tab') {
  5353. active.setAttribute('aria-selected', false);
  5354. }
  5355. }
  5356. $(element).addClass(ClassName$9.ACTIVE);
  5357. if (element.getAttribute('role') === 'tab') {
  5358. element.setAttribute('aria-selected', true);
  5359. }
  5360. Util.reflow(element);
  5361. if (element.classList.contains(ClassName$9.FADE)) {
  5362. element.classList.add(ClassName$9.SHOW);
  5363. }
  5364. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5365. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5366. if (dropdownElement) {
  5367. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5368. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5369. }
  5370. element.setAttribute('aria-expanded', true);
  5371. }
  5372. if (callback) {
  5373. callback();
  5374. }
  5375. } // Static
  5376. ;
  5377. Tab._jQueryInterface = function _jQueryInterface(config) {
  5378. return this.each(function () {
  5379. var $this = $(this);
  5380. var data = $this.data(DATA_KEY$9);
  5381. if (!data) {
  5382. data = new Tab(this);
  5383. $this.data(DATA_KEY$9, data);
  5384. }
  5385. if (typeof config === 'string') {
  5386. if (typeof data[config] === 'undefined') {
  5387. throw new TypeError("No method named \"" + config + "\"");
  5388. }
  5389. data[config]();
  5390. }
  5391. });
  5392. };
  5393. _createClass(Tab, null, [{
  5394. key: "VERSION",
  5395. get: function get() {
  5396. return VERSION$9;
  5397. }
  5398. }]);
  5399. return Tab;
  5400. }();
  5401. /**
  5402. * ------------------------------------------------------------------------
  5403. * Data Api implementation
  5404. * ------------------------------------------------------------------------
  5405. */
  5406. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5407. event.preventDefault();
  5408. Tab._jQueryInterface.call($(this), 'show');
  5409. });
  5410. /**
  5411. * ------------------------------------------------------------------------
  5412. * jQuery
  5413. * ------------------------------------------------------------------------
  5414. */
  5415. $.fn[NAME$9] = Tab._jQueryInterface;
  5416. $.fn[NAME$9].Constructor = Tab;
  5417. $.fn[NAME$9].noConflict = function () {
  5418. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5419. return Tab._jQueryInterface;
  5420. };
  5421. /**
  5422. * ------------------------------------------------------------------------
  5423. * Constants
  5424. * ------------------------------------------------------------------------
  5425. */
  5426. var NAME$a = 'toast';
  5427. var VERSION$a = '4.4.1';
  5428. var DATA_KEY$a = 'bs.toast';
  5429. var EVENT_KEY$a = "." + DATA_KEY$a;
  5430. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5431. var Event$a = {
  5432. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5433. HIDE: "hide" + EVENT_KEY$a,
  5434. HIDDEN: "hidden" + EVENT_KEY$a,
  5435. SHOW: "show" + EVENT_KEY$a,
  5436. SHOWN: "shown" + EVENT_KEY$a
  5437. };
  5438. var ClassName$a = {
  5439. FADE: 'fade',
  5440. HIDE: 'hide',
  5441. SHOW: 'show',
  5442. SHOWING: 'showing'
  5443. };
  5444. var DefaultType$7 = {
  5445. animation: 'boolean',
  5446. autohide: 'boolean',
  5447. delay: 'number'
  5448. };
  5449. var Default$7 = {
  5450. animation: true,
  5451. autohide: true,
  5452. delay: 500
  5453. };
  5454. var Selector$a = {
  5455. DATA_DISMISS: '[data-dismiss="toast"]'
  5456. };
  5457. /**
  5458. * ------------------------------------------------------------------------
  5459. * Class Definition
  5460. * ------------------------------------------------------------------------
  5461. */
  5462. var Toast =
  5463. /*#__PURE__*/
  5464. function () {
  5465. function Toast(element, config) {
  5466. this._element = element;
  5467. this._config = this._getConfig(config);
  5468. this._timeout = null;
  5469. this._setListeners();
  5470. } // Getters
  5471. var _proto = Toast.prototype;
  5472. // Public
  5473. _proto.show = function show() {
  5474. var _this = this;
  5475. var showEvent = $.Event(Event$a.SHOW);
  5476. $(this._element).trigger(showEvent);
  5477. if (showEvent.isDefaultPrevented()) {
  5478. return;
  5479. }
  5480. if (this._config.animation) {
  5481. this._element.classList.add(ClassName$a.FADE);
  5482. }
  5483. var complete = function complete() {
  5484. _this._element.classList.remove(ClassName$a.SHOWING);
  5485. _this._element.classList.add(ClassName$a.SHOW);
  5486. $(_this._element).trigger(Event$a.SHOWN);
  5487. if (_this._config.autohide) {
  5488. _this._timeout = setTimeout(function () {
  5489. _this.hide();
  5490. }, _this._config.delay);
  5491. }
  5492. };
  5493. this._element.classList.remove(ClassName$a.HIDE);
  5494. Util.reflow(this._element);
  5495. this._element.classList.add(ClassName$a.SHOWING);
  5496. if (this._config.animation) {
  5497. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5498. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5499. } else {
  5500. complete();
  5501. }
  5502. };
  5503. _proto.hide = function hide() {
  5504. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5505. return;
  5506. }
  5507. var hideEvent = $.Event(Event$a.HIDE);
  5508. $(this._element).trigger(hideEvent);
  5509. if (hideEvent.isDefaultPrevented()) {
  5510. return;
  5511. }
  5512. this._close();
  5513. };
  5514. _proto.dispose = function dispose() {
  5515. clearTimeout(this._timeout);
  5516. this._timeout = null;
  5517. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5518. this._element.classList.remove(ClassName$a.SHOW);
  5519. }
  5520. $(this._element).off(Event$a.CLICK_DISMISS);
  5521. $.removeData(this._element, DATA_KEY$a);
  5522. this._element = null;
  5523. this._config = null;
  5524. } // Private
  5525. ;
  5526. _proto._getConfig = function _getConfig(config) {
  5527. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5528. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5529. return config;
  5530. };
  5531. _proto._setListeners = function _setListeners() {
  5532. var _this2 = this;
  5533. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5534. return _this2.hide();
  5535. });
  5536. };
  5537. _proto._close = function _close() {
  5538. var _this3 = this;
  5539. var complete = function complete() {
  5540. _this3._element.classList.add(ClassName$a.HIDE);
  5541. $(_this3._element).trigger(Event$a.HIDDEN);
  5542. };
  5543. this._element.classList.remove(ClassName$a.SHOW);
  5544. if (this._config.animation) {
  5545. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5546. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5547. } else {
  5548. complete();
  5549. }
  5550. } // Static
  5551. ;
  5552. Toast._jQueryInterface = function _jQueryInterface(config) {
  5553. return this.each(function () {
  5554. var $element = $(this);
  5555. var data = $element.data(DATA_KEY$a);
  5556. var _config = typeof config === 'object' && config;
  5557. if (!data) {
  5558. data = new Toast(this, _config);
  5559. $element.data(DATA_KEY$a, data);
  5560. }
  5561. if (typeof config === 'string') {
  5562. if (typeof data[config] === 'undefined') {
  5563. throw new TypeError("No method named \"" + config + "\"");
  5564. }
  5565. data[config](this);
  5566. }
  5567. });
  5568. };
  5569. _createClass(Toast, null, [{
  5570. key: "VERSION",
  5571. get: function get() {
  5572. return VERSION$a;
  5573. }
  5574. }, {
  5575. key: "DefaultType",
  5576. get: function get() {
  5577. return DefaultType$7;
  5578. }
  5579. }, {
  5580. key: "Default",
  5581. get: function get() {
  5582. return Default$7;
  5583. }
  5584. }]);
  5585. return Toast;
  5586. }();
  5587. /**
  5588. * ------------------------------------------------------------------------
  5589. * jQuery
  5590. * ------------------------------------------------------------------------
  5591. */
  5592. $.fn[NAME$a] = Toast._jQueryInterface;
  5593. $.fn[NAME$a].Constructor = Toast;
  5594. $.fn[NAME$a].noConflict = function () {
  5595. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5596. return Toast._jQueryInterface;
  5597. };
  5598. exports.Alert = Alert;
  5599. exports.Button = Button;
  5600. exports.Carousel = Carousel;
  5601. exports.Collapse = Collapse;
  5602. exports.Dropdown = Dropdown;
  5603. exports.Modal = Modal;
  5604. exports.Popover = Popover;
  5605. exports.Scrollspy = ScrollSpy;
  5606. exports.Tab = Tab;
  5607. exports.Toast = Toast;
  5608. exports.Tooltip = Tooltip;
  5609. exports.Util = Util;
  5610. Object.defineProperty(exports, '__esModule', { value: true });
  5611. })));
  5612. //# sourceMappingURL=bootstrap.js.map
  5613. /***/ }),
  5614. /***/ "./node_modules/buffer/index.js":
  5615. /*!**************************************!*\
  5616. !*** ./node_modules/buffer/index.js ***!
  5617. \**************************************/
  5618. /*! no static exports found */
  5619. /***/ (function(module, exports, __webpack_require__) {
  5620. "use strict";
  5621. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5622. * The buffer module from node.js, for the browser.
  5623. *
  5624. * @author Feross Aboukhadijeh <http://feross.org>
  5625. * @license MIT
  5626. */
  5627. /* eslint-disable no-proto */
  5628. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5629. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5630. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5631. exports.Buffer = Buffer
  5632. exports.SlowBuffer = SlowBuffer
  5633. exports.INSPECT_MAX_BYTES = 50
  5634. /**
  5635. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5636. * === true Use Uint8Array implementation (fastest)
  5637. * === false Use Object implementation (most compatible, even IE6)
  5638. *
  5639. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5640. * Opera 11.6+, iOS 4.2+.
  5641. *
  5642. * Due to various browser bugs, sometimes the Object implementation will be used even
  5643. * when the browser supports typed arrays.
  5644. *
  5645. * Note:
  5646. *
  5647. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5648. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5649. *
  5650. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5651. *
  5652. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5653. * incorrect length in some situations.
  5654. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5655. * get the Object implementation, which is slower but behaves correctly.
  5656. */
  5657. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5658. ? global.TYPED_ARRAY_SUPPORT
  5659. : typedArraySupport()
  5660. /*
  5661. * Export kMaxLength after typed array support is determined.
  5662. */
  5663. exports.kMaxLength = kMaxLength()
  5664. function typedArraySupport () {
  5665. try {
  5666. var arr = new Uint8Array(1)
  5667. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5668. return arr.foo() === 42 && // typed array instances can be augmented
  5669. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5670. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5671. } catch (e) {
  5672. return false
  5673. }
  5674. }
  5675. function kMaxLength () {
  5676. return Buffer.TYPED_ARRAY_SUPPORT
  5677. ? 0x7fffffff
  5678. : 0x3fffffff
  5679. }
  5680. function createBuffer (that, length) {
  5681. if (kMaxLength() < length) {
  5682. throw new RangeError('Invalid typed array length')
  5683. }
  5684. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5685. // Return an augmented `Uint8Array` instance, for best performance
  5686. that = new Uint8Array(length)
  5687. that.__proto__ = Buffer.prototype
  5688. } else {
  5689. // Fallback: Return an object instance of the Buffer class
  5690. if (that === null) {
  5691. that = new Buffer(length)
  5692. }
  5693. that.length = length
  5694. }
  5695. return that
  5696. }
  5697. /**
  5698. * The Buffer constructor returns instances of `Uint8Array` that have their
  5699. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5700. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5701. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5702. * returns a single octet.
  5703. *
  5704. * The `Uint8Array` prototype remains unmodified.
  5705. */
  5706. function Buffer (arg, encodingOrOffset, length) {
  5707. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5708. return new Buffer(arg, encodingOrOffset, length)
  5709. }
  5710. // Common case.
  5711. if (typeof arg === 'number') {
  5712. if (typeof encodingOrOffset === 'string') {
  5713. throw new Error(
  5714. 'If encoding is specified then the first argument must be a string'
  5715. )
  5716. }
  5717. return allocUnsafe(this, arg)
  5718. }
  5719. return from(this, arg, encodingOrOffset, length)
  5720. }
  5721. Buffer.poolSize = 8192 // not used by this implementation
  5722. // TODO: Legacy, not needed anymore. Remove in next major version.
  5723. Buffer._augment = function (arr) {
  5724. arr.__proto__ = Buffer.prototype
  5725. return arr
  5726. }
  5727. function from (that, value, encodingOrOffset, length) {
  5728. if (typeof value === 'number') {
  5729. throw new TypeError('"value" argument must not be a number')
  5730. }
  5731. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5732. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5733. }
  5734. if (typeof value === 'string') {
  5735. return fromString(that, value, encodingOrOffset)
  5736. }
  5737. return fromObject(that, value)
  5738. }
  5739. /**
  5740. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5741. * if value is a number.
  5742. * Buffer.from(str[, encoding])
  5743. * Buffer.from(array)
  5744. * Buffer.from(buffer)
  5745. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5746. **/
  5747. Buffer.from = function (value, encodingOrOffset, length) {
  5748. return from(null, value, encodingOrOffset, length)
  5749. }
  5750. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5751. Buffer.prototype.__proto__ = Uint8Array.prototype
  5752. Buffer.__proto__ = Uint8Array
  5753. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5754. Buffer[Symbol.species] === Buffer) {
  5755. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5756. Object.defineProperty(Buffer, Symbol.species, {
  5757. value: null,
  5758. configurable: true
  5759. })
  5760. }
  5761. }
  5762. function assertSize (size) {
  5763. if (typeof size !== 'number') {
  5764. throw new TypeError('"size" argument must be a number')
  5765. } else if (size < 0) {
  5766. throw new RangeError('"size" argument must not be negative')
  5767. }
  5768. }
  5769. function alloc (that, size, fill, encoding) {
  5770. assertSize(size)
  5771. if (size <= 0) {
  5772. return createBuffer(that, size)
  5773. }
  5774. if (fill !== undefined) {
  5775. // Only pay attention to encoding if it's a string. This
  5776. // prevents accidentally sending in a number that would
  5777. // be interpretted as a start offset.
  5778. return typeof encoding === 'string'
  5779. ? createBuffer(that, size).fill(fill, encoding)
  5780. : createBuffer(that, size).fill(fill)
  5781. }
  5782. return createBuffer(that, size)
  5783. }
  5784. /**
  5785. * Creates a new filled Buffer instance.
  5786. * alloc(size[, fill[, encoding]])
  5787. **/
  5788. Buffer.alloc = function (size, fill, encoding) {
  5789. return alloc(null, size, fill, encoding)
  5790. }
  5791. function allocUnsafe (that, size) {
  5792. assertSize(size)
  5793. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5794. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5795. for (var i = 0; i < size; ++i) {
  5796. that[i] = 0
  5797. }
  5798. }
  5799. return that
  5800. }
  5801. /**
  5802. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5803. * */
  5804. Buffer.allocUnsafe = function (size) {
  5805. return allocUnsafe(null, size)
  5806. }
  5807. /**
  5808. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5809. */
  5810. Buffer.allocUnsafeSlow = function (size) {
  5811. return allocUnsafe(null, size)
  5812. }
  5813. function fromString (that, string, encoding) {
  5814. if (typeof encoding !== 'string' || encoding === '') {
  5815. encoding = 'utf8'
  5816. }
  5817. if (!Buffer.isEncoding(encoding)) {
  5818. throw new TypeError('"encoding" must be a valid string encoding')
  5819. }
  5820. var length = byteLength(string, encoding) | 0
  5821. that = createBuffer(that, length)
  5822. var actual = that.write(string, encoding)
  5823. if (actual !== length) {
  5824. // Writing a hex string, for example, that contains invalid characters will
  5825. // cause everything after the first invalid character to be ignored. (e.g.
  5826. // 'abxxcd' will be treated as 'ab')
  5827. that = that.slice(0, actual)
  5828. }
  5829. return that
  5830. }
  5831. function fromArrayLike (that, array) {
  5832. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5833. that = createBuffer(that, length)
  5834. for (var i = 0; i < length; i += 1) {
  5835. that[i] = array[i] & 255
  5836. }
  5837. return that
  5838. }
  5839. function fromArrayBuffer (that, array, byteOffset, length) {
  5840. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5841. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5842. throw new RangeError('\'offset\' is out of bounds')
  5843. }
  5844. if (array.byteLength < byteOffset + (length || 0)) {
  5845. throw new RangeError('\'length\' is out of bounds')
  5846. }
  5847. if (byteOffset === undefined && length === undefined) {
  5848. array = new Uint8Array(array)
  5849. } else if (length === undefined) {
  5850. array = new Uint8Array(array, byteOffset)
  5851. } else {
  5852. array = new Uint8Array(array, byteOffset, length)
  5853. }
  5854. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5855. // Return an augmented `Uint8Array` instance, for best performance
  5856. that = array
  5857. that.__proto__ = Buffer.prototype
  5858. } else {
  5859. // Fallback: Return an object instance of the Buffer class
  5860. that = fromArrayLike(that, array)
  5861. }
  5862. return that
  5863. }
  5864. function fromObject (that, obj) {
  5865. if (Buffer.isBuffer(obj)) {
  5866. var len = checked(obj.length) | 0
  5867. that = createBuffer(that, len)
  5868. if (that.length === 0) {
  5869. return that
  5870. }
  5871. obj.copy(that, 0, 0, len)
  5872. return that
  5873. }
  5874. if (obj) {
  5875. if ((typeof ArrayBuffer !== 'undefined' &&
  5876. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5877. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5878. return createBuffer(that, 0)
  5879. }
  5880. return fromArrayLike(that, obj)
  5881. }
  5882. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5883. return fromArrayLike(that, obj.data)
  5884. }
  5885. }
  5886. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5887. }
  5888. function checked (length) {
  5889. // Note: cannot use `length < kMaxLength()` here because that fails when
  5890. // length is NaN (which is otherwise coerced to zero.)
  5891. if (length >= kMaxLength()) {
  5892. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5893. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5894. }
  5895. return length | 0
  5896. }
  5897. function SlowBuffer (length) {
  5898. if (+length != length) { // eslint-disable-line eqeqeq
  5899. length = 0
  5900. }
  5901. return Buffer.alloc(+length)
  5902. }
  5903. Buffer.isBuffer = function isBuffer (b) {
  5904. return !!(b != null && b._isBuffer)
  5905. }
  5906. Buffer.compare = function compare (a, b) {
  5907. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5908. throw new TypeError('Arguments must be Buffers')
  5909. }
  5910. if (a === b) return 0
  5911. var x = a.length
  5912. var y = b.length
  5913. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5914. if (a[i] !== b[i]) {
  5915. x = a[i]
  5916. y = b[i]
  5917. break
  5918. }
  5919. }
  5920. if (x < y) return -1
  5921. if (y < x) return 1
  5922. return 0
  5923. }
  5924. Buffer.isEncoding = function isEncoding (encoding) {
  5925. switch (String(encoding).toLowerCase()) {
  5926. case 'hex':
  5927. case 'utf8':
  5928. case 'utf-8':
  5929. case 'ascii':
  5930. case 'latin1':
  5931. case 'binary':
  5932. case 'base64':
  5933. case 'ucs2':
  5934. case 'ucs-2':
  5935. case 'utf16le':
  5936. case 'utf-16le':
  5937. return true
  5938. default:
  5939. return false
  5940. }
  5941. }
  5942. Buffer.concat = function concat (list, length) {
  5943. if (!isArray(list)) {
  5944. throw new TypeError('"list" argument must be an Array of Buffers')
  5945. }
  5946. if (list.length === 0) {
  5947. return Buffer.alloc(0)
  5948. }
  5949. var i
  5950. if (length === undefined) {
  5951. length = 0
  5952. for (i = 0; i < list.length; ++i) {
  5953. length += list[i].length
  5954. }
  5955. }
  5956. var buffer = Buffer.allocUnsafe(length)
  5957. var pos = 0
  5958. for (i = 0; i < list.length; ++i) {
  5959. var buf = list[i]
  5960. if (!Buffer.isBuffer(buf)) {
  5961. throw new TypeError('"list" argument must be an Array of Buffers')
  5962. }
  5963. buf.copy(buffer, pos)
  5964. pos += buf.length
  5965. }
  5966. return buffer
  5967. }
  5968. function byteLength (string, encoding) {
  5969. if (Buffer.isBuffer(string)) {
  5970. return string.length
  5971. }
  5972. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  5973. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  5974. return string.byteLength
  5975. }
  5976. if (typeof string !== 'string') {
  5977. string = '' + string
  5978. }
  5979. var len = string.length
  5980. if (len === 0) return 0
  5981. // Use a for loop to avoid recursion
  5982. var loweredCase = false
  5983. for (;;) {
  5984. switch (encoding) {
  5985. case 'ascii':
  5986. case 'latin1':
  5987. case 'binary':
  5988. return len
  5989. case 'utf8':
  5990. case 'utf-8':
  5991. case undefined:
  5992. return utf8ToBytes(string).length
  5993. case 'ucs2':
  5994. case 'ucs-2':
  5995. case 'utf16le':
  5996. case 'utf-16le':
  5997. return len * 2
  5998. case 'hex':
  5999. return len >>> 1
  6000. case 'base64':
  6001. return base64ToBytes(string).length
  6002. default:
  6003. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6004. encoding = ('' + encoding).toLowerCase()
  6005. loweredCase = true
  6006. }
  6007. }
  6008. }
  6009. Buffer.byteLength = byteLength
  6010. function slowToString (encoding, start, end) {
  6011. var loweredCase = false
  6012. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6013. // property of a typed array.
  6014. // This behaves neither like String nor Uint8Array in that we set start/end
  6015. // to their upper/lower bounds if the value passed is out of range.
  6016. // undefined is handled specially as per ECMA-262 6th Edition,
  6017. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6018. if (start === undefined || start < 0) {
  6019. start = 0
  6020. }
  6021. // Return early if start > this.length. Done here to prevent potential uint32
  6022. // coercion fail below.
  6023. if (start > this.length) {
  6024. return ''
  6025. }
  6026. if (end === undefined || end > this.length) {
  6027. end = this.length
  6028. }
  6029. if (end <= 0) {
  6030. return ''
  6031. }
  6032. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6033. end >>>= 0
  6034. start >>>= 0
  6035. if (end <= start) {
  6036. return ''
  6037. }
  6038. if (!encoding) encoding = 'utf8'
  6039. while (true) {
  6040. switch (encoding) {
  6041. case 'hex':
  6042. return hexSlice(this, start, end)
  6043. case 'utf8':
  6044. case 'utf-8':
  6045. return utf8Slice(this, start, end)
  6046. case 'ascii':
  6047. return asciiSlice(this, start, end)
  6048. case 'latin1':
  6049. case 'binary':
  6050. return latin1Slice(this, start, end)
  6051. case 'base64':
  6052. return base64Slice(this, start, end)
  6053. case 'ucs2':
  6054. case 'ucs-2':
  6055. case 'utf16le':
  6056. case 'utf-16le':
  6057. return utf16leSlice(this, start, end)
  6058. default:
  6059. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6060. encoding = (encoding + '').toLowerCase()
  6061. loweredCase = true
  6062. }
  6063. }
  6064. }
  6065. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6066. // Buffer instances.
  6067. Buffer.prototype._isBuffer = true
  6068. function swap (b, n, m) {
  6069. var i = b[n]
  6070. b[n] = b[m]
  6071. b[m] = i
  6072. }
  6073. Buffer.prototype.swap16 = function swap16 () {
  6074. var len = this.length
  6075. if (len % 2 !== 0) {
  6076. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6077. }
  6078. for (var i = 0; i < len; i += 2) {
  6079. swap(this, i, i + 1)
  6080. }
  6081. return this
  6082. }
  6083. Buffer.prototype.swap32 = function swap32 () {
  6084. var len = this.length
  6085. if (len % 4 !== 0) {
  6086. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6087. }
  6088. for (var i = 0; i < len; i += 4) {
  6089. swap(this, i, i + 3)
  6090. swap(this, i + 1, i + 2)
  6091. }
  6092. return this
  6093. }
  6094. Buffer.prototype.swap64 = function swap64 () {
  6095. var len = this.length
  6096. if (len % 8 !== 0) {
  6097. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6098. }
  6099. for (var i = 0; i < len; i += 8) {
  6100. swap(this, i, i + 7)
  6101. swap(this, i + 1, i + 6)
  6102. swap(this, i + 2, i + 5)
  6103. swap(this, i + 3, i + 4)
  6104. }
  6105. return this
  6106. }
  6107. Buffer.prototype.toString = function toString () {
  6108. var length = this.length | 0
  6109. if (length === 0) return ''
  6110. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6111. return slowToString.apply(this, arguments)
  6112. }
  6113. Buffer.prototype.equals = function equals (b) {
  6114. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6115. if (this === b) return true
  6116. return Buffer.compare(this, b) === 0
  6117. }
  6118. Buffer.prototype.inspect = function inspect () {
  6119. var str = ''
  6120. var max = exports.INSPECT_MAX_BYTES
  6121. if (this.length > 0) {
  6122. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6123. if (this.length > max) str += ' ... '
  6124. }
  6125. return '<Buffer ' + str + '>'
  6126. }
  6127. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6128. if (!Buffer.isBuffer(target)) {
  6129. throw new TypeError('Argument must be a Buffer')
  6130. }
  6131. if (start === undefined) {
  6132. start = 0
  6133. }
  6134. if (end === undefined) {
  6135. end = target ? target.length : 0
  6136. }
  6137. if (thisStart === undefined) {
  6138. thisStart = 0
  6139. }
  6140. if (thisEnd === undefined) {
  6141. thisEnd = this.length
  6142. }
  6143. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6144. throw new RangeError('out of range index')
  6145. }
  6146. if (thisStart >= thisEnd && start >= end) {
  6147. return 0
  6148. }
  6149. if (thisStart >= thisEnd) {
  6150. return -1
  6151. }
  6152. if (start >= end) {
  6153. return 1
  6154. }
  6155. start >>>= 0
  6156. end >>>= 0
  6157. thisStart >>>= 0
  6158. thisEnd >>>= 0
  6159. if (this === target) return 0
  6160. var x = thisEnd - thisStart
  6161. var y = end - start
  6162. var len = Math.min(x, y)
  6163. var thisCopy = this.slice(thisStart, thisEnd)
  6164. var targetCopy = target.slice(start, end)
  6165. for (var i = 0; i < len; ++i) {
  6166. if (thisCopy[i] !== targetCopy[i]) {
  6167. x = thisCopy[i]
  6168. y = targetCopy[i]
  6169. break
  6170. }
  6171. }
  6172. if (x < y) return -1
  6173. if (y < x) return 1
  6174. return 0
  6175. }
  6176. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6177. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6178. //
  6179. // Arguments:
  6180. // - buffer - a Buffer to search
  6181. // - val - a string, Buffer, or number
  6182. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6183. // - encoding - an optional encoding, relevant is val is a string
  6184. // - dir - true for indexOf, false for lastIndexOf
  6185. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6186. // Empty buffer means no match
  6187. if (buffer.length === 0) return -1
  6188. // Normalize byteOffset
  6189. if (typeof byteOffset === 'string') {
  6190. encoding = byteOffset
  6191. byteOffset = 0
  6192. } else if (byteOffset > 0x7fffffff) {
  6193. byteOffset = 0x7fffffff
  6194. } else if (byteOffset < -0x80000000) {
  6195. byteOffset = -0x80000000
  6196. }
  6197. byteOffset = +byteOffset // Coerce to Number.
  6198. if (isNaN(byteOffset)) {
  6199. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6200. byteOffset = dir ? 0 : (buffer.length - 1)
  6201. }
  6202. // Normalize byteOffset: negative offsets start from the end of the buffer
  6203. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6204. if (byteOffset >= buffer.length) {
  6205. if (dir) return -1
  6206. else byteOffset = buffer.length - 1
  6207. } else if (byteOffset < 0) {
  6208. if (dir) byteOffset = 0
  6209. else return -1
  6210. }
  6211. // Normalize val
  6212. if (typeof val === 'string') {
  6213. val = Buffer.from(val, encoding)
  6214. }
  6215. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6216. if (Buffer.isBuffer(val)) {
  6217. // Special case: looking for empty string/buffer always fails
  6218. if (val.length === 0) {
  6219. return -1
  6220. }
  6221. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6222. } else if (typeof val === 'number') {
  6223. val = val & 0xFF // Search for a byte value [0-255]
  6224. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6225. typeof Uint8Array.prototype.indexOf === 'function') {
  6226. if (dir) {
  6227. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6228. } else {
  6229. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6230. }
  6231. }
  6232. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6233. }
  6234. throw new TypeError('val must be string, number or Buffer')
  6235. }
  6236. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6237. var indexSize = 1
  6238. var arrLength = arr.length
  6239. var valLength = val.length
  6240. if (encoding !== undefined) {
  6241. encoding = String(encoding).toLowerCase()
  6242. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6243. encoding === 'utf16le' || encoding === 'utf-16le') {
  6244. if (arr.length < 2 || val.length < 2) {
  6245. return -1
  6246. }
  6247. indexSize = 2
  6248. arrLength /= 2
  6249. valLength /= 2
  6250. byteOffset /= 2
  6251. }
  6252. }
  6253. function read (buf, i) {
  6254. if (indexSize === 1) {
  6255. return buf[i]
  6256. } else {
  6257. return buf.readUInt16BE(i * indexSize)
  6258. }
  6259. }
  6260. var i
  6261. if (dir) {
  6262. var foundIndex = -1
  6263. for (i = byteOffset; i < arrLength; i++) {
  6264. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6265. if (foundIndex === -1) foundIndex = i
  6266. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6267. } else {
  6268. if (foundIndex !== -1) i -= i - foundIndex
  6269. foundIndex = -1
  6270. }
  6271. }
  6272. } else {
  6273. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6274. for (i = byteOffset; i >= 0; i--) {
  6275. var found = true
  6276. for (var j = 0; j < valLength; j++) {
  6277. if (read(arr, i + j) !== read(val, j)) {
  6278. found = false
  6279. break
  6280. }
  6281. }
  6282. if (found) return i
  6283. }
  6284. }
  6285. return -1
  6286. }
  6287. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6288. return this.indexOf(val, byteOffset, encoding) !== -1
  6289. }
  6290. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6291. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6292. }
  6293. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6294. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6295. }
  6296. function hexWrite (buf, string, offset, length) {
  6297. offset = Number(offset) || 0
  6298. var remaining = buf.length - offset
  6299. if (!length) {
  6300. length = remaining
  6301. } else {
  6302. length = Number(length)
  6303. if (length > remaining) {
  6304. length = remaining
  6305. }
  6306. }
  6307. // must be an even number of digits
  6308. var strLen = string.length
  6309. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6310. if (length > strLen / 2) {
  6311. length = strLen / 2
  6312. }
  6313. for (var i = 0; i < length; ++i) {
  6314. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6315. if (isNaN(parsed)) return i
  6316. buf[offset + i] = parsed
  6317. }
  6318. return i
  6319. }
  6320. function utf8Write (buf, string, offset, length) {
  6321. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6322. }
  6323. function asciiWrite (buf, string, offset, length) {
  6324. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6325. }
  6326. function latin1Write (buf, string, offset, length) {
  6327. return asciiWrite(buf, string, offset, length)
  6328. }
  6329. function base64Write (buf, string, offset, length) {
  6330. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6331. }
  6332. function ucs2Write (buf, string, offset, length) {
  6333. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6334. }
  6335. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6336. // Buffer#write(string)
  6337. if (offset === undefined) {
  6338. encoding = 'utf8'
  6339. length = this.length
  6340. offset = 0
  6341. // Buffer#write(string, encoding)
  6342. } else if (length === undefined && typeof offset === 'string') {
  6343. encoding = offset
  6344. length = this.length
  6345. offset = 0
  6346. // Buffer#write(string, offset[, length][, encoding])
  6347. } else if (isFinite(offset)) {
  6348. offset = offset | 0
  6349. if (isFinite(length)) {
  6350. length = length | 0
  6351. if (encoding === undefined) encoding = 'utf8'
  6352. } else {
  6353. encoding = length
  6354. length = undefined
  6355. }
  6356. // legacy write(string, encoding, offset, length) - remove in v0.13
  6357. } else {
  6358. throw new Error(
  6359. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6360. )
  6361. }
  6362. var remaining = this.length - offset
  6363. if (length === undefined || length > remaining) length = remaining
  6364. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6365. throw new RangeError('Attempt to write outside buffer bounds')
  6366. }
  6367. if (!encoding) encoding = 'utf8'
  6368. var loweredCase = false
  6369. for (;;) {
  6370. switch (encoding) {
  6371. case 'hex':
  6372. return hexWrite(this, string, offset, length)
  6373. case 'utf8':
  6374. case 'utf-8':
  6375. return utf8Write(this, string, offset, length)
  6376. case 'ascii':
  6377. return asciiWrite(this, string, offset, length)
  6378. case 'latin1':
  6379. case 'binary':
  6380. return latin1Write(this, string, offset, length)
  6381. case 'base64':
  6382. // Warning: maxLength not taken into account in base64Write
  6383. return base64Write(this, string, offset, length)
  6384. case 'ucs2':
  6385. case 'ucs-2':
  6386. case 'utf16le':
  6387. case 'utf-16le':
  6388. return ucs2Write(this, string, offset, length)
  6389. default:
  6390. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6391. encoding = ('' + encoding).toLowerCase()
  6392. loweredCase = true
  6393. }
  6394. }
  6395. }
  6396. Buffer.prototype.toJSON = function toJSON () {
  6397. return {
  6398. type: 'Buffer',
  6399. data: Array.prototype.slice.call(this._arr || this, 0)
  6400. }
  6401. }
  6402. function base64Slice (buf, start, end) {
  6403. if (start === 0 && end === buf.length) {
  6404. return base64.fromByteArray(buf)
  6405. } else {
  6406. return base64.fromByteArray(buf.slice(start, end))
  6407. }
  6408. }
  6409. function utf8Slice (buf, start, end) {
  6410. end = Math.min(buf.length, end)
  6411. var res = []
  6412. var i = start
  6413. while (i < end) {
  6414. var firstByte = buf[i]
  6415. var codePoint = null
  6416. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6417. : (firstByte > 0xDF) ? 3
  6418. : (firstByte > 0xBF) ? 2
  6419. : 1
  6420. if (i + bytesPerSequence <= end) {
  6421. var secondByte, thirdByte, fourthByte, tempCodePoint
  6422. switch (bytesPerSequence) {
  6423. case 1:
  6424. if (firstByte < 0x80) {
  6425. codePoint = firstByte
  6426. }
  6427. break
  6428. case 2:
  6429. secondByte = buf[i + 1]
  6430. if ((secondByte & 0xC0) === 0x80) {
  6431. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6432. if (tempCodePoint > 0x7F) {
  6433. codePoint = tempCodePoint
  6434. }
  6435. }
  6436. break
  6437. case 3:
  6438. secondByte = buf[i + 1]
  6439. thirdByte = buf[i + 2]
  6440. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6441. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6442. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6443. codePoint = tempCodePoint
  6444. }
  6445. }
  6446. break
  6447. case 4:
  6448. secondByte = buf[i + 1]
  6449. thirdByte = buf[i + 2]
  6450. fourthByte = buf[i + 3]
  6451. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6452. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6453. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6454. codePoint = tempCodePoint
  6455. }
  6456. }
  6457. }
  6458. }
  6459. if (codePoint === null) {
  6460. // we did not generate a valid codePoint so insert a
  6461. // replacement char (U+FFFD) and advance only 1 byte
  6462. codePoint = 0xFFFD
  6463. bytesPerSequence = 1
  6464. } else if (codePoint > 0xFFFF) {
  6465. // encode to utf16 (surrogate pair dance)
  6466. codePoint -= 0x10000
  6467. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6468. codePoint = 0xDC00 | codePoint & 0x3FF
  6469. }
  6470. res.push(codePoint)
  6471. i += bytesPerSequence
  6472. }
  6473. return decodeCodePointsArray(res)
  6474. }
  6475. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6476. // the lowest limit is Chrome, with 0x10000 args.
  6477. // We go 1 magnitude less, for safety
  6478. var MAX_ARGUMENTS_LENGTH = 0x1000
  6479. function decodeCodePointsArray (codePoints) {
  6480. var len = codePoints.length
  6481. if (len <= MAX_ARGUMENTS_LENGTH) {
  6482. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6483. }
  6484. // Decode in chunks to avoid "call stack size exceeded".
  6485. var res = ''
  6486. var i = 0
  6487. while (i < len) {
  6488. res += String.fromCharCode.apply(
  6489. String,
  6490. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6491. )
  6492. }
  6493. return res
  6494. }
  6495. function asciiSlice (buf, start, end) {
  6496. var ret = ''
  6497. end = Math.min(buf.length, end)
  6498. for (var i = start; i < end; ++i) {
  6499. ret += String.fromCharCode(buf[i] & 0x7F)
  6500. }
  6501. return ret
  6502. }
  6503. function latin1Slice (buf, start, end) {
  6504. var ret = ''
  6505. end = Math.min(buf.length, end)
  6506. for (var i = start; i < end; ++i) {
  6507. ret += String.fromCharCode(buf[i])
  6508. }
  6509. return ret
  6510. }
  6511. function hexSlice (buf, start, end) {
  6512. var len = buf.length
  6513. if (!start || start < 0) start = 0
  6514. if (!end || end < 0 || end > len) end = len
  6515. var out = ''
  6516. for (var i = start; i < end; ++i) {
  6517. out += toHex(buf[i])
  6518. }
  6519. return out
  6520. }
  6521. function utf16leSlice (buf, start, end) {
  6522. var bytes = buf.slice(start, end)
  6523. var res = ''
  6524. for (var i = 0; i < bytes.length; i += 2) {
  6525. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6526. }
  6527. return res
  6528. }
  6529. Buffer.prototype.slice = function slice (start, end) {
  6530. var len = this.length
  6531. start = ~~start
  6532. end = end === undefined ? len : ~~end
  6533. if (start < 0) {
  6534. start += len
  6535. if (start < 0) start = 0
  6536. } else if (start > len) {
  6537. start = len
  6538. }
  6539. if (end < 0) {
  6540. end += len
  6541. if (end < 0) end = 0
  6542. } else if (end > len) {
  6543. end = len
  6544. }
  6545. if (end < start) end = start
  6546. var newBuf
  6547. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6548. newBuf = this.subarray(start, end)
  6549. newBuf.__proto__ = Buffer.prototype
  6550. } else {
  6551. var sliceLen = end - start
  6552. newBuf = new Buffer(sliceLen, undefined)
  6553. for (var i = 0; i < sliceLen; ++i) {
  6554. newBuf[i] = this[i + start]
  6555. }
  6556. }
  6557. return newBuf
  6558. }
  6559. /*
  6560. * Need to make sure that buffer isn't trying to write out of bounds.
  6561. */
  6562. function checkOffset (offset, ext, length) {
  6563. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6564. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6565. }
  6566. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6567. offset = offset | 0
  6568. byteLength = byteLength | 0
  6569. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6570. var val = this[offset]
  6571. var mul = 1
  6572. var i = 0
  6573. while (++i < byteLength && (mul *= 0x100)) {
  6574. val += this[offset + i] * mul
  6575. }
  6576. return val
  6577. }
  6578. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6579. offset = offset | 0
  6580. byteLength = byteLength | 0
  6581. if (!noAssert) {
  6582. checkOffset(offset, byteLength, this.length)
  6583. }
  6584. var val = this[offset + --byteLength]
  6585. var mul = 1
  6586. while (byteLength > 0 && (mul *= 0x100)) {
  6587. val += this[offset + --byteLength] * mul
  6588. }
  6589. return val
  6590. }
  6591. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6592. if (!noAssert) checkOffset(offset, 1, this.length)
  6593. return this[offset]
  6594. }
  6595. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6596. if (!noAssert) checkOffset(offset, 2, this.length)
  6597. return this[offset] | (this[offset + 1] << 8)
  6598. }
  6599. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6600. if (!noAssert) checkOffset(offset, 2, this.length)
  6601. return (this[offset] << 8) | this[offset + 1]
  6602. }
  6603. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6604. if (!noAssert) checkOffset(offset, 4, this.length)
  6605. return ((this[offset]) |
  6606. (this[offset + 1] << 8) |
  6607. (this[offset + 2] << 16)) +
  6608. (this[offset + 3] * 0x1000000)
  6609. }
  6610. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6611. if (!noAssert) checkOffset(offset, 4, this.length)
  6612. return (this[offset] * 0x1000000) +
  6613. ((this[offset + 1] << 16) |
  6614. (this[offset + 2] << 8) |
  6615. this[offset + 3])
  6616. }
  6617. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6618. offset = offset | 0
  6619. byteLength = byteLength | 0
  6620. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6621. var val = this[offset]
  6622. var mul = 1
  6623. var i = 0
  6624. while (++i < byteLength && (mul *= 0x100)) {
  6625. val += this[offset + i] * mul
  6626. }
  6627. mul *= 0x80
  6628. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6629. return val
  6630. }
  6631. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6632. offset = offset | 0
  6633. byteLength = byteLength | 0
  6634. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6635. var i = byteLength
  6636. var mul = 1
  6637. var val = this[offset + --i]
  6638. while (i > 0 && (mul *= 0x100)) {
  6639. val += this[offset + --i] * mul
  6640. }
  6641. mul *= 0x80
  6642. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6643. return val
  6644. }
  6645. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6646. if (!noAssert) checkOffset(offset, 1, this.length)
  6647. if (!(this[offset] & 0x80)) return (this[offset])
  6648. return ((0xff - this[offset] + 1) * -1)
  6649. }
  6650. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6651. if (!noAssert) checkOffset(offset, 2, this.length)
  6652. var val = this[offset] | (this[offset + 1] << 8)
  6653. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6654. }
  6655. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6656. if (!noAssert) checkOffset(offset, 2, this.length)
  6657. var val = this[offset + 1] | (this[offset] << 8)
  6658. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6659. }
  6660. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6661. if (!noAssert) checkOffset(offset, 4, this.length)
  6662. return (this[offset]) |
  6663. (this[offset + 1] << 8) |
  6664. (this[offset + 2] << 16) |
  6665. (this[offset + 3] << 24)
  6666. }
  6667. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6668. if (!noAssert) checkOffset(offset, 4, this.length)
  6669. return (this[offset] << 24) |
  6670. (this[offset + 1] << 16) |
  6671. (this[offset + 2] << 8) |
  6672. (this[offset + 3])
  6673. }
  6674. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6675. if (!noAssert) checkOffset(offset, 4, this.length)
  6676. return ieee754.read(this, offset, true, 23, 4)
  6677. }
  6678. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6679. if (!noAssert) checkOffset(offset, 4, this.length)
  6680. return ieee754.read(this, offset, false, 23, 4)
  6681. }
  6682. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6683. if (!noAssert) checkOffset(offset, 8, this.length)
  6684. return ieee754.read(this, offset, true, 52, 8)
  6685. }
  6686. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6687. if (!noAssert) checkOffset(offset, 8, this.length)
  6688. return ieee754.read(this, offset, false, 52, 8)
  6689. }
  6690. function checkInt (buf, value, offset, ext, max, min) {
  6691. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6692. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6693. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6694. }
  6695. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6696. value = +value
  6697. offset = offset | 0
  6698. byteLength = byteLength | 0
  6699. if (!noAssert) {
  6700. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6701. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6702. }
  6703. var mul = 1
  6704. var i = 0
  6705. this[offset] = value & 0xFF
  6706. while (++i < byteLength && (mul *= 0x100)) {
  6707. this[offset + i] = (value / mul) & 0xFF
  6708. }
  6709. return offset + byteLength
  6710. }
  6711. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6712. value = +value
  6713. offset = offset | 0
  6714. byteLength = byteLength | 0
  6715. if (!noAssert) {
  6716. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6717. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6718. }
  6719. var i = byteLength - 1
  6720. var mul = 1
  6721. this[offset + i] = value & 0xFF
  6722. while (--i >= 0 && (mul *= 0x100)) {
  6723. this[offset + i] = (value / mul) & 0xFF
  6724. }
  6725. return offset + byteLength
  6726. }
  6727. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6728. value = +value
  6729. offset = offset | 0
  6730. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6731. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6732. this[offset] = (value & 0xff)
  6733. return offset + 1
  6734. }
  6735. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6736. if (value < 0) value = 0xffff + value + 1
  6737. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6738. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6739. (littleEndian ? i : 1 - i) * 8
  6740. }
  6741. }
  6742. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6743. value = +value
  6744. offset = offset | 0
  6745. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6746. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6747. this[offset] = (value & 0xff)
  6748. this[offset + 1] = (value >>> 8)
  6749. } else {
  6750. objectWriteUInt16(this, value, offset, true)
  6751. }
  6752. return offset + 2
  6753. }
  6754. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6755. value = +value
  6756. offset = offset | 0
  6757. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6758. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6759. this[offset] = (value >>> 8)
  6760. this[offset + 1] = (value & 0xff)
  6761. } else {
  6762. objectWriteUInt16(this, value, offset, false)
  6763. }
  6764. return offset + 2
  6765. }
  6766. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6767. if (value < 0) value = 0xffffffff + value + 1
  6768. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6769. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6770. }
  6771. }
  6772. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6773. value = +value
  6774. offset = offset | 0
  6775. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6776. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6777. this[offset + 3] = (value >>> 24)
  6778. this[offset + 2] = (value >>> 16)
  6779. this[offset + 1] = (value >>> 8)
  6780. this[offset] = (value & 0xff)
  6781. } else {
  6782. objectWriteUInt32(this, value, offset, true)
  6783. }
  6784. return offset + 4
  6785. }
  6786. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6787. value = +value
  6788. offset = offset | 0
  6789. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6790. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6791. this[offset] = (value >>> 24)
  6792. this[offset + 1] = (value >>> 16)
  6793. this[offset + 2] = (value >>> 8)
  6794. this[offset + 3] = (value & 0xff)
  6795. } else {
  6796. objectWriteUInt32(this, value, offset, false)
  6797. }
  6798. return offset + 4
  6799. }
  6800. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6801. value = +value
  6802. offset = offset | 0
  6803. if (!noAssert) {
  6804. var limit = Math.pow(2, 8 * byteLength - 1)
  6805. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6806. }
  6807. var i = 0
  6808. var mul = 1
  6809. var sub = 0
  6810. this[offset] = value & 0xFF
  6811. while (++i < byteLength && (mul *= 0x100)) {
  6812. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6813. sub = 1
  6814. }
  6815. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6816. }
  6817. return offset + byteLength
  6818. }
  6819. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6820. value = +value
  6821. offset = offset | 0
  6822. if (!noAssert) {
  6823. var limit = Math.pow(2, 8 * byteLength - 1)
  6824. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6825. }
  6826. var i = byteLength - 1
  6827. var mul = 1
  6828. var sub = 0
  6829. this[offset + i] = value & 0xFF
  6830. while (--i >= 0 && (mul *= 0x100)) {
  6831. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6832. sub = 1
  6833. }
  6834. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6835. }
  6836. return offset + byteLength
  6837. }
  6838. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6839. value = +value
  6840. offset = offset | 0
  6841. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6842. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6843. if (value < 0) value = 0xff + value + 1
  6844. this[offset] = (value & 0xff)
  6845. return offset + 1
  6846. }
  6847. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6848. value = +value
  6849. offset = offset | 0
  6850. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6851. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6852. this[offset] = (value & 0xff)
  6853. this[offset + 1] = (value >>> 8)
  6854. } else {
  6855. objectWriteUInt16(this, value, offset, true)
  6856. }
  6857. return offset + 2
  6858. }
  6859. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6860. value = +value
  6861. offset = offset | 0
  6862. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6863. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6864. this[offset] = (value >>> 8)
  6865. this[offset + 1] = (value & 0xff)
  6866. } else {
  6867. objectWriteUInt16(this, value, offset, false)
  6868. }
  6869. return offset + 2
  6870. }
  6871. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6872. value = +value
  6873. offset = offset | 0
  6874. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6875. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6876. this[offset] = (value & 0xff)
  6877. this[offset + 1] = (value >>> 8)
  6878. this[offset + 2] = (value >>> 16)
  6879. this[offset + 3] = (value >>> 24)
  6880. } else {
  6881. objectWriteUInt32(this, value, offset, true)
  6882. }
  6883. return offset + 4
  6884. }
  6885. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6886. value = +value
  6887. offset = offset | 0
  6888. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6889. if (value < 0) value = 0xffffffff + value + 1
  6890. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6891. this[offset] = (value >>> 24)
  6892. this[offset + 1] = (value >>> 16)
  6893. this[offset + 2] = (value >>> 8)
  6894. this[offset + 3] = (value & 0xff)
  6895. } else {
  6896. objectWriteUInt32(this, value, offset, false)
  6897. }
  6898. return offset + 4
  6899. }
  6900. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6901. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6902. if (offset < 0) throw new RangeError('Index out of range')
  6903. }
  6904. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6905. if (!noAssert) {
  6906. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6907. }
  6908. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6909. return offset + 4
  6910. }
  6911. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6912. return writeFloat(this, value, offset, true, noAssert)
  6913. }
  6914. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6915. return writeFloat(this, value, offset, false, noAssert)
  6916. }
  6917. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6918. if (!noAssert) {
  6919. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  6920. }
  6921. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  6922. return offset + 8
  6923. }
  6924. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  6925. return writeDouble(this, value, offset, true, noAssert)
  6926. }
  6927. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  6928. return writeDouble(this, value, offset, false, noAssert)
  6929. }
  6930. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  6931. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  6932. if (!start) start = 0
  6933. if (!end && end !== 0) end = this.length
  6934. if (targetStart >= target.length) targetStart = target.length
  6935. if (!targetStart) targetStart = 0
  6936. if (end > 0 && end < start) end = start
  6937. // Copy 0 bytes; we're done
  6938. if (end === start) return 0
  6939. if (target.length === 0 || this.length === 0) return 0
  6940. // Fatal error conditions
  6941. if (targetStart < 0) {
  6942. throw new RangeError('targetStart out of bounds')
  6943. }
  6944. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  6945. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  6946. // Are we oob?
  6947. if (end > this.length) end = this.length
  6948. if (target.length - targetStart < end - start) {
  6949. end = target.length - targetStart + start
  6950. }
  6951. var len = end - start
  6952. var i
  6953. if (this === target && start < targetStart && targetStart < end) {
  6954. // descending copy from end
  6955. for (i = len - 1; i >= 0; --i) {
  6956. target[i + targetStart] = this[i + start]
  6957. }
  6958. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  6959. // ascending copy from start
  6960. for (i = 0; i < len; ++i) {
  6961. target[i + targetStart] = this[i + start]
  6962. }
  6963. } else {
  6964. Uint8Array.prototype.set.call(
  6965. target,
  6966. this.subarray(start, start + len),
  6967. targetStart
  6968. )
  6969. }
  6970. return len
  6971. }
  6972. // Usage:
  6973. // buffer.fill(number[, offset[, end]])
  6974. // buffer.fill(buffer[, offset[, end]])
  6975. // buffer.fill(string[, offset[, end]][, encoding])
  6976. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  6977. // Handle string cases:
  6978. if (typeof val === 'string') {
  6979. if (typeof start === 'string') {
  6980. encoding = start
  6981. start = 0
  6982. end = this.length
  6983. } else if (typeof end === 'string') {
  6984. encoding = end
  6985. end = this.length
  6986. }
  6987. if (val.length === 1) {
  6988. var code = val.charCodeAt(0)
  6989. if (code < 256) {
  6990. val = code
  6991. }
  6992. }
  6993. if (encoding !== undefined && typeof encoding !== 'string') {
  6994. throw new TypeError('encoding must be a string')
  6995. }
  6996. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  6997. throw new TypeError('Unknown encoding: ' + encoding)
  6998. }
  6999. } else if (typeof val === 'number') {
  7000. val = val & 255
  7001. }
  7002. // Invalid ranges are not set to a default, so can range check early.
  7003. if (start < 0 || this.length < start || this.length < end) {
  7004. throw new RangeError('Out of range index')
  7005. }
  7006. if (end <= start) {
  7007. return this
  7008. }
  7009. start = start >>> 0
  7010. end = end === undefined ? this.length : end >>> 0
  7011. if (!val) val = 0
  7012. var i
  7013. if (typeof val === 'number') {
  7014. for (i = start; i < end; ++i) {
  7015. this[i] = val
  7016. }
  7017. } else {
  7018. var bytes = Buffer.isBuffer(val)
  7019. ? val
  7020. : utf8ToBytes(new Buffer(val, encoding).toString())
  7021. var len = bytes.length
  7022. for (i = 0; i < end - start; ++i) {
  7023. this[i + start] = bytes[i % len]
  7024. }
  7025. }
  7026. return this
  7027. }
  7028. // HELPER FUNCTIONS
  7029. // ================
  7030. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7031. function base64clean (str) {
  7032. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7033. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7034. // Node converts strings with length < 2 to ''
  7035. if (str.length < 2) return ''
  7036. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7037. while (str.length % 4 !== 0) {
  7038. str = str + '='
  7039. }
  7040. return str
  7041. }
  7042. function stringtrim (str) {
  7043. if (str.trim) return str.trim()
  7044. return str.replace(/^\s+|\s+$/g, '')
  7045. }
  7046. function toHex (n) {
  7047. if (n < 16) return '0' + n.toString(16)
  7048. return n.toString(16)
  7049. }
  7050. function utf8ToBytes (string, units) {
  7051. units = units || Infinity
  7052. var codePoint
  7053. var length = string.length
  7054. var leadSurrogate = null
  7055. var bytes = []
  7056. for (var i = 0; i < length; ++i) {
  7057. codePoint = string.charCodeAt(i)
  7058. // is surrogate component
  7059. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7060. // last char was a lead
  7061. if (!leadSurrogate) {
  7062. // no lead yet
  7063. if (codePoint > 0xDBFF) {
  7064. // unexpected trail
  7065. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7066. continue
  7067. } else if (i + 1 === length) {
  7068. // unpaired lead
  7069. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7070. continue
  7071. }
  7072. // valid lead
  7073. leadSurrogate = codePoint
  7074. continue
  7075. }
  7076. // 2 leads in a row
  7077. if (codePoint < 0xDC00) {
  7078. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7079. leadSurrogate = codePoint
  7080. continue
  7081. }
  7082. // valid surrogate pair
  7083. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7084. } else if (leadSurrogate) {
  7085. // valid bmp char, but last char was a lead
  7086. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7087. }
  7088. leadSurrogate = null
  7089. // encode utf8
  7090. if (codePoint < 0x80) {
  7091. if ((units -= 1) < 0) break
  7092. bytes.push(codePoint)
  7093. } else if (codePoint < 0x800) {
  7094. if ((units -= 2) < 0) break
  7095. bytes.push(
  7096. codePoint >> 0x6 | 0xC0,
  7097. codePoint & 0x3F | 0x80
  7098. )
  7099. } else if (codePoint < 0x10000) {
  7100. if ((units -= 3) < 0) break
  7101. bytes.push(
  7102. codePoint >> 0xC | 0xE0,
  7103. codePoint >> 0x6 & 0x3F | 0x80,
  7104. codePoint & 0x3F | 0x80
  7105. )
  7106. } else if (codePoint < 0x110000) {
  7107. if ((units -= 4) < 0) break
  7108. bytes.push(
  7109. codePoint >> 0x12 | 0xF0,
  7110. codePoint >> 0xC & 0x3F | 0x80,
  7111. codePoint >> 0x6 & 0x3F | 0x80,
  7112. codePoint & 0x3F | 0x80
  7113. )
  7114. } else {
  7115. throw new Error('Invalid code point')
  7116. }
  7117. }
  7118. return bytes
  7119. }
  7120. function asciiToBytes (str) {
  7121. var byteArray = []
  7122. for (var i = 0; i < str.length; ++i) {
  7123. // Node's code seems to be doing this and not & 0x7F..
  7124. byteArray.push(str.charCodeAt(i) & 0xFF)
  7125. }
  7126. return byteArray
  7127. }
  7128. function utf16leToBytes (str, units) {
  7129. var c, hi, lo
  7130. var byteArray = []
  7131. for (var i = 0; i < str.length; ++i) {
  7132. if ((units -= 2) < 0) break
  7133. c = str.charCodeAt(i)
  7134. hi = c >> 8
  7135. lo = c % 256
  7136. byteArray.push(lo)
  7137. byteArray.push(hi)
  7138. }
  7139. return byteArray
  7140. }
  7141. function base64ToBytes (str) {
  7142. return base64.toByteArray(base64clean(str))
  7143. }
  7144. function blitBuffer (src, dst, offset, length) {
  7145. for (var i = 0; i < length; ++i) {
  7146. if ((i + offset >= dst.length) || (i >= src.length)) break
  7147. dst[i + offset] = src[i]
  7148. }
  7149. return i
  7150. }
  7151. function isnan (val) {
  7152. return val !== val // eslint-disable-line no-self-compare
  7153. }
  7154. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7155. /***/ }),
  7156. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7157. /*!**************************************************!*\
  7158. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7159. \**************************************************/
  7160. /*! no static exports found */
  7161. /***/ (function(module, exports, __webpack_require__) {
  7162. /*!
  7163. * clipboard.js v2.0.4
  7164. * https://zenorocha.github.io/clipboard.js
  7165. *
  7166. * Licensed MIT © Zeno Rocha
  7167. */
  7168. (function webpackUniversalModuleDefinition(root, factory) {
  7169. if(true)
  7170. module.exports = factory();
  7171. else {}
  7172. })(this, function() {
  7173. return /******/ (function(modules) { // webpackBootstrap
  7174. /******/ // The module cache
  7175. /******/ var installedModules = {};
  7176. /******/
  7177. /******/ // The require function
  7178. /******/ function __webpack_require__(moduleId) {
  7179. /******/
  7180. /******/ // Check if module is in cache
  7181. /******/ if(installedModules[moduleId]) {
  7182. /******/ return installedModules[moduleId].exports;
  7183. /******/ }
  7184. /******/ // Create a new module (and put it into the cache)
  7185. /******/ var module = installedModules[moduleId] = {
  7186. /******/ i: moduleId,
  7187. /******/ l: false,
  7188. /******/ exports: {}
  7189. /******/ };
  7190. /******/
  7191. /******/ // Execute the module function
  7192. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7193. /******/
  7194. /******/ // Flag the module as loaded
  7195. /******/ module.l = true;
  7196. /******/
  7197. /******/ // Return the exports of the module
  7198. /******/ return module.exports;
  7199. /******/ }
  7200. /******/
  7201. /******/
  7202. /******/ // expose the modules object (__webpack_modules__)
  7203. /******/ __webpack_require__.m = modules;
  7204. /******/
  7205. /******/ // expose the module cache
  7206. /******/ __webpack_require__.c = installedModules;
  7207. /******/
  7208. /******/ // define getter function for harmony exports
  7209. /******/ __webpack_require__.d = function(exports, name, getter) {
  7210. /******/ if(!__webpack_require__.o(exports, name)) {
  7211. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7212. /******/ }
  7213. /******/ };
  7214. /******/
  7215. /******/ // define __esModule on exports
  7216. /******/ __webpack_require__.r = function(exports) {
  7217. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7218. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7219. /******/ }
  7220. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7221. /******/ };
  7222. /******/
  7223. /******/ // create a fake namespace object
  7224. /******/ // mode & 1: value is a module id, require it
  7225. /******/ // mode & 2: merge all properties of value into the ns
  7226. /******/ // mode & 4: return value when already ns object
  7227. /******/ // mode & 8|1: behave like require
  7228. /******/ __webpack_require__.t = function(value, mode) {
  7229. /******/ if(mode & 1) value = __webpack_require__(value);
  7230. /******/ if(mode & 8) return value;
  7231. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7232. /******/ var ns = Object.create(null);
  7233. /******/ __webpack_require__.r(ns);
  7234. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7235. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7236. /******/ return ns;
  7237. /******/ };
  7238. /******/
  7239. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7240. /******/ __webpack_require__.n = function(module) {
  7241. /******/ var getter = module && module.__esModule ?
  7242. /******/ function getDefault() { return module['default']; } :
  7243. /******/ function getModuleExports() { return module; };
  7244. /******/ __webpack_require__.d(getter, 'a', getter);
  7245. /******/ return getter;
  7246. /******/ };
  7247. /******/
  7248. /******/ // Object.prototype.hasOwnProperty.call
  7249. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7250. /******/
  7251. /******/ // __webpack_public_path__
  7252. /******/ __webpack_require__.p = "";
  7253. /******/
  7254. /******/
  7255. /******/ // Load entry module and return exports
  7256. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7257. /******/ })
  7258. /************************************************************************/
  7259. /******/ ([
  7260. /* 0 */
  7261. /***/ (function(module, exports, __webpack_require__) {
  7262. "use strict";
  7263. 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; };
  7264. 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; }; }();
  7265. var _clipboardAction = __webpack_require__(1);
  7266. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7267. var _tinyEmitter = __webpack_require__(3);
  7268. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7269. var _goodListener = __webpack_require__(4);
  7270. var _goodListener2 = _interopRequireDefault(_goodListener);
  7271. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7272. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7273. 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; }
  7274. 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; }
  7275. /**
  7276. * Base class which takes one or more elements, adds event listeners to them,
  7277. * and instantiates a new `ClipboardAction` on each click.
  7278. */
  7279. var Clipboard = function (_Emitter) {
  7280. _inherits(Clipboard, _Emitter);
  7281. /**
  7282. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7283. * @param {Object} options
  7284. */
  7285. function Clipboard(trigger, options) {
  7286. _classCallCheck(this, Clipboard);
  7287. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7288. _this.resolveOptions(options);
  7289. _this.listenClick(trigger);
  7290. return _this;
  7291. }
  7292. /**
  7293. * Defines if attributes would be resolved using internal setter functions
  7294. * or custom functions that were passed in the constructor.
  7295. * @param {Object} options
  7296. */
  7297. _createClass(Clipboard, [{
  7298. key: 'resolveOptions',
  7299. value: function resolveOptions() {
  7300. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7301. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7302. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7303. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7304. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7305. }
  7306. /**
  7307. * Adds a click event listener to the passed trigger.
  7308. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7309. */
  7310. }, {
  7311. key: 'listenClick',
  7312. value: function listenClick(trigger) {
  7313. var _this2 = this;
  7314. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7315. return _this2.onClick(e);
  7316. });
  7317. }
  7318. /**
  7319. * Defines a new `ClipboardAction` on each click event.
  7320. * @param {Event} e
  7321. */
  7322. }, {
  7323. key: 'onClick',
  7324. value: function onClick(e) {
  7325. var trigger = e.delegateTarget || e.currentTarget;
  7326. if (this.clipboardAction) {
  7327. this.clipboardAction = null;
  7328. }
  7329. this.clipboardAction = new _clipboardAction2.default({
  7330. action: this.action(trigger),
  7331. target: this.target(trigger),
  7332. text: this.text(trigger),
  7333. container: this.container,
  7334. trigger: trigger,
  7335. emitter: this
  7336. });
  7337. }
  7338. /**
  7339. * Default `action` lookup function.
  7340. * @param {Element} trigger
  7341. */
  7342. }, {
  7343. key: 'defaultAction',
  7344. value: function defaultAction(trigger) {
  7345. return getAttributeValue('action', trigger);
  7346. }
  7347. /**
  7348. * Default `target` lookup function.
  7349. * @param {Element} trigger
  7350. */
  7351. }, {
  7352. key: 'defaultTarget',
  7353. value: function defaultTarget(trigger) {
  7354. var selector = getAttributeValue('target', trigger);
  7355. if (selector) {
  7356. return document.querySelector(selector);
  7357. }
  7358. }
  7359. /**
  7360. * Returns the support of the given action, or all actions if no action is
  7361. * given.
  7362. * @param {String} [action]
  7363. */
  7364. }, {
  7365. key: 'defaultText',
  7366. /**
  7367. * Default `text` lookup function.
  7368. * @param {Element} trigger
  7369. */
  7370. value: function defaultText(trigger) {
  7371. return getAttributeValue('text', trigger);
  7372. }
  7373. /**
  7374. * Destroy lifecycle.
  7375. */
  7376. }, {
  7377. key: 'destroy',
  7378. value: function destroy() {
  7379. this.listener.destroy();
  7380. if (this.clipboardAction) {
  7381. this.clipboardAction.destroy();
  7382. this.clipboardAction = null;
  7383. }
  7384. }
  7385. }], [{
  7386. key: 'isSupported',
  7387. value: function isSupported() {
  7388. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7389. var actions = typeof action === 'string' ? [action] : action;
  7390. var support = !!document.queryCommandSupported;
  7391. actions.forEach(function (action) {
  7392. support = support && !!document.queryCommandSupported(action);
  7393. });
  7394. return support;
  7395. }
  7396. }]);
  7397. return Clipboard;
  7398. }(_tinyEmitter2.default);
  7399. /**
  7400. * Helper function to retrieve attribute value.
  7401. * @param {String} suffix
  7402. * @param {Element} element
  7403. */
  7404. function getAttributeValue(suffix, element) {
  7405. var attribute = 'data-clipboard-' + suffix;
  7406. if (!element.hasAttribute(attribute)) {
  7407. return;
  7408. }
  7409. return element.getAttribute(attribute);
  7410. }
  7411. module.exports = Clipboard;
  7412. /***/ }),
  7413. /* 1 */
  7414. /***/ (function(module, exports, __webpack_require__) {
  7415. "use strict";
  7416. 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; };
  7417. 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; }; }();
  7418. var _select = __webpack_require__(2);
  7419. var _select2 = _interopRequireDefault(_select);
  7420. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7422. /**
  7423. * Inner class which performs selection from either `text` or `target`
  7424. * properties and then executes copy or cut operations.
  7425. */
  7426. var ClipboardAction = function () {
  7427. /**
  7428. * @param {Object} options
  7429. */
  7430. function ClipboardAction(options) {
  7431. _classCallCheck(this, ClipboardAction);
  7432. this.resolveOptions(options);
  7433. this.initSelection();
  7434. }
  7435. /**
  7436. * Defines base properties passed from constructor.
  7437. * @param {Object} options
  7438. */
  7439. _createClass(ClipboardAction, [{
  7440. key: 'resolveOptions',
  7441. value: function resolveOptions() {
  7442. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7443. this.action = options.action;
  7444. this.container = options.container;
  7445. this.emitter = options.emitter;
  7446. this.target = options.target;
  7447. this.text = options.text;
  7448. this.trigger = options.trigger;
  7449. this.selectedText = '';
  7450. }
  7451. /**
  7452. * Decides which selection strategy is going to be applied based
  7453. * on the existence of `text` and `target` properties.
  7454. */
  7455. }, {
  7456. key: 'initSelection',
  7457. value: function initSelection() {
  7458. if (this.text) {
  7459. this.selectFake();
  7460. } else if (this.target) {
  7461. this.selectTarget();
  7462. }
  7463. }
  7464. /**
  7465. * Creates a fake textarea element, sets its value from `text` property,
  7466. * and makes a selection on it.
  7467. */
  7468. }, {
  7469. key: 'selectFake',
  7470. value: function selectFake() {
  7471. var _this = this;
  7472. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7473. this.removeFake();
  7474. this.fakeHandlerCallback = function () {
  7475. return _this.removeFake();
  7476. };
  7477. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7478. this.fakeElem = document.createElement('textarea');
  7479. // Prevent zooming on iOS
  7480. this.fakeElem.style.fontSize = '12pt';
  7481. // Reset box model
  7482. this.fakeElem.style.border = '0';
  7483. this.fakeElem.style.padding = '0';
  7484. this.fakeElem.style.margin = '0';
  7485. // Move element out of screen horizontally
  7486. this.fakeElem.style.position = 'absolute';
  7487. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7488. // Move element to the same position vertically
  7489. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7490. this.fakeElem.style.top = yPosition + 'px';
  7491. this.fakeElem.setAttribute('readonly', '');
  7492. this.fakeElem.value = this.text;
  7493. this.container.appendChild(this.fakeElem);
  7494. this.selectedText = (0, _select2.default)(this.fakeElem);
  7495. this.copyText();
  7496. }
  7497. /**
  7498. * Only removes the fake element after another click event, that way
  7499. * a user can hit `Ctrl+C` to copy because selection still exists.
  7500. */
  7501. }, {
  7502. key: 'removeFake',
  7503. value: function removeFake() {
  7504. if (this.fakeHandler) {
  7505. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7506. this.fakeHandler = null;
  7507. this.fakeHandlerCallback = null;
  7508. }
  7509. if (this.fakeElem) {
  7510. this.container.removeChild(this.fakeElem);
  7511. this.fakeElem = null;
  7512. }
  7513. }
  7514. /**
  7515. * Selects the content from element passed on `target` property.
  7516. */
  7517. }, {
  7518. key: 'selectTarget',
  7519. value: function selectTarget() {
  7520. this.selectedText = (0, _select2.default)(this.target);
  7521. this.copyText();
  7522. }
  7523. /**
  7524. * Executes the copy operation based on the current selection.
  7525. */
  7526. }, {
  7527. key: 'copyText',
  7528. value: function copyText() {
  7529. var succeeded = void 0;
  7530. try {
  7531. succeeded = document.execCommand(this.action);
  7532. } catch (err) {
  7533. succeeded = false;
  7534. }
  7535. this.handleResult(succeeded);
  7536. }
  7537. /**
  7538. * Fires an event based on the copy operation result.
  7539. * @param {Boolean} succeeded
  7540. */
  7541. }, {
  7542. key: 'handleResult',
  7543. value: function handleResult(succeeded) {
  7544. this.emitter.emit(succeeded ? 'success' : 'error', {
  7545. action: this.action,
  7546. text: this.selectedText,
  7547. trigger: this.trigger,
  7548. clearSelection: this.clearSelection.bind(this)
  7549. });
  7550. }
  7551. /**
  7552. * Moves focus away from `target` and back to the trigger, removes current selection.
  7553. */
  7554. }, {
  7555. key: 'clearSelection',
  7556. value: function clearSelection() {
  7557. if (this.trigger) {
  7558. this.trigger.focus();
  7559. }
  7560. window.getSelection().removeAllRanges();
  7561. }
  7562. /**
  7563. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7564. * @param {String} action
  7565. */
  7566. }, {
  7567. key: 'destroy',
  7568. /**
  7569. * Destroy lifecycle.
  7570. */
  7571. value: function destroy() {
  7572. this.removeFake();
  7573. }
  7574. }, {
  7575. key: 'action',
  7576. set: function set() {
  7577. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7578. this._action = action;
  7579. if (this._action !== 'copy' && this._action !== 'cut') {
  7580. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7581. }
  7582. }
  7583. /**
  7584. * Gets the `action` property.
  7585. * @return {String}
  7586. */
  7587. ,
  7588. get: function get() {
  7589. return this._action;
  7590. }
  7591. /**
  7592. * Sets the `target` property using an element
  7593. * that will be have its content copied.
  7594. * @param {Element} target
  7595. */
  7596. }, {
  7597. key: 'target',
  7598. set: function set(target) {
  7599. if (target !== undefined) {
  7600. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7601. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7602. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7603. }
  7604. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7605. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7606. }
  7607. this._target = target;
  7608. } else {
  7609. throw new Error('Invalid "target" value, use a valid Element');
  7610. }
  7611. }
  7612. }
  7613. /**
  7614. * Gets the `target` property.
  7615. * @return {String|HTMLElement}
  7616. */
  7617. ,
  7618. get: function get() {
  7619. return this._target;
  7620. }
  7621. }]);
  7622. return ClipboardAction;
  7623. }();
  7624. module.exports = ClipboardAction;
  7625. /***/ }),
  7626. /* 2 */
  7627. /***/ (function(module, exports) {
  7628. function select(element) {
  7629. var selectedText;
  7630. if (element.nodeName === 'SELECT') {
  7631. element.focus();
  7632. selectedText = element.value;
  7633. }
  7634. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7635. var isReadOnly = element.hasAttribute('readonly');
  7636. if (!isReadOnly) {
  7637. element.setAttribute('readonly', '');
  7638. }
  7639. element.select();
  7640. element.setSelectionRange(0, element.value.length);
  7641. if (!isReadOnly) {
  7642. element.removeAttribute('readonly');
  7643. }
  7644. selectedText = element.value;
  7645. }
  7646. else {
  7647. if (element.hasAttribute('contenteditable')) {
  7648. element.focus();
  7649. }
  7650. var selection = window.getSelection();
  7651. var range = document.createRange();
  7652. range.selectNodeContents(element);
  7653. selection.removeAllRanges();
  7654. selection.addRange(range);
  7655. selectedText = selection.toString();
  7656. }
  7657. return selectedText;
  7658. }
  7659. module.exports = select;
  7660. /***/ }),
  7661. /* 3 */
  7662. /***/ (function(module, exports) {
  7663. function E () {
  7664. // Keep this empty so it's easier to inherit from
  7665. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7666. }
  7667. E.prototype = {
  7668. on: function (name, callback, ctx) {
  7669. var e = this.e || (this.e = {});
  7670. (e[name] || (e[name] = [])).push({
  7671. fn: callback,
  7672. ctx: ctx
  7673. });
  7674. return this;
  7675. },
  7676. once: function (name, callback, ctx) {
  7677. var self = this;
  7678. function listener () {
  7679. self.off(name, listener);
  7680. callback.apply(ctx, arguments);
  7681. };
  7682. listener._ = callback
  7683. return this.on(name, listener, ctx);
  7684. },
  7685. emit: function (name) {
  7686. var data = [].slice.call(arguments, 1);
  7687. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7688. var i = 0;
  7689. var len = evtArr.length;
  7690. for (i; i < len; i++) {
  7691. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7692. }
  7693. return this;
  7694. },
  7695. off: function (name, callback) {
  7696. var e = this.e || (this.e = {});
  7697. var evts = e[name];
  7698. var liveEvents = [];
  7699. if (evts && callback) {
  7700. for (var i = 0, len = evts.length; i < len; i++) {
  7701. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7702. liveEvents.push(evts[i]);
  7703. }
  7704. }
  7705. // Remove event from queue to prevent memory leak
  7706. // Suggested by https://github.com/lazd
  7707. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7708. (liveEvents.length)
  7709. ? e[name] = liveEvents
  7710. : delete e[name];
  7711. return this;
  7712. }
  7713. };
  7714. module.exports = E;
  7715. /***/ }),
  7716. /* 4 */
  7717. /***/ (function(module, exports, __webpack_require__) {
  7718. var is = __webpack_require__(5);
  7719. var delegate = __webpack_require__(6);
  7720. /**
  7721. * Validates all params and calls the right
  7722. * listener function based on its target type.
  7723. *
  7724. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7725. * @param {String} type
  7726. * @param {Function} callback
  7727. * @return {Object}
  7728. */
  7729. function listen(target, type, callback) {
  7730. if (!target && !type && !callback) {
  7731. throw new Error('Missing required arguments');
  7732. }
  7733. if (!is.string(type)) {
  7734. throw new TypeError('Second argument must be a String');
  7735. }
  7736. if (!is.fn(callback)) {
  7737. throw new TypeError('Third argument must be a Function');
  7738. }
  7739. if (is.node(target)) {
  7740. return listenNode(target, type, callback);
  7741. }
  7742. else if (is.nodeList(target)) {
  7743. return listenNodeList(target, type, callback);
  7744. }
  7745. else if (is.string(target)) {
  7746. return listenSelector(target, type, callback);
  7747. }
  7748. else {
  7749. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7750. }
  7751. }
  7752. /**
  7753. * Adds an event listener to a HTML element
  7754. * and returns a remove listener function.
  7755. *
  7756. * @param {HTMLElement} node
  7757. * @param {String} type
  7758. * @param {Function} callback
  7759. * @return {Object}
  7760. */
  7761. function listenNode(node, type, callback) {
  7762. node.addEventListener(type, callback);
  7763. return {
  7764. destroy: function() {
  7765. node.removeEventListener(type, callback);
  7766. }
  7767. }
  7768. }
  7769. /**
  7770. * Add an event listener to a list of HTML elements
  7771. * and returns a remove listener function.
  7772. *
  7773. * @param {NodeList|HTMLCollection} nodeList
  7774. * @param {String} type
  7775. * @param {Function} callback
  7776. * @return {Object}
  7777. */
  7778. function listenNodeList(nodeList, type, callback) {
  7779. Array.prototype.forEach.call(nodeList, function(node) {
  7780. node.addEventListener(type, callback);
  7781. });
  7782. return {
  7783. destroy: function() {
  7784. Array.prototype.forEach.call(nodeList, function(node) {
  7785. node.removeEventListener(type, callback);
  7786. });
  7787. }
  7788. }
  7789. }
  7790. /**
  7791. * Add an event listener to a selector
  7792. * and returns a remove listener function.
  7793. *
  7794. * @param {String} selector
  7795. * @param {String} type
  7796. * @param {Function} callback
  7797. * @return {Object}
  7798. */
  7799. function listenSelector(selector, type, callback) {
  7800. return delegate(document.body, selector, type, callback);
  7801. }
  7802. module.exports = listen;
  7803. /***/ }),
  7804. /* 5 */
  7805. /***/ (function(module, exports) {
  7806. /**
  7807. * Check if argument is a HTML element.
  7808. *
  7809. * @param {Object} value
  7810. * @return {Boolean}
  7811. */
  7812. exports.node = function(value) {
  7813. return value !== undefined
  7814. && value instanceof HTMLElement
  7815. && value.nodeType === 1;
  7816. };
  7817. /**
  7818. * Check if argument is a list of HTML elements.
  7819. *
  7820. * @param {Object} value
  7821. * @return {Boolean}
  7822. */
  7823. exports.nodeList = function(value) {
  7824. var type = Object.prototype.toString.call(value);
  7825. return value !== undefined
  7826. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7827. && ('length' in value)
  7828. && (value.length === 0 || exports.node(value[0]));
  7829. };
  7830. /**
  7831. * Check if argument is a string.
  7832. *
  7833. * @param {Object} value
  7834. * @return {Boolean}
  7835. */
  7836. exports.string = function(value) {
  7837. return typeof value === 'string'
  7838. || value instanceof String;
  7839. };
  7840. /**
  7841. * Check if argument is a function.
  7842. *
  7843. * @param {Object} value
  7844. * @return {Boolean}
  7845. */
  7846. exports.fn = function(value) {
  7847. var type = Object.prototype.toString.call(value);
  7848. return type === '[object Function]';
  7849. };
  7850. /***/ }),
  7851. /* 6 */
  7852. /***/ (function(module, exports, __webpack_require__) {
  7853. var closest = __webpack_require__(7);
  7854. /**
  7855. * Delegates event to a selector.
  7856. *
  7857. * @param {Element} element
  7858. * @param {String} selector
  7859. * @param {String} type
  7860. * @param {Function} callback
  7861. * @param {Boolean} useCapture
  7862. * @return {Object}
  7863. */
  7864. function _delegate(element, selector, type, callback, useCapture) {
  7865. var listenerFn = listener.apply(this, arguments);
  7866. element.addEventListener(type, listenerFn, useCapture);
  7867. return {
  7868. destroy: function() {
  7869. element.removeEventListener(type, listenerFn, useCapture);
  7870. }
  7871. }
  7872. }
  7873. /**
  7874. * Delegates event to a selector.
  7875. *
  7876. * @param {Element|String|Array} [elements]
  7877. * @param {String} selector
  7878. * @param {String} type
  7879. * @param {Function} callback
  7880. * @param {Boolean} useCapture
  7881. * @return {Object}
  7882. */
  7883. function delegate(elements, selector, type, callback, useCapture) {
  7884. // Handle the regular Element usage
  7885. if (typeof elements.addEventListener === 'function') {
  7886. return _delegate.apply(null, arguments);
  7887. }
  7888. // Handle Element-less usage, it defaults to global delegation
  7889. if (typeof type === 'function') {
  7890. // Use `document` as the first parameter, then apply arguments
  7891. // This is a short way to .unshift `arguments` without running into deoptimizations
  7892. return _delegate.bind(null, document).apply(null, arguments);
  7893. }
  7894. // Handle Selector-based usage
  7895. if (typeof elements === 'string') {
  7896. elements = document.querySelectorAll(elements);
  7897. }
  7898. // Handle Array-like based usage
  7899. return Array.prototype.map.call(elements, function (element) {
  7900. return _delegate(element, selector, type, callback, useCapture);
  7901. });
  7902. }
  7903. /**
  7904. * Finds closest match and invokes callback.
  7905. *
  7906. * @param {Element} element
  7907. * @param {String} selector
  7908. * @param {String} type
  7909. * @param {Function} callback
  7910. * @return {Function}
  7911. */
  7912. function listener(element, selector, type, callback) {
  7913. return function(e) {
  7914. e.delegateTarget = closest(e.target, selector);
  7915. if (e.delegateTarget) {
  7916. callback.call(element, e);
  7917. }
  7918. }
  7919. }
  7920. module.exports = delegate;
  7921. /***/ }),
  7922. /* 7 */
  7923. /***/ (function(module, exports) {
  7924. var DOCUMENT_NODE_TYPE = 9;
  7925. /**
  7926. * A polyfill for Element.matches()
  7927. */
  7928. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  7929. var proto = Element.prototype;
  7930. proto.matches = proto.matchesSelector ||
  7931. proto.mozMatchesSelector ||
  7932. proto.msMatchesSelector ||
  7933. proto.oMatchesSelector ||
  7934. proto.webkitMatchesSelector;
  7935. }
  7936. /**
  7937. * Finds the closest parent that matches a selector.
  7938. *
  7939. * @param {Element} element
  7940. * @param {String} selector
  7941. * @return {Function}
  7942. */
  7943. function closest (element, selector) {
  7944. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  7945. if (typeof element.matches === 'function' &&
  7946. element.matches(selector)) {
  7947. return element;
  7948. }
  7949. element = element.parentNode;
  7950. }
  7951. }
  7952. module.exports = closest;
  7953. /***/ })
  7954. /******/ ]);
  7955. });
  7956. /***/ }),
  7957. /***/ "./node_modules/ieee754/index.js":
  7958. /*!***************************************!*\
  7959. !*** ./node_modules/ieee754/index.js ***!
  7960. \***************************************/
  7961. /*! no static exports found */
  7962. /***/ (function(module, exports) {
  7963. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  7964. var e, m
  7965. var eLen = (nBytes * 8) - mLen - 1
  7966. var eMax = (1 << eLen) - 1
  7967. var eBias = eMax >> 1
  7968. var nBits = -7
  7969. var i = isLE ? (nBytes - 1) : 0
  7970. var d = isLE ? -1 : 1
  7971. var s = buffer[offset + i]
  7972. i += d
  7973. e = s & ((1 << (-nBits)) - 1)
  7974. s >>= (-nBits)
  7975. nBits += eLen
  7976. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7977. m = e & ((1 << (-nBits)) - 1)
  7978. e >>= (-nBits)
  7979. nBits += mLen
  7980. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7981. if (e === 0) {
  7982. e = 1 - eBias
  7983. } else if (e === eMax) {
  7984. return m ? NaN : ((s ? -1 : 1) * Infinity)
  7985. } else {
  7986. m = m + Math.pow(2, mLen)
  7987. e = e - eBias
  7988. }
  7989. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  7990. }
  7991. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  7992. var e, m, c
  7993. var eLen = (nBytes * 8) - mLen - 1
  7994. var eMax = (1 << eLen) - 1
  7995. var eBias = eMax >> 1
  7996. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  7997. var i = isLE ? 0 : (nBytes - 1)
  7998. var d = isLE ? 1 : -1
  7999. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8000. value = Math.abs(value)
  8001. if (isNaN(value) || value === Infinity) {
  8002. m = isNaN(value) ? 1 : 0
  8003. e = eMax
  8004. } else {
  8005. e = Math.floor(Math.log(value) / Math.LN2)
  8006. if (value * (c = Math.pow(2, -e)) < 1) {
  8007. e--
  8008. c *= 2
  8009. }
  8010. if (e + eBias >= 1) {
  8011. value += rt / c
  8012. } else {
  8013. value += rt * Math.pow(2, 1 - eBias)
  8014. }
  8015. if (value * c >= 2) {
  8016. e++
  8017. c /= 2
  8018. }
  8019. if (e + eBias >= eMax) {
  8020. m = 0
  8021. e = eMax
  8022. } else if (e + eBias >= 1) {
  8023. m = ((value * c) - 1) * Math.pow(2, mLen)
  8024. e = e + eBias
  8025. } else {
  8026. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8027. e = 0
  8028. }
  8029. }
  8030. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8031. e = (e << mLen) | m
  8032. eLen += mLen
  8033. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8034. buffer[offset + i - d] |= s * 128
  8035. }
  8036. /***/ }),
  8037. /***/ "./node_modules/isarray/index.js":
  8038. /*!***************************************!*\
  8039. !*** ./node_modules/isarray/index.js ***!
  8040. \***************************************/
  8041. /*! no static exports found */
  8042. /***/ (function(module, exports) {
  8043. var toString = {}.toString;
  8044. module.exports = Array.isArray || function (arr) {
  8045. return toString.call(arr) == '[object Array]';
  8046. };
  8047. /***/ }),
  8048. /***/ "./node_modules/jquery/dist/jquery.js":
  8049. /*!********************************************!*\
  8050. !*** ./node_modules/jquery/dist/jquery.js ***!
  8051. \********************************************/
  8052. /*! no static exports found */
  8053. /***/ (function(module, exports, __webpack_require__) {
  8054. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8055. * jQuery JavaScript Library v3.4.1
  8056. * https://jquery.com/
  8057. *
  8058. * Includes Sizzle.js
  8059. * https://sizzlejs.com/
  8060. *
  8061. * Copyright JS Foundation and other contributors
  8062. * Released under the MIT license
  8063. * https://jquery.org/license
  8064. *
  8065. * Date: 2019-05-01T21:04Z
  8066. */
  8067. ( function( global, factory ) {
  8068. "use strict";
  8069. if ( true && typeof module.exports === "object" ) {
  8070. // For CommonJS and CommonJS-like environments where a proper `window`
  8071. // is present, execute the factory and get jQuery.
  8072. // For environments that do not have a `window` with a `document`
  8073. // (such as Node.js), expose a factory as module.exports.
  8074. // This accentuates the need for the creation of a real `window`.
  8075. // e.g. var jQuery = require("jquery")(window);
  8076. // See ticket #14549 for more info.
  8077. module.exports = global.document ?
  8078. factory( global, true ) :
  8079. function( w ) {
  8080. if ( !w.document ) {
  8081. throw new Error( "jQuery requires a window with a document" );
  8082. }
  8083. return factory( w );
  8084. };
  8085. } else {
  8086. factory( global );
  8087. }
  8088. // Pass this if window is not defined yet
  8089. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8090. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8091. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8092. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8093. // enough that all such attempts are guarded in a try block.
  8094. "use strict";
  8095. var arr = [];
  8096. var document = window.document;
  8097. var getProto = Object.getPrototypeOf;
  8098. var slice = arr.slice;
  8099. var concat = arr.concat;
  8100. var push = arr.push;
  8101. var indexOf = arr.indexOf;
  8102. var class2type = {};
  8103. var toString = class2type.toString;
  8104. var hasOwn = class2type.hasOwnProperty;
  8105. var fnToString = hasOwn.toString;
  8106. var ObjectFunctionString = fnToString.call( Object );
  8107. var support = {};
  8108. var isFunction = function isFunction( obj ) {
  8109. // Support: Chrome <=57, Firefox <=52
  8110. // In some browsers, typeof returns "function" for HTML <object> elements
  8111. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8112. // We don't want to classify *any* DOM node as a function.
  8113. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8114. };
  8115. var isWindow = function isWindow( obj ) {
  8116. return obj != null && obj === obj.window;
  8117. };
  8118. var preservedScriptAttributes = {
  8119. type: true,
  8120. src: true,
  8121. nonce: true,
  8122. noModule: true
  8123. };
  8124. function DOMEval( code, node, doc ) {
  8125. doc = doc || document;
  8126. var i, val,
  8127. script = doc.createElement( "script" );
  8128. script.text = code;
  8129. if ( node ) {
  8130. for ( i in preservedScriptAttributes ) {
  8131. // Support: Firefox 64+, Edge 18+
  8132. // Some browsers don't support the "nonce" property on scripts.
  8133. // On the other hand, just using `getAttribute` is not enough as
  8134. // the `nonce` attribute is reset to an empty string whenever it
  8135. // becomes browsing-context connected.
  8136. // See https://github.com/whatwg/html/issues/2369
  8137. // See https://html.spec.whatwg.org/#nonce-attributes
  8138. // The `node.getAttribute` check was added for the sake of
  8139. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8140. // via an object.
  8141. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8142. if ( val ) {
  8143. script.setAttribute( i, val );
  8144. }
  8145. }
  8146. }
  8147. doc.head.appendChild( script ).parentNode.removeChild( script );
  8148. }
  8149. function toType( obj ) {
  8150. if ( obj == null ) {
  8151. return obj + "";
  8152. }
  8153. // Support: Android <=2.3 only (functionish RegExp)
  8154. return typeof obj === "object" || typeof obj === "function" ?
  8155. class2type[ toString.call( obj ) ] || "object" :
  8156. typeof obj;
  8157. }
  8158. /* global Symbol */
  8159. // Defining this global in .eslintrc.json would create a danger of using the global
  8160. // unguarded in another place, it seems safer to define global only for this module
  8161. var
  8162. version = "3.4.1",
  8163. // Define a local copy of jQuery
  8164. jQuery = function( selector, context ) {
  8165. // The jQuery object is actually just the init constructor 'enhanced'
  8166. // Need init if jQuery is called (just allow error to be thrown if not included)
  8167. return new jQuery.fn.init( selector, context );
  8168. },
  8169. // Support: Android <=4.0 only
  8170. // Make sure we trim BOM and NBSP
  8171. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8172. jQuery.fn = jQuery.prototype = {
  8173. // The current version of jQuery being used
  8174. jquery: version,
  8175. constructor: jQuery,
  8176. // The default length of a jQuery object is 0
  8177. length: 0,
  8178. toArray: function() {
  8179. return slice.call( this );
  8180. },
  8181. // Get the Nth element in the matched element set OR
  8182. // Get the whole matched element set as a clean array
  8183. get: function( num ) {
  8184. // Return all the elements in a clean array
  8185. if ( num == null ) {
  8186. return slice.call( this );
  8187. }
  8188. // Return just the one element from the set
  8189. return num < 0 ? this[ num + this.length ] : this[ num ];
  8190. },
  8191. // Take an array of elements and push it onto the stack
  8192. // (returning the new matched element set)
  8193. pushStack: function( elems ) {
  8194. // Build a new jQuery matched element set
  8195. var ret = jQuery.merge( this.constructor(), elems );
  8196. // Add the old object onto the stack (as a reference)
  8197. ret.prevObject = this;
  8198. // Return the newly-formed element set
  8199. return ret;
  8200. },
  8201. // Execute a callback for every element in the matched set.
  8202. each: function( callback ) {
  8203. return jQuery.each( this, callback );
  8204. },
  8205. map: function( callback ) {
  8206. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8207. return callback.call( elem, i, elem );
  8208. } ) );
  8209. },
  8210. slice: function() {
  8211. return this.pushStack( slice.apply( this, arguments ) );
  8212. },
  8213. first: function() {
  8214. return this.eq( 0 );
  8215. },
  8216. last: function() {
  8217. return this.eq( -1 );
  8218. },
  8219. eq: function( i ) {
  8220. var len = this.length,
  8221. j = +i + ( i < 0 ? len : 0 );
  8222. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8223. },
  8224. end: function() {
  8225. return this.prevObject || this.constructor();
  8226. },
  8227. // For internal use only.
  8228. // Behaves like an Array's method, not like a jQuery method.
  8229. push: push,
  8230. sort: arr.sort,
  8231. splice: arr.splice
  8232. };
  8233. jQuery.extend = jQuery.fn.extend = function() {
  8234. var options, name, src, copy, copyIsArray, clone,
  8235. target = arguments[ 0 ] || {},
  8236. i = 1,
  8237. length = arguments.length,
  8238. deep = false;
  8239. // Handle a deep copy situation
  8240. if ( typeof target === "boolean" ) {
  8241. deep = target;
  8242. // Skip the boolean and the target
  8243. target = arguments[ i ] || {};
  8244. i++;
  8245. }
  8246. // Handle case when target is a string or something (possible in deep copy)
  8247. if ( typeof target !== "object" && !isFunction( target ) ) {
  8248. target = {};
  8249. }
  8250. // Extend jQuery itself if only one argument is passed
  8251. if ( i === length ) {
  8252. target = this;
  8253. i--;
  8254. }
  8255. for ( ; i < length; i++ ) {
  8256. // Only deal with non-null/undefined values
  8257. if ( ( options = arguments[ i ] ) != null ) {
  8258. // Extend the base object
  8259. for ( name in options ) {
  8260. copy = options[ name ];
  8261. // Prevent Object.prototype pollution
  8262. // Prevent never-ending loop
  8263. if ( name === "__proto__" || target === copy ) {
  8264. continue;
  8265. }
  8266. // Recurse if we're merging plain objects or arrays
  8267. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8268. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8269. src = target[ name ];
  8270. // Ensure proper type for the source value
  8271. if ( copyIsArray && !Array.isArray( src ) ) {
  8272. clone = [];
  8273. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8274. clone = {};
  8275. } else {
  8276. clone = src;
  8277. }
  8278. copyIsArray = false;
  8279. // Never move original objects, clone them
  8280. target[ name ] = jQuery.extend( deep, clone, copy );
  8281. // Don't bring in undefined values
  8282. } else if ( copy !== undefined ) {
  8283. target[ name ] = copy;
  8284. }
  8285. }
  8286. }
  8287. }
  8288. // Return the modified object
  8289. return target;
  8290. };
  8291. jQuery.extend( {
  8292. // Unique for each copy of jQuery on the page
  8293. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8294. // Assume jQuery is ready without the ready module
  8295. isReady: true,
  8296. error: function( msg ) {
  8297. throw new Error( msg );
  8298. },
  8299. noop: function() {},
  8300. isPlainObject: function( obj ) {
  8301. var proto, Ctor;
  8302. // Detect obvious negatives
  8303. // Use toString instead of jQuery.type to catch host objects
  8304. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8305. return false;
  8306. }
  8307. proto = getProto( obj );
  8308. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8309. if ( !proto ) {
  8310. return true;
  8311. }
  8312. // Objects with prototype are plain iff they were constructed by a global Object function
  8313. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8314. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8315. },
  8316. isEmptyObject: function( obj ) {
  8317. var name;
  8318. for ( name in obj ) {
  8319. return false;
  8320. }
  8321. return true;
  8322. },
  8323. // Evaluates a script in a global context
  8324. globalEval: function( code, options ) {
  8325. DOMEval( code, { nonce: options && options.nonce } );
  8326. },
  8327. each: function( obj, callback ) {
  8328. var length, i = 0;
  8329. if ( isArrayLike( obj ) ) {
  8330. length = obj.length;
  8331. for ( ; i < length; i++ ) {
  8332. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8333. break;
  8334. }
  8335. }
  8336. } else {
  8337. for ( i in obj ) {
  8338. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8339. break;
  8340. }
  8341. }
  8342. }
  8343. return obj;
  8344. },
  8345. // Support: Android <=4.0 only
  8346. trim: function( text ) {
  8347. return text == null ?
  8348. "" :
  8349. ( text + "" ).replace( rtrim, "" );
  8350. },
  8351. // results is for internal usage only
  8352. makeArray: function( arr, results ) {
  8353. var ret = results || [];
  8354. if ( arr != null ) {
  8355. if ( isArrayLike( Object( arr ) ) ) {
  8356. jQuery.merge( ret,
  8357. typeof arr === "string" ?
  8358. [ arr ] : arr
  8359. );
  8360. } else {
  8361. push.call( ret, arr );
  8362. }
  8363. }
  8364. return ret;
  8365. },
  8366. inArray: function( elem, arr, i ) {
  8367. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8368. },
  8369. // Support: Android <=4.0 only, PhantomJS 1 only
  8370. // push.apply(_, arraylike) throws on ancient WebKit
  8371. merge: function( first, second ) {
  8372. var len = +second.length,
  8373. j = 0,
  8374. i = first.length;
  8375. for ( ; j < len; j++ ) {
  8376. first[ i++ ] = second[ j ];
  8377. }
  8378. first.length = i;
  8379. return first;
  8380. },
  8381. grep: function( elems, callback, invert ) {
  8382. var callbackInverse,
  8383. matches = [],
  8384. i = 0,
  8385. length = elems.length,
  8386. callbackExpect = !invert;
  8387. // Go through the array, only saving the items
  8388. // that pass the validator function
  8389. for ( ; i < length; i++ ) {
  8390. callbackInverse = !callback( elems[ i ], i );
  8391. if ( callbackInverse !== callbackExpect ) {
  8392. matches.push( elems[ i ] );
  8393. }
  8394. }
  8395. return matches;
  8396. },
  8397. // arg is for internal usage only
  8398. map: function( elems, callback, arg ) {
  8399. var length, value,
  8400. i = 0,
  8401. ret = [];
  8402. // Go through the array, translating each of the items to their new values
  8403. if ( isArrayLike( elems ) ) {
  8404. length = elems.length;
  8405. for ( ; i < length; i++ ) {
  8406. value = callback( elems[ i ], i, arg );
  8407. if ( value != null ) {
  8408. ret.push( value );
  8409. }
  8410. }
  8411. // Go through every key on the object,
  8412. } else {
  8413. for ( i in elems ) {
  8414. value = callback( elems[ i ], i, arg );
  8415. if ( value != null ) {
  8416. ret.push( value );
  8417. }
  8418. }
  8419. }
  8420. // Flatten any nested arrays
  8421. return concat.apply( [], ret );
  8422. },
  8423. // A global GUID counter for objects
  8424. guid: 1,
  8425. // jQuery.support is not used in Core but other projects attach their
  8426. // properties to it so it needs to exist.
  8427. support: support
  8428. } );
  8429. if ( typeof Symbol === "function" ) {
  8430. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8431. }
  8432. // Populate the class2type map
  8433. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8434. function( i, name ) {
  8435. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8436. } );
  8437. function isArrayLike( obj ) {
  8438. // Support: real iOS 8.2 only (not reproducible in simulator)
  8439. // `in` check used to prevent JIT error (gh-2145)
  8440. // hasOwn isn't used here due to false negatives
  8441. // regarding Nodelist length in IE
  8442. var length = !!obj && "length" in obj && obj.length,
  8443. type = toType( obj );
  8444. if ( isFunction( obj ) || isWindow( obj ) ) {
  8445. return false;
  8446. }
  8447. return type === "array" || length === 0 ||
  8448. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8449. }
  8450. var Sizzle =
  8451. /*!
  8452. * Sizzle CSS Selector Engine v2.3.4
  8453. * https://sizzlejs.com/
  8454. *
  8455. * Copyright JS Foundation and other contributors
  8456. * Released under the MIT license
  8457. * https://js.foundation/
  8458. *
  8459. * Date: 2019-04-08
  8460. */
  8461. (function( window ) {
  8462. var i,
  8463. support,
  8464. Expr,
  8465. getText,
  8466. isXML,
  8467. tokenize,
  8468. compile,
  8469. select,
  8470. outermostContext,
  8471. sortInput,
  8472. hasDuplicate,
  8473. // Local document vars
  8474. setDocument,
  8475. document,
  8476. docElem,
  8477. documentIsHTML,
  8478. rbuggyQSA,
  8479. rbuggyMatches,
  8480. matches,
  8481. contains,
  8482. // Instance-specific data
  8483. expando = "sizzle" + 1 * new Date(),
  8484. preferredDoc = window.document,
  8485. dirruns = 0,
  8486. done = 0,
  8487. classCache = createCache(),
  8488. tokenCache = createCache(),
  8489. compilerCache = createCache(),
  8490. nonnativeSelectorCache = createCache(),
  8491. sortOrder = function( a, b ) {
  8492. if ( a === b ) {
  8493. hasDuplicate = true;
  8494. }
  8495. return 0;
  8496. },
  8497. // Instance methods
  8498. hasOwn = ({}).hasOwnProperty,
  8499. arr = [],
  8500. pop = arr.pop,
  8501. push_native = arr.push,
  8502. push = arr.push,
  8503. slice = arr.slice,
  8504. // Use a stripped-down indexOf as it's faster than native
  8505. // https://jsperf.com/thor-indexof-vs-for/5
  8506. indexOf = function( list, elem ) {
  8507. var i = 0,
  8508. len = list.length;
  8509. for ( ; i < len; i++ ) {
  8510. if ( list[i] === elem ) {
  8511. return i;
  8512. }
  8513. }
  8514. return -1;
  8515. },
  8516. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8517. // Regular expressions
  8518. // http://www.w3.org/TR/css3-selectors/#whitespace
  8519. whitespace = "[\\x20\\t\\r\\n\\f]",
  8520. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8521. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8522. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8523. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8524. // Operator (capture 2)
  8525. "*([*^$|!~]?=)" + whitespace +
  8526. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8527. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8528. "*\\]",
  8529. pseudos = ":(" + identifier + ")(?:\\((" +
  8530. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8531. // 1. quoted (capture 3; capture 4 or capture 5)
  8532. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8533. // 2. simple (capture 6)
  8534. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8535. // 3. anything else (capture 2)
  8536. ".*" +
  8537. ")\\)|)",
  8538. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8539. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8540. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8541. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8542. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8543. rdescend = new RegExp( whitespace + "|>" ),
  8544. rpseudo = new RegExp( pseudos ),
  8545. ridentifier = new RegExp( "^" + identifier + "$" ),
  8546. matchExpr = {
  8547. "ID": new RegExp( "^#(" + identifier + ")" ),
  8548. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8549. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8550. "ATTR": new RegExp( "^" + attributes ),
  8551. "PSEUDO": new RegExp( "^" + pseudos ),
  8552. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8553. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8554. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8555. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8556. // For use in libraries implementing .is()
  8557. // We use this for POS matching in `select`
  8558. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8559. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8560. },
  8561. rhtml = /HTML$/i,
  8562. rinputs = /^(?:input|select|textarea|button)$/i,
  8563. rheader = /^h\d$/i,
  8564. rnative = /^[^{]+\{\s*\[native \w/,
  8565. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8566. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8567. rsibling = /[+~]/,
  8568. // CSS escapes
  8569. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8570. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8571. funescape = function( _, escaped, escapedWhitespace ) {
  8572. var high = "0x" + escaped - 0x10000;
  8573. // NaN means non-codepoint
  8574. // Support: Firefox<24
  8575. // Workaround erroneous numeric interpretation of +"0x"
  8576. return high !== high || escapedWhitespace ?
  8577. escaped :
  8578. high < 0 ?
  8579. // BMP codepoint
  8580. String.fromCharCode( high + 0x10000 ) :
  8581. // Supplemental Plane codepoint (surrogate pair)
  8582. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8583. },
  8584. // CSS string/identifier serialization
  8585. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8586. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8587. fcssescape = function( ch, asCodePoint ) {
  8588. if ( asCodePoint ) {
  8589. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8590. if ( ch === "\0" ) {
  8591. return "\uFFFD";
  8592. }
  8593. // Control characters and (dependent upon position) numbers get escaped as code points
  8594. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8595. }
  8596. // Other potentially-special ASCII characters get backslash-escaped
  8597. return "\\" + ch;
  8598. },
  8599. // Used for iframes
  8600. // See setDocument()
  8601. // Removing the function wrapper causes a "Permission Denied"
  8602. // error in IE
  8603. unloadHandler = function() {
  8604. setDocument();
  8605. },
  8606. inDisabledFieldset = addCombinator(
  8607. function( elem ) {
  8608. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8609. },
  8610. { dir: "parentNode", next: "legend" }
  8611. );
  8612. // Optimize for push.apply( _, NodeList )
  8613. try {
  8614. push.apply(
  8615. (arr = slice.call( preferredDoc.childNodes )),
  8616. preferredDoc.childNodes
  8617. );
  8618. // Support: Android<4.0
  8619. // Detect silently failing push.apply
  8620. arr[ preferredDoc.childNodes.length ].nodeType;
  8621. } catch ( e ) {
  8622. push = { apply: arr.length ?
  8623. // Leverage slice if possible
  8624. function( target, els ) {
  8625. push_native.apply( target, slice.call(els) );
  8626. } :
  8627. // Support: IE<9
  8628. // Otherwise append directly
  8629. function( target, els ) {
  8630. var j = target.length,
  8631. i = 0;
  8632. // Can't trust NodeList.length
  8633. while ( (target[j++] = els[i++]) ) {}
  8634. target.length = j - 1;
  8635. }
  8636. };
  8637. }
  8638. function Sizzle( selector, context, results, seed ) {
  8639. var m, i, elem, nid, match, groups, newSelector,
  8640. newContext = context && context.ownerDocument,
  8641. // nodeType defaults to 9, since context defaults to document
  8642. nodeType = context ? context.nodeType : 9;
  8643. results = results || [];
  8644. // Return early from calls with invalid selector or context
  8645. if ( typeof selector !== "string" || !selector ||
  8646. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8647. return results;
  8648. }
  8649. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8650. if ( !seed ) {
  8651. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8652. setDocument( context );
  8653. }
  8654. context = context || document;
  8655. if ( documentIsHTML ) {
  8656. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8657. // (excepting DocumentFragment context, where the methods don't exist)
  8658. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8659. // ID selector
  8660. if ( (m = match[1]) ) {
  8661. // Document context
  8662. if ( nodeType === 9 ) {
  8663. if ( (elem = context.getElementById( m )) ) {
  8664. // Support: IE, Opera, Webkit
  8665. // TODO: identify versions
  8666. // getElementById can match elements by name instead of ID
  8667. if ( elem.id === m ) {
  8668. results.push( elem );
  8669. return results;
  8670. }
  8671. } else {
  8672. return results;
  8673. }
  8674. // Element context
  8675. } else {
  8676. // Support: IE, Opera, Webkit
  8677. // TODO: identify versions
  8678. // getElementById can match elements by name instead of ID
  8679. if ( newContext && (elem = newContext.getElementById( m )) &&
  8680. contains( context, elem ) &&
  8681. elem.id === m ) {
  8682. results.push( elem );
  8683. return results;
  8684. }
  8685. }
  8686. // Type selector
  8687. } else if ( match[2] ) {
  8688. push.apply( results, context.getElementsByTagName( selector ) );
  8689. return results;
  8690. // Class selector
  8691. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8692. context.getElementsByClassName ) {
  8693. push.apply( results, context.getElementsByClassName( m ) );
  8694. return results;
  8695. }
  8696. }
  8697. // Take advantage of querySelectorAll
  8698. if ( support.qsa &&
  8699. !nonnativeSelectorCache[ selector + " " ] &&
  8700. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8701. // Support: IE 8 only
  8702. // Exclude object elements
  8703. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8704. newSelector = selector;
  8705. newContext = context;
  8706. // qSA considers elements outside a scoping root when evaluating child or
  8707. // descendant combinators, which is not what we want.
  8708. // In such cases, we work around the behavior by prefixing every selector in the
  8709. // list with an ID selector referencing the scope context.
  8710. // Thanks to Andrew Dupont for this technique.
  8711. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8712. // Capture the context ID, setting it first if necessary
  8713. if ( (nid = context.getAttribute( "id" )) ) {
  8714. nid = nid.replace( rcssescape, fcssescape );
  8715. } else {
  8716. context.setAttribute( "id", (nid = expando) );
  8717. }
  8718. // Prefix every selector in the list
  8719. groups = tokenize( selector );
  8720. i = groups.length;
  8721. while ( i-- ) {
  8722. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8723. }
  8724. newSelector = groups.join( "," );
  8725. // Expand context for sibling selectors
  8726. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8727. context;
  8728. }
  8729. try {
  8730. push.apply( results,
  8731. newContext.querySelectorAll( newSelector )
  8732. );
  8733. return results;
  8734. } catch ( qsaError ) {
  8735. nonnativeSelectorCache( selector, true );
  8736. } finally {
  8737. if ( nid === expando ) {
  8738. context.removeAttribute( "id" );
  8739. }
  8740. }
  8741. }
  8742. }
  8743. }
  8744. // All others
  8745. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8746. }
  8747. /**
  8748. * Create key-value caches of limited size
  8749. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8750. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8751. * deleting the oldest entry
  8752. */
  8753. function createCache() {
  8754. var keys = [];
  8755. function cache( key, value ) {
  8756. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8757. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8758. // Only keep the most recent entries
  8759. delete cache[ keys.shift() ];
  8760. }
  8761. return (cache[ key + " " ] = value);
  8762. }
  8763. return cache;
  8764. }
  8765. /**
  8766. * Mark a function for special use by Sizzle
  8767. * @param {Function} fn The function to mark
  8768. */
  8769. function markFunction( fn ) {
  8770. fn[ expando ] = true;
  8771. return fn;
  8772. }
  8773. /**
  8774. * Support testing using an element
  8775. * @param {Function} fn Passed the created element and returns a boolean result
  8776. */
  8777. function assert( fn ) {
  8778. var el = document.createElement("fieldset");
  8779. try {
  8780. return !!fn( el );
  8781. } catch (e) {
  8782. return false;
  8783. } finally {
  8784. // Remove from its parent by default
  8785. if ( el.parentNode ) {
  8786. el.parentNode.removeChild( el );
  8787. }
  8788. // release memory in IE
  8789. el = null;
  8790. }
  8791. }
  8792. /**
  8793. * Adds the same handler for all of the specified attrs
  8794. * @param {String} attrs Pipe-separated list of attributes
  8795. * @param {Function} handler The method that will be applied
  8796. */
  8797. function addHandle( attrs, handler ) {
  8798. var arr = attrs.split("|"),
  8799. i = arr.length;
  8800. while ( i-- ) {
  8801. Expr.attrHandle[ arr[i] ] = handler;
  8802. }
  8803. }
  8804. /**
  8805. * Checks document order of two siblings
  8806. * @param {Element} a
  8807. * @param {Element} b
  8808. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8809. */
  8810. function siblingCheck( a, b ) {
  8811. var cur = b && a,
  8812. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8813. a.sourceIndex - b.sourceIndex;
  8814. // Use IE sourceIndex if available on both nodes
  8815. if ( diff ) {
  8816. return diff;
  8817. }
  8818. // Check if b follows a
  8819. if ( cur ) {
  8820. while ( (cur = cur.nextSibling) ) {
  8821. if ( cur === b ) {
  8822. return -1;
  8823. }
  8824. }
  8825. }
  8826. return a ? 1 : -1;
  8827. }
  8828. /**
  8829. * Returns a function to use in pseudos for input types
  8830. * @param {String} type
  8831. */
  8832. function createInputPseudo( type ) {
  8833. return function( elem ) {
  8834. var name = elem.nodeName.toLowerCase();
  8835. return name === "input" && elem.type === type;
  8836. };
  8837. }
  8838. /**
  8839. * Returns a function to use in pseudos for buttons
  8840. * @param {String} type
  8841. */
  8842. function createButtonPseudo( type ) {
  8843. return function( elem ) {
  8844. var name = elem.nodeName.toLowerCase();
  8845. return (name === "input" || name === "button") && elem.type === type;
  8846. };
  8847. }
  8848. /**
  8849. * Returns a function to use in pseudos for :enabled/:disabled
  8850. * @param {Boolean} disabled true for :disabled; false for :enabled
  8851. */
  8852. function createDisabledPseudo( disabled ) {
  8853. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8854. return function( elem ) {
  8855. // Only certain elements can match :enabled or :disabled
  8856. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8857. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8858. if ( "form" in elem ) {
  8859. // Check for inherited disabledness on relevant non-disabled elements:
  8860. // * listed form-associated elements in a disabled fieldset
  8861. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8862. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8863. // * option elements in a disabled optgroup
  8864. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8865. // All such elements have a "form" property.
  8866. if ( elem.parentNode && elem.disabled === false ) {
  8867. // Option elements defer to a parent optgroup if present
  8868. if ( "label" in elem ) {
  8869. if ( "label" in elem.parentNode ) {
  8870. return elem.parentNode.disabled === disabled;
  8871. } else {
  8872. return elem.disabled === disabled;
  8873. }
  8874. }
  8875. // Support: IE 6 - 11
  8876. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8877. return elem.isDisabled === disabled ||
  8878. // Where there is no isDisabled, check manually
  8879. /* jshint -W018 */
  8880. elem.isDisabled !== !disabled &&
  8881. inDisabledFieldset( elem ) === disabled;
  8882. }
  8883. return elem.disabled === disabled;
  8884. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8885. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8886. // even exist on them, let alone have a boolean value.
  8887. } else if ( "label" in elem ) {
  8888. return elem.disabled === disabled;
  8889. }
  8890. // Remaining elements are neither :enabled nor :disabled
  8891. return false;
  8892. };
  8893. }
  8894. /**
  8895. * Returns a function to use in pseudos for positionals
  8896. * @param {Function} fn
  8897. */
  8898. function createPositionalPseudo( fn ) {
  8899. return markFunction(function( argument ) {
  8900. argument = +argument;
  8901. return markFunction(function( seed, matches ) {
  8902. var j,
  8903. matchIndexes = fn( [], seed.length, argument ),
  8904. i = matchIndexes.length;
  8905. // Match elements found at the specified indexes
  8906. while ( i-- ) {
  8907. if ( seed[ (j = matchIndexes[i]) ] ) {
  8908. seed[j] = !(matches[j] = seed[j]);
  8909. }
  8910. }
  8911. });
  8912. });
  8913. }
  8914. /**
  8915. * Checks a node for validity as a Sizzle context
  8916. * @param {Element|Object=} context
  8917. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  8918. */
  8919. function testContext( context ) {
  8920. return context && typeof context.getElementsByTagName !== "undefined" && context;
  8921. }
  8922. // Expose support vars for convenience
  8923. support = Sizzle.support = {};
  8924. /**
  8925. * Detects XML nodes
  8926. * @param {Element|Object} elem An element or a document
  8927. * @returns {Boolean} True iff elem is a non-HTML XML node
  8928. */
  8929. isXML = Sizzle.isXML = function( elem ) {
  8930. var namespace = elem.namespaceURI,
  8931. docElem = (elem.ownerDocument || elem).documentElement;
  8932. // Support: IE <=8
  8933. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  8934. // https://bugs.jquery.com/ticket/4833
  8935. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  8936. };
  8937. /**
  8938. * Sets document-related variables once based on the current document
  8939. * @param {Element|Object} [doc] An element or document object to use to set the document
  8940. * @returns {Object} Returns the current document
  8941. */
  8942. setDocument = Sizzle.setDocument = function( node ) {
  8943. var hasCompare, subWindow,
  8944. doc = node ? node.ownerDocument || node : preferredDoc;
  8945. // Return early if doc is invalid or already selected
  8946. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  8947. return document;
  8948. }
  8949. // Update global variables
  8950. document = doc;
  8951. docElem = document.documentElement;
  8952. documentIsHTML = !isXML( document );
  8953. // Support: IE 9-11, Edge
  8954. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  8955. if ( preferredDoc !== document &&
  8956. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  8957. // Support: IE 11, Edge
  8958. if ( subWindow.addEventListener ) {
  8959. subWindow.addEventListener( "unload", unloadHandler, false );
  8960. // Support: IE 9 - 10 only
  8961. } else if ( subWindow.attachEvent ) {
  8962. subWindow.attachEvent( "onunload", unloadHandler );
  8963. }
  8964. }
  8965. /* Attributes
  8966. ---------------------------------------------------------------------- */
  8967. // Support: IE<8
  8968. // Verify that getAttribute really returns attributes and not properties
  8969. // (excepting IE8 booleans)
  8970. support.attributes = assert(function( el ) {
  8971. el.className = "i";
  8972. return !el.getAttribute("className");
  8973. });
  8974. /* getElement(s)By*
  8975. ---------------------------------------------------------------------- */
  8976. // Check if getElementsByTagName("*") returns only elements
  8977. support.getElementsByTagName = assert(function( el ) {
  8978. el.appendChild( document.createComment("") );
  8979. return !el.getElementsByTagName("*").length;
  8980. });
  8981. // Support: IE<9
  8982. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  8983. // Support: IE<10
  8984. // Check if getElementById returns elements by name
  8985. // The broken getElementById methods don't pick up programmatically-set names,
  8986. // so use a roundabout getElementsByName test
  8987. support.getById = assert(function( el ) {
  8988. docElem.appendChild( el ).id = expando;
  8989. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  8990. });
  8991. // ID filter and find
  8992. if ( support.getById ) {
  8993. Expr.filter["ID"] = function( id ) {
  8994. var attrId = id.replace( runescape, funescape );
  8995. return function( elem ) {
  8996. return elem.getAttribute("id") === attrId;
  8997. };
  8998. };
  8999. Expr.find["ID"] = function( id, context ) {
  9000. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9001. var elem = context.getElementById( id );
  9002. return elem ? [ elem ] : [];
  9003. }
  9004. };
  9005. } else {
  9006. Expr.filter["ID"] = function( id ) {
  9007. var attrId = id.replace( runescape, funescape );
  9008. return function( elem ) {
  9009. var node = typeof elem.getAttributeNode !== "undefined" &&
  9010. elem.getAttributeNode("id");
  9011. return node && node.value === attrId;
  9012. };
  9013. };
  9014. // Support: IE 6 - 7 only
  9015. // getElementById is not reliable as a find shortcut
  9016. Expr.find["ID"] = function( id, context ) {
  9017. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9018. var node, i, elems,
  9019. elem = context.getElementById( id );
  9020. if ( elem ) {
  9021. // Verify the id attribute
  9022. node = elem.getAttributeNode("id");
  9023. if ( node && node.value === id ) {
  9024. return [ elem ];
  9025. }
  9026. // Fall back on getElementsByName
  9027. elems = context.getElementsByName( id );
  9028. i = 0;
  9029. while ( (elem = elems[i++]) ) {
  9030. node = elem.getAttributeNode("id");
  9031. if ( node && node.value === id ) {
  9032. return [ elem ];
  9033. }
  9034. }
  9035. }
  9036. return [];
  9037. }
  9038. };
  9039. }
  9040. // Tag
  9041. Expr.find["TAG"] = support.getElementsByTagName ?
  9042. function( tag, context ) {
  9043. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9044. return context.getElementsByTagName( tag );
  9045. // DocumentFragment nodes don't have gEBTN
  9046. } else if ( support.qsa ) {
  9047. return context.querySelectorAll( tag );
  9048. }
  9049. } :
  9050. function( tag, context ) {
  9051. var elem,
  9052. tmp = [],
  9053. i = 0,
  9054. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9055. results = context.getElementsByTagName( tag );
  9056. // Filter out possible comments
  9057. if ( tag === "*" ) {
  9058. while ( (elem = results[i++]) ) {
  9059. if ( elem.nodeType === 1 ) {
  9060. tmp.push( elem );
  9061. }
  9062. }
  9063. return tmp;
  9064. }
  9065. return results;
  9066. };
  9067. // Class
  9068. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9069. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9070. return context.getElementsByClassName( className );
  9071. }
  9072. };
  9073. /* QSA/matchesSelector
  9074. ---------------------------------------------------------------------- */
  9075. // QSA and matchesSelector support
  9076. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9077. rbuggyMatches = [];
  9078. // qSa(:focus) reports false when true (Chrome 21)
  9079. // We allow this because of a bug in IE8/9 that throws an error
  9080. // whenever `document.activeElement` is accessed on an iframe
  9081. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9082. // See https://bugs.jquery.com/ticket/13378
  9083. rbuggyQSA = [];
  9084. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9085. // Build QSA regex
  9086. // Regex strategy adopted from Diego Perini
  9087. assert(function( el ) {
  9088. // Select is set to empty string on purpose
  9089. // This is to test IE's treatment of not explicitly
  9090. // setting a boolean content attribute,
  9091. // since its presence should be enough
  9092. // https://bugs.jquery.com/ticket/12359
  9093. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9094. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9095. "<option selected=''></option></select>";
  9096. // Support: IE8, Opera 11-12.16
  9097. // Nothing should be selected when empty strings follow ^= or $= or *=
  9098. // The test attribute must be unknown in Opera but "safe" for WinRT
  9099. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9100. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9101. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9102. }
  9103. // Support: IE8
  9104. // Boolean attributes and "value" are not treated correctly
  9105. if ( !el.querySelectorAll("[selected]").length ) {
  9106. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9107. }
  9108. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9109. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9110. rbuggyQSA.push("~=");
  9111. }
  9112. // Webkit/Opera - :checked should return selected option elements
  9113. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9114. // IE8 throws error here and will not see later tests
  9115. if ( !el.querySelectorAll(":checked").length ) {
  9116. rbuggyQSA.push(":checked");
  9117. }
  9118. // Support: Safari 8+, iOS 8+
  9119. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9120. // In-page `selector#id sibling-combinator selector` fails
  9121. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9122. rbuggyQSA.push(".#.+[+~]");
  9123. }
  9124. });
  9125. assert(function( el ) {
  9126. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9127. "<select disabled='disabled'><option/></select>";
  9128. // Support: Windows 8 Native Apps
  9129. // The type and name attributes are restricted during .innerHTML assignment
  9130. var input = document.createElement("input");
  9131. input.setAttribute( "type", "hidden" );
  9132. el.appendChild( input ).setAttribute( "name", "D" );
  9133. // Support: IE8
  9134. // Enforce case-sensitivity of name attribute
  9135. if ( el.querySelectorAll("[name=d]").length ) {
  9136. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9137. }
  9138. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9139. // IE8 throws error here and will not see later tests
  9140. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9141. rbuggyQSA.push( ":enabled", ":disabled" );
  9142. }
  9143. // Support: IE9-11+
  9144. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9145. docElem.appendChild( el ).disabled = true;
  9146. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9147. rbuggyQSA.push( ":enabled", ":disabled" );
  9148. }
  9149. // Opera 10-11 does not throw on post-comma invalid pseudos
  9150. el.querySelectorAll("*,:x");
  9151. rbuggyQSA.push(",.*:");
  9152. });
  9153. }
  9154. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9155. docElem.webkitMatchesSelector ||
  9156. docElem.mozMatchesSelector ||
  9157. docElem.oMatchesSelector ||
  9158. docElem.msMatchesSelector) )) ) {
  9159. assert(function( el ) {
  9160. // Check to see if it's possible to do matchesSelector
  9161. // on a disconnected node (IE 9)
  9162. support.disconnectedMatch = matches.call( el, "*" );
  9163. // This should fail with an exception
  9164. // Gecko does not error, returns false instead
  9165. matches.call( el, "[s!='']:x" );
  9166. rbuggyMatches.push( "!=", pseudos );
  9167. });
  9168. }
  9169. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9170. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9171. /* Contains
  9172. ---------------------------------------------------------------------- */
  9173. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9174. // Element contains another
  9175. // Purposefully self-exclusive
  9176. // As in, an element does not contain itself
  9177. contains = hasCompare || rnative.test( docElem.contains ) ?
  9178. function( a, b ) {
  9179. var adown = a.nodeType === 9 ? a.documentElement : a,
  9180. bup = b && b.parentNode;
  9181. return a === bup || !!( bup && bup.nodeType === 1 && (
  9182. adown.contains ?
  9183. adown.contains( bup ) :
  9184. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9185. ));
  9186. } :
  9187. function( a, b ) {
  9188. if ( b ) {
  9189. while ( (b = b.parentNode) ) {
  9190. if ( b === a ) {
  9191. return true;
  9192. }
  9193. }
  9194. }
  9195. return false;
  9196. };
  9197. /* Sorting
  9198. ---------------------------------------------------------------------- */
  9199. // Document order sorting
  9200. sortOrder = hasCompare ?
  9201. function( a, b ) {
  9202. // Flag for duplicate removal
  9203. if ( a === b ) {
  9204. hasDuplicate = true;
  9205. return 0;
  9206. }
  9207. // Sort on method existence if only one input has compareDocumentPosition
  9208. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9209. if ( compare ) {
  9210. return compare;
  9211. }
  9212. // Calculate position if both inputs belong to the same document
  9213. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9214. a.compareDocumentPosition( b ) :
  9215. // Otherwise we know they are disconnected
  9216. 1;
  9217. // Disconnected nodes
  9218. if ( compare & 1 ||
  9219. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9220. // Choose the first element that is related to our preferred document
  9221. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9222. return -1;
  9223. }
  9224. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9225. return 1;
  9226. }
  9227. // Maintain original order
  9228. return sortInput ?
  9229. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9230. 0;
  9231. }
  9232. return compare & 4 ? -1 : 1;
  9233. } :
  9234. function( a, b ) {
  9235. // Exit early if the nodes are identical
  9236. if ( a === b ) {
  9237. hasDuplicate = true;
  9238. return 0;
  9239. }
  9240. var cur,
  9241. i = 0,
  9242. aup = a.parentNode,
  9243. bup = b.parentNode,
  9244. ap = [ a ],
  9245. bp = [ b ];
  9246. // Parentless nodes are either documents or disconnected
  9247. if ( !aup || !bup ) {
  9248. return a === document ? -1 :
  9249. b === document ? 1 :
  9250. aup ? -1 :
  9251. bup ? 1 :
  9252. sortInput ?
  9253. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9254. 0;
  9255. // If the nodes are siblings, we can do a quick check
  9256. } else if ( aup === bup ) {
  9257. return siblingCheck( a, b );
  9258. }
  9259. // Otherwise we need full lists of their ancestors for comparison
  9260. cur = a;
  9261. while ( (cur = cur.parentNode) ) {
  9262. ap.unshift( cur );
  9263. }
  9264. cur = b;
  9265. while ( (cur = cur.parentNode) ) {
  9266. bp.unshift( cur );
  9267. }
  9268. // Walk down the tree looking for a discrepancy
  9269. while ( ap[i] === bp[i] ) {
  9270. i++;
  9271. }
  9272. return i ?
  9273. // Do a sibling check if the nodes have a common ancestor
  9274. siblingCheck( ap[i], bp[i] ) :
  9275. // Otherwise nodes in our document sort first
  9276. ap[i] === preferredDoc ? -1 :
  9277. bp[i] === preferredDoc ? 1 :
  9278. 0;
  9279. };
  9280. return document;
  9281. };
  9282. Sizzle.matches = function( expr, elements ) {
  9283. return Sizzle( expr, null, null, elements );
  9284. };
  9285. Sizzle.matchesSelector = function( elem, expr ) {
  9286. // Set document vars if needed
  9287. if ( ( elem.ownerDocument || elem ) !== document ) {
  9288. setDocument( elem );
  9289. }
  9290. if ( support.matchesSelector && documentIsHTML &&
  9291. !nonnativeSelectorCache[ expr + " " ] &&
  9292. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9293. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9294. try {
  9295. var ret = matches.call( elem, expr );
  9296. // IE 9's matchesSelector returns false on disconnected nodes
  9297. if ( ret || support.disconnectedMatch ||
  9298. // As well, disconnected nodes are said to be in a document
  9299. // fragment in IE 9
  9300. elem.document && elem.document.nodeType !== 11 ) {
  9301. return ret;
  9302. }
  9303. } catch (e) {
  9304. nonnativeSelectorCache( expr, true );
  9305. }
  9306. }
  9307. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9308. };
  9309. Sizzle.contains = function( context, elem ) {
  9310. // Set document vars if needed
  9311. if ( ( context.ownerDocument || context ) !== document ) {
  9312. setDocument( context );
  9313. }
  9314. return contains( context, elem );
  9315. };
  9316. Sizzle.attr = function( elem, name ) {
  9317. // Set document vars if needed
  9318. if ( ( elem.ownerDocument || elem ) !== document ) {
  9319. setDocument( elem );
  9320. }
  9321. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9322. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9323. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9324. fn( elem, name, !documentIsHTML ) :
  9325. undefined;
  9326. return val !== undefined ?
  9327. val :
  9328. support.attributes || !documentIsHTML ?
  9329. elem.getAttribute( name ) :
  9330. (val = elem.getAttributeNode(name)) && val.specified ?
  9331. val.value :
  9332. null;
  9333. };
  9334. Sizzle.escape = function( sel ) {
  9335. return (sel + "").replace( rcssescape, fcssescape );
  9336. };
  9337. Sizzle.error = function( msg ) {
  9338. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9339. };
  9340. /**
  9341. * Document sorting and removing duplicates
  9342. * @param {ArrayLike} results
  9343. */
  9344. Sizzle.uniqueSort = function( results ) {
  9345. var elem,
  9346. duplicates = [],
  9347. j = 0,
  9348. i = 0;
  9349. // Unless we *know* we can detect duplicates, assume their presence
  9350. hasDuplicate = !support.detectDuplicates;
  9351. sortInput = !support.sortStable && results.slice( 0 );
  9352. results.sort( sortOrder );
  9353. if ( hasDuplicate ) {
  9354. while ( (elem = results[i++]) ) {
  9355. if ( elem === results[ i ] ) {
  9356. j = duplicates.push( i );
  9357. }
  9358. }
  9359. while ( j-- ) {
  9360. results.splice( duplicates[ j ], 1 );
  9361. }
  9362. }
  9363. // Clear input after sorting to release objects
  9364. // See https://github.com/jquery/sizzle/pull/225
  9365. sortInput = null;
  9366. return results;
  9367. };
  9368. /**
  9369. * Utility function for retrieving the text value of an array of DOM nodes
  9370. * @param {Array|Element} elem
  9371. */
  9372. getText = Sizzle.getText = function( elem ) {
  9373. var node,
  9374. ret = "",
  9375. i = 0,
  9376. nodeType = elem.nodeType;
  9377. if ( !nodeType ) {
  9378. // If no nodeType, this is expected to be an array
  9379. while ( (node = elem[i++]) ) {
  9380. // Do not traverse comment nodes
  9381. ret += getText( node );
  9382. }
  9383. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9384. // Use textContent for elements
  9385. // innerText usage removed for consistency of new lines (jQuery #11153)
  9386. if ( typeof elem.textContent === "string" ) {
  9387. return elem.textContent;
  9388. } else {
  9389. // Traverse its children
  9390. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9391. ret += getText( elem );
  9392. }
  9393. }
  9394. } else if ( nodeType === 3 || nodeType === 4 ) {
  9395. return elem.nodeValue;
  9396. }
  9397. // Do not include comment or processing instruction nodes
  9398. return ret;
  9399. };
  9400. Expr = Sizzle.selectors = {
  9401. // Can be adjusted by the user
  9402. cacheLength: 50,
  9403. createPseudo: markFunction,
  9404. match: matchExpr,
  9405. attrHandle: {},
  9406. find: {},
  9407. relative: {
  9408. ">": { dir: "parentNode", first: true },
  9409. " ": { dir: "parentNode" },
  9410. "+": { dir: "previousSibling", first: true },
  9411. "~": { dir: "previousSibling" }
  9412. },
  9413. preFilter: {
  9414. "ATTR": function( match ) {
  9415. match[1] = match[1].replace( runescape, funescape );
  9416. // Move the given value to match[3] whether quoted or unquoted
  9417. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9418. if ( match[2] === "~=" ) {
  9419. match[3] = " " + match[3] + " ";
  9420. }
  9421. return match.slice( 0, 4 );
  9422. },
  9423. "CHILD": function( match ) {
  9424. /* matches from matchExpr["CHILD"]
  9425. 1 type (only|nth|...)
  9426. 2 what (child|of-type)
  9427. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9428. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9429. 5 sign of xn-component
  9430. 6 x of xn-component
  9431. 7 sign of y-component
  9432. 8 y of y-component
  9433. */
  9434. match[1] = match[1].toLowerCase();
  9435. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9436. // nth-* requires argument
  9437. if ( !match[3] ) {
  9438. Sizzle.error( match[0] );
  9439. }
  9440. // numeric x and y parameters for Expr.filter.CHILD
  9441. // remember that false/true cast respectively to 0/1
  9442. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9443. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9444. // other types prohibit arguments
  9445. } else if ( match[3] ) {
  9446. Sizzle.error( match[0] );
  9447. }
  9448. return match;
  9449. },
  9450. "PSEUDO": function( match ) {
  9451. var excess,
  9452. unquoted = !match[6] && match[2];
  9453. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9454. return null;
  9455. }
  9456. // Accept quoted arguments as-is
  9457. if ( match[3] ) {
  9458. match[2] = match[4] || match[5] || "";
  9459. // Strip excess characters from unquoted arguments
  9460. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9461. // Get excess from tokenize (recursively)
  9462. (excess = tokenize( unquoted, true )) &&
  9463. // advance to the next closing parenthesis
  9464. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9465. // excess is a negative index
  9466. match[0] = match[0].slice( 0, excess );
  9467. match[2] = unquoted.slice( 0, excess );
  9468. }
  9469. // Return only captures needed by the pseudo filter method (type and argument)
  9470. return match.slice( 0, 3 );
  9471. }
  9472. },
  9473. filter: {
  9474. "TAG": function( nodeNameSelector ) {
  9475. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9476. return nodeNameSelector === "*" ?
  9477. function() { return true; } :
  9478. function( elem ) {
  9479. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9480. };
  9481. },
  9482. "CLASS": function( className ) {
  9483. var pattern = classCache[ className + " " ];
  9484. return pattern ||
  9485. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9486. classCache( className, function( elem ) {
  9487. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9488. });
  9489. },
  9490. "ATTR": function( name, operator, check ) {
  9491. return function( elem ) {
  9492. var result = Sizzle.attr( elem, name );
  9493. if ( result == null ) {
  9494. return operator === "!=";
  9495. }
  9496. if ( !operator ) {
  9497. return true;
  9498. }
  9499. result += "";
  9500. return operator === "=" ? result === check :
  9501. operator === "!=" ? result !== check :
  9502. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9503. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9504. operator === "$=" ? check && result.slice( -check.length ) === check :
  9505. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9506. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9507. false;
  9508. };
  9509. },
  9510. "CHILD": function( type, what, argument, first, last ) {
  9511. var simple = type.slice( 0, 3 ) !== "nth",
  9512. forward = type.slice( -4 ) !== "last",
  9513. ofType = what === "of-type";
  9514. return first === 1 && last === 0 ?
  9515. // Shortcut for :nth-*(n)
  9516. function( elem ) {
  9517. return !!elem.parentNode;
  9518. } :
  9519. function( elem, context, xml ) {
  9520. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9521. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9522. parent = elem.parentNode,
  9523. name = ofType && elem.nodeName.toLowerCase(),
  9524. useCache = !xml && !ofType,
  9525. diff = false;
  9526. if ( parent ) {
  9527. // :(first|last|only)-(child|of-type)
  9528. if ( simple ) {
  9529. while ( dir ) {
  9530. node = elem;
  9531. while ( (node = node[ dir ]) ) {
  9532. if ( ofType ?
  9533. node.nodeName.toLowerCase() === name :
  9534. node.nodeType === 1 ) {
  9535. return false;
  9536. }
  9537. }
  9538. // Reverse direction for :only-* (if we haven't yet done so)
  9539. start = dir = type === "only" && !start && "nextSibling";
  9540. }
  9541. return true;
  9542. }
  9543. start = [ forward ? parent.firstChild : parent.lastChild ];
  9544. // non-xml :nth-child(...) stores cache data on `parent`
  9545. if ( forward && useCache ) {
  9546. // Seek `elem` from a previously-cached index
  9547. // ...in a gzip-friendly way
  9548. node = parent;
  9549. outerCache = node[ expando ] || (node[ expando ] = {});
  9550. // Support: IE <9 only
  9551. // Defend against cloned attroperties (jQuery gh-1709)
  9552. uniqueCache = outerCache[ node.uniqueID ] ||
  9553. (outerCache[ node.uniqueID ] = {});
  9554. cache = uniqueCache[ type ] || [];
  9555. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9556. diff = nodeIndex && cache[ 2 ];
  9557. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9558. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9559. // Fallback to seeking `elem` from the start
  9560. (diff = nodeIndex = 0) || start.pop()) ) {
  9561. // When found, cache indexes on `parent` and break
  9562. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9563. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9564. break;
  9565. }
  9566. }
  9567. } else {
  9568. // Use previously-cached element index if available
  9569. if ( useCache ) {
  9570. // ...in a gzip-friendly way
  9571. node = elem;
  9572. outerCache = node[ expando ] || (node[ expando ] = {});
  9573. // Support: IE <9 only
  9574. // Defend against cloned attroperties (jQuery gh-1709)
  9575. uniqueCache = outerCache[ node.uniqueID ] ||
  9576. (outerCache[ node.uniqueID ] = {});
  9577. cache = uniqueCache[ type ] || [];
  9578. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9579. diff = nodeIndex;
  9580. }
  9581. // xml :nth-child(...)
  9582. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9583. if ( diff === false ) {
  9584. // Use the same loop as above to seek `elem` from the start
  9585. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9586. (diff = nodeIndex = 0) || start.pop()) ) {
  9587. if ( ( ofType ?
  9588. node.nodeName.toLowerCase() === name :
  9589. node.nodeType === 1 ) &&
  9590. ++diff ) {
  9591. // Cache the index of each encountered element
  9592. if ( useCache ) {
  9593. outerCache = node[ expando ] || (node[ expando ] = {});
  9594. // Support: IE <9 only
  9595. // Defend against cloned attroperties (jQuery gh-1709)
  9596. uniqueCache = outerCache[ node.uniqueID ] ||
  9597. (outerCache[ node.uniqueID ] = {});
  9598. uniqueCache[ type ] = [ dirruns, diff ];
  9599. }
  9600. if ( node === elem ) {
  9601. break;
  9602. }
  9603. }
  9604. }
  9605. }
  9606. }
  9607. // Incorporate the offset, then check against cycle size
  9608. diff -= last;
  9609. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9610. }
  9611. };
  9612. },
  9613. "PSEUDO": function( pseudo, argument ) {
  9614. // pseudo-class names are case-insensitive
  9615. // http://www.w3.org/TR/selectors/#pseudo-classes
  9616. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9617. // Remember that setFilters inherits from pseudos
  9618. var args,
  9619. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9620. Sizzle.error( "unsupported pseudo: " + pseudo );
  9621. // The user may use createPseudo to indicate that
  9622. // arguments are needed to create the filter function
  9623. // just as Sizzle does
  9624. if ( fn[ expando ] ) {
  9625. return fn( argument );
  9626. }
  9627. // But maintain support for old signatures
  9628. if ( fn.length > 1 ) {
  9629. args = [ pseudo, pseudo, "", argument ];
  9630. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9631. markFunction(function( seed, matches ) {
  9632. var idx,
  9633. matched = fn( seed, argument ),
  9634. i = matched.length;
  9635. while ( i-- ) {
  9636. idx = indexOf( seed, matched[i] );
  9637. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9638. }
  9639. }) :
  9640. function( elem ) {
  9641. return fn( elem, 0, args );
  9642. };
  9643. }
  9644. return fn;
  9645. }
  9646. },
  9647. pseudos: {
  9648. // Potentially complex pseudos
  9649. "not": markFunction(function( selector ) {
  9650. // Trim the selector passed to compile
  9651. // to avoid treating leading and trailing
  9652. // spaces as combinators
  9653. var input = [],
  9654. results = [],
  9655. matcher = compile( selector.replace( rtrim, "$1" ) );
  9656. return matcher[ expando ] ?
  9657. markFunction(function( seed, matches, context, xml ) {
  9658. var elem,
  9659. unmatched = matcher( seed, null, xml, [] ),
  9660. i = seed.length;
  9661. // Match elements unmatched by `matcher`
  9662. while ( i-- ) {
  9663. if ( (elem = unmatched[i]) ) {
  9664. seed[i] = !(matches[i] = elem);
  9665. }
  9666. }
  9667. }) :
  9668. function( elem, context, xml ) {
  9669. input[0] = elem;
  9670. matcher( input, null, xml, results );
  9671. // Don't keep the element (issue #299)
  9672. input[0] = null;
  9673. return !results.pop();
  9674. };
  9675. }),
  9676. "has": markFunction(function( selector ) {
  9677. return function( elem ) {
  9678. return Sizzle( selector, elem ).length > 0;
  9679. };
  9680. }),
  9681. "contains": markFunction(function( text ) {
  9682. text = text.replace( runescape, funescape );
  9683. return function( elem ) {
  9684. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9685. };
  9686. }),
  9687. // "Whether an element is represented by a :lang() selector
  9688. // is based solely on the element's language value
  9689. // being equal to the identifier C,
  9690. // or beginning with the identifier C immediately followed by "-".
  9691. // The matching of C against the element's language value is performed case-insensitively.
  9692. // The identifier C does not have to be a valid language name."
  9693. // http://www.w3.org/TR/selectors/#lang-pseudo
  9694. "lang": markFunction( function( lang ) {
  9695. // lang value must be a valid identifier
  9696. if ( !ridentifier.test(lang || "") ) {
  9697. Sizzle.error( "unsupported lang: " + lang );
  9698. }
  9699. lang = lang.replace( runescape, funescape ).toLowerCase();
  9700. return function( elem ) {
  9701. var elemLang;
  9702. do {
  9703. if ( (elemLang = documentIsHTML ?
  9704. elem.lang :
  9705. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9706. elemLang = elemLang.toLowerCase();
  9707. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9708. }
  9709. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9710. return false;
  9711. };
  9712. }),
  9713. // Miscellaneous
  9714. "target": function( elem ) {
  9715. var hash = window.location && window.location.hash;
  9716. return hash && hash.slice( 1 ) === elem.id;
  9717. },
  9718. "root": function( elem ) {
  9719. return elem === docElem;
  9720. },
  9721. "focus": function( elem ) {
  9722. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9723. },
  9724. // Boolean properties
  9725. "enabled": createDisabledPseudo( false ),
  9726. "disabled": createDisabledPseudo( true ),
  9727. "checked": function( elem ) {
  9728. // In CSS3, :checked should return both checked and selected elements
  9729. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9730. var nodeName = elem.nodeName.toLowerCase();
  9731. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9732. },
  9733. "selected": function( elem ) {
  9734. // Accessing this property makes selected-by-default
  9735. // options in Safari work properly
  9736. if ( elem.parentNode ) {
  9737. elem.parentNode.selectedIndex;
  9738. }
  9739. return elem.selected === true;
  9740. },
  9741. // Contents
  9742. "empty": function( elem ) {
  9743. // http://www.w3.org/TR/selectors/#empty-pseudo
  9744. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9745. // but not by others (comment: 8; processing instruction: 7; etc.)
  9746. // nodeType < 6 works because attributes (2) do not appear as children
  9747. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9748. if ( elem.nodeType < 6 ) {
  9749. return false;
  9750. }
  9751. }
  9752. return true;
  9753. },
  9754. "parent": function( elem ) {
  9755. return !Expr.pseudos["empty"]( elem );
  9756. },
  9757. // Element/input types
  9758. "header": function( elem ) {
  9759. return rheader.test( elem.nodeName );
  9760. },
  9761. "input": function( elem ) {
  9762. return rinputs.test( elem.nodeName );
  9763. },
  9764. "button": function( elem ) {
  9765. var name = elem.nodeName.toLowerCase();
  9766. return name === "input" && elem.type === "button" || name === "button";
  9767. },
  9768. "text": function( elem ) {
  9769. var attr;
  9770. return elem.nodeName.toLowerCase() === "input" &&
  9771. elem.type === "text" &&
  9772. // Support: IE<8
  9773. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9774. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9775. },
  9776. // Position-in-collection
  9777. "first": createPositionalPseudo(function() {
  9778. return [ 0 ];
  9779. }),
  9780. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9781. return [ length - 1 ];
  9782. }),
  9783. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9784. return [ argument < 0 ? argument + length : argument ];
  9785. }),
  9786. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9787. var i = 0;
  9788. for ( ; i < length; i += 2 ) {
  9789. matchIndexes.push( i );
  9790. }
  9791. return matchIndexes;
  9792. }),
  9793. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9794. var i = 1;
  9795. for ( ; i < length; i += 2 ) {
  9796. matchIndexes.push( i );
  9797. }
  9798. return matchIndexes;
  9799. }),
  9800. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9801. var i = argument < 0 ?
  9802. argument + length :
  9803. argument > length ?
  9804. length :
  9805. argument;
  9806. for ( ; --i >= 0; ) {
  9807. matchIndexes.push( i );
  9808. }
  9809. return matchIndexes;
  9810. }),
  9811. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9812. var i = argument < 0 ? argument + length : argument;
  9813. for ( ; ++i < length; ) {
  9814. matchIndexes.push( i );
  9815. }
  9816. return matchIndexes;
  9817. })
  9818. }
  9819. };
  9820. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9821. // Add button/input type pseudos
  9822. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9823. Expr.pseudos[ i ] = createInputPseudo( i );
  9824. }
  9825. for ( i in { submit: true, reset: true } ) {
  9826. Expr.pseudos[ i ] = createButtonPseudo( i );
  9827. }
  9828. // Easy API for creating new setFilters
  9829. function setFilters() {}
  9830. setFilters.prototype = Expr.filters = Expr.pseudos;
  9831. Expr.setFilters = new setFilters();
  9832. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9833. var matched, match, tokens, type,
  9834. soFar, groups, preFilters,
  9835. cached = tokenCache[ selector + " " ];
  9836. if ( cached ) {
  9837. return parseOnly ? 0 : cached.slice( 0 );
  9838. }
  9839. soFar = selector;
  9840. groups = [];
  9841. preFilters = Expr.preFilter;
  9842. while ( soFar ) {
  9843. // Comma and first run
  9844. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9845. if ( match ) {
  9846. // Don't consume trailing commas as valid
  9847. soFar = soFar.slice( match[0].length ) || soFar;
  9848. }
  9849. groups.push( (tokens = []) );
  9850. }
  9851. matched = false;
  9852. // Combinators
  9853. if ( (match = rcombinators.exec( soFar )) ) {
  9854. matched = match.shift();
  9855. tokens.push({
  9856. value: matched,
  9857. // Cast descendant combinators to space
  9858. type: match[0].replace( rtrim, " " )
  9859. });
  9860. soFar = soFar.slice( matched.length );
  9861. }
  9862. // Filters
  9863. for ( type in Expr.filter ) {
  9864. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9865. (match = preFilters[ type ]( match ))) ) {
  9866. matched = match.shift();
  9867. tokens.push({
  9868. value: matched,
  9869. type: type,
  9870. matches: match
  9871. });
  9872. soFar = soFar.slice( matched.length );
  9873. }
  9874. }
  9875. if ( !matched ) {
  9876. break;
  9877. }
  9878. }
  9879. // Return the length of the invalid excess
  9880. // if we're just parsing
  9881. // Otherwise, throw an error or return tokens
  9882. return parseOnly ?
  9883. soFar.length :
  9884. soFar ?
  9885. Sizzle.error( selector ) :
  9886. // Cache the tokens
  9887. tokenCache( selector, groups ).slice( 0 );
  9888. };
  9889. function toSelector( tokens ) {
  9890. var i = 0,
  9891. len = tokens.length,
  9892. selector = "";
  9893. for ( ; i < len; i++ ) {
  9894. selector += tokens[i].value;
  9895. }
  9896. return selector;
  9897. }
  9898. function addCombinator( matcher, combinator, base ) {
  9899. var dir = combinator.dir,
  9900. skip = combinator.next,
  9901. key = skip || dir,
  9902. checkNonElements = base && key === "parentNode",
  9903. doneName = done++;
  9904. return combinator.first ?
  9905. // Check against closest ancestor/preceding element
  9906. function( elem, context, xml ) {
  9907. while ( (elem = elem[ dir ]) ) {
  9908. if ( elem.nodeType === 1 || checkNonElements ) {
  9909. return matcher( elem, context, xml );
  9910. }
  9911. }
  9912. return false;
  9913. } :
  9914. // Check against all ancestor/preceding elements
  9915. function( elem, context, xml ) {
  9916. var oldCache, uniqueCache, outerCache,
  9917. newCache = [ dirruns, doneName ];
  9918. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  9919. if ( xml ) {
  9920. while ( (elem = elem[ dir ]) ) {
  9921. if ( elem.nodeType === 1 || checkNonElements ) {
  9922. if ( matcher( elem, context, xml ) ) {
  9923. return true;
  9924. }
  9925. }
  9926. }
  9927. } else {
  9928. while ( (elem = elem[ dir ]) ) {
  9929. if ( elem.nodeType === 1 || checkNonElements ) {
  9930. outerCache = elem[ expando ] || (elem[ expando ] = {});
  9931. // Support: IE <9 only
  9932. // Defend against cloned attroperties (jQuery gh-1709)
  9933. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  9934. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  9935. elem = elem[ dir ] || elem;
  9936. } else if ( (oldCache = uniqueCache[ key ]) &&
  9937. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  9938. // Assign to newCache so results back-propagate to previous elements
  9939. return (newCache[ 2 ] = oldCache[ 2 ]);
  9940. } else {
  9941. // Reuse newcache so results back-propagate to previous elements
  9942. uniqueCache[ key ] = newCache;
  9943. // A match means we're done; a fail means we have to keep checking
  9944. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  9945. return true;
  9946. }
  9947. }
  9948. }
  9949. }
  9950. }
  9951. return false;
  9952. };
  9953. }
  9954. function elementMatcher( matchers ) {
  9955. return matchers.length > 1 ?
  9956. function( elem, context, xml ) {
  9957. var i = matchers.length;
  9958. while ( i-- ) {
  9959. if ( !matchers[i]( elem, context, xml ) ) {
  9960. return false;
  9961. }
  9962. }
  9963. return true;
  9964. } :
  9965. matchers[0];
  9966. }
  9967. function multipleContexts( selector, contexts, results ) {
  9968. var i = 0,
  9969. len = contexts.length;
  9970. for ( ; i < len; i++ ) {
  9971. Sizzle( selector, contexts[i], results );
  9972. }
  9973. return results;
  9974. }
  9975. function condense( unmatched, map, filter, context, xml ) {
  9976. var elem,
  9977. newUnmatched = [],
  9978. i = 0,
  9979. len = unmatched.length,
  9980. mapped = map != null;
  9981. for ( ; i < len; i++ ) {
  9982. if ( (elem = unmatched[i]) ) {
  9983. if ( !filter || filter( elem, context, xml ) ) {
  9984. newUnmatched.push( elem );
  9985. if ( mapped ) {
  9986. map.push( i );
  9987. }
  9988. }
  9989. }
  9990. }
  9991. return newUnmatched;
  9992. }
  9993. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  9994. if ( postFilter && !postFilter[ expando ] ) {
  9995. postFilter = setMatcher( postFilter );
  9996. }
  9997. if ( postFinder && !postFinder[ expando ] ) {
  9998. postFinder = setMatcher( postFinder, postSelector );
  9999. }
  10000. return markFunction(function( seed, results, context, xml ) {
  10001. var temp, i, elem,
  10002. preMap = [],
  10003. postMap = [],
  10004. preexisting = results.length,
  10005. // Get initial elements from seed or context
  10006. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10007. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10008. matcherIn = preFilter && ( seed || !selector ) ?
  10009. condense( elems, preMap, preFilter, context, xml ) :
  10010. elems,
  10011. matcherOut = matcher ?
  10012. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10013. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10014. // ...intermediate processing is necessary
  10015. [] :
  10016. // ...otherwise use results directly
  10017. results :
  10018. matcherIn;
  10019. // Find primary matches
  10020. if ( matcher ) {
  10021. matcher( matcherIn, matcherOut, context, xml );
  10022. }
  10023. // Apply postFilter
  10024. if ( postFilter ) {
  10025. temp = condense( matcherOut, postMap );
  10026. postFilter( temp, [], context, xml );
  10027. // Un-match failing elements by moving them back to matcherIn
  10028. i = temp.length;
  10029. while ( i-- ) {
  10030. if ( (elem = temp[i]) ) {
  10031. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10032. }
  10033. }
  10034. }
  10035. if ( seed ) {
  10036. if ( postFinder || preFilter ) {
  10037. if ( postFinder ) {
  10038. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10039. temp = [];
  10040. i = matcherOut.length;
  10041. while ( i-- ) {
  10042. if ( (elem = matcherOut[i]) ) {
  10043. // Restore matcherIn since elem is not yet a final match
  10044. temp.push( (matcherIn[i] = elem) );
  10045. }
  10046. }
  10047. postFinder( null, (matcherOut = []), temp, xml );
  10048. }
  10049. // Move matched elements from seed to results to keep them synchronized
  10050. i = matcherOut.length;
  10051. while ( i-- ) {
  10052. if ( (elem = matcherOut[i]) &&
  10053. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10054. seed[temp] = !(results[temp] = elem);
  10055. }
  10056. }
  10057. }
  10058. // Add elements to results, through postFinder if defined
  10059. } else {
  10060. matcherOut = condense(
  10061. matcherOut === results ?
  10062. matcherOut.splice( preexisting, matcherOut.length ) :
  10063. matcherOut
  10064. );
  10065. if ( postFinder ) {
  10066. postFinder( null, results, matcherOut, xml );
  10067. } else {
  10068. push.apply( results, matcherOut );
  10069. }
  10070. }
  10071. });
  10072. }
  10073. function matcherFromTokens( tokens ) {
  10074. var checkContext, matcher, j,
  10075. len = tokens.length,
  10076. leadingRelative = Expr.relative[ tokens[0].type ],
  10077. implicitRelative = leadingRelative || Expr.relative[" "],
  10078. i = leadingRelative ? 1 : 0,
  10079. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10080. matchContext = addCombinator( function( elem ) {
  10081. return elem === checkContext;
  10082. }, implicitRelative, true ),
  10083. matchAnyContext = addCombinator( function( elem ) {
  10084. return indexOf( checkContext, elem ) > -1;
  10085. }, implicitRelative, true ),
  10086. matchers = [ function( elem, context, xml ) {
  10087. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10088. (checkContext = context).nodeType ?
  10089. matchContext( elem, context, xml ) :
  10090. matchAnyContext( elem, context, xml ) );
  10091. // Avoid hanging onto element (issue #299)
  10092. checkContext = null;
  10093. return ret;
  10094. } ];
  10095. for ( ; i < len; i++ ) {
  10096. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10097. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10098. } else {
  10099. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10100. // Return special upon seeing a positional matcher
  10101. if ( matcher[ expando ] ) {
  10102. // Find the next relative operator (if any) for proper handling
  10103. j = ++i;
  10104. for ( ; j < len; j++ ) {
  10105. if ( Expr.relative[ tokens[j].type ] ) {
  10106. break;
  10107. }
  10108. }
  10109. return setMatcher(
  10110. i > 1 && elementMatcher( matchers ),
  10111. i > 1 && toSelector(
  10112. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10113. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10114. ).replace( rtrim, "$1" ),
  10115. matcher,
  10116. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10117. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10118. j < len && toSelector( tokens )
  10119. );
  10120. }
  10121. matchers.push( matcher );
  10122. }
  10123. }
  10124. return elementMatcher( matchers );
  10125. }
  10126. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10127. var bySet = setMatchers.length > 0,
  10128. byElement = elementMatchers.length > 0,
  10129. superMatcher = function( seed, context, xml, results, outermost ) {
  10130. var elem, j, matcher,
  10131. matchedCount = 0,
  10132. i = "0",
  10133. unmatched = seed && [],
  10134. setMatched = [],
  10135. contextBackup = outermostContext,
  10136. // We must always have either seed elements or outermost context
  10137. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10138. // Use integer dirruns iff this is the outermost matcher
  10139. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10140. len = elems.length;
  10141. if ( outermost ) {
  10142. outermostContext = context === document || context || outermost;
  10143. }
  10144. // Add elements passing elementMatchers directly to results
  10145. // Support: IE<9, Safari
  10146. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10147. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10148. if ( byElement && elem ) {
  10149. j = 0;
  10150. if ( !context && elem.ownerDocument !== document ) {
  10151. setDocument( elem );
  10152. xml = !documentIsHTML;
  10153. }
  10154. while ( (matcher = elementMatchers[j++]) ) {
  10155. if ( matcher( elem, context || document, xml) ) {
  10156. results.push( elem );
  10157. break;
  10158. }
  10159. }
  10160. if ( outermost ) {
  10161. dirruns = dirrunsUnique;
  10162. }
  10163. }
  10164. // Track unmatched elements for set filters
  10165. if ( bySet ) {
  10166. // They will have gone through all possible matchers
  10167. if ( (elem = !matcher && elem) ) {
  10168. matchedCount--;
  10169. }
  10170. // Lengthen the array for every element, matched or not
  10171. if ( seed ) {
  10172. unmatched.push( elem );
  10173. }
  10174. }
  10175. }
  10176. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10177. // makes the latter nonnegative.
  10178. matchedCount += i;
  10179. // Apply set filters to unmatched elements
  10180. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10181. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10182. // no element matchers and no seed.
  10183. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10184. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10185. // numerically zero.
  10186. if ( bySet && i !== matchedCount ) {
  10187. j = 0;
  10188. while ( (matcher = setMatchers[j++]) ) {
  10189. matcher( unmatched, setMatched, context, xml );
  10190. }
  10191. if ( seed ) {
  10192. // Reintegrate element matches to eliminate the need for sorting
  10193. if ( matchedCount > 0 ) {
  10194. while ( i-- ) {
  10195. if ( !(unmatched[i] || setMatched[i]) ) {
  10196. setMatched[i] = pop.call( results );
  10197. }
  10198. }
  10199. }
  10200. // Discard index placeholder values to get only actual matches
  10201. setMatched = condense( setMatched );
  10202. }
  10203. // Add matches to results
  10204. push.apply( results, setMatched );
  10205. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10206. if ( outermost && !seed && setMatched.length > 0 &&
  10207. ( matchedCount + setMatchers.length ) > 1 ) {
  10208. Sizzle.uniqueSort( results );
  10209. }
  10210. }
  10211. // Override manipulation of globals by nested matchers
  10212. if ( outermost ) {
  10213. dirruns = dirrunsUnique;
  10214. outermostContext = contextBackup;
  10215. }
  10216. return unmatched;
  10217. };
  10218. return bySet ?
  10219. markFunction( superMatcher ) :
  10220. superMatcher;
  10221. }
  10222. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10223. var i,
  10224. setMatchers = [],
  10225. elementMatchers = [],
  10226. cached = compilerCache[ selector + " " ];
  10227. if ( !cached ) {
  10228. // Generate a function of recursive functions that can be used to check each element
  10229. if ( !match ) {
  10230. match = tokenize( selector );
  10231. }
  10232. i = match.length;
  10233. while ( i-- ) {
  10234. cached = matcherFromTokens( match[i] );
  10235. if ( cached[ expando ] ) {
  10236. setMatchers.push( cached );
  10237. } else {
  10238. elementMatchers.push( cached );
  10239. }
  10240. }
  10241. // Cache the compiled function
  10242. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10243. // Save selector and tokenization
  10244. cached.selector = selector;
  10245. }
  10246. return cached;
  10247. };
  10248. /**
  10249. * A low-level selection function that works with Sizzle's compiled
  10250. * selector functions
  10251. * @param {String|Function} selector A selector or a pre-compiled
  10252. * selector function built with Sizzle.compile
  10253. * @param {Element} context
  10254. * @param {Array} [results]
  10255. * @param {Array} [seed] A set of elements to match against
  10256. */
  10257. select = Sizzle.select = function( selector, context, results, seed ) {
  10258. var i, tokens, token, type, find,
  10259. compiled = typeof selector === "function" && selector,
  10260. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10261. results = results || [];
  10262. // Try to minimize operations if there is only one selector in the list and no seed
  10263. // (the latter of which guarantees us context)
  10264. if ( match.length === 1 ) {
  10265. // Reduce context if the leading compound selector is an ID
  10266. tokens = match[0] = match[0].slice( 0 );
  10267. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10268. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10269. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10270. if ( !context ) {
  10271. return results;
  10272. // Precompiled matchers will still verify ancestry, so step up a level
  10273. } else if ( compiled ) {
  10274. context = context.parentNode;
  10275. }
  10276. selector = selector.slice( tokens.shift().value.length );
  10277. }
  10278. // Fetch a seed set for right-to-left matching
  10279. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10280. while ( i-- ) {
  10281. token = tokens[i];
  10282. // Abort if we hit a combinator
  10283. if ( Expr.relative[ (type = token.type) ] ) {
  10284. break;
  10285. }
  10286. if ( (find = Expr.find[ type ]) ) {
  10287. // Search, expanding context for leading sibling combinators
  10288. if ( (seed = find(
  10289. token.matches[0].replace( runescape, funescape ),
  10290. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10291. )) ) {
  10292. // If seed is empty or no tokens remain, we can return early
  10293. tokens.splice( i, 1 );
  10294. selector = seed.length && toSelector( tokens );
  10295. if ( !selector ) {
  10296. push.apply( results, seed );
  10297. return results;
  10298. }
  10299. break;
  10300. }
  10301. }
  10302. }
  10303. }
  10304. // Compile and execute a filtering function if one is not provided
  10305. // Provide `match` to avoid retokenization if we modified the selector above
  10306. ( compiled || compile( selector, match ) )(
  10307. seed,
  10308. context,
  10309. !documentIsHTML,
  10310. results,
  10311. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10312. );
  10313. return results;
  10314. };
  10315. // One-time assignments
  10316. // Sort stability
  10317. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10318. // Support: Chrome 14-35+
  10319. // Always assume duplicates if they aren't passed to the comparison function
  10320. support.detectDuplicates = !!hasDuplicate;
  10321. // Initialize against the default document
  10322. setDocument();
  10323. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10324. // Detached nodes confoundingly follow *each other*
  10325. support.sortDetached = assert(function( el ) {
  10326. // Should return 1, but returns 4 (following)
  10327. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10328. });
  10329. // Support: IE<8
  10330. // Prevent attribute/property "interpolation"
  10331. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10332. if ( !assert(function( el ) {
  10333. el.innerHTML = "<a href='#'></a>";
  10334. return el.firstChild.getAttribute("href") === "#" ;
  10335. }) ) {
  10336. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10337. if ( !isXML ) {
  10338. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10339. }
  10340. });
  10341. }
  10342. // Support: IE<9
  10343. // Use defaultValue in place of getAttribute("value")
  10344. if ( !support.attributes || !assert(function( el ) {
  10345. el.innerHTML = "<input/>";
  10346. el.firstChild.setAttribute( "value", "" );
  10347. return el.firstChild.getAttribute( "value" ) === "";
  10348. }) ) {
  10349. addHandle( "value", function( elem, name, isXML ) {
  10350. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10351. return elem.defaultValue;
  10352. }
  10353. });
  10354. }
  10355. // Support: IE<9
  10356. // Use getAttributeNode to fetch booleans when getAttribute lies
  10357. if ( !assert(function( el ) {
  10358. return el.getAttribute("disabled") == null;
  10359. }) ) {
  10360. addHandle( booleans, function( elem, name, isXML ) {
  10361. var val;
  10362. if ( !isXML ) {
  10363. return elem[ name ] === true ? name.toLowerCase() :
  10364. (val = elem.getAttributeNode( name )) && val.specified ?
  10365. val.value :
  10366. null;
  10367. }
  10368. });
  10369. }
  10370. return Sizzle;
  10371. })( window );
  10372. jQuery.find = Sizzle;
  10373. jQuery.expr = Sizzle.selectors;
  10374. // Deprecated
  10375. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10376. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10377. jQuery.text = Sizzle.getText;
  10378. jQuery.isXMLDoc = Sizzle.isXML;
  10379. jQuery.contains = Sizzle.contains;
  10380. jQuery.escapeSelector = Sizzle.escape;
  10381. var dir = function( elem, dir, until ) {
  10382. var matched = [],
  10383. truncate = until !== undefined;
  10384. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10385. if ( elem.nodeType === 1 ) {
  10386. if ( truncate && jQuery( elem ).is( until ) ) {
  10387. break;
  10388. }
  10389. matched.push( elem );
  10390. }
  10391. }
  10392. return matched;
  10393. };
  10394. var siblings = function( n, elem ) {
  10395. var matched = [];
  10396. for ( ; n; n = n.nextSibling ) {
  10397. if ( n.nodeType === 1 && n !== elem ) {
  10398. matched.push( n );
  10399. }
  10400. }
  10401. return matched;
  10402. };
  10403. var rneedsContext = jQuery.expr.match.needsContext;
  10404. function nodeName( elem, name ) {
  10405. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10406. };
  10407. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10408. // Implement the identical functionality for filter and not
  10409. function winnow( elements, qualifier, not ) {
  10410. if ( isFunction( qualifier ) ) {
  10411. return jQuery.grep( elements, function( elem, i ) {
  10412. return !!qualifier.call( elem, i, elem ) !== not;
  10413. } );
  10414. }
  10415. // Single element
  10416. if ( qualifier.nodeType ) {
  10417. return jQuery.grep( elements, function( elem ) {
  10418. return ( elem === qualifier ) !== not;
  10419. } );
  10420. }
  10421. // Arraylike of elements (jQuery, arguments, Array)
  10422. if ( typeof qualifier !== "string" ) {
  10423. return jQuery.grep( elements, function( elem ) {
  10424. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10425. } );
  10426. }
  10427. // Filtered directly for both simple and complex selectors
  10428. return jQuery.filter( qualifier, elements, not );
  10429. }
  10430. jQuery.filter = function( expr, elems, not ) {
  10431. var elem = elems[ 0 ];
  10432. if ( not ) {
  10433. expr = ":not(" + expr + ")";
  10434. }
  10435. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10436. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10437. }
  10438. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10439. return elem.nodeType === 1;
  10440. } ) );
  10441. };
  10442. jQuery.fn.extend( {
  10443. find: function( selector ) {
  10444. var i, ret,
  10445. len = this.length,
  10446. self = this;
  10447. if ( typeof selector !== "string" ) {
  10448. return this.pushStack( jQuery( selector ).filter( function() {
  10449. for ( i = 0; i < len; i++ ) {
  10450. if ( jQuery.contains( self[ i ], this ) ) {
  10451. return true;
  10452. }
  10453. }
  10454. } ) );
  10455. }
  10456. ret = this.pushStack( [] );
  10457. for ( i = 0; i < len; i++ ) {
  10458. jQuery.find( selector, self[ i ], ret );
  10459. }
  10460. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10461. },
  10462. filter: function( selector ) {
  10463. return this.pushStack( winnow( this, selector || [], false ) );
  10464. },
  10465. not: function( selector ) {
  10466. return this.pushStack( winnow( this, selector || [], true ) );
  10467. },
  10468. is: function( selector ) {
  10469. return !!winnow(
  10470. this,
  10471. // If this is a positional/relative selector, check membership in the returned set
  10472. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10473. typeof selector === "string" && rneedsContext.test( selector ) ?
  10474. jQuery( selector ) :
  10475. selector || [],
  10476. false
  10477. ).length;
  10478. }
  10479. } );
  10480. // Initialize a jQuery object
  10481. // A central reference to the root jQuery(document)
  10482. var rootjQuery,
  10483. // A simple way to check for HTML strings
  10484. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10485. // Strict HTML recognition (#11290: must start with <)
  10486. // Shortcut simple #id case for speed
  10487. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10488. init = jQuery.fn.init = function( selector, context, root ) {
  10489. var match, elem;
  10490. // HANDLE: $(""), $(null), $(undefined), $(false)
  10491. if ( !selector ) {
  10492. return this;
  10493. }
  10494. // Method init() accepts an alternate rootjQuery
  10495. // so migrate can support jQuery.sub (gh-2101)
  10496. root = root || rootjQuery;
  10497. // Handle HTML strings
  10498. if ( typeof selector === "string" ) {
  10499. if ( selector[ 0 ] === "<" &&
  10500. selector[ selector.length - 1 ] === ">" &&
  10501. selector.length >= 3 ) {
  10502. // Assume that strings that start and end with <> are HTML and skip the regex check
  10503. match = [ null, selector, null ];
  10504. } else {
  10505. match = rquickExpr.exec( selector );
  10506. }
  10507. // Match html or make sure no context is specified for #id
  10508. if ( match && ( match[ 1 ] || !context ) ) {
  10509. // HANDLE: $(html) -> $(array)
  10510. if ( match[ 1 ] ) {
  10511. context = context instanceof jQuery ? context[ 0 ] : context;
  10512. // Option to run scripts is true for back-compat
  10513. // Intentionally let the error be thrown if parseHTML is not present
  10514. jQuery.merge( this, jQuery.parseHTML(
  10515. match[ 1 ],
  10516. context && context.nodeType ? context.ownerDocument || context : document,
  10517. true
  10518. ) );
  10519. // HANDLE: $(html, props)
  10520. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10521. for ( match in context ) {
  10522. // Properties of context are called as methods if possible
  10523. if ( isFunction( this[ match ] ) ) {
  10524. this[ match ]( context[ match ] );
  10525. // ...and otherwise set as attributes
  10526. } else {
  10527. this.attr( match, context[ match ] );
  10528. }
  10529. }
  10530. }
  10531. return this;
  10532. // HANDLE: $(#id)
  10533. } else {
  10534. elem = document.getElementById( match[ 2 ] );
  10535. if ( elem ) {
  10536. // Inject the element directly into the jQuery object
  10537. this[ 0 ] = elem;
  10538. this.length = 1;
  10539. }
  10540. return this;
  10541. }
  10542. // HANDLE: $(expr, $(...))
  10543. } else if ( !context || context.jquery ) {
  10544. return ( context || root ).find( selector );
  10545. // HANDLE: $(expr, context)
  10546. // (which is just equivalent to: $(context).find(expr)
  10547. } else {
  10548. return this.constructor( context ).find( selector );
  10549. }
  10550. // HANDLE: $(DOMElement)
  10551. } else if ( selector.nodeType ) {
  10552. this[ 0 ] = selector;
  10553. this.length = 1;
  10554. return this;
  10555. // HANDLE: $(function)
  10556. // Shortcut for document ready
  10557. } else if ( isFunction( selector ) ) {
  10558. return root.ready !== undefined ?
  10559. root.ready( selector ) :
  10560. // Execute immediately if ready is not present
  10561. selector( jQuery );
  10562. }
  10563. return jQuery.makeArray( selector, this );
  10564. };
  10565. // Give the init function the jQuery prototype for later instantiation
  10566. init.prototype = jQuery.fn;
  10567. // Initialize central reference
  10568. rootjQuery = jQuery( document );
  10569. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10570. // Methods guaranteed to produce a unique set when starting from a unique set
  10571. guaranteedUnique = {
  10572. children: true,
  10573. contents: true,
  10574. next: true,
  10575. prev: true
  10576. };
  10577. jQuery.fn.extend( {
  10578. has: function( target ) {
  10579. var targets = jQuery( target, this ),
  10580. l = targets.length;
  10581. return this.filter( function() {
  10582. var i = 0;
  10583. for ( ; i < l; i++ ) {
  10584. if ( jQuery.contains( this, targets[ i ] ) ) {
  10585. return true;
  10586. }
  10587. }
  10588. } );
  10589. },
  10590. closest: function( selectors, context ) {
  10591. var cur,
  10592. i = 0,
  10593. l = this.length,
  10594. matched = [],
  10595. targets = typeof selectors !== "string" && jQuery( selectors );
  10596. // Positional selectors never match, since there's no _selection_ context
  10597. if ( !rneedsContext.test( selectors ) ) {
  10598. for ( ; i < l; i++ ) {
  10599. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10600. // Always skip document fragments
  10601. if ( cur.nodeType < 11 && ( targets ?
  10602. targets.index( cur ) > -1 :
  10603. // Don't pass non-elements to Sizzle
  10604. cur.nodeType === 1 &&
  10605. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10606. matched.push( cur );
  10607. break;
  10608. }
  10609. }
  10610. }
  10611. }
  10612. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10613. },
  10614. // Determine the position of an element within the set
  10615. index: function( elem ) {
  10616. // No argument, return index in parent
  10617. if ( !elem ) {
  10618. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10619. }
  10620. // Index in selector
  10621. if ( typeof elem === "string" ) {
  10622. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10623. }
  10624. // Locate the position of the desired element
  10625. return indexOf.call( this,
  10626. // If it receives a jQuery object, the first element is used
  10627. elem.jquery ? elem[ 0 ] : elem
  10628. );
  10629. },
  10630. add: function( selector, context ) {
  10631. return this.pushStack(
  10632. jQuery.uniqueSort(
  10633. jQuery.merge( this.get(), jQuery( selector, context ) )
  10634. )
  10635. );
  10636. },
  10637. addBack: function( selector ) {
  10638. return this.add( selector == null ?
  10639. this.prevObject : this.prevObject.filter( selector )
  10640. );
  10641. }
  10642. } );
  10643. function sibling( cur, dir ) {
  10644. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10645. return cur;
  10646. }
  10647. jQuery.each( {
  10648. parent: function( elem ) {
  10649. var parent = elem.parentNode;
  10650. return parent && parent.nodeType !== 11 ? parent : null;
  10651. },
  10652. parents: function( elem ) {
  10653. return dir( elem, "parentNode" );
  10654. },
  10655. parentsUntil: function( elem, i, until ) {
  10656. return dir( elem, "parentNode", until );
  10657. },
  10658. next: function( elem ) {
  10659. return sibling( elem, "nextSibling" );
  10660. },
  10661. prev: function( elem ) {
  10662. return sibling( elem, "previousSibling" );
  10663. },
  10664. nextAll: function( elem ) {
  10665. return dir( elem, "nextSibling" );
  10666. },
  10667. prevAll: function( elem ) {
  10668. return dir( elem, "previousSibling" );
  10669. },
  10670. nextUntil: function( elem, i, until ) {
  10671. return dir( elem, "nextSibling", until );
  10672. },
  10673. prevUntil: function( elem, i, until ) {
  10674. return dir( elem, "previousSibling", until );
  10675. },
  10676. siblings: function( elem ) {
  10677. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10678. },
  10679. children: function( elem ) {
  10680. return siblings( elem.firstChild );
  10681. },
  10682. contents: function( elem ) {
  10683. if ( typeof elem.contentDocument !== "undefined" ) {
  10684. return elem.contentDocument;
  10685. }
  10686. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10687. // Treat the template element as a regular one in browsers that
  10688. // don't support it.
  10689. if ( nodeName( elem, "template" ) ) {
  10690. elem = elem.content || elem;
  10691. }
  10692. return jQuery.merge( [], elem.childNodes );
  10693. }
  10694. }, function( name, fn ) {
  10695. jQuery.fn[ name ] = function( until, selector ) {
  10696. var matched = jQuery.map( this, fn, until );
  10697. if ( name.slice( -5 ) !== "Until" ) {
  10698. selector = until;
  10699. }
  10700. if ( selector && typeof selector === "string" ) {
  10701. matched = jQuery.filter( selector, matched );
  10702. }
  10703. if ( this.length > 1 ) {
  10704. // Remove duplicates
  10705. if ( !guaranteedUnique[ name ] ) {
  10706. jQuery.uniqueSort( matched );
  10707. }
  10708. // Reverse order for parents* and prev-derivatives
  10709. if ( rparentsprev.test( name ) ) {
  10710. matched.reverse();
  10711. }
  10712. }
  10713. return this.pushStack( matched );
  10714. };
  10715. } );
  10716. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10717. // Convert String-formatted options into Object-formatted ones
  10718. function createOptions( options ) {
  10719. var object = {};
  10720. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10721. object[ flag ] = true;
  10722. } );
  10723. return object;
  10724. }
  10725. /*
  10726. * Create a callback list using the following parameters:
  10727. *
  10728. * options: an optional list of space-separated options that will change how
  10729. * the callback list behaves or a more traditional option object
  10730. *
  10731. * By default a callback list will act like an event callback list and can be
  10732. * "fired" multiple times.
  10733. *
  10734. * Possible options:
  10735. *
  10736. * once: will ensure the callback list can only be fired once (like a Deferred)
  10737. *
  10738. * memory: will keep track of previous values and will call any callback added
  10739. * after the list has been fired right away with the latest "memorized"
  10740. * values (like a Deferred)
  10741. *
  10742. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10743. *
  10744. * stopOnFalse: interrupt callings when a callback returns false
  10745. *
  10746. */
  10747. jQuery.Callbacks = function( options ) {
  10748. // Convert options from String-formatted to Object-formatted if needed
  10749. // (we check in cache first)
  10750. options = typeof options === "string" ?
  10751. createOptions( options ) :
  10752. jQuery.extend( {}, options );
  10753. var // Flag to know if list is currently firing
  10754. firing,
  10755. // Last fire value for non-forgettable lists
  10756. memory,
  10757. // Flag to know if list was already fired
  10758. fired,
  10759. // Flag to prevent firing
  10760. locked,
  10761. // Actual callback list
  10762. list = [],
  10763. // Queue of execution data for repeatable lists
  10764. queue = [],
  10765. // Index of currently firing callback (modified by add/remove as needed)
  10766. firingIndex = -1,
  10767. // Fire callbacks
  10768. fire = function() {
  10769. // Enforce single-firing
  10770. locked = locked || options.once;
  10771. // Execute callbacks for all pending executions,
  10772. // respecting firingIndex overrides and runtime changes
  10773. fired = firing = true;
  10774. for ( ; queue.length; firingIndex = -1 ) {
  10775. memory = queue.shift();
  10776. while ( ++firingIndex < list.length ) {
  10777. // Run callback and check for early termination
  10778. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10779. options.stopOnFalse ) {
  10780. // Jump to end and forget the data so .add doesn't re-fire
  10781. firingIndex = list.length;
  10782. memory = false;
  10783. }
  10784. }
  10785. }
  10786. // Forget the data if we're done with it
  10787. if ( !options.memory ) {
  10788. memory = false;
  10789. }
  10790. firing = false;
  10791. // Clean up if we're done firing for good
  10792. if ( locked ) {
  10793. // Keep an empty list if we have data for future add calls
  10794. if ( memory ) {
  10795. list = [];
  10796. // Otherwise, this object is spent
  10797. } else {
  10798. list = "";
  10799. }
  10800. }
  10801. },
  10802. // Actual Callbacks object
  10803. self = {
  10804. // Add a callback or a collection of callbacks to the list
  10805. add: function() {
  10806. if ( list ) {
  10807. // If we have memory from a past run, we should fire after adding
  10808. if ( memory && !firing ) {
  10809. firingIndex = list.length - 1;
  10810. queue.push( memory );
  10811. }
  10812. ( function add( args ) {
  10813. jQuery.each( args, function( _, arg ) {
  10814. if ( isFunction( arg ) ) {
  10815. if ( !options.unique || !self.has( arg ) ) {
  10816. list.push( arg );
  10817. }
  10818. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10819. // Inspect recursively
  10820. add( arg );
  10821. }
  10822. } );
  10823. } )( arguments );
  10824. if ( memory && !firing ) {
  10825. fire();
  10826. }
  10827. }
  10828. return this;
  10829. },
  10830. // Remove a callback from the list
  10831. remove: function() {
  10832. jQuery.each( arguments, function( _, arg ) {
  10833. var index;
  10834. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10835. list.splice( index, 1 );
  10836. // Handle firing indexes
  10837. if ( index <= firingIndex ) {
  10838. firingIndex--;
  10839. }
  10840. }
  10841. } );
  10842. return this;
  10843. },
  10844. // Check if a given callback is in the list.
  10845. // If no argument is given, return whether or not list has callbacks attached.
  10846. has: function( fn ) {
  10847. return fn ?
  10848. jQuery.inArray( fn, list ) > -1 :
  10849. list.length > 0;
  10850. },
  10851. // Remove all callbacks from the list
  10852. empty: function() {
  10853. if ( list ) {
  10854. list = [];
  10855. }
  10856. return this;
  10857. },
  10858. // Disable .fire and .add
  10859. // Abort any current/pending executions
  10860. // Clear all callbacks and values
  10861. disable: function() {
  10862. locked = queue = [];
  10863. list = memory = "";
  10864. return this;
  10865. },
  10866. disabled: function() {
  10867. return !list;
  10868. },
  10869. // Disable .fire
  10870. // Also disable .add unless we have memory (since it would have no effect)
  10871. // Abort any pending executions
  10872. lock: function() {
  10873. locked = queue = [];
  10874. if ( !memory && !firing ) {
  10875. list = memory = "";
  10876. }
  10877. return this;
  10878. },
  10879. locked: function() {
  10880. return !!locked;
  10881. },
  10882. // Call all callbacks with the given context and arguments
  10883. fireWith: function( context, args ) {
  10884. if ( !locked ) {
  10885. args = args || [];
  10886. args = [ context, args.slice ? args.slice() : args ];
  10887. queue.push( args );
  10888. if ( !firing ) {
  10889. fire();
  10890. }
  10891. }
  10892. return this;
  10893. },
  10894. // Call all the callbacks with the given arguments
  10895. fire: function() {
  10896. self.fireWith( this, arguments );
  10897. return this;
  10898. },
  10899. // To know if the callbacks have already been called at least once
  10900. fired: function() {
  10901. return !!fired;
  10902. }
  10903. };
  10904. return self;
  10905. };
  10906. function Identity( v ) {
  10907. return v;
  10908. }
  10909. function Thrower( ex ) {
  10910. throw ex;
  10911. }
  10912. function adoptValue( value, resolve, reject, noValue ) {
  10913. var method;
  10914. try {
  10915. // Check for promise aspect first to privilege synchronous behavior
  10916. if ( value && isFunction( ( method = value.promise ) ) ) {
  10917. method.call( value ).done( resolve ).fail( reject );
  10918. // Other thenables
  10919. } else if ( value && isFunction( ( method = value.then ) ) ) {
  10920. method.call( value, resolve, reject );
  10921. // Other non-thenables
  10922. } else {
  10923. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  10924. // * false: [ value ].slice( 0 ) => resolve( value )
  10925. // * true: [ value ].slice( 1 ) => resolve()
  10926. resolve.apply( undefined, [ value ].slice( noValue ) );
  10927. }
  10928. // For Promises/A+, convert exceptions into rejections
  10929. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  10930. // Deferred#then to conditionally suppress rejection.
  10931. } catch ( value ) {
  10932. // Support: Android 4.0 only
  10933. // Strict mode functions invoked without .call/.apply get global-object context
  10934. reject.apply( undefined, [ value ] );
  10935. }
  10936. }
  10937. jQuery.extend( {
  10938. Deferred: function( func ) {
  10939. var tuples = [
  10940. // action, add listener, callbacks,
  10941. // ... .then handlers, argument index, [final state]
  10942. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  10943. jQuery.Callbacks( "memory" ), 2 ],
  10944. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  10945. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  10946. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  10947. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  10948. ],
  10949. state = "pending",
  10950. promise = {
  10951. state: function() {
  10952. return state;
  10953. },
  10954. always: function() {
  10955. deferred.done( arguments ).fail( arguments );
  10956. return this;
  10957. },
  10958. "catch": function( fn ) {
  10959. return promise.then( null, fn );
  10960. },
  10961. // Keep pipe for back-compat
  10962. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  10963. var fns = arguments;
  10964. return jQuery.Deferred( function( newDefer ) {
  10965. jQuery.each( tuples, function( i, tuple ) {
  10966. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  10967. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  10968. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  10969. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  10970. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  10971. deferred[ tuple[ 1 ] ]( function() {
  10972. var returned = fn && fn.apply( this, arguments );
  10973. if ( returned && isFunction( returned.promise ) ) {
  10974. returned.promise()
  10975. .progress( newDefer.notify )
  10976. .done( newDefer.resolve )
  10977. .fail( newDefer.reject );
  10978. } else {
  10979. newDefer[ tuple[ 0 ] + "With" ](
  10980. this,
  10981. fn ? [ returned ] : arguments
  10982. );
  10983. }
  10984. } );
  10985. } );
  10986. fns = null;
  10987. } ).promise();
  10988. },
  10989. then: function( onFulfilled, onRejected, onProgress ) {
  10990. var maxDepth = 0;
  10991. function resolve( depth, deferred, handler, special ) {
  10992. return function() {
  10993. var that = this,
  10994. args = arguments,
  10995. mightThrow = function() {
  10996. var returned, then;
  10997. // Support: Promises/A+ section 2.3.3.3.3
  10998. // https://promisesaplus.com/#point-59
  10999. // Ignore double-resolution attempts
  11000. if ( depth < maxDepth ) {
  11001. return;
  11002. }
  11003. returned = handler.apply( that, args );
  11004. // Support: Promises/A+ section 2.3.1
  11005. // https://promisesaplus.com/#point-48
  11006. if ( returned === deferred.promise() ) {
  11007. throw new TypeError( "Thenable self-resolution" );
  11008. }
  11009. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11010. // https://promisesaplus.com/#point-54
  11011. // https://promisesaplus.com/#point-75
  11012. // Retrieve `then` only once
  11013. then = returned &&
  11014. // Support: Promises/A+ section 2.3.4
  11015. // https://promisesaplus.com/#point-64
  11016. // Only check objects and functions for thenability
  11017. ( typeof returned === "object" ||
  11018. typeof returned === "function" ) &&
  11019. returned.then;
  11020. // Handle a returned thenable
  11021. if ( isFunction( then ) ) {
  11022. // Special processors (notify) just wait for resolution
  11023. if ( special ) {
  11024. then.call(
  11025. returned,
  11026. resolve( maxDepth, deferred, Identity, special ),
  11027. resolve( maxDepth, deferred, Thrower, special )
  11028. );
  11029. // Normal processors (resolve) also hook into progress
  11030. } else {
  11031. // ...and disregard older resolution values
  11032. maxDepth++;
  11033. then.call(
  11034. returned,
  11035. resolve( maxDepth, deferred, Identity, special ),
  11036. resolve( maxDepth, deferred, Thrower, special ),
  11037. resolve( maxDepth, deferred, Identity,
  11038. deferred.notifyWith )
  11039. );
  11040. }
  11041. // Handle all other returned values
  11042. } else {
  11043. // Only substitute handlers pass on context
  11044. // and multiple values (non-spec behavior)
  11045. if ( handler !== Identity ) {
  11046. that = undefined;
  11047. args = [ returned ];
  11048. }
  11049. // Process the value(s)
  11050. // Default process is resolve
  11051. ( special || deferred.resolveWith )( that, args );
  11052. }
  11053. },
  11054. // Only normal processors (resolve) catch and reject exceptions
  11055. process = special ?
  11056. mightThrow :
  11057. function() {
  11058. try {
  11059. mightThrow();
  11060. } catch ( e ) {
  11061. if ( jQuery.Deferred.exceptionHook ) {
  11062. jQuery.Deferred.exceptionHook( e,
  11063. process.stackTrace );
  11064. }
  11065. // Support: Promises/A+ section 2.3.3.3.4.1
  11066. // https://promisesaplus.com/#point-61
  11067. // Ignore post-resolution exceptions
  11068. if ( depth + 1 >= maxDepth ) {
  11069. // Only substitute handlers pass on context
  11070. // and multiple values (non-spec behavior)
  11071. if ( handler !== Thrower ) {
  11072. that = undefined;
  11073. args = [ e ];
  11074. }
  11075. deferred.rejectWith( that, args );
  11076. }
  11077. }
  11078. };
  11079. // Support: Promises/A+ section 2.3.3.3.1
  11080. // https://promisesaplus.com/#point-57
  11081. // Re-resolve promises immediately to dodge false rejection from
  11082. // subsequent errors
  11083. if ( depth ) {
  11084. process();
  11085. } else {
  11086. // Call an optional hook to record the stack, in case of exception
  11087. // since it's otherwise lost when execution goes async
  11088. if ( jQuery.Deferred.getStackHook ) {
  11089. process.stackTrace = jQuery.Deferred.getStackHook();
  11090. }
  11091. window.setTimeout( process );
  11092. }
  11093. };
  11094. }
  11095. return jQuery.Deferred( function( newDefer ) {
  11096. // progress_handlers.add( ... )
  11097. tuples[ 0 ][ 3 ].add(
  11098. resolve(
  11099. 0,
  11100. newDefer,
  11101. isFunction( onProgress ) ?
  11102. onProgress :
  11103. Identity,
  11104. newDefer.notifyWith
  11105. )
  11106. );
  11107. // fulfilled_handlers.add( ... )
  11108. tuples[ 1 ][ 3 ].add(
  11109. resolve(
  11110. 0,
  11111. newDefer,
  11112. isFunction( onFulfilled ) ?
  11113. onFulfilled :
  11114. Identity
  11115. )
  11116. );
  11117. // rejected_handlers.add( ... )
  11118. tuples[ 2 ][ 3 ].add(
  11119. resolve(
  11120. 0,
  11121. newDefer,
  11122. isFunction( onRejected ) ?
  11123. onRejected :
  11124. Thrower
  11125. )
  11126. );
  11127. } ).promise();
  11128. },
  11129. // Get a promise for this deferred
  11130. // If obj is provided, the promise aspect is added to the object
  11131. promise: function( obj ) {
  11132. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11133. }
  11134. },
  11135. deferred = {};
  11136. // Add list-specific methods
  11137. jQuery.each( tuples, function( i, tuple ) {
  11138. var list = tuple[ 2 ],
  11139. stateString = tuple[ 5 ];
  11140. // promise.progress = list.add
  11141. // promise.done = list.add
  11142. // promise.fail = list.add
  11143. promise[ tuple[ 1 ] ] = list.add;
  11144. // Handle state
  11145. if ( stateString ) {
  11146. list.add(
  11147. function() {
  11148. // state = "resolved" (i.e., fulfilled)
  11149. // state = "rejected"
  11150. state = stateString;
  11151. },
  11152. // rejected_callbacks.disable
  11153. // fulfilled_callbacks.disable
  11154. tuples[ 3 - i ][ 2 ].disable,
  11155. // rejected_handlers.disable
  11156. // fulfilled_handlers.disable
  11157. tuples[ 3 - i ][ 3 ].disable,
  11158. // progress_callbacks.lock
  11159. tuples[ 0 ][ 2 ].lock,
  11160. // progress_handlers.lock
  11161. tuples[ 0 ][ 3 ].lock
  11162. );
  11163. }
  11164. // progress_handlers.fire
  11165. // fulfilled_handlers.fire
  11166. // rejected_handlers.fire
  11167. list.add( tuple[ 3 ].fire );
  11168. // deferred.notify = function() { deferred.notifyWith(...) }
  11169. // deferred.resolve = function() { deferred.resolveWith(...) }
  11170. // deferred.reject = function() { deferred.rejectWith(...) }
  11171. deferred[ tuple[ 0 ] ] = function() {
  11172. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11173. return this;
  11174. };
  11175. // deferred.notifyWith = list.fireWith
  11176. // deferred.resolveWith = list.fireWith
  11177. // deferred.rejectWith = list.fireWith
  11178. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11179. } );
  11180. // Make the deferred a promise
  11181. promise.promise( deferred );
  11182. // Call given func if any
  11183. if ( func ) {
  11184. func.call( deferred, deferred );
  11185. }
  11186. // All done!
  11187. return deferred;
  11188. },
  11189. // Deferred helper
  11190. when: function( singleValue ) {
  11191. var
  11192. // count of uncompleted subordinates
  11193. remaining = arguments.length,
  11194. // count of unprocessed arguments
  11195. i = remaining,
  11196. // subordinate fulfillment data
  11197. resolveContexts = Array( i ),
  11198. resolveValues = slice.call( arguments ),
  11199. // the master Deferred
  11200. master = jQuery.Deferred(),
  11201. // subordinate callback factory
  11202. updateFunc = function( i ) {
  11203. return function( value ) {
  11204. resolveContexts[ i ] = this;
  11205. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11206. if ( !( --remaining ) ) {
  11207. master.resolveWith( resolveContexts, resolveValues );
  11208. }
  11209. };
  11210. };
  11211. // Single- and empty arguments are adopted like Promise.resolve
  11212. if ( remaining <= 1 ) {
  11213. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11214. !remaining );
  11215. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11216. if ( master.state() === "pending" ||
  11217. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11218. return master.then();
  11219. }
  11220. }
  11221. // Multiple arguments are aggregated like Promise.all array elements
  11222. while ( i-- ) {
  11223. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11224. }
  11225. return master.promise();
  11226. }
  11227. } );
  11228. // These usually indicate a programmer mistake during development,
  11229. // warn about them ASAP rather than swallowing them by default.
  11230. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11231. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11232. // Support: IE 8 - 9 only
  11233. // Console exists when dev tools are open, which can happen at any time
  11234. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11235. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11236. }
  11237. };
  11238. jQuery.readyException = function( error ) {
  11239. window.setTimeout( function() {
  11240. throw error;
  11241. } );
  11242. };
  11243. // The deferred used on DOM ready
  11244. var readyList = jQuery.Deferred();
  11245. jQuery.fn.ready = function( fn ) {
  11246. readyList
  11247. .then( fn )
  11248. // Wrap jQuery.readyException in a function so that the lookup
  11249. // happens at the time of error handling instead of callback
  11250. // registration.
  11251. .catch( function( error ) {
  11252. jQuery.readyException( error );
  11253. } );
  11254. return this;
  11255. };
  11256. jQuery.extend( {
  11257. // Is the DOM ready to be used? Set to true once it occurs.
  11258. isReady: false,
  11259. // A counter to track how many items to wait for before
  11260. // the ready event fires. See #6781
  11261. readyWait: 1,
  11262. // Handle when the DOM is ready
  11263. ready: function( wait ) {
  11264. // Abort if there are pending holds or we're already ready
  11265. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11266. return;
  11267. }
  11268. // Remember that the DOM is ready
  11269. jQuery.isReady = true;
  11270. // If a normal DOM Ready event fired, decrement, and wait if need be
  11271. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11272. return;
  11273. }
  11274. // If there are functions bound, to execute
  11275. readyList.resolveWith( document, [ jQuery ] );
  11276. }
  11277. } );
  11278. jQuery.ready.then = readyList.then;
  11279. // The ready event handler and self cleanup method
  11280. function completed() {
  11281. document.removeEventListener( "DOMContentLoaded", completed );
  11282. window.removeEventListener( "load", completed );
  11283. jQuery.ready();
  11284. }
  11285. // Catch cases where $(document).ready() is called
  11286. // after the browser event has already occurred.
  11287. // Support: IE <=9 - 10 only
  11288. // Older IE sometimes signals "interactive" too soon
  11289. if ( document.readyState === "complete" ||
  11290. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11291. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11292. window.setTimeout( jQuery.ready );
  11293. } else {
  11294. // Use the handy event callback
  11295. document.addEventListener( "DOMContentLoaded", completed );
  11296. // A fallback to window.onload, that will always work
  11297. window.addEventListener( "load", completed );
  11298. }
  11299. // Multifunctional method to get and set values of a collection
  11300. // The value/s can optionally be executed if it's a function
  11301. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11302. var i = 0,
  11303. len = elems.length,
  11304. bulk = key == null;
  11305. // Sets many values
  11306. if ( toType( key ) === "object" ) {
  11307. chainable = true;
  11308. for ( i in key ) {
  11309. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11310. }
  11311. // Sets one value
  11312. } else if ( value !== undefined ) {
  11313. chainable = true;
  11314. if ( !isFunction( value ) ) {
  11315. raw = true;
  11316. }
  11317. if ( bulk ) {
  11318. // Bulk operations run against the entire set
  11319. if ( raw ) {
  11320. fn.call( elems, value );
  11321. fn = null;
  11322. // ...except when executing function values
  11323. } else {
  11324. bulk = fn;
  11325. fn = function( elem, key, value ) {
  11326. return bulk.call( jQuery( elem ), value );
  11327. };
  11328. }
  11329. }
  11330. if ( fn ) {
  11331. for ( ; i < len; i++ ) {
  11332. fn(
  11333. elems[ i ], key, raw ?
  11334. value :
  11335. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11336. );
  11337. }
  11338. }
  11339. }
  11340. if ( chainable ) {
  11341. return elems;
  11342. }
  11343. // Gets
  11344. if ( bulk ) {
  11345. return fn.call( elems );
  11346. }
  11347. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11348. };
  11349. // Matches dashed string for camelizing
  11350. var rmsPrefix = /^-ms-/,
  11351. rdashAlpha = /-([a-z])/g;
  11352. // Used by camelCase as callback to replace()
  11353. function fcamelCase( all, letter ) {
  11354. return letter.toUpperCase();
  11355. }
  11356. // Convert dashed to camelCase; used by the css and data modules
  11357. // Support: IE <=9 - 11, Edge 12 - 15
  11358. // Microsoft forgot to hump their vendor prefix (#9572)
  11359. function camelCase( string ) {
  11360. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11361. }
  11362. var acceptData = function( owner ) {
  11363. // Accepts only:
  11364. // - Node
  11365. // - Node.ELEMENT_NODE
  11366. // - Node.DOCUMENT_NODE
  11367. // - Object
  11368. // - Any
  11369. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11370. };
  11371. function Data() {
  11372. this.expando = jQuery.expando + Data.uid++;
  11373. }
  11374. Data.uid = 1;
  11375. Data.prototype = {
  11376. cache: function( owner ) {
  11377. // Check if the owner object already has a cache
  11378. var value = owner[ this.expando ];
  11379. // If not, create one
  11380. if ( !value ) {
  11381. value = {};
  11382. // We can accept data for non-element nodes in modern browsers,
  11383. // but we should not, see #8335.
  11384. // Always return an empty object.
  11385. if ( acceptData( owner ) ) {
  11386. // If it is a node unlikely to be stringify-ed or looped over
  11387. // use plain assignment
  11388. if ( owner.nodeType ) {
  11389. owner[ this.expando ] = value;
  11390. // Otherwise secure it in a non-enumerable property
  11391. // configurable must be true to allow the property to be
  11392. // deleted when data is removed
  11393. } else {
  11394. Object.defineProperty( owner, this.expando, {
  11395. value: value,
  11396. configurable: true
  11397. } );
  11398. }
  11399. }
  11400. }
  11401. return value;
  11402. },
  11403. set: function( owner, data, value ) {
  11404. var prop,
  11405. cache = this.cache( owner );
  11406. // Handle: [ owner, key, value ] args
  11407. // Always use camelCase key (gh-2257)
  11408. if ( typeof data === "string" ) {
  11409. cache[ camelCase( data ) ] = value;
  11410. // Handle: [ owner, { properties } ] args
  11411. } else {
  11412. // Copy the properties one-by-one to the cache object
  11413. for ( prop in data ) {
  11414. cache[ camelCase( prop ) ] = data[ prop ];
  11415. }
  11416. }
  11417. return cache;
  11418. },
  11419. get: function( owner, key ) {
  11420. return key === undefined ?
  11421. this.cache( owner ) :
  11422. // Always use camelCase key (gh-2257)
  11423. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11424. },
  11425. access: function( owner, key, value ) {
  11426. // In cases where either:
  11427. //
  11428. // 1. No key was specified
  11429. // 2. A string key was specified, but no value provided
  11430. //
  11431. // Take the "read" path and allow the get method to determine
  11432. // which value to return, respectively either:
  11433. //
  11434. // 1. The entire cache object
  11435. // 2. The data stored at the key
  11436. //
  11437. if ( key === undefined ||
  11438. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11439. return this.get( owner, key );
  11440. }
  11441. // When the key is not a string, or both a key and value
  11442. // are specified, set or extend (existing objects) with either:
  11443. //
  11444. // 1. An object of properties
  11445. // 2. A key and value
  11446. //
  11447. this.set( owner, key, value );
  11448. // Since the "set" path can have two possible entry points
  11449. // return the expected data based on which path was taken[*]
  11450. return value !== undefined ? value : key;
  11451. },
  11452. remove: function( owner, key ) {
  11453. var i,
  11454. cache = owner[ this.expando ];
  11455. if ( cache === undefined ) {
  11456. return;
  11457. }
  11458. if ( key !== undefined ) {
  11459. // Support array or space separated string of keys
  11460. if ( Array.isArray( key ) ) {
  11461. // If key is an array of keys...
  11462. // We always set camelCase keys, so remove that.
  11463. key = key.map( camelCase );
  11464. } else {
  11465. key = camelCase( key );
  11466. // If a key with the spaces exists, use it.
  11467. // Otherwise, create an array by matching non-whitespace
  11468. key = key in cache ?
  11469. [ key ] :
  11470. ( key.match( rnothtmlwhite ) || [] );
  11471. }
  11472. i = key.length;
  11473. while ( i-- ) {
  11474. delete cache[ key[ i ] ];
  11475. }
  11476. }
  11477. // Remove the expando if there's no more data
  11478. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11479. // Support: Chrome <=35 - 45
  11480. // Webkit & Blink performance suffers when deleting properties
  11481. // from DOM nodes, so set to undefined instead
  11482. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11483. if ( owner.nodeType ) {
  11484. owner[ this.expando ] = undefined;
  11485. } else {
  11486. delete owner[ this.expando ];
  11487. }
  11488. }
  11489. },
  11490. hasData: function( owner ) {
  11491. var cache = owner[ this.expando ];
  11492. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11493. }
  11494. };
  11495. var dataPriv = new Data();
  11496. var dataUser = new Data();
  11497. // Implementation Summary
  11498. //
  11499. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11500. // 2. Improve the module's maintainability by reducing the storage
  11501. // paths to a single mechanism.
  11502. // 3. Use the same single mechanism to support "private" and "user" data.
  11503. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11504. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11505. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11506. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11507. rmultiDash = /[A-Z]/g;
  11508. function getData( data ) {
  11509. if ( data === "true" ) {
  11510. return true;
  11511. }
  11512. if ( data === "false" ) {
  11513. return false;
  11514. }
  11515. if ( data === "null" ) {
  11516. return null;
  11517. }
  11518. // Only convert to a number if it doesn't change the string
  11519. if ( data === +data + "" ) {
  11520. return +data;
  11521. }
  11522. if ( rbrace.test( data ) ) {
  11523. return JSON.parse( data );
  11524. }
  11525. return data;
  11526. }
  11527. function dataAttr( elem, key, data ) {
  11528. var name;
  11529. // If nothing was found internally, try to fetch any
  11530. // data from the HTML5 data-* attribute
  11531. if ( data === undefined && elem.nodeType === 1 ) {
  11532. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11533. data = elem.getAttribute( name );
  11534. if ( typeof data === "string" ) {
  11535. try {
  11536. data = getData( data );
  11537. } catch ( e ) {}
  11538. // Make sure we set the data so it isn't changed later
  11539. dataUser.set( elem, key, data );
  11540. } else {
  11541. data = undefined;
  11542. }
  11543. }
  11544. return data;
  11545. }
  11546. jQuery.extend( {
  11547. hasData: function( elem ) {
  11548. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11549. },
  11550. data: function( elem, name, data ) {
  11551. return dataUser.access( elem, name, data );
  11552. },
  11553. removeData: function( elem, name ) {
  11554. dataUser.remove( elem, name );
  11555. },
  11556. // TODO: Now that all calls to _data and _removeData have been replaced
  11557. // with direct calls to dataPriv methods, these can be deprecated.
  11558. _data: function( elem, name, data ) {
  11559. return dataPriv.access( elem, name, data );
  11560. },
  11561. _removeData: function( elem, name ) {
  11562. dataPriv.remove( elem, name );
  11563. }
  11564. } );
  11565. jQuery.fn.extend( {
  11566. data: function( key, value ) {
  11567. var i, name, data,
  11568. elem = this[ 0 ],
  11569. attrs = elem && elem.attributes;
  11570. // Gets all values
  11571. if ( key === undefined ) {
  11572. if ( this.length ) {
  11573. data = dataUser.get( elem );
  11574. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11575. i = attrs.length;
  11576. while ( i-- ) {
  11577. // Support: IE 11 only
  11578. // The attrs elements can be null (#14894)
  11579. if ( attrs[ i ] ) {
  11580. name = attrs[ i ].name;
  11581. if ( name.indexOf( "data-" ) === 0 ) {
  11582. name = camelCase( name.slice( 5 ) );
  11583. dataAttr( elem, name, data[ name ] );
  11584. }
  11585. }
  11586. }
  11587. dataPriv.set( elem, "hasDataAttrs", true );
  11588. }
  11589. }
  11590. return data;
  11591. }
  11592. // Sets multiple values
  11593. if ( typeof key === "object" ) {
  11594. return this.each( function() {
  11595. dataUser.set( this, key );
  11596. } );
  11597. }
  11598. return access( this, function( value ) {
  11599. var data;
  11600. // The calling jQuery object (element matches) is not empty
  11601. // (and therefore has an element appears at this[ 0 ]) and the
  11602. // `value` parameter was not undefined. An empty jQuery object
  11603. // will result in `undefined` for elem = this[ 0 ] which will
  11604. // throw an exception if an attempt to read a data cache is made.
  11605. if ( elem && value === undefined ) {
  11606. // Attempt to get data from the cache
  11607. // The key will always be camelCased in Data
  11608. data = dataUser.get( elem, key );
  11609. if ( data !== undefined ) {
  11610. return data;
  11611. }
  11612. // Attempt to "discover" the data in
  11613. // HTML5 custom data-* attrs
  11614. data = dataAttr( elem, key );
  11615. if ( data !== undefined ) {
  11616. return data;
  11617. }
  11618. // We tried really hard, but the data doesn't exist.
  11619. return;
  11620. }
  11621. // Set the data...
  11622. this.each( function() {
  11623. // We always store the camelCased key
  11624. dataUser.set( this, key, value );
  11625. } );
  11626. }, null, value, arguments.length > 1, null, true );
  11627. },
  11628. removeData: function( key ) {
  11629. return this.each( function() {
  11630. dataUser.remove( this, key );
  11631. } );
  11632. }
  11633. } );
  11634. jQuery.extend( {
  11635. queue: function( elem, type, data ) {
  11636. var queue;
  11637. if ( elem ) {
  11638. type = ( type || "fx" ) + "queue";
  11639. queue = dataPriv.get( elem, type );
  11640. // Speed up dequeue by getting out quickly if this is just a lookup
  11641. if ( data ) {
  11642. if ( !queue || Array.isArray( data ) ) {
  11643. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11644. } else {
  11645. queue.push( data );
  11646. }
  11647. }
  11648. return queue || [];
  11649. }
  11650. },
  11651. dequeue: function( elem, type ) {
  11652. type = type || "fx";
  11653. var queue = jQuery.queue( elem, type ),
  11654. startLength = queue.length,
  11655. fn = queue.shift(),
  11656. hooks = jQuery._queueHooks( elem, type ),
  11657. next = function() {
  11658. jQuery.dequeue( elem, type );
  11659. };
  11660. // If the fx queue is dequeued, always remove the progress sentinel
  11661. if ( fn === "inprogress" ) {
  11662. fn = queue.shift();
  11663. startLength--;
  11664. }
  11665. if ( fn ) {
  11666. // Add a progress sentinel to prevent the fx queue from being
  11667. // automatically dequeued
  11668. if ( type === "fx" ) {
  11669. queue.unshift( "inprogress" );
  11670. }
  11671. // Clear up the last queue stop function
  11672. delete hooks.stop;
  11673. fn.call( elem, next, hooks );
  11674. }
  11675. if ( !startLength && hooks ) {
  11676. hooks.empty.fire();
  11677. }
  11678. },
  11679. // Not public - generate a queueHooks object, or return the current one
  11680. _queueHooks: function( elem, type ) {
  11681. var key = type + "queueHooks";
  11682. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11683. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11684. dataPriv.remove( elem, [ type + "queue", key ] );
  11685. } )
  11686. } );
  11687. }
  11688. } );
  11689. jQuery.fn.extend( {
  11690. queue: function( type, data ) {
  11691. var setter = 2;
  11692. if ( typeof type !== "string" ) {
  11693. data = type;
  11694. type = "fx";
  11695. setter--;
  11696. }
  11697. if ( arguments.length < setter ) {
  11698. return jQuery.queue( this[ 0 ], type );
  11699. }
  11700. return data === undefined ?
  11701. this :
  11702. this.each( function() {
  11703. var queue = jQuery.queue( this, type, data );
  11704. // Ensure a hooks for this queue
  11705. jQuery._queueHooks( this, type );
  11706. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11707. jQuery.dequeue( this, type );
  11708. }
  11709. } );
  11710. },
  11711. dequeue: function( type ) {
  11712. return this.each( function() {
  11713. jQuery.dequeue( this, type );
  11714. } );
  11715. },
  11716. clearQueue: function( type ) {
  11717. return this.queue( type || "fx", [] );
  11718. },
  11719. // Get a promise resolved when queues of a certain type
  11720. // are emptied (fx is the type by default)
  11721. promise: function( type, obj ) {
  11722. var tmp,
  11723. count = 1,
  11724. defer = jQuery.Deferred(),
  11725. elements = this,
  11726. i = this.length,
  11727. resolve = function() {
  11728. if ( !( --count ) ) {
  11729. defer.resolveWith( elements, [ elements ] );
  11730. }
  11731. };
  11732. if ( typeof type !== "string" ) {
  11733. obj = type;
  11734. type = undefined;
  11735. }
  11736. type = type || "fx";
  11737. while ( i-- ) {
  11738. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11739. if ( tmp && tmp.empty ) {
  11740. count++;
  11741. tmp.empty.add( resolve );
  11742. }
  11743. }
  11744. resolve();
  11745. return defer.promise( obj );
  11746. }
  11747. } );
  11748. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11749. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11750. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11751. var documentElement = document.documentElement;
  11752. var isAttached = function( elem ) {
  11753. return jQuery.contains( elem.ownerDocument, elem );
  11754. },
  11755. composed = { composed: true };
  11756. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11757. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11758. // Support: iOS 10.0-10.2 only
  11759. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11760. // leading to errors. We need to check for `getRootNode`.
  11761. if ( documentElement.getRootNode ) {
  11762. isAttached = function( elem ) {
  11763. return jQuery.contains( elem.ownerDocument, elem ) ||
  11764. elem.getRootNode( composed ) === elem.ownerDocument;
  11765. };
  11766. }
  11767. var isHiddenWithinTree = function( elem, el ) {
  11768. // isHiddenWithinTree might be called from jQuery#filter function;
  11769. // in that case, element will be second argument
  11770. elem = el || elem;
  11771. // Inline style trumps all
  11772. return elem.style.display === "none" ||
  11773. elem.style.display === "" &&
  11774. // Otherwise, check computed style
  11775. // Support: Firefox <=43 - 45
  11776. // Disconnected elements can have computed display: none, so first confirm that elem is
  11777. // in the document.
  11778. isAttached( elem ) &&
  11779. jQuery.css( elem, "display" ) === "none";
  11780. };
  11781. var swap = function( elem, options, callback, args ) {
  11782. var ret, name,
  11783. old = {};
  11784. // Remember the old values, and insert the new ones
  11785. for ( name in options ) {
  11786. old[ name ] = elem.style[ name ];
  11787. elem.style[ name ] = options[ name ];
  11788. }
  11789. ret = callback.apply( elem, args || [] );
  11790. // Revert the old values
  11791. for ( name in options ) {
  11792. elem.style[ name ] = old[ name ];
  11793. }
  11794. return ret;
  11795. };
  11796. function adjustCSS( elem, prop, valueParts, tween ) {
  11797. var adjusted, scale,
  11798. maxIterations = 20,
  11799. currentValue = tween ?
  11800. function() {
  11801. return tween.cur();
  11802. } :
  11803. function() {
  11804. return jQuery.css( elem, prop, "" );
  11805. },
  11806. initial = currentValue(),
  11807. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11808. // Starting value computation is required for potential unit mismatches
  11809. initialInUnit = elem.nodeType &&
  11810. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11811. rcssNum.exec( jQuery.css( elem, prop ) );
  11812. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11813. // Support: Firefox <=54
  11814. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11815. initial = initial / 2;
  11816. // Trust units reported by jQuery.css
  11817. unit = unit || initialInUnit[ 3 ];
  11818. // Iteratively approximate from a nonzero starting point
  11819. initialInUnit = +initial || 1;
  11820. while ( maxIterations-- ) {
  11821. // Evaluate and update our best guess (doubling guesses that zero out).
  11822. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11823. jQuery.style( elem, prop, initialInUnit + unit );
  11824. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11825. maxIterations = 0;
  11826. }
  11827. initialInUnit = initialInUnit / scale;
  11828. }
  11829. initialInUnit = initialInUnit * 2;
  11830. jQuery.style( elem, prop, initialInUnit + unit );
  11831. // Make sure we update the tween properties later on
  11832. valueParts = valueParts || [];
  11833. }
  11834. if ( valueParts ) {
  11835. initialInUnit = +initialInUnit || +initial || 0;
  11836. // Apply relative offset (+=/-=) if specified
  11837. adjusted = valueParts[ 1 ] ?
  11838. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11839. +valueParts[ 2 ];
  11840. if ( tween ) {
  11841. tween.unit = unit;
  11842. tween.start = initialInUnit;
  11843. tween.end = adjusted;
  11844. }
  11845. }
  11846. return adjusted;
  11847. }
  11848. var defaultDisplayMap = {};
  11849. function getDefaultDisplay( elem ) {
  11850. var temp,
  11851. doc = elem.ownerDocument,
  11852. nodeName = elem.nodeName,
  11853. display = defaultDisplayMap[ nodeName ];
  11854. if ( display ) {
  11855. return display;
  11856. }
  11857. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11858. display = jQuery.css( temp, "display" );
  11859. temp.parentNode.removeChild( temp );
  11860. if ( display === "none" ) {
  11861. display = "block";
  11862. }
  11863. defaultDisplayMap[ nodeName ] = display;
  11864. return display;
  11865. }
  11866. function showHide( elements, show ) {
  11867. var display, elem,
  11868. values = [],
  11869. index = 0,
  11870. length = elements.length;
  11871. // Determine new display value for elements that need to change
  11872. for ( ; index < length; index++ ) {
  11873. elem = elements[ index ];
  11874. if ( !elem.style ) {
  11875. continue;
  11876. }
  11877. display = elem.style.display;
  11878. if ( show ) {
  11879. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11880. // check is required in this first loop unless we have a nonempty display value (either
  11881. // inline or about-to-be-restored)
  11882. if ( display === "none" ) {
  11883. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11884. if ( !values[ index ] ) {
  11885. elem.style.display = "";
  11886. }
  11887. }
  11888. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  11889. values[ index ] = getDefaultDisplay( elem );
  11890. }
  11891. } else {
  11892. if ( display !== "none" ) {
  11893. values[ index ] = "none";
  11894. // Remember what we're overwriting
  11895. dataPriv.set( elem, "display", display );
  11896. }
  11897. }
  11898. }
  11899. // Set the display of the elements in a second loop to avoid constant reflow
  11900. for ( index = 0; index < length; index++ ) {
  11901. if ( values[ index ] != null ) {
  11902. elements[ index ].style.display = values[ index ];
  11903. }
  11904. }
  11905. return elements;
  11906. }
  11907. jQuery.fn.extend( {
  11908. show: function() {
  11909. return showHide( this, true );
  11910. },
  11911. hide: function() {
  11912. return showHide( this );
  11913. },
  11914. toggle: function( state ) {
  11915. if ( typeof state === "boolean" ) {
  11916. return state ? this.show() : this.hide();
  11917. }
  11918. return this.each( function() {
  11919. if ( isHiddenWithinTree( this ) ) {
  11920. jQuery( this ).show();
  11921. } else {
  11922. jQuery( this ).hide();
  11923. }
  11924. } );
  11925. }
  11926. } );
  11927. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  11928. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  11929. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  11930. // We have to close these tags to support XHTML (#13200)
  11931. var wrapMap = {
  11932. // Support: IE <=9 only
  11933. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  11934. // XHTML parsers do not magically insert elements in the
  11935. // same way that tag soup parsers do. So we cannot shorten
  11936. // this by omitting <tbody> or other required elements.
  11937. thead: [ 1, "<table>", "</table>" ],
  11938. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  11939. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  11940. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  11941. _default: [ 0, "", "" ]
  11942. };
  11943. // Support: IE <=9 only
  11944. wrapMap.optgroup = wrapMap.option;
  11945. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  11946. wrapMap.th = wrapMap.td;
  11947. function getAll( context, tag ) {
  11948. // Support: IE <=9 - 11 only
  11949. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  11950. var ret;
  11951. if ( typeof context.getElementsByTagName !== "undefined" ) {
  11952. ret = context.getElementsByTagName( tag || "*" );
  11953. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  11954. ret = context.querySelectorAll( tag || "*" );
  11955. } else {
  11956. ret = [];
  11957. }
  11958. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  11959. return jQuery.merge( [ context ], ret );
  11960. }
  11961. return ret;
  11962. }
  11963. // Mark scripts as having already been evaluated
  11964. function setGlobalEval( elems, refElements ) {
  11965. var i = 0,
  11966. l = elems.length;
  11967. for ( ; i < l; i++ ) {
  11968. dataPriv.set(
  11969. elems[ i ],
  11970. "globalEval",
  11971. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  11972. );
  11973. }
  11974. }
  11975. var rhtml = /<|&#?\w+;/;
  11976. function buildFragment( elems, context, scripts, selection, ignored ) {
  11977. var elem, tmp, tag, wrap, attached, j,
  11978. fragment = context.createDocumentFragment(),
  11979. nodes = [],
  11980. i = 0,
  11981. l = elems.length;
  11982. for ( ; i < l; i++ ) {
  11983. elem = elems[ i ];
  11984. if ( elem || elem === 0 ) {
  11985. // Add nodes directly
  11986. if ( toType( elem ) === "object" ) {
  11987. // Support: Android <=4.0 only, PhantomJS 1 only
  11988. // push.apply(_, arraylike) throws on ancient WebKit
  11989. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  11990. // Convert non-html into a text node
  11991. } else if ( !rhtml.test( elem ) ) {
  11992. nodes.push( context.createTextNode( elem ) );
  11993. // Convert html into DOM nodes
  11994. } else {
  11995. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  11996. // Deserialize a standard representation
  11997. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  11998. wrap = wrapMap[ tag ] || wrapMap._default;
  11999. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12000. // Descend through wrappers to the right content
  12001. j = wrap[ 0 ];
  12002. while ( j-- ) {
  12003. tmp = tmp.lastChild;
  12004. }
  12005. // Support: Android <=4.0 only, PhantomJS 1 only
  12006. // push.apply(_, arraylike) throws on ancient WebKit
  12007. jQuery.merge( nodes, tmp.childNodes );
  12008. // Remember the top-level container
  12009. tmp = fragment.firstChild;
  12010. // Ensure the created nodes are orphaned (#12392)
  12011. tmp.textContent = "";
  12012. }
  12013. }
  12014. }
  12015. // Remove wrapper from fragment
  12016. fragment.textContent = "";
  12017. i = 0;
  12018. while ( ( elem = nodes[ i++ ] ) ) {
  12019. // Skip elements already in the context collection (trac-4087)
  12020. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12021. if ( ignored ) {
  12022. ignored.push( elem );
  12023. }
  12024. continue;
  12025. }
  12026. attached = isAttached( elem );
  12027. // Append to fragment
  12028. tmp = getAll( fragment.appendChild( elem ), "script" );
  12029. // Preserve script evaluation history
  12030. if ( attached ) {
  12031. setGlobalEval( tmp );
  12032. }
  12033. // Capture executables
  12034. if ( scripts ) {
  12035. j = 0;
  12036. while ( ( elem = tmp[ j++ ] ) ) {
  12037. if ( rscriptType.test( elem.type || "" ) ) {
  12038. scripts.push( elem );
  12039. }
  12040. }
  12041. }
  12042. }
  12043. return fragment;
  12044. }
  12045. ( function() {
  12046. var fragment = document.createDocumentFragment(),
  12047. div = fragment.appendChild( document.createElement( "div" ) ),
  12048. input = document.createElement( "input" );
  12049. // Support: Android 4.0 - 4.3 only
  12050. // Check state lost if the name is set (#11217)
  12051. // Support: Windows Web Apps (WWA)
  12052. // `name` and `type` must use .setAttribute for WWA (#14901)
  12053. input.setAttribute( "type", "radio" );
  12054. input.setAttribute( "checked", "checked" );
  12055. input.setAttribute( "name", "t" );
  12056. div.appendChild( input );
  12057. // Support: Android <=4.1 only
  12058. // Older WebKit doesn't clone checked state correctly in fragments
  12059. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12060. // Support: IE <=11 only
  12061. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12062. div.innerHTML = "<textarea>x</textarea>";
  12063. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12064. } )();
  12065. var
  12066. rkeyEvent = /^key/,
  12067. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12068. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12069. function returnTrue() {
  12070. return true;
  12071. }
  12072. function returnFalse() {
  12073. return false;
  12074. }
  12075. // Support: IE <=9 - 11+
  12076. // focus() and blur() are asynchronous, except when they are no-op.
  12077. // So expect focus to be synchronous when the element is already active,
  12078. // and blur to be synchronous when the element is not already active.
  12079. // (focus and blur are always synchronous in other supported browsers,
  12080. // this just defines when we can count on it).
  12081. function expectSync( elem, type ) {
  12082. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12083. }
  12084. // Support: IE <=9 only
  12085. // Accessing document.activeElement can throw unexpectedly
  12086. // https://bugs.jquery.com/ticket/13393
  12087. function safeActiveElement() {
  12088. try {
  12089. return document.activeElement;
  12090. } catch ( err ) { }
  12091. }
  12092. function on( elem, types, selector, data, fn, one ) {
  12093. var origFn, type;
  12094. // Types can be a map of types/handlers
  12095. if ( typeof types === "object" ) {
  12096. // ( types-Object, selector, data )
  12097. if ( typeof selector !== "string" ) {
  12098. // ( types-Object, data )
  12099. data = data || selector;
  12100. selector = undefined;
  12101. }
  12102. for ( type in types ) {
  12103. on( elem, type, selector, data, types[ type ], one );
  12104. }
  12105. return elem;
  12106. }
  12107. if ( data == null && fn == null ) {
  12108. // ( types, fn )
  12109. fn = selector;
  12110. data = selector = undefined;
  12111. } else if ( fn == null ) {
  12112. if ( typeof selector === "string" ) {
  12113. // ( types, selector, fn )
  12114. fn = data;
  12115. data = undefined;
  12116. } else {
  12117. // ( types, data, fn )
  12118. fn = data;
  12119. data = selector;
  12120. selector = undefined;
  12121. }
  12122. }
  12123. if ( fn === false ) {
  12124. fn = returnFalse;
  12125. } else if ( !fn ) {
  12126. return elem;
  12127. }
  12128. if ( one === 1 ) {
  12129. origFn = fn;
  12130. fn = function( event ) {
  12131. // Can use an empty set, since event contains the info
  12132. jQuery().off( event );
  12133. return origFn.apply( this, arguments );
  12134. };
  12135. // Use same guid so caller can remove using origFn
  12136. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12137. }
  12138. return elem.each( function() {
  12139. jQuery.event.add( this, types, fn, data, selector );
  12140. } );
  12141. }
  12142. /*
  12143. * Helper functions for managing events -- not part of the public interface.
  12144. * Props to Dean Edwards' addEvent library for many of the ideas.
  12145. */
  12146. jQuery.event = {
  12147. global: {},
  12148. add: function( elem, types, handler, data, selector ) {
  12149. var handleObjIn, eventHandle, tmp,
  12150. events, t, handleObj,
  12151. special, handlers, type, namespaces, origType,
  12152. elemData = dataPriv.get( elem );
  12153. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12154. if ( !elemData ) {
  12155. return;
  12156. }
  12157. // Caller can pass in an object of custom data in lieu of the handler
  12158. if ( handler.handler ) {
  12159. handleObjIn = handler;
  12160. handler = handleObjIn.handler;
  12161. selector = handleObjIn.selector;
  12162. }
  12163. // Ensure that invalid selectors throw exceptions at attach time
  12164. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12165. if ( selector ) {
  12166. jQuery.find.matchesSelector( documentElement, selector );
  12167. }
  12168. // Make sure that the handler has a unique ID, used to find/remove it later
  12169. if ( !handler.guid ) {
  12170. handler.guid = jQuery.guid++;
  12171. }
  12172. // Init the element's event structure and main handler, if this is the first
  12173. if ( !( events = elemData.events ) ) {
  12174. events = elemData.events = {};
  12175. }
  12176. if ( !( eventHandle = elemData.handle ) ) {
  12177. eventHandle = elemData.handle = function( e ) {
  12178. // Discard the second event of a jQuery.event.trigger() and
  12179. // when an event is called after a page has unloaded
  12180. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12181. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12182. };
  12183. }
  12184. // Handle multiple events separated by a space
  12185. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12186. t = types.length;
  12187. while ( t-- ) {
  12188. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12189. type = origType = tmp[ 1 ];
  12190. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12191. // There *must* be a type, no attaching namespace-only handlers
  12192. if ( !type ) {
  12193. continue;
  12194. }
  12195. // If event changes its type, use the special event handlers for the changed type
  12196. special = jQuery.event.special[ type ] || {};
  12197. // If selector defined, determine special event api type, otherwise given type
  12198. type = ( selector ? special.delegateType : special.bindType ) || type;
  12199. // Update special based on newly reset type
  12200. special = jQuery.event.special[ type ] || {};
  12201. // handleObj is passed to all event handlers
  12202. handleObj = jQuery.extend( {
  12203. type: type,
  12204. origType: origType,
  12205. data: data,
  12206. handler: handler,
  12207. guid: handler.guid,
  12208. selector: selector,
  12209. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12210. namespace: namespaces.join( "." )
  12211. }, handleObjIn );
  12212. // Init the event handler queue if we're the first
  12213. if ( !( handlers = events[ type ] ) ) {
  12214. handlers = events[ type ] = [];
  12215. handlers.delegateCount = 0;
  12216. // Only use addEventListener if the special events handler returns false
  12217. if ( !special.setup ||
  12218. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12219. if ( elem.addEventListener ) {
  12220. elem.addEventListener( type, eventHandle );
  12221. }
  12222. }
  12223. }
  12224. if ( special.add ) {
  12225. special.add.call( elem, handleObj );
  12226. if ( !handleObj.handler.guid ) {
  12227. handleObj.handler.guid = handler.guid;
  12228. }
  12229. }
  12230. // Add to the element's handler list, delegates in front
  12231. if ( selector ) {
  12232. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12233. } else {
  12234. handlers.push( handleObj );
  12235. }
  12236. // Keep track of which events have ever been used, for event optimization
  12237. jQuery.event.global[ type ] = true;
  12238. }
  12239. },
  12240. // Detach an event or set of events from an element
  12241. remove: function( elem, types, handler, selector, mappedTypes ) {
  12242. var j, origCount, tmp,
  12243. events, t, handleObj,
  12244. special, handlers, type, namespaces, origType,
  12245. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12246. if ( !elemData || !( events = elemData.events ) ) {
  12247. return;
  12248. }
  12249. // Once for each type.namespace in types; type may be omitted
  12250. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12251. t = types.length;
  12252. while ( t-- ) {
  12253. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12254. type = origType = tmp[ 1 ];
  12255. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12256. // Unbind all events (on this namespace, if provided) for the element
  12257. if ( !type ) {
  12258. for ( type in events ) {
  12259. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12260. }
  12261. continue;
  12262. }
  12263. special = jQuery.event.special[ type ] || {};
  12264. type = ( selector ? special.delegateType : special.bindType ) || type;
  12265. handlers = events[ type ] || [];
  12266. tmp = tmp[ 2 ] &&
  12267. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12268. // Remove matching events
  12269. origCount = j = handlers.length;
  12270. while ( j-- ) {
  12271. handleObj = handlers[ j ];
  12272. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12273. ( !handler || handler.guid === handleObj.guid ) &&
  12274. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12275. ( !selector || selector === handleObj.selector ||
  12276. selector === "**" && handleObj.selector ) ) {
  12277. handlers.splice( j, 1 );
  12278. if ( handleObj.selector ) {
  12279. handlers.delegateCount--;
  12280. }
  12281. if ( special.remove ) {
  12282. special.remove.call( elem, handleObj );
  12283. }
  12284. }
  12285. }
  12286. // Remove generic event handler if we removed something and no more handlers exist
  12287. // (avoids potential for endless recursion during removal of special event handlers)
  12288. if ( origCount && !handlers.length ) {
  12289. if ( !special.teardown ||
  12290. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12291. jQuery.removeEvent( elem, type, elemData.handle );
  12292. }
  12293. delete events[ type ];
  12294. }
  12295. }
  12296. // Remove data and the expando if it's no longer used
  12297. if ( jQuery.isEmptyObject( events ) ) {
  12298. dataPriv.remove( elem, "handle events" );
  12299. }
  12300. },
  12301. dispatch: function( nativeEvent ) {
  12302. // Make a writable jQuery.Event from the native event object
  12303. var event = jQuery.event.fix( nativeEvent );
  12304. var i, j, ret, matched, handleObj, handlerQueue,
  12305. args = new Array( arguments.length ),
  12306. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12307. special = jQuery.event.special[ event.type ] || {};
  12308. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12309. args[ 0 ] = event;
  12310. for ( i = 1; i < arguments.length; i++ ) {
  12311. args[ i ] = arguments[ i ];
  12312. }
  12313. event.delegateTarget = this;
  12314. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12315. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12316. return;
  12317. }
  12318. // Determine handlers
  12319. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12320. // Run delegates first; they may want to stop propagation beneath us
  12321. i = 0;
  12322. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12323. event.currentTarget = matched.elem;
  12324. j = 0;
  12325. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12326. !event.isImmediatePropagationStopped() ) {
  12327. // If the event is namespaced, then each handler is only invoked if it is
  12328. // specially universal or its namespaces are a superset of the event's.
  12329. if ( !event.rnamespace || handleObj.namespace === false ||
  12330. event.rnamespace.test( handleObj.namespace ) ) {
  12331. event.handleObj = handleObj;
  12332. event.data = handleObj.data;
  12333. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12334. handleObj.handler ).apply( matched.elem, args );
  12335. if ( ret !== undefined ) {
  12336. if ( ( event.result = ret ) === false ) {
  12337. event.preventDefault();
  12338. event.stopPropagation();
  12339. }
  12340. }
  12341. }
  12342. }
  12343. }
  12344. // Call the postDispatch hook for the mapped type
  12345. if ( special.postDispatch ) {
  12346. special.postDispatch.call( this, event );
  12347. }
  12348. return event.result;
  12349. },
  12350. handlers: function( event, handlers ) {
  12351. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12352. handlerQueue = [],
  12353. delegateCount = handlers.delegateCount,
  12354. cur = event.target;
  12355. // Find delegate handlers
  12356. if ( delegateCount &&
  12357. // Support: IE <=9
  12358. // Black-hole SVG <use> instance trees (trac-13180)
  12359. cur.nodeType &&
  12360. // Support: Firefox <=42
  12361. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12362. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12363. // Support: IE 11 only
  12364. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12365. !( event.type === "click" && event.button >= 1 ) ) {
  12366. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12367. // Don't check non-elements (#13208)
  12368. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12369. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12370. matchedHandlers = [];
  12371. matchedSelectors = {};
  12372. for ( i = 0; i < delegateCount; i++ ) {
  12373. handleObj = handlers[ i ];
  12374. // Don't conflict with Object.prototype properties (#13203)
  12375. sel = handleObj.selector + " ";
  12376. if ( matchedSelectors[ sel ] === undefined ) {
  12377. matchedSelectors[ sel ] = handleObj.needsContext ?
  12378. jQuery( sel, this ).index( cur ) > -1 :
  12379. jQuery.find( sel, this, null, [ cur ] ).length;
  12380. }
  12381. if ( matchedSelectors[ sel ] ) {
  12382. matchedHandlers.push( handleObj );
  12383. }
  12384. }
  12385. if ( matchedHandlers.length ) {
  12386. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12387. }
  12388. }
  12389. }
  12390. }
  12391. // Add the remaining (directly-bound) handlers
  12392. cur = this;
  12393. if ( delegateCount < handlers.length ) {
  12394. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12395. }
  12396. return handlerQueue;
  12397. },
  12398. addProp: function( name, hook ) {
  12399. Object.defineProperty( jQuery.Event.prototype, name, {
  12400. enumerable: true,
  12401. configurable: true,
  12402. get: isFunction( hook ) ?
  12403. function() {
  12404. if ( this.originalEvent ) {
  12405. return hook( this.originalEvent );
  12406. }
  12407. } :
  12408. function() {
  12409. if ( this.originalEvent ) {
  12410. return this.originalEvent[ name ];
  12411. }
  12412. },
  12413. set: function( value ) {
  12414. Object.defineProperty( this, name, {
  12415. enumerable: true,
  12416. configurable: true,
  12417. writable: true,
  12418. value: value
  12419. } );
  12420. }
  12421. } );
  12422. },
  12423. fix: function( originalEvent ) {
  12424. return originalEvent[ jQuery.expando ] ?
  12425. originalEvent :
  12426. new jQuery.Event( originalEvent );
  12427. },
  12428. special: {
  12429. load: {
  12430. // Prevent triggered image.load events from bubbling to window.load
  12431. noBubble: true
  12432. },
  12433. click: {
  12434. // Utilize native event to ensure correct state for checkable inputs
  12435. setup: function( data ) {
  12436. // For mutual compressibility with _default, replace `this` access with a local var.
  12437. // `|| data` is dead code meant only to preserve the variable through minification.
  12438. var el = this || data;
  12439. // Claim the first handler
  12440. if ( rcheckableType.test( el.type ) &&
  12441. el.click && nodeName( el, "input" ) ) {
  12442. // dataPriv.set( el, "click", ... )
  12443. leverageNative( el, "click", returnTrue );
  12444. }
  12445. // Return false to allow normal processing in the caller
  12446. return false;
  12447. },
  12448. trigger: function( data ) {
  12449. // For mutual compressibility with _default, replace `this` access with a local var.
  12450. // `|| data` is dead code meant only to preserve the variable through minification.
  12451. var el = this || data;
  12452. // Force setup before triggering a click
  12453. if ( rcheckableType.test( el.type ) &&
  12454. el.click && nodeName( el, "input" ) ) {
  12455. leverageNative( el, "click" );
  12456. }
  12457. // Return non-false to allow normal event-path propagation
  12458. return true;
  12459. },
  12460. // For cross-browser consistency, suppress native .click() on links
  12461. // Also prevent it if we're currently inside a leveraged native-event stack
  12462. _default: function( event ) {
  12463. var target = event.target;
  12464. return rcheckableType.test( target.type ) &&
  12465. target.click && nodeName( target, "input" ) &&
  12466. dataPriv.get( target, "click" ) ||
  12467. nodeName( target, "a" );
  12468. }
  12469. },
  12470. beforeunload: {
  12471. postDispatch: function( event ) {
  12472. // Support: Firefox 20+
  12473. // Firefox doesn't alert if the returnValue field is not set.
  12474. if ( event.result !== undefined && event.originalEvent ) {
  12475. event.originalEvent.returnValue = event.result;
  12476. }
  12477. }
  12478. }
  12479. }
  12480. };
  12481. // Ensure the presence of an event listener that handles manually-triggered
  12482. // synthetic events by interrupting progress until reinvoked in response to
  12483. // *native* events that it fires directly, ensuring that state changes have
  12484. // already occurred before other listeners are invoked.
  12485. function leverageNative( el, type, expectSync ) {
  12486. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12487. if ( !expectSync ) {
  12488. if ( dataPriv.get( el, type ) === undefined ) {
  12489. jQuery.event.add( el, type, returnTrue );
  12490. }
  12491. return;
  12492. }
  12493. // Register the controller as a special universal handler for all event namespaces
  12494. dataPriv.set( el, type, false );
  12495. jQuery.event.add( el, type, {
  12496. namespace: false,
  12497. handler: function( event ) {
  12498. var notAsync, result,
  12499. saved = dataPriv.get( this, type );
  12500. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12501. // Interrupt processing of the outer synthetic .trigger()ed event
  12502. // Saved data should be false in such cases, but might be a leftover capture object
  12503. // from an async native handler (gh-4350)
  12504. if ( !saved.length ) {
  12505. // Store arguments for use when handling the inner native event
  12506. // There will always be at least one argument (an event object), so this array
  12507. // will not be confused with a leftover capture object.
  12508. saved = slice.call( arguments );
  12509. dataPriv.set( this, type, saved );
  12510. // Trigger the native event and capture its result
  12511. // Support: IE <=9 - 11+
  12512. // focus() and blur() are asynchronous
  12513. notAsync = expectSync( this, type );
  12514. this[ type ]();
  12515. result = dataPriv.get( this, type );
  12516. if ( saved !== result || notAsync ) {
  12517. dataPriv.set( this, type, false );
  12518. } else {
  12519. result = {};
  12520. }
  12521. if ( saved !== result ) {
  12522. // Cancel the outer synthetic event
  12523. event.stopImmediatePropagation();
  12524. event.preventDefault();
  12525. return result.value;
  12526. }
  12527. // If this is an inner synthetic event for an event with a bubbling surrogate
  12528. // (focus or blur), assume that the surrogate already propagated from triggering the
  12529. // native event and prevent that from happening again here.
  12530. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12531. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12532. // less bad than duplication.
  12533. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12534. event.stopPropagation();
  12535. }
  12536. // If this is a native event triggered above, everything is now in order
  12537. // Fire an inner synthetic event with the original arguments
  12538. } else if ( saved.length ) {
  12539. // ...and capture the result
  12540. dataPriv.set( this, type, {
  12541. value: jQuery.event.trigger(
  12542. // Support: IE <=9 - 11+
  12543. // Extend with the prototype to reset the above stopImmediatePropagation()
  12544. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12545. saved.slice( 1 ),
  12546. this
  12547. )
  12548. } );
  12549. // Abort handling of the native event
  12550. event.stopImmediatePropagation();
  12551. }
  12552. }
  12553. } );
  12554. }
  12555. jQuery.removeEvent = function( elem, type, handle ) {
  12556. // This "if" is needed for plain objects
  12557. if ( elem.removeEventListener ) {
  12558. elem.removeEventListener( type, handle );
  12559. }
  12560. };
  12561. jQuery.Event = function( src, props ) {
  12562. // Allow instantiation without the 'new' keyword
  12563. if ( !( this instanceof jQuery.Event ) ) {
  12564. return new jQuery.Event( src, props );
  12565. }
  12566. // Event object
  12567. if ( src && src.type ) {
  12568. this.originalEvent = src;
  12569. this.type = src.type;
  12570. // Events bubbling up the document may have been marked as prevented
  12571. // by a handler lower down the tree; reflect the correct value.
  12572. this.isDefaultPrevented = src.defaultPrevented ||
  12573. src.defaultPrevented === undefined &&
  12574. // Support: Android <=2.3 only
  12575. src.returnValue === false ?
  12576. returnTrue :
  12577. returnFalse;
  12578. // Create target properties
  12579. // Support: Safari <=6 - 7 only
  12580. // Target should not be a text node (#504, #13143)
  12581. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12582. src.target.parentNode :
  12583. src.target;
  12584. this.currentTarget = src.currentTarget;
  12585. this.relatedTarget = src.relatedTarget;
  12586. // Event type
  12587. } else {
  12588. this.type = src;
  12589. }
  12590. // Put explicitly provided properties onto the event object
  12591. if ( props ) {
  12592. jQuery.extend( this, props );
  12593. }
  12594. // Create a timestamp if incoming event doesn't have one
  12595. this.timeStamp = src && src.timeStamp || Date.now();
  12596. // Mark it as fixed
  12597. this[ jQuery.expando ] = true;
  12598. };
  12599. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12600. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12601. jQuery.Event.prototype = {
  12602. constructor: jQuery.Event,
  12603. isDefaultPrevented: returnFalse,
  12604. isPropagationStopped: returnFalse,
  12605. isImmediatePropagationStopped: returnFalse,
  12606. isSimulated: false,
  12607. preventDefault: function() {
  12608. var e = this.originalEvent;
  12609. this.isDefaultPrevented = returnTrue;
  12610. if ( e && !this.isSimulated ) {
  12611. e.preventDefault();
  12612. }
  12613. },
  12614. stopPropagation: function() {
  12615. var e = this.originalEvent;
  12616. this.isPropagationStopped = returnTrue;
  12617. if ( e && !this.isSimulated ) {
  12618. e.stopPropagation();
  12619. }
  12620. },
  12621. stopImmediatePropagation: function() {
  12622. var e = this.originalEvent;
  12623. this.isImmediatePropagationStopped = returnTrue;
  12624. if ( e && !this.isSimulated ) {
  12625. e.stopImmediatePropagation();
  12626. }
  12627. this.stopPropagation();
  12628. }
  12629. };
  12630. // Includes all common event props including KeyEvent and MouseEvent specific props
  12631. jQuery.each( {
  12632. altKey: true,
  12633. bubbles: true,
  12634. cancelable: true,
  12635. changedTouches: true,
  12636. ctrlKey: true,
  12637. detail: true,
  12638. eventPhase: true,
  12639. metaKey: true,
  12640. pageX: true,
  12641. pageY: true,
  12642. shiftKey: true,
  12643. view: true,
  12644. "char": true,
  12645. code: true,
  12646. charCode: true,
  12647. key: true,
  12648. keyCode: true,
  12649. button: true,
  12650. buttons: true,
  12651. clientX: true,
  12652. clientY: true,
  12653. offsetX: true,
  12654. offsetY: true,
  12655. pointerId: true,
  12656. pointerType: true,
  12657. screenX: true,
  12658. screenY: true,
  12659. targetTouches: true,
  12660. toElement: true,
  12661. touches: true,
  12662. which: function( event ) {
  12663. var button = event.button;
  12664. // Add which for key events
  12665. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12666. return event.charCode != null ? event.charCode : event.keyCode;
  12667. }
  12668. // Add which for click: 1 === left; 2 === middle; 3 === right
  12669. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12670. if ( button & 1 ) {
  12671. return 1;
  12672. }
  12673. if ( button & 2 ) {
  12674. return 3;
  12675. }
  12676. if ( button & 4 ) {
  12677. return 2;
  12678. }
  12679. return 0;
  12680. }
  12681. return event.which;
  12682. }
  12683. }, jQuery.event.addProp );
  12684. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12685. jQuery.event.special[ type ] = {
  12686. // Utilize native event if possible so blur/focus sequence is correct
  12687. setup: function() {
  12688. // Claim the first handler
  12689. // dataPriv.set( this, "focus", ... )
  12690. // dataPriv.set( this, "blur", ... )
  12691. leverageNative( this, type, expectSync );
  12692. // Return false to allow normal processing in the caller
  12693. return false;
  12694. },
  12695. trigger: function() {
  12696. // Force setup before trigger
  12697. leverageNative( this, type );
  12698. // Return non-false to allow normal event-path propagation
  12699. return true;
  12700. },
  12701. delegateType: delegateType
  12702. };
  12703. } );
  12704. // Create mouseenter/leave events using mouseover/out and event-time checks
  12705. // so that event delegation works in jQuery.
  12706. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12707. //
  12708. // Support: Safari 7 only
  12709. // Safari sends mouseenter too often; see:
  12710. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12711. // for the description of the bug (it existed in older Chrome versions as well).
  12712. jQuery.each( {
  12713. mouseenter: "mouseover",
  12714. mouseleave: "mouseout",
  12715. pointerenter: "pointerover",
  12716. pointerleave: "pointerout"
  12717. }, function( orig, fix ) {
  12718. jQuery.event.special[ orig ] = {
  12719. delegateType: fix,
  12720. bindType: fix,
  12721. handle: function( event ) {
  12722. var ret,
  12723. target = this,
  12724. related = event.relatedTarget,
  12725. handleObj = event.handleObj;
  12726. // For mouseenter/leave call the handler if related is outside the target.
  12727. // NB: No relatedTarget if the mouse left/entered the browser window
  12728. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12729. event.type = handleObj.origType;
  12730. ret = handleObj.handler.apply( this, arguments );
  12731. event.type = fix;
  12732. }
  12733. return ret;
  12734. }
  12735. };
  12736. } );
  12737. jQuery.fn.extend( {
  12738. on: function( types, selector, data, fn ) {
  12739. return on( this, types, selector, data, fn );
  12740. },
  12741. one: function( types, selector, data, fn ) {
  12742. return on( this, types, selector, data, fn, 1 );
  12743. },
  12744. off: function( types, selector, fn ) {
  12745. var handleObj, type;
  12746. if ( types && types.preventDefault && types.handleObj ) {
  12747. // ( event ) dispatched jQuery.Event
  12748. handleObj = types.handleObj;
  12749. jQuery( types.delegateTarget ).off(
  12750. handleObj.namespace ?
  12751. handleObj.origType + "." + handleObj.namespace :
  12752. handleObj.origType,
  12753. handleObj.selector,
  12754. handleObj.handler
  12755. );
  12756. return this;
  12757. }
  12758. if ( typeof types === "object" ) {
  12759. // ( types-object [, selector] )
  12760. for ( type in types ) {
  12761. this.off( type, selector, types[ type ] );
  12762. }
  12763. return this;
  12764. }
  12765. if ( selector === false || typeof selector === "function" ) {
  12766. // ( types [, fn] )
  12767. fn = selector;
  12768. selector = undefined;
  12769. }
  12770. if ( fn === false ) {
  12771. fn = returnFalse;
  12772. }
  12773. return this.each( function() {
  12774. jQuery.event.remove( this, types, fn, selector );
  12775. } );
  12776. }
  12777. } );
  12778. var
  12779. /* eslint-disable max-len */
  12780. // See https://github.com/eslint/eslint/issues/3229
  12781. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12782. /* eslint-enable */
  12783. // Support: IE <=10 - 11, Edge 12 - 13 only
  12784. // In IE/Edge using regex groups here causes severe slowdowns.
  12785. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12786. rnoInnerhtml = /<script|<style|<link/i,
  12787. // checked="checked" or checked
  12788. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12789. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12790. // Prefer a tbody over its parent table for containing new rows
  12791. function manipulationTarget( elem, content ) {
  12792. if ( nodeName( elem, "table" ) &&
  12793. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12794. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12795. }
  12796. return elem;
  12797. }
  12798. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12799. function disableScript( elem ) {
  12800. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12801. return elem;
  12802. }
  12803. function restoreScript( elem ) {
  12804. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12805. elem.type = elem.type.slice( 5 );
  12806. } else {
  12807. elem.removeAttribute( "type" );
  12808. }
  12809. return elem;
  12810. }
  12811. function cloneCopyEvent( src, dest ) {
  12812. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12813. if ( dest.nodeType !== 1 ) {
  12814. return;
  12815. }
  12816. // 1. Copy private data: events, handlers, etc.
  12817. if ( dataPriv.hasData( src ) ) {
  12818. pdataOld = dataPriv.access( src );
  12819. pdataCur = dataPriv.set( dest, pdataOld );
  12820. events = pdataOld.events;
  12821. if ( events ) {
  12822. delete pdataCur.handle;
  12823. pdataCur.events = {};
  12824. for ( type in events ) {
  12825. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12826. jQuery.event.add( dest, type, events[ type ][ i ] );
  12827. }
  12828. }
  12829. }
  12830. }
  12831. // 2. Copy user data
  12832. if ( dataUser.hasData( src ) ) {
  12833. udataOld = dataUser.access( src );
  12834. udataCur = jQuery.extend( {}, udataOld );
  12835. dataUser.set( dest, udataCur );
  12836. }
  12837. }
  12838. // Fix IE bugs, see support tests
  12839. function fixInput( src, dest ) {
  12840. var nodeName = dest.nodeName.toLowerCase();
  12841. // Fails to persist the checked state of a cloned checkbox or radio button.
  12842. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12843. dest.checked = src.checked;
  12844. // Fails to return the selected option to the default selected state when cloning options
  12845. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12846. dest.defaultValue = src.defaultValue;
  12847. }
  12848. }
  12849. function domManip( collection, args, callback, ignored ) {
  12850. // Flatten any nested arrays
  12851. args = concat.apply( [], args );
  12852. var fragment, first, scripts, hasScripts, node, doc,
  12853. i = 0,
  12854. l = collection.length,
  12855. iNoClone = l - 1,
  12856. value = args[ 0 ],
  12857. valueIsFunction = isFunction( value );
  12858. // We can't cloneNode fragments that contain checked, in WebKit
  12859. if ( valueIsFunction ||
  12860. ( l > 1 && typeof value === "string" &&
  12861. !support.checkClone && rchecked.test( value ) ) ) {
  12862. return collection.each( function( index ) {
  12863. var self = collection.eq( index );
  12864. if ( valueIsFunction ) {
  12865. args[ 0 ] = value.call( this, index, self.html() );
  12866. }
  12867. domManip( self, args, callback, ignored );
  12868. } );
  12869. }
  12870. if ( l ) {
  12871. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12872. first = fragment.firstChild;
  12873. if ( fragment.childNodes.length === 1 ) {
  12874. fragment = first;
  12875. }
  12876. // Require either new content or an interest in ignored elements to invoke the callback
  12877. if ( first || ignored ) {
  12878. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12879. hasScripts = scripts.length;
  12880. // Use the original fragment for the last item
  12881. // instead of the first because it can end up
  12882. // being emptied incorrectly in certain situations (#8070).
  12883. for ( ; i < l; i++ ) {
  12884. node = fragment;
  12885. if ( i !== iNoClone ) {
  12886. node = jQuery.clone( node, true, true );
  12887. // Keep references to cloned scripts for later restoration
  12888. if ( hasScripts ) {
  12889. // Support: Android <=4.0 only, PhantomJS 1 only
  12890. // push.apply(_, arraylike) throws on ancient WebKit
  12891. jQuery.merge( scripts, getAll( node, "script" ) );
  12892. }
  12893. }
  12894. callback.call( collection[ i ], node, i );
  12895. }
  12896. if ( hasScripts ) {
  12897. doc = scripts[ scripts.length - 1 ].ownerDocument;
  12898. // Reenable scripts
  12899. jQuery.map( scripts, restoreScript );
  12900. // Evaluate executable scripts on first document insertion
  12901. for ( i = 0; i < hasScripts; i++ ) {
  12902. node = scripts[ i ];
  12903. if ( rscriptType.test( node.type || "" ) &&
  12904. !dataPriv.access( node, "globalEval" ) &&
  12905. jQuery.contains( doc, node ) ) {
  12906. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  12907. // Optional AJAX dependency, but won't run scripts if not present
  12908. if ( jQuery._evalUrl && !node.noModule ) {
  12909. jQuery._evalUrl( node.src, {
  12910. nonce: node.nonce || node.getAttribute( "nonce" )
  12911. } );
  12912. }
  12913. } else {
  12914. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  12915. }
  12916. }
  12917. }
  12918. }
  12919. }
  12920. }
  12921. return collection;
  12922. }
  12923. function remove( elem, selector, keepData ) {
  12924. var node,
  12925. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  12926. i = 0;
  12927. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  12928. if ( !keepData && node.nodeType === 1 ) {
  12929. jQuery.cleanData( getAll( node ) );
  12930. }
  12931. if ( node.parentNode ) {
  12932. if ( keepData && isAttached( node ) ) {
  12933. setGlobalEval( getAll( node, "script" ) );
  12934. }
  12935. node.parentNode.removeChild( node );
  12936. }
  12937. }
  12938. return elem;
  12939. }
  12940. jQuery.extend( {
  12941. htmlPrefilter: function( html ) {
  12942. return html.replace( rxhtmlTag, "<$1></$2>" );
  12943. },
  12944. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  12945. var i, l, srcElements, destElements,
  12946. clone = elem.cloneNode( true ),
  12947. inPage = isAttached( elem );
  12948. // Fix IE cloning issues
  12949. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  12950. !jQuery.isXMLDoc( elem ) ) {
  12951. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  12952. destElements = getAll( clone );
  12953. srcElements = getAll( elem );
  12954. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12955. fixInput( srcElements[ i ], destElements[ i ] );
  12956. }
  12957. }
  12958. // Copy the events from the original to the clone
  12959. if ( dataAndEvents ) {
  12960. if ( deepDataAndEvents ) {
  12961. srcElements = srcElements || getAll( elem );
  12962. destElements = destElements || getAll( clone );
  12963. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12964. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  12965. }
  12966. } else {
  12967. cloneCopyEvent( elem, clone );
  12968. }
  12969. }
  12970. // Preserve script evaluation history
  12971. destElements = getAll( clone, "script" );
  12972. if ( destElements.length > 0 ) {
  12973. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  12974. }
  12975. // Return the cloned set
  12976. return clone;
  12977. },
  12978. cleanData: function( elems ) {
  12979. var data, elem, type,
  12980. special = jQuery.event.special,
  12981. i = 0;
  12982. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  12983. if ( acceptData( elem ) ) {
  12984. if ( ( data = elem[ dataPriv.expando ] ) ) {
  12985. if ( data.events ) {
  12986. for ( type in data.events ) {
  12987. if ( special[ type ] ) {
  12988. jQuery.event.remove( elem, type );
  12989. // This is a shortcut to avoid jQuery.event.remove's overhead
  12990. } else {
  12991. jQuery.removeEvent( elem, type, data.handle );
  12992. }
  12993. }
  12994. }
  12995. // Support: Chrome <=35 - 45+
  12996. // Assign undefined instead of using delete, see Data#remove
  12997. elem[ dataPriv.expando ] = undefined;
  12998. }
  12999. if ( elem[ dataUser.expando ] ) {
  13000. // Support: Chrome <=35 - 45+
  13001. // Assign undefined instead of using delete, see Data#remove
  13002. elem[ dataUser.expando ] = undefined;
  13003. }
  13004. }
  13005. }
  13006. }
  13007. } );
  13008. jQuery.fn.extend( {
  13009. detach: function( selector ) {
  13010. return remove( this, selector, true );
  13011. },
  13012. remove: function( selector ) {
  13013. return remove( this, selector );
  13014. },
  13015. text: function( value ) {
  13016. return access( this, function( value ) {
  13017. return value === undefined ?
  13018. jQuery.text( this ) :
  13019. this.empty().each( function() {
  13020. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13021. this.textContent = value;
  13022. }
  13023. } );
  13024. }, null, value, arguments.length );
  13025. },
  13026. append: function() {
  13027. return domManip( this, arguments, function( elem ) {
  13028. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13029. var target = manipulationTarget( this, elem );
  13030. target.appendChild( elem );
  13031. }
  13032. } );
  13033. },
  13034. prepend: function() {
  13035. return domManip( this, arguments, function( elem ) {
  13036. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13037. var target = manipulationTarget( this, elem );
  13038. target.insertBefore( elem, target.firstChild );
  13039. }
  13040. } );
  13041. },
  13042. before: function() {
  13043. return domManip( this, arguments, function( elem ) {
  13044. if ( this.parentNode ) {
  13045. this.parentNode.insertBefore( elem, this );
  13046. }
  13047. } );
  13048. },
  13049. after: function() {
  13050. return domManip( this, arguments, function( elem ) {
  13051. if ( this.parentNode ) {
  13052. this.parentNode.insertBefore( elem, this.nextSibling );
  13053. }
  13054. } );
  13055. },
  13056. empty: function() {
  13057. var elem,
  13058. i = 0;
  13059. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13060. if ( elem.nodeType === 1 ) {
  13061. // Prevent memory leaks
  13062. jQuery.cleanData( getAll( elem, false ) );
  13063. // Remove any remaining nodes
  13064. elem.textContent = "";
  13065. }
  13066. }
  13067. return this;
  13068. },
  13069. clone: function( dataAndEvents, deepDataAndEvents ) {
  13070. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13071. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13072. return this.map( function() {
  13073. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13074. } );
  13075. },
  13076. html: function( value ) {
  13077. return access( this, function( value ) {
  13078. var elem = this[ 0 ] || {},
  13079. i = 0,
  13080. l = this.length;
  13081. if ( value === undefined && elem.nodeType === 1 ) {
  13082. return elem.innerHTML;
  13083. }
  13084. // See if we can take a shortcut and just use innerHTML
  13085. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13086. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13087. value = jQuery.htmlPrefilter( value );
  13088. try {
  13089. for ( ; i < l; i++ ) {
  13090. elem = this[ i ] || {};
  13091. // Remove element nodes and prevent memory leaks
  13092. if ( elem.nodeType === 1 ) {
  13093. jQuery.cleanData( getAll( elem, false ) );
  13094. elem.innerHTML = value;
  13095. }
  13096. }
  13097. elem = 0;
  13098. // If using innerHTML throws an exception, use the fallback method
  13099. } catch ( e ) {}
  13100. }
  13101. if ( elem ) {
  13102. this.empty().append( value );
  13103. }
  13104. }, null, value, arguments.length );
  13105. },
  13106. replaceWith: function() {
  13107. var ignored = [];
  13108. // Make the changes, replacing each non-ignored context element with the new content
  13109. return domManip( this, arguments, function( elem ) {
  13110. var parent = this.parentNode;
  13111. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13112. jQuery.cleanData( getAll( this ) );
  13113. if ( parent ) {
  13114. parent.replaceChild( elem, this );
  13115. }
  13116. }
  13117. // Force callback invocation
  13118. }, ignored );
  13119. }
  13120. } );
  13121. jQuery.each( {
  13122. appendTo: "append",
  13123. prependTo: "prepend",
  13124. insertBefore: "before",
  13125. insertAfter: "after",
  13126. replaceAll: "replaceWith"
  13127. }, function( name, original ) {
  13128. jQuery.fn[ name ] = function( selector ) {
  13129. var elems,
  13130. ret = [],
  13131. insert = jQuery( selector ),
  13132. last = insert.length - 1,
  13133. i = 0;
  13134. for ( ; i <= last; i++ ) {
  13135. elems = i === last ? this : this.clone( true );
  13136. jQuery( insert[ i ] )[ original ]( elems );
  13137. // Support: Android <=4.0 only, PhantomJS 1 only
  13138. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13139. push.apply( ret, elems.get() );
  13140. }
  13141. return this.pushStack( ret );
  13142. };
  13143. } );
  13144. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13145. var getStyles = function( elem ) {
  13146. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13147. // IE throws on elements created in popups
  13148. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13149. var view = elem.ownerDocument.defaultView;
  13150. if ( !view || !view.opener ) {
  13151. view = window;
  13152. }
  13153. return view.getComputedStyle( elem );
  13154. };
  13155. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13156. ( function() {
  13157. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13158. // so they're executed at the same time to save the second computation.
  13159. function computeStyleTests() {
  13160. // This is a singleton, we need to execute it only once
  13161. if ( !div ) {
  13162. return;
  13163. }
  13164. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13165. "margin-top:1px;padding:0;border:0";
  13166. div.style.cssText =
  13167. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13168. "margin:auto;border:1px;padding:1px;" +
  13169. "width:60%;top:1%";
  13170. documentElement.appendChild( container ).appendChild( div );
  13171. var divStyle = window.getComputedStyle( div );
  13172. pixelPositionVal = divStyle.top !== "1%";
  13173. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13174. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13175. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13176. // Some styles come back with percentage values, even though they shouldn't
  13177. div.style.right = "60%";
  13178. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13179. // Support: IE 9 - 11 only
  13180. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13181. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13182. // Support: IE 9 only
  13183. // Detect overflow:scroll screwiness (gh-3699)
  13184. // Support: Chrome <=64
  13185. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13186. div.style.position = "absolute";
  13187. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13188. documentElement.removeChild( container );
  13189. // Nullify the div so it wouldn't be stored in the memory and
  13190. // it will also be a sign that checks already performed
  13191. div = null;
  13192. }
  13193. function roundPixelMeasures( measure ) {
  13194. return Math.round( parseFloat( measure ) );
  13195. }
  13196. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13197. reliableMarginLeftVal,
  13198. container = document.createElement( "div" ),
  13199. div = document.createElement( "div" );
  13200. // Finish early in limited (non-browser) environments
  13201. if ( !div.style ) {
  13202. return;
  13203. }
  13204. // Support: IE <=9 - 11 only
  13205. // Style of cloned element affects source element cloned (#8908)
  13206. div.style.backgroundClip = "content-box";
  13207. div.cloneNode( true ).style.backgroundClip = "";
  13208. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13209. jQuery.extend( support, {
  13210. boxSizingReliable: function() {
  13211. computeStyleTests();
  13212. return boxSizingReliableVal;
  13213. },
  13214. pixelBoxStyles: function() {
  13215. computeStyleTests();
  13216. return pixelBoxStylesVal;
  13217. },
  13218. pixelPosition: function() {
  13219. computeStyleTests();
  13220. return pixelPositionVal;
  13221. },
  13222. reliableMarginLeft: function() {
  13223. computeStyleTests();
  13224. return reliableMarginLeftVal;
  13225. },
  13226. scrollboxSize: function() {
  13227. computeStyleTests();
  13228. return scrollboxSizeVal;
  13229. }
  13230. } );
  13231. } )();
  13232. function curCSS( elem, name, computed ) {
  13233. var width, minWidth, maxWidth, ret,
  13234. // Support: Firefox 51+
  13235. // Retrieving style before computed somehow
  13236. // fixes an issue with getting wrong values
  13237. // on detached elements
  13238. style = elem.style;
  13239. computed = computed || getStyles( elem );
  13240. // getPropertyValue is needed for:
  13241. // .css('filter') (IE 9 only, #12537)
  13242. // .css('--customProperty) (#3144)
  13243. if ( computed ) {
  13244. ret = computed.getPropertyValue( name ) || computed[ name ];
  13245. if ( ret === "" && !isAttached( elem ) ) {
  13246. ret = jQuery.style( elem, name );
  13247. }
  13248. // A tribute to the "awesome hack by Dean Edwards"
  13249. // Android Browser returns percentage for some values,
  13250. // but width seems to be reliably pixels.
  13251. // This is against the CSSOM draft spec:
  13252. // https://drafts.csswg.org/cssom/#resolved-values
  13253. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13254. // Remember the original values
  13255. width = style.width;
  13256. minWidth = style.minWidth;
  13257. maxWidth = style.maxWidth;
  13258. // Put in the new values to get a computed value out
  13259. style.minWidth = style.maxWidth = style.width = ret;
  13260. ret = computed.width;
  13261. // Revert the changed values
  13262. style.width = width;
  13263. style.minWidth = minWidth;
  13264. style.maxWidth = maxWidth;
  13265. }
  13266. }
  13267. return ret !== undefined ?
  13268. // Support: IE <=9 - 11 only
  13269. // IE returns zIndex value as an integer.
  13270. ret + "" :
  13271. ret;
  13272. }
  13273. function addGetHookIf( conditionFn, hookFn ) {
  13274. // Define the hook, we'll check on the first run if it's really needed.
  13275. return {
  13276. get: function() {
  13277. if ( conditionFn() ) {
  13278. // Hook not needed (or it's not possible to use it due
  13279. // to missing dependency), remove it.
  13280. delete this.get;
  13281. return;
  13282. }
  13283. // Hook needed; redefine it so that the support test is not executed again.
  13284. return ( this.get = hookFn ).apply( this, arguments );
  13285. }
  13286. };
  13287. }
  13288. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13289. emptyStyle = document.createElement( "div" ).style,
  13290. vendorProps = {};
  13291. // Return a vendor-prefixed property or undefined
  13292. function vendorPropName( name ) {
  13293. // Check for vendor prefixed names
  13294. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13295. i = cssPrefixes.length;
  13296. while ( i-- ) {
  13297. name = cssPrefixes[ i ] + capName;
  13298. if ( name in emptyStyle ) {
  13299. return name;
  13300. }
  13301. }
  13302. }
  13303. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13304. function finalPropName( name ) {
  13305. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13306. if ( final ) {
  13307. return final;
  13308. }
  13309. if ( name in emptyStyle ) {
  13310. return name;
  13311. }
  13312. return vendorProps[ name ] = vendorPropName( name ) || name;
  13313. }
  13314. var
  13315. // Swappable if display is none or starts with table
  13316. // except "table", "table-cell", or "table-caption"
  13317. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13318. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13319. rcustomProp = /^--/,
  13320. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13321. cssNormalTransform = {
  13322. letterSpacing: "0",
  13323. fontWeight: "400"
  13324. };
  13325. function setPositiveNumber( elem, value, subtract ) {
  13326. // Any relative (+/-) values have already been
  13327. // normalized at this point
  13328. var matches = rcssNum.exec( value );
  13329. return matches ?
  13330. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13331. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13332. value;
  13333. }
  13334. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13335. var i = dimension === "width" ? 1 : 0,
  13336. extra = 0,
  13337. delta = 0;
  13338. // Adjustment may not be necessary
  13339. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13340. return 0;
  13341. }
  13342. for ( ; i < 4; i += 2 ) {
  13343. // Both box models exclude margin
  13344. if ( box === "margin" ) {
  13345. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13346. }
  13347. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13348. if ( !isBorderBox ) {
  13349. // Add padding
  13350. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13351. // For "border" or "margin", add border
  13352. if ( box !== "padding" ) {
  13353. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13354. // But still keep track of it otherwise
  13355. } else {
  13356. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13357. }
  13358. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13359. // "padding" or "margin"
  13360. } else {
  13361. // For "content", subtract padding
  13362. if ( box === "content" ) {
  13363. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13364. }
  13365. // For "content" or "padding", subtract border
  13366. if ( box !== "margin" ) {
  13367. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13368. }
  13369. }
  13370. }
  13371. // Account for positive content-box scroll gutter when requested by providing computedVal
  13372. if ( !isBorderBox && computedVal >= 0 ) {
  13373. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13374. // Assuming integer scroll gutter, subtract the rest and round down
  13375. delta += Math.max( 0, Math.ceil(
  13376. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13377. computedVal -
  13378. delta -
  13379. extra -
  13380. 0.5
  13381. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13382. // Use an explicit zero to avoid NaN (gh-3964)
  13383. ) ) || 0;
  13384. }
  13385. return delta;
  13386. }
  13387. function getWidthOrHeight( elem, dimension, extra ) {
  13388. // Start with computed style
  13389. var styles = getStyles( elem ),
  13390. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13391. // Fake content-box until we know it's needed to know the true value.
  13392. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13393. isBorderBox = boxSizingNeeded &&
  13394. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13395. valueIsBorderBox = isBorderBox,
  13396. val = curCSS( elem, dimension, styles ),
  13397. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13398. // Support: Firefox <=54
  13399. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13400. if ( rnumnonpx.test( val ) ) {
  13401. if ( !extra ) {
  13402. return val;
  13403. }
  13404. val = "auto";
  13405. }
  13406. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13407. // This happens for inline elements with no explicit setting (gh-3571)
  13408. // Support: Android <=4.1 - 4.3 only
  13409. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13410. // Support: IE 9-11 only
  13411. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13412. // We use getClientRects() to check for hidden/disconnected.
  13413. // In those cases, the computed value can be trusted to be border-box
  13414. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13415. val === "auto" ||
  13416. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13417. elem.getClientRects().length ) {
  13418. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13419. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13420. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13421. // retrieved value as a content box dimension.
  13422. valueIsBorderBox = offsetProp in elem;
  13423. if ( valueIsBorderBox ) {
  13424. val = elem[ offsetProp ];
  13425. }
  13426. }
  13427. // Normalize "" and auto
  13428. val = parseFloat( val ) || 0;
  13429. // Adjust for the element's box model
  13430. return ( val +
  13431. boxModelAdjustment(
  13432. elem,
  13433. dimension,
  13434. extra || ( isBorderBox ? "border" : "content" ),
  13435. valueIsBorderBox,
  13436. styles,
  13437. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13438. val
  13439. )
  13440. ) + "px";
  13441. }
  13442. jQuery.extend( {
  13443. // Add in style property hooks for overriding the default
  13444. // behavior of getting and setting a style property
  13445. cssHooks: {
  13446. opacity: {
  13447. get: function( elem, computed ) {
  13448. if ( computed ) {
  13449. // We should always get a number back from opacity
  13450. var ret = curCSS( elem, "opacity" );
  13451. return ret === "" ? "1" : ret;
  13452. }
  13453. }
  13454. }
  13455. },
  13456. // Don't automatically add "px" to these possibly-unitless properties
  13457. cssNumber: {
  13458. "animationIterationCount": true,
  13459. "columnCount": true,
  13460. "fillOpacity": true,
  13461. "flexGrow": true,
  13462. "flexShrink": true,
  13463. "fontWeight": true,
  13464. "gridArea": true,
  13465. "gridColumn": true,
  13466. "gridColumnEnd": true,
  13467. "gridColumnStart": true,
  13468. "gridRow": true,
  13469. "gridRowEnd": true,
  13470. "gridRowStart": true,
  13471. "lineHeight": true,
  13472. "opacity": true,
  13473. "order": true,
  13474. "orphans": true,
  13475. "widows": true,
  13476. "zIndex": true,
  13477. "zoom": true
  13478. },
  13479. // Add in properties whose names you wish to fix before
  13480. // setting or getting the value
  13481. cssProps: {},
  13482. // Get and set the style property on a DOM Node
  13483. style: function( elem, name, value, extra ) {
  13484. // Don't set styles on text and comment nodes
  13485. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13486. return;
  13487. }
  13488. // Make sure that we're working with the right name
  13489. var ret, type, hooks,
  13490. origName = camelCase( name ),
  13491. isCustomProp = rcustomProp.test( name ),
  13492. style = elem.style;
  13493. // Make sure that we're working with the right name. We don't
  13494. // want to query the value if it is a CSS custom property
  13495. // since they are user-defined.
  13496. if ( !isCustomProp ) {
  13497. name = finalPropName( origName );
  13498. }
  13499. // Gets hook for the prefixed version, then unprefixed version
  13500. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13501. // Check if we're setting a value
  13502. if ( value !== undefined ) {
  13503. type = typeof value;
  13504. // Convert "+=" or "-=" to relative numbers (#7345)
  13505. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13506. value = adjustCSS( elem, name, ret );
  13507. // Fixes bug #9237
  13508. type = "number";
  13509. }
  13510. // Make sure that null and NaN values aren't set (#7116)
  13511. if ( value == null || value !== value ) {
  13512. return;
  13513. }
  13514. // If a number was passed in, add the unit (except for certain CSS properties)
  13515. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13516. // "px" to a few hardcoded values.
  13517. if ( type === "number" && !isCustomProp ) {
  13518. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13519. }
  13520. // background-* props affect original clone's values
  13521. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13522. style[ name ] = "inherit";
  13523. }
  13524. // If a hook was provided, use that value, otherwise just set the specified value
  13525. if ( !hooks || !( "set" in hooks ) ||
  13526. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13527. if ( isCustomProp ) {
  13528. style.setProperty( name, value );
  13529. } else {
  13530. style[ name ] = value;
  13531. }
  13532. }
  13533. } else {
  13534. // If a hook was provided get the non-computed value from there
  13535. if ( hooks && "get" in hooks &&
  13536. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13537. return ret;
  13538. }
  13539. // Otherwise just get the value from the style object
  13540. return style[ name ];
  13541. }
  13542. },
  13543. css: function( elem, name, extra, styles ) {
  13544. var val, num, hooks,
  13545. origName = camelCase( name ),
  13546. isCustomProp = rcustomProp.test( name );
  13547. // Make sure that we're working with the right name. We don't
  13548. // want to modify the value if it is a CSS custom property
  13549. // since they are user-defined.
  13550. if ( !isCustomProp ) {
  13551. name = finalPropName( origName );
  13552. }
  13553. // Try prefixed name followed by the unprefixed name
  13554. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13555. // If a hook was provided get the computed value from there
  13556. if ( hooks && "get" in hooks ) {
  13557. val = hooks.get( elem, true, extra );
  13558. }
  13559. // Otherwise, if a way to get the computed value exists, use that
  13560. if ( val === undefined ) {
  13561. val = curCSS( elem, name, styles );
  13562. }
  13563. // Convert "normal" to computed value
  13564. if ( val === "normal" && name in cssNormalTransform ) {
  13565. val = cssNormalTransform[ name ];
  13566. }
  13567. // Make numeric if forced or a qualifier was provided and val looks numeric
  13568. if ( extra === "" || extra ) {
  13569. num = parseFloat( val );
  13570. return extra === true || isFinite( num ) ? num || 0 : val;
  13571. }
  13572. return val;
  13573. }
  13574. } );
  13575. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13576. jQuery.cssHooks[ dimension ] = {
  13577. get: function( elem, computed, extra ) {
  13578. if ( computed ) {
  13579. // Certain elements can have dimension info if we invisibly show them
  13580. // but it must have a current display style that would benefit
  13581. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13582. // Support: Safari 8+
  13583. // Table columns in Safari have non-zero offsetWidth & zero
  13584. // getBoundingClientRect().width unless display is changed.
  13585. // Support: IE <=11 only
  13586. // Running getBoundingClientRect on a disconnected node
  13587. // in IE throws an error.
  13588. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13589. swap( elem, cssShow, function() {
  13590. return getWidthOrHeight( elem, dimension, extra );
  13591. } ) :
  13592. getWidthOrHeight( elem, dimension, extra );
  13593. }
  13594. },
  13595. set: function( elem, value, extra ) {
  13596. var matches,
  13597. styles = getStyles( elem ),
  13598. // Only read styles.position if the test has a chance to fail
  13599. // to avoid forcing a reflow.
  13600. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13601. styles.position === "absolute",
  13602. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13603. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13604. isBorderBox = boxSizingNeeded &&
  13605. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13606. subtract = extra ?
  13607. boxModelAdjustment(
  13608. elem,
  13609. dimension,
  13610. extra,
  13611. isBorderBox,
  13612. styles
  13613. ) :
  13614. 0;
  13615. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13616. // faking a content-box to get border and padding (gh-3699)
  13617. if ( isBorderBox && scrollboxSizeBuggy ) {
  13618. subtract -= Math.ceil(
  13619. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13620. parseFloat( styles[ dimension ] ) -
  13621. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13622. 0.5
  13623. );
  13624. }
  13625. // Convert to pixels if value adjustment is needed
  13626. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13627. ( matches[ 3 ] || "px" ) !== "px" ) {
  13628. elem.style[ dimension ] = value;
  13629. value = jQuery.css( elem, dimension );
  13630. }
  13631. return setPositiveNumber( elem, value, subtract );
  13632. }
  13633. };
  13634. } );
  13635. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13636. function( elem, computed ) {
  13637. if ( computed ) {
  13638. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13639. elem.getBoundingClientRect().left -
  13640. swap( elem, { marginLeft: 0 }, function() {
  13641. return elem.getBoundingClientRect().left;
  13642. } )
  13643. ) + "px";
  13644. }
  13645. }
  13646. );
  13647. // These hooks are used by animate to expand properties
  13648. jQuery.each( {
  13649. margin: "",
  13650. padding: "",
  13651. border: "Width"
  13652. }, function( prefix, suffix ) {
  13653. jQuery.cssHooks[ prefix + suffix ] = {
  13654. expand: function( value ) {
  13655. var i = 0,
  13656. expanded = {},
  13657. // Assumes a single number if not a string
  13658. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13659. for ( ; i < 4; i++ ) {
  13660. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13661. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13662. }
  13663. return expanded;
  13664. }
  13665. };
  13666. if ( prefix !== "margin" ) {
  13667. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13668. }
  13669. } );
  13670. jQuery.fn.extend( {
  13671. css: function( name, value ) {
  13672. return access( this, function( elem, name, value ) {
  13673. var styles, len,
  13674. map = {},
  13675. i = 0;
  13676. if ( Array.isArray( name ) ) {
  13677. styles = getStyles( elem );
  13678. len = name.length;
  13679. for ( ; i < len; i++ ) {
  13680. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13681. }
  13682. return map;
  13683. }
  13684. return value !== undefined ?
  13685. jQuery.style( elem, name, value ) :
  13686. jQuery.css( elem, name );
  13687. }, name, value, arguments.length > 1 );
  13688. }
  13689. } );
  13690. function Tween( elem, options, prop, end, easing ) {
  13691. return new Tween.prototype.init( elem, options, prop, end, easing );
  13692. }
  13693. jQuery.Tween = Tween;
  13694. Tween.prototype = {
  13695. constructor: Tween,
  13696. init: function( elem, options, prop, end, easing, unit ) {
  13697. this.elem = elem;
  13698. this.prop = prop;
  13699. this.easing = easing || jQuery.easing._default;
  13700. this.options = options;
  13701. this.start = this.now = this.cur();
  13702. this.end = end;
  13703. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13704. },
  13705. cur: function() {
  13706. var hooks = Tween.propHooks[ this.prop ];
  13707. return hooks && hooks.get ?
  13708. hooks.get( this ) :
  13709. Tween.propHooks._default.get( this );
  13710. },
  13711. run: function( percent ) {
  13712. var eased,
  13713. hooks = Tween.propHooks[ this.prop ];
  13714. if ( this.options.duration ) {
  13715. this.pos = eased = jQuery.easing[ this.easing ](
  13716. percent, this.options.duration * percent, 0, 1, this.options.duration
  13717. );
  13718. } else {
  13719. this.pos = eased = percent;
  13720. }
  13721. this.now = ( this.end - this.start ) * eased + this.start;
  13722. if ( this.options.step ) {
  13723. this.options.step.call( this.elem, this.now, this );
  13724. }
  13725. if ( hooks && hooks.set ) {
  13726. hooks.set( this );
  13727. } else {
  13728. Tween.propHooks._default.set( this );
  13729. }
  13730. return this;
  13731. }
  13732. };
  13733. Tween.prototype.init.prototype = Tween.prototype;
  13734. Tween.propHooks = {
  13735. _default: {
  13736. get: function( tween ) {
  13737. var result;
  13738. // Use a property on the element directly when it is not a DOM element,
  13739. // or when there is no matching style property that exists.
  13740. if ( tween.elem.nodeType !== 1 ||
  13741. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13742. return tween.elem[ tween.prop ];
  13743. }
  13744. // Passing an empty string as a 3rd parameter to .css will automatically
  13745. // attempt a parseFloat and fallback to a string if the parse fails.
  13746. // Simple values such as "10px" are parsed to Float;
  13747. // complex values such as "rotate(1rad)" are returned as-is.
  13748. result = jQuery.css( tween.elem, tween.prop, "" );
  13749. // Empty strings, null, undefined and "auto" are converted to 0.
  13750. return !result || result === "auto" ? 0 : result;
  13751. },
  13752. set: function( tween ) {
  13753. // Use step hook for back compat.
  13754. // Use cssHook if its there.
  13755. // Use .style if available and use plain properties where available.
  13756. if ( jQuery.fx.step[ tween.prop ] ) {
  13757. jQuery.fx.step[ tween.prop ]( tween );
  13758. } else if ( tween.elem.nodeType === 1 && (
  13759. jQuery.cssHooks[ tween.prop ] ||
  13760. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13761. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13762. } else {
  13763. tween.elem[ tween.prop ] = tween.now;
  13764. }
  13765. }
  13766. }
  13767. };
  13768. // Support: IE <=9 only
  13769. // Panic based approach to setting things on disconnected nodes
  13770. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13771. set: function( tween ) {
  13772. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13773. tween.elem[ tween.prop ] = tween.now;
  13774. }
  13775. }
  13776. };
  13777. jQuery.easing = {
  13778. linear: function( p ) {
  13779. return p;
  13780. },
  13781. swing: function( p ) {
  13782. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13783. },
  13784. _default: "swing"
  13785. };
  13786. jQuery.fx = Tween.prototype.init;
  13787. // Back compat <1.8 extension point
  13788. jQuery.fx.step = {};
  13789. var
  13790. fxNow, inProgress,
  13791. rfxtypes = /^(?:toggle|show|hide)$/,
  13792. rrun = /queueHooks$/;
  13793. function schedule() {
  13794. if ( inProgress ) {
  13795. if ( document.hidden === false && window.requestAnimationFrame ) {
  13796. window.requestAnimationFrame( schedule );
  13797. } else {
  13798. window.setTimeout( schedule, jQuery.fx.interval );
  13799. }
  13800. jQuery.fx.tick();
  13801. }
  13802. }
  13803. // Animations created synchronously will run synchronously
  13804. function createFxNow() {
  13805. window.setTimeout( function() {
  13806. fxNow = undefined;
  13807. } );
  13808. return ( fxNow = Date.now() );
  13809. }
  13810. // Generate parameters to create a standard animation
  13811. function genFx( type, includeWidth ) {
  13812. var which,
  13813. i = 0,
  13814. attrs = { height: type };
  13815. // If we include width, step value is 1 to do all cssExpand values,
  13816. // otherwise step value is 2 to skip over Left and Right
  13817. includeWidth = includeWidth ? 1 : 0;
  13818. for ( ; i < 4; i += 2 - includeWidth ) {
  13819. which = cssExpand[ i ];
  13820. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13821. }
  13822. if ( includeWidth ) {
  13823. attrs.opacity = attrs.width = type;
  13824. }
  13825. return attrs;
  13826. }
  13827. function createTween( value, prop, animation ) {
  13828. var tween,
  13829. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13830. index = 0,
  13831. length = collection.length;
  13832. for ( ; index < length; index++ ) {
  13833. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13834. // We're done with this property
  13835. return tween;
  13836. }
  13837. }
  13838. }
  13839. function defaultPrefilter( elem, props, opts ) {
  13840. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13841. isBox = "width" in props || "height" in props,
  13842. anim = this,
  13843. orig = {},
  13844. style = elem.style,
  13845. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13846. dataShow = dataPriv.get( elem, "fxshow" );
  13847. // Queue-skipping animations hijack the fx hooks
  13848. if ( !opts.queue ) {
  13849. hooks = jQuery._queueHooks( elem, "fx" );
  13850. if ( hooks.unqueued == null ) {
  13851. hooks.unqueued = 0;
  13852. oldfire = hooks.empty.fire;
  13853. hooks.empty.fire = function() {
  13854. if ( !hooks.unqueued ) {
  13855. oldfire();
  13856. }
  13857. };
  13858. }
  13859. hooks.unqueued++;
  13860. anim.always( function() {
  13861. // Ensure the complete handler is called before this completes
  13862. anim.always( function() {
  13863. hooks.unqueued--;
  13864. if ( !jQuery.queue( elem, "fx" ).length ) {
  13865. hooks.empty.fire();
  13866. }
  13867. } );
  13868. } );
  13869. }
  13870. // Detect show/hide animations
  13871. for ( prop in props ) {
  13872. value = props[ prop ];
  13873. if ( rfxtypes.test( value ) ) {
  13874. delete props[ prop ];
  13875. toggle = toggle || value === "toggle";
  13876. if ( value === ( hidden ? "hide" : "show" ) ) {
  13877. // Pretend to be hidden if this is a "show" and
  13878. // there is still data from a stopped show/hide
  13879. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13880. hidden = true;
  13881. // Ignore all other no-op show/hide data
  13882. } else {
  13883. continue;
  13884. }
  13885. }
  13886. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13887. }
  13888. }
  13889. // Bail out if this is a no-op like .hide().hide()
  13890. propTween = !jQuery.isEmptyObject( props );
  13891. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  13892. return;
  13893. }
  13894. // Restrict "overflow" and "display" styles during box animations
  13895. if ( isBox && elem.nodeType === 1 ) {
  13896. // Support: IE <=9 - 11, Edge 12 - 15
  13897. // Record all 3 overflow attributes because IE does not infer the shorthand
  13898. // from identically-valued overflowX and overflowY and Edge just mirrors
  13899. // the overflowX value there.
  13900. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  13901. // Identify a display type, preferring old show/hide data over the CSS cascade
  13902. restoreDisplay = dataShow && dataShow.display;
  13903. if ( restoreDisplay == null ) {
  13904. restoreDisplay = dataPriv.get( elem, "display" );
  13905. }
  13906. display = jQuery.css( elem, "display" );
  13907. if ( display === "none" ) {
  13908. if ( restoreDisplay ) {
  13909. display = restoreDisplay;
  13910. } else {
  13911. // Get nonempty value(s) by temporarily forcing visibility
  13912. showHide( [ elem ], true );
  13913. restoreDisplay = elem.style.display || restoreDisplay;
  13914. display = jQuery.css( elem, "display" );
  13915. showHide( [ elem ] );
  13916. }
  13917. }
  13918. // Animate inline elements as inline-block
  13919. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  13920. if ( jQuery.css( elem, "float" ) === "none" ) {
  13921. // Restore the original display value at the end of pure show/hide animations
  13922. if ( !propTween ) {
  13923. anim.done( function() {
  13924. style.display = restoreDisplay;
  13925. } );
  13926. if ( restoreDisplay == null ) {
  13927. display = style.display;
  13928. restoreDisplay = display === "none" ? "" : display;
  13929. }
  13930. }
  13931. style.display = "inline-block";
  13932. }
  13933. }
  13934. }
  13935. if ( opts.overflow ) {
  13936. style.overflow = "hidden";
  13937. anim.always( function() {
  13938. style.overflow = opts.overflow[ 0 ];
  13939. style.overflowX = opts.overflow[ 1 ];
  13940. style.overflowY = opts.overflow[ 2 ];
  13941. } );
  13942. }
  13943. // Implement show/hide animations
  13944. propTween = false;
  13945. for ( prop in orig ) {
  13946. // General show/hide setup for this element animation
  13947. if ( !propTween ) {
  13948. if ( dataShow ) {
  13949. if ( "hidden" in dataShow ) {
  13950. hidden = dataShow.hidden;
  13951. }
  13952. } else {
  13953. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  13954. }
  13955. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  13956. if ( toggle ) {
  13957. dataShow.hidden = !hidden;
  13958. }
  13959. // Show elements before animating them
  13960. if ( hidden ) {
  13961. showHide( [ elem ], true );
  13962. }
  13963. /* eslint-disable no-loop-func */
  13964. anim.done( function() {
  13965. /* eslint-enable no-loop-func */
  13966. // The final step of a "hide" animation is actually hiding the element
  13967. if ( !hidden ) {
  13968. showHide( [ elem ] );
  13969. }
  13970. dataPriv.remove( elem, "fxshow" );
  13971. for ( prop in orig ) {
  13972. jQuery.style( elem, prop, orig[ prop ] );
  13973. }
  13974. } );
  13975. }
  13976. // Per-property setup
  13977. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  13978. if ( !( prop in dataShow ) ) {
  13979. dataShow[ prop ] = propTween.start;
  13980. if ( hidden ) {
  13981. propTween.end = propTween.start;
  13982. propTween.start = 0;
  13983. }
  13984. }
  13985. }
  13986. }
  13987. function propFilter( props, specialEasing ) {
  13988. var index, name, easing, value, hooks;
  13989. // camelCase, specialEasing and expand cssHook pass
  13990. for ( index in props ) {
  13991. name = camelCase( index );
  13992. easing = specialEasing[ name ];
  13993. value = props[ index ];
  13994. if ( Array.isArray( value ) ) {
  13995. easing = value[ 1 ];
  13996. value = props[ index ] = value[ 0 ];
  13997. }
  13998. if ( index !== name ) {
  13999. props[ name ] = value;
  14000. delete props[ index ];
  14001. }
  14002. hooks = jQuery.cssHooks[ name ];
  14003. if ( hooks && "expand" in hooks ) {
  14004. value = hooks.expand( value );
  14005. delete props[ name ];
  14006. // Not quite $.extend, this won't overwrite existing keys.
  14007. // Reusing 'index' because we have the correct "name"
  14008. for ( index in value ) {
  14009. if ( !( index in props ) ) {
  14010. props[ index ] = value[ index ];
  14011. specialEasing[ index ] = easing;
  14012. }
  14013. }
  14014. } else {
  14015. specialEasing[ name ] = easing;
  14016. }
  14017. }
  14018. }
  14019. function Animation( elem, properties, options ) {
  14020. var result,
  14021. stopped,
  14022. index = 0,
  14023. length = Animation.prefilters.length,
  14024. deferred = jQuery.Deferred().always( function() {
  14025. // Don't match elem in the :animated selector
  14026. delete tick.elem;
  14027. } ),
  14028. tick = function() {
  14029. if ( stopped ) {
  14030. return false;
  14031. }
  14032. var currentTime = fxNow || createFxNow(),
  14033. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14034. // Support: Android 2.3 only
  14035. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14036. temp = remaining / animation.duration || 0,
  14037. percent = 1 - temp,
  14038. index = 0,
  14039. length = animation.tweens.length;
  14040. for ( ; index < length; index++ ) {
  14041. animation.tweens[ index ].run( percent );
  14042. }
  14043. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14044. // If there's more to do, yield
  14045. if ( percent < 1 && length ) {
  14046. return remaining;
  14047. }
  14048. // If this was an empty animation, synthesize a final progress notification
  14049. if ( !length ) {
  14050. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14051. }
  14052. // Resolve the animation and report its conclusion
  14053. deferred.resolveWith( elem, [ animation ] );
  14054. return false;
  14055. },
  14056. animation = deferred.promise( {
  14057. elem: elem,
  14058. props: jQuery.extend( {}, properties ),
  14059. opts: jQuery.extend( true, {
  14060. specialEasing: {},
  14061. easing: jQuery.easing._default
  14062. }, options ),
  14063. originalProperties: properties,
  14064. originalOptions: options,
  14065. startTime: fxNow || createFxNow(),
  14066. duration: options.duration,
  14067. tweens: [],
  14068. createTween: function( prop, end ) {
  14069. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14070. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14071. animation.tweens.push( tween );
  14072. return tween;
  14073. },
  14074. stop: function( gotoEnd ) {
  14075. var index = 0,
  14076. // If we are going to the end, we want to run all the tweens
  14077. // otherwise we skip this part
  14078. length = gotoEnd ? animation.tweens.length : 0;
  14079. if ( stopped ) {
  14080. return this;
  14081. }
  14082. stopped = true;
  14083. for ( ; index < length; index++ ) {
  14084. animation.tweens[ index ].run( 1 );
  14085. }
  14086. // Resolve when we played the last frame; otherwise, reject
  14087. if ( gotoEnd ) {
  14088. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14089. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14090. } else {
  14091. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14092. }
  14093. return this;
  14094. }
  14095. } ),
  14096. props = animation.props;
  14097. propFilter( props, animation.opts.specialEasing );
  14098. for ( ; index < length; index++ ) {
  14099. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14100. if ( result ) {
  14101. if ( isFunction( result.stop ) ) {
  14102. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14103. result.stop.bind( result );
  14104. }
  14105. return result;
  14106. }
  14107. }
  14108. jQuery.map( props, createTween, animation );
  14109. if ( isFunction( animation.opts.start ) ) {
  14110. animation.opts.start.call( elem, animation );
  14111. }
  14112. // Attach callbacks from options
  14113. animation
  14114. .progress( animation.opts.progress )
  14115. .done( animation.opts.done, animation.opts.complete )
  14116. .fail( animation.opts.fail )
  14117. .always( animation.opts.always );
  14118. jQuery.fx.timer(
  14119. jQuery.extend( tick, {
  14120. elem: elem,
  14121. anim: animation,
  14122. queue: animation.opts.queue
  14123. } )
  14124. );
  14125. return animation;
  14126. }
  14127. jQuery.Animation = jQuery.extend( Animation, {
  14128. tweeners: {
  14129. "*": [ function( prop, value ) {
  14130. var tween = this.createTween( prop, value );
  14131. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14132. return tween;
  14133. } ]
  14134. },
  14135. tweener: function( props, callback ) {
  14136. if ( isFunction( props ) ) {
  14137. callback = props;
  14138. props = [ "*" ];
  14139. } else {
  14140. props = props.match( rnothtmlwhite );
  14141. }
  14142. var prop,
  14143. index = 0,
  14144. length = props.length;
  14145. for ( ; index < length; index++ ) {
  14146. prop = props[ index ];
  14147. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14148. Animation.tweeners[ prop ].unshift( callback );
  14149. }
  14150. },
  14151. prefilters: [ defaultPrefilter ],
  14152. prefilter: function( callback, prepend ) {
  14153. if ( prepend ) {
  14154. Animation.prefilters.unshift( callback );
  14155. } else {
  14156. Animation.prefilters.push( callback );
  14157. }
  14158. }
  14159. } );
  14160. jQuery.speed = function( speed, easing, fn ) {
  14161. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14162. complete: fn || !fn && easing ||
  14163. isFunction( speed ) && speed,
  14164. duration: speed,
  14165. easing: fn && easing || easing && !isFunction( easing ) && easing
  14166. };
  14167. // Go to the end state if fx are off
  14168. if ( jQuery.fx.off ) {
  14169. opt.duration = 0;
  14170. } else {
  14171. if ( typeof opt.duration !== "number" ) {
  14172. if ( opt.duration in jQuery.fx.speeds ) {
  14173. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14174. } else {
  14175. opt.duration = jQuery.fx.speeds._default;
  14176. }
  14177. }
  14178. }
  14179. // Normalize opt.queue - true/undefined/null -> "fx"
  14180. if ( opt.queue == null || opt.queue === true ) {
  14181. opt.queue = "fx";
  14182. }
  14183. // Queueing
  14184. opt.old = opt.complete;
  14185. opt.complete = function() {
  14186. if ( isFunction( opt.old ) ) {
  14187. opt.old.call( this );
  14188. }
  14189. if ( opt.queue ) {
  14190. jQuery.dequeue( this, opt.queue );
  14191. }
  14192. };
  14193. return opt;
  14194. };
  14195. jQuery.fn.extend( {
  14196. fadeTo: function( speed, to, easing, callback ) {
  14197. // Show any hidden elements after setting opacity to 0
  14198. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14199. // Animate to the value specified
  14200. .end().animate( { opacity: to }, speed, easing, callback );
  14201. },
  14202. animate: function( prop, speed, easing, callback ) {
  14203. var empty = jQuery.isEmptyObject( prop ),
  14204. optall = jQuery.speed( speed, easing, callback ),
  14205. doAnimation = function() {
  14206. // Operate on a copy of prop so per-property easing won't be lost
  14207. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14208. // Empty animations, or finishing resolves immediately
  14209. if ( empty || dataPriv.get( this, "finish" ) ) {
  14210. anim.stop( true );
  14211. }
  14212. };
  14213. doAnimation.finish = doAnimation;
  14214. return empty || optall.queue === false ?
  14215. this.each( doAnimation ) :
  14216. this.queue( optall.queue, doAnimation );
  14217. },
  14218. stop: function( type, clearQueue, gotoEnd ) {
  14219. var stopQueue = function( hooks ) {
  14220. var stop = hooks.stop;
  14221. delete hooks.stop;
  14222. stop( gotoEnd );
  14223. };
  14224. if ( typeof type !== "string" ) {
  14225. gotoEnd = clearQueue;
  14226. clearQueue = type;
  14227. type = undefined;
  14228. }
  14229. if ( clearQueue && type !== false ) {
  14230. this.queue( type || "fx", [] );
  14231. }
  14232. return this.each( function() {
  14233. var dequeue = true,
  14234. index = type != null && type + "queueHooks",
  14235. timers = jQuery.timers,
  14236. data = dataPriv.get( this );
  14237. if ( index ) {
  14238. if ( data[ index ] && data[ index ].stop ) {
  14239. stopQueue( data[ index ] );
  14240. }
  14241. } else {
  14242. for ( index in data ) {
  14243. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14244. stopQueue( data[ index ] );
  14245. }
  14246. }
  14247. }
  14248. for ( index = timers.length; index--; ) {
  14249. if ( timers[ index ].elem === this &&
  14250. ( type == null || timers[ index ].queue === type ) ) {
  14251. timers[ index ].anim.stop( gotoEnd );
  14252. dequeue = false;
  14253. timers.splice( index, 1 );
  14254. }
  14255. }
  14256. // Start the next in the queue if the last step wasn't forced.
  14257. // Timers currently will call their complete callbacks, which
  14258. // will dequeue but only if they were gotoEnd.
  14259. if ( dequeue || !gotoEnd ) {
  14260. jQuery.dequeue( this, type );
  14261. }
  14262. } );
  14263. },
  14264. finish: function( type ) {
  14265. if ( type !== false ) {
  14266. type = type || "fx";
  14267. }
  14268. return this.each( function() {
  14269. var index,
  14270. data = dataPriv.get( this ),
  14271. queue = data[ type + "queue" ],
  14272. hooks = data[ type + "queueHooks" ],
  14273. timers = jQuery.timers,
  14274. length = queue ? queue.length : 0;
  14275. // Enable finishing flag on private data
  14276. data.finish = true;
  14277. // Empty the queue first
  14278. jQuery.queue( this, type, [] );
  14279. if ( hooks && hooks.stop ) {
  14280. hooks.stop.call( this, true );
  14281. }
  14282. // Look for any active animations, and finish them
  14283. for ( index = timers.length; index--; ) {
  14284. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14285. timers[ index ].anim.stop( true );
  14286. timers.splice( index, 1 );
  14287. }
  14288. }
  14289. // Look for any animations in the old queue and finish them
  14290. for ( index = 0; index < length; index++ ) {
  14291. if ( queue[ index ] && queue[ index ].finish ) {
  14292. queue[ index ].finish.call( this );
  14293. }
  14294. }
  14295. // Turn off finishing flag
  14296. delete data.finish;
  14297. } );
  14298. }
  14299. } );
  14300. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14301. var cssFn = jQuery.fn[ name ];
  14302. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14303. return speed == null || typeof speed === "boolean" ?
  14304. cssFn.apply( this, arguments ) :
  14305. this.animate( genFx( name, true ), speed, easing, callback );
  14306. };
  14307. } );
  14308. // Generate shortcuts for custom animations
  14309. jQuery.each( {
  14310. slideDown: genFx( "show" ),
  14311. slideUp: genFx( "hide" ),
  14312. slideToggle: genFx( "toggle" ),
  14313. fadeIn: { opacity: "show" },
  14314. fadeOut: { opacity: "hide" },
  14315. fadeToggle: { opacity: "toggle" }
  14316. }, function( name, props ) {
  14317. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14318. return this.animate( props, speed, easing, callback );
  14319. };
  14320. } );
  14321. jQuery.timers = [];
  14322. jQuery.fx.tick = function() {
  14323. var timer,
  14324. i = 0,
  14325. timers = jQuery.timers;
  14326. fxNow = Date.now();
  14327. for ( ; i < timers.length; i++ ) {
  14328. timer = timers[ i ];
  14329. // Run the timer and safely remove it when done (allowing for external removal)
  14330. if ( !timer() && timers[ i ] === timer ) {
  14331. timers.splice( i--, 1 );
  14332. }
  14333. }
  14334. if ( !timers.length ) {
  14335. jQuery.fx.stop();
  14336. }
  14337. fxNow = undefined;
  14338. };
  14339. jQuery.fx.timer = function( timer ) {
  14340. jQuery.timers.push( timer );
  14341. jQuery.fx.start();
  14342. };
  14343. jQuery.fx.interval = 13;
  14344. jQuery.fx.start = function() {
  14345. if ( inProgress ) {
  14346. return;
  14347. }
  14348. inProgress = true;
  14349. schedule();
  14350. };
  14351. jQuery.fx.stop = function() {
  14352. inProgress = null;
  14353. };
  14354. jQuery.fx.speeds = {
  14355. slow: 600,
  14356. fast: 200,
  14357. // Default speed
  14358. _default: 400
  14359. };
  14360. // Based off of the plugin by Clint Helfers, with permission.
  14361. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14362. jQuery.fn.delay = function( time, type ) {
  14363. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14364. type = type || "fx";
  14365. return this.queue( type, function( next, hooks ) {
  14366. var timeout = window.setTimeout( next, time );
  14367. hooks.stop = function() {
  14368. window.clearTimeout( timeout );
  14369. };
  14370. } );
  14371. };
  14372. ( function() {
  14373. var input = document.createElement( "input" ),
  14374. select = document.createElement( "select" ),
  14375. opt = select.appendChild( document.createElement( "option" ) );
  14376. input.type = "checkbox";
  14377. // Support: Android <=4.3 only
  14378. // Default value for a checkbox should be "on"
  14379. support.checkOn = input.value !== "";
  14380. // Support: IE <=11 only
  14381. // Must access selectedIndex to make default options select
  14382. support.optSelected = opt.selected;
  14383. // Support: IE <=11 only
  14384. // An input loses its value after becoming a radio
  14385. input = document.createElement( "input" );
  14386. input.value = "t";
  14387. input.type = "radio";
  14388. support.radioValue = input.value === "t";
  14389. } )();
  14390. var boolHook,
  14391. attrHandle = jQuery.expr.attrHandle;
  14392. jQuery.fn.extend( {
  14393. attr: function( name, value ) {
  14394. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14395. },
  14396. removeAttr: function( name ) {
  14397. return this.each( function() {
  14398. jQuery.removeAttr( this, name );
  14399. } );
  14400. }
  14401. } );
  14402. jQuery.extend( {
  14403. attr: function( elem, name, value ) {
  14404. var ret, hooks,
  14405. nType = elem.nodeType;
  14406. // Don't get/set attributes on text, comment and attribute nodes
  14407. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14408. return;
  14409. }
  14410. // Fallback to prop when attributes are not supported
  14411. if ( typeof elem.getAttribute === "undefined" ) {
  14412. return jQuery.prop( elem, name, value );
  14413. }
  14414. // Attribute hooks are determined by the lowercase version
  14415. // Grab necessary hook if one is defined
  14416. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14417. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14418. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14419. }
  14420. if ( value !== undefined ) {
  14421. if ( value === null ) {
  14422. jQuery.removeAttr( elem, name );
  14423. return;
  14424. }
  14425. if ( hooks && "set" in hooks &&
  14426. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14427. return ret;
  14428. }
  14429. elem.setAttribute( name, value + "" );
  14430. return value;
  14431. }
  14432. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14433. return ret;
  14434. }
  14435. ret = jQuery.find.attr( elem, name );
  14436. // Non-existent attributes return null, we normalize to undefined
  14437. return ret == null ? undefined : ret;
  14438. },
  14439. attrHooks: {
  14440. type: {
  14441. set: function( elem, value ) {
  14442. if ( !support.radioValue && value === "radio" &&
  14443. nodeName( elem, "input" ) ) {
  14444. var val = elem.value;
  14445. elem.setAttribute( "type", value );
  14446. if ( val ) {
  14447. elem.value = val;
  14448. }
  14449. return value;
  14450. }
  14451. }
  14452. }
  14453. },
  14454. removeAttr: function( elem, value ) {
  14455. var name,
  14456. i = 0,
  14457. // Attribute names can contain non-HTML whitespace characters
  14458. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14459. attrNames = value && value.match( rnothtmlwhite );
  14460. if ( attrNames && elem.nodeType === 1 ) {
  14461. while ( ( name = attrNames[ i++ ] ) ) {
  14462. elem.removeAttribute( name );
  14463. }
  14464. }
  14465. }
  14466. } );
  14467. // Hooks for boolean attributes
  14468. boolHook = {
  14469. set: function( elem, value, name ) {
  14470. if ( value === false ) {
  14471. // Remove boolean attributes when set to false
  14472. jQuery.removeAttr( elem, name );
  14473. } else {
  14474. elem.setAttribute( name, name );
  14475. }
  14476. return name;
  14477. }
  14478. };
  14479. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14480. var getter = attrHandle[ name ] || jQuery.find.attr;
  14481. attrHandle[ name ] = function( elem, name, isXML ) {
  14482. var ret, handle,
  14483. lowercaseName = name.toLowerCase();
  14484. if ( !isXML ) {
  14485. // Avoid an infinite loop by temporarily removing this function from the getter
  14486. handle = attrHandle[ lowercaseName ];
  14487. attrHandle[ lowercaseName ] = ret;
  14488. ret = getter( elem, name, isXML ) != null ?
  14489. lowercaseName :
  14490. null;
  14491. attrHandle[ lowercaseName ] = handle;
  14492. }
  14493. return ret;
  14494. };
  14495. } );
  14496. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14497. rclickable = /^(?:a|area)$/i;
  14498. jQuery.fn.extend( {
  14499. prop: function( name, value ) {
  14500. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14501. },
  14502. removeProp: function( name ) {
  14503. return this.each( function() {
  14504. delete this[ jQuery.propFix[ name ] || name ];
  14505. } );
  14506. }
  14507. } );
  14508. jQuery.extend( {
  14509. prop: function( elem, name, value ) {
  14510. var ret, hooks,
  14511. nType = elem.nodeType;
  14512. // Don't get/set properties on text, comment and attribute nodes
  14513. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14514. return;
  14515. }
  14516. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14517. // Fix name and attach hooks
  14518. name = jQuery.propFix[ name ] || name;
  14519. hooks = jQuery.propHooks[ name ];
  14520. }
  14521. if ( value !== undefined ) {
  14522. if ( hooks && "set" in hooks &&
  14523. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14524. return ret;
  14525. }
  14526. return ( elem[ name ] = value );
  14527. }
  14528. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14529. return ret;
  14530. }
  14531. return elem[ name ];
  14532. },
  14533. propHooks: {
  14534. tabIndex: {
  14535. get: function( elem ) {
  14536. // Support: IE <=9 - 11 only
  14537. // elem.tabIndex doesn't always return the
  14538. // correct value when it hasn't been explicitly set
  14539. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14540. // Use proper attribute retrieval(#12072)
  14541. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14542. if ( tabindex ) {
  14543. return parseInt( tabindex, 10 );
  14544. }
  14545. if (
  14546. rfocusable.test( elem.nodeName ) ||
  14547. rclickable.test( elem.nodeName ) &&
  14548. elem.href
  14549. ) {
  14550. return 0;
  14551. }
  14552. return -1;
  14553. }
  14554. }
  14555. },
  14556. propFix: {
  14557. "for": "htmlFor",
  14558. "class": "className"
  14559. }
  14560. } );
  14561. // Support: IE <=11 only
  14562. // Accessing the selectedIndex property
  14563. // forces the browser to respect setting selected
  14564. // on the option
  14565. // The getter ensures a default option is selected
  14566. // when in an optgroup
  14567. // eslint rule "no-unused-expressions" is disabled for this code
  14568. // since it considers such accessions noop
  14569. if ( !support.optSelected ) {
  14570. jQuery.propHooks.selected = {
  14571. get: function( elem ) {
  14572. /* eslint no-unused-expressions: "off" */
  14573. var parent = elem.parentNode;
  14574. if ( parent && parent.parentNode ) {
  14575. parent.parentNode.selectedIndex;
  14576. }
  14577. return null;
  14578. },
  14579. set: function( elem ) {
  14580. /* eslint no-unused-expressions: "off" */
  14581. var parent = elem.parentNode;
  14582. if ( parent ) {
  14583. parent.selectedIndex;
  14584. if ( parent.parentNode ) {
  14585. parent.parentNode.selectedIndex;
  14586. }
  14587. }
  14588. }
  14589. };
  14590. }
  14591. jQuery.each( [
  14592. "tabIndex",
  14593. "readOnly",
  14594. "maxLength",
  14595. "cellSpacing",
  14596. "cellPadding",
  14597. "rowSpan",
  14598. "colSpan",
  14599. "useMap",
  14600. "frameBorder",
  14601. "contentEditable"
  14602. ], function() {
  14603. jQuery.propFix[ this.toLowerCase() ] = this;
  14604. } );
  14605. // Strip and collapse whitespace according to HTML spec
  14606. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14607. function stripAndCollapse( value ) {
  14608. var tokens = value.match( rnothtmlwhite ) || [];
  14609. return tokens.join( " " );
  14610. }
  14611. function getClass( elem ) {
  14612. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14613. }
  14614. function classesToArray( value ) {
  14615. if ( Array.isArray( value ) ) {
  14616. return value;
  14617. }
  14618. if ( typeof value === "string" ) {
  14619. return value.match( rnothtmlwhite ) || [];
  14620. }
  14621. return [];
  14622. }
  14623. jQuery.fn.extend( {
  14624. addClass: function( value ) {
  14625. var classes, elem, cur, curValue, clazz, j, finalValue,
  14626. i = 0;
  14627. if ( isFunction( value ) ) {
  14628. return this.each( function( j ) {
  14629. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14630. } );
  14631. }
  14632. classes = classesToArray( value );
  14633. if ( classes.length ) {
  14634. while ( ( elem = this[ i++ ] ) ) {
  14635. curValue = getClass( elem );
  14636. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14637. if ( cur ) {
  14638. j = 0;
  14639. while ( ( clazz = classes[ j++ ] ) ) {
  14640. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14641. cur += clazz + " ";
  14642. }
  14643. }
  14644. // Only assign if different to avoid unneeded rendering.
  14645. finalValue = stripAndCollapse( cur );
  14646. if ( curValue !== finalValue ) {
  14647. elem.setAttribute( "class", finalValue );
  14648. }
  14649. }
  14650. }
  14651. }
  14652. return this;
  14653. },
  14654. removeClass: function( value ) {
  14655. var classes, elem, cur, curValue, clazz, j, finalValue,
  14656. i = 0;
  14657. if ( isFunction( value ) ) {
  14658. return this.each( function( j ) {
  14659. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14660. } );
  14661. }
  14662. if ( !arguments.length ) {
  14663. return this.attr( "class", "" );
  14664. }
  14665. classes = classesToArray( value );
  14666. if ( classes.length ) {
  14667. while ( ( elem = this[ i++ ] ) ) {
  14668. curValue = getClass( elem );
  14669. // This expression is here for better compressibility (see addClass)
  14670. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14671. if ( cur ) {
  14672. j = 0;
  14673. while ( ( clazz = classes[ j++ ] ) ) {
  14674. // Remove *all* instances
  14675. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14676. cur = cur.replace( " " + clazz + " ", " " );
  14677. }
  14678. }
  14679. // Only assign if different to avoid unneeded rendering.
  14680. finalValue = stripAndCollapse( cur );
  14681. if ( curValue !== finalValue ) {
  14682. elem.setAttribute( "class", finalValue );
  14683. }
  14684. }
  14685. }
  14686. }
  14687. return this;
  14688. },
  14689. toggleClass: function( value, stateVal ) {
  14690. var type = typeof value,
  14691. isValidValue = type === "string" || Array.isArray( value );
  14692. if ( typeof stateVal === "boolean" && isValidValue ) {
  14693. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14694. }
  14695. if ( isFunction( value ) ) {
  14696. return this.each( function( i ) {
  14697. jQuery( this ).toggleClass(
  14698. value.call( this, i, getClass( this ), stateVal ),
  14699. stateVal
  14700. );
  14701. } );
  14702. }
  14703. return this.each( function() {
  14704. var className, i, self, classNames;
  14705. if ( isValidValue ) {
  14706. // Toggle individual class names
  14707. i = 0;
  14708. self = jQuery( this );
  14709. classNames = classesToArray( value );
  14710. while ( ( className = classNames[ i++ ] ) ) {
  14711. // Check each className given, space separated list
  14712. if ( self.hasClass( className ) ) {
  14713. self.removeClass( className );
  14714. } else {
  14715. self.addClass( className );
  14716. }
  14717. }
  14718. // Toggle whole class name
  14719. } else if ( value === undefined || type === "boolean" ) {
  14720. className = getClass( this );
  14721. if ( className ) {
  14722. // Store className if set
  14723. dataPriv.set( this, "__className__", className );
  14724. }
  14725. // If the element has a class name or if we're passed `false`,
  14726. // then remove the whole classname (if there was one, the above saved it).
  14727. // Otherwise bring back whatever was previously saved (if anything),
  14728. // falling back to the empty string if nothing was stored.
  14729. if ( this.setAttribute ) {
  14730. this.setAttribute( "class",
  14731. className || value === false ?
  14732. "" :
  14733. dataPriv.get( this, "__className__" ) || ""
  14734. );
  14735. }
  14736. }
  14737. } );
  14738. },
  14739. hasClass: function( selector ) {
  14740. var className, elem,
  14741. i = 0;
  14742. className = " " + selector + " ";
  14743. while ( ( elem = this[ i++ ] ) ) {
  14744. if ( elem.nodeType === 1 &&
  14745. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14746. return true;
  14747. }
  14748. }
  14749. return false;
  14750. }
  14751. } );
  14752. var rreturn = /\r/g;
  14753. jQuery.fn.extend( {
  14754. val: function( value ) {
  14755. var hooks, ret, valueIsFunction,
  14756. elem = this[ 0 ];
  14757. if ( !arguments.length ) {
  14758. if ( elem ) {
  14759. hooks = jQuery.valHooks[ elem.type ] ||
  14760. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14761. if ( hooks &&
  14762. "get" in hooks &&
  14763. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14764. ) {
  14765. return ret;
  14766. }
  14767. ret = elem.value;
  14768. // Handle most common string cases
  14769. if ( typeof ret === "string" ) {
  14770. return ret.replace( rreturn, "" );
  14771. }
  14772. // Handle cases where value is null/undef or number
  14773. return ret == null ? "" : ret;
  14774. }
  14775. return;
  14776. }
  14777. valueIsFunction = isFunction( value );
  14778. return this.each( function( i ) {
  14779. var val;
  14780. if ( this.nodeType !== 1 ) {
  14781. return;
  14782. }
  14783. if ( valueIsFunction ) {
  14784. val = value.call( this, i, jQuery( this ).val() );
  14785. } else {
  14786. val = value;
  14787. }
  14788. // Treat null/undefined as ""; convert numbers to string
  14789. if ( val == null ) {
  14790. val = "";
  14791. } else if ( typeof val === "number" ) {
  14792. val += "";
  14793. } else if ( Array.isArray( val ) ) {
  14794. val = jQuery.map( val, function( value ) {
  14795. return value == null ? "" : value + "";
  14796. } );
  14797. }
  14798. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14799. // If set returns undefined, fall back to normal setting
  14800. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14801. this.value = val;
  14802. }
  14803. } );
  14804. }
  14805. } );
  14806. jQuery.extend( {
  14807. valHooks: {
  14808. option: {
  14809. get: function( elem ) {
  14810. var val = jQuery.find.attr( elem, "value" );
  14811. return val != null ?
  14812. val :
  14813. // Support: IE <=10 - 11 only
  14814. // option.text throws exceptions (#14686, #14858)
  14815. // Strip and collapse whitespace
  14816. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14817. stripAndCollapse( jQuery.text( elem ) );
  14818. }
  14819. },
  14820. select: {
  14821. get: function( elem ) {
  14822. var value, option, i,
  14823. options = elem.options,
  14824. index = elem.selectedIndex,
  14825. one = elem.type === "select-one",
  14826. values = one ? null : [],
  14827. max = one ? index + 1 : options.length;
  14828. if ( index < 0 ) {
  14829. i = max;
  14830. } else {
  14831. i = one ? index : 0;
  14832. }
  14833. // Loop through all the selected options
  14834. for ( ; i < max; i++ ) {
  14835. option = options[ i ];
  14836. // Support: IE <=9 only
  14837. // IE8-9 doesn't update selected after form reset (#2551)
  14838. if ( ( option.selected || i === index ) &&
  14839. // Don't return options that are disabled or in a disabled optgroup
  14840. !option.disabled &&
  14841. ( !option.parentNode.disabled ||
  14842. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14843. // Get the specific value for the option
  14844. value = jQuery( option ).val();
  14845. // We don't need an array for one selects
  14846. if ( one ) {
  14847. return value;
  14848. }
  14849. // Multi-Selects return an array
  14850. values.push( value );
  14851. }
  14852. }
  14853. return values;
  14854. },
  14855. set: function( elem, value ) {
  14856. var optionSet, option,
  14857. options = elem.options,
  14858. values = jQuery.makeArray( value ),
  14859. i = options.length;
  14860. while ( i-- ) {
  14861. option = options[ i ];
  14862. /* eslint-disable no-cond-assign */
  14863. if ( option.selected =
  14864. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14865. ) {
  14866. optionSet = true;
  14867. }
  14868. /* eslint-enable no-cond-assign */
  14869. }
  14870. // Force browsers to behave consistently when non-matching value is set
  14871. if ( !optionSet ) {
  14872. elem.selectedIndex = -1;
  14873. }
  14874. return values;
  14875. }
  14876. }
  14877. }
  14878. } );
  14879. // Radios and checkboxes getter/setter
  14880. jQuery.each( [ "radio", "checkbox" ], function() {
  14881. jQuery.valHooks[ this ] = {
  14882. set: function( elem, value ) {
  14883. if ( Array.isArray( value ) ) {
  14884. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14885. }
  14886. }
  14887. };
  14888. if ( !support.checkOn ) {
  14889. jQuery.valHooks[ this ].get = function( elem ) {
  14890. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  14891. };
  14892. }
  14893. } );
  14894. // Return jQuery for attributes-only inclusion
  14895. support.focusin = "onfocusin" in window;
  14896. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  14897. stopPropagationCallback = function( e ) {
  14898. e.stopPropagation();
  14899. };
  14900. jQuery.extend( jQuery.event, {
  14901. trigger: function( event, data, elem, onlyHandlers ) {
  14902. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  14903. eventPath = [ elem || document ],
  14904. type = hasOwn.call( event, "type" ) ? event.type : event,
  14905. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  14906. cur = lastElement = tmp = elem = elem || document;
  14907. // Don't do events on text and comment nodes
  14908. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  14909. return;
  14910. }
  14911. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  14912. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  14913. return;
  14914. }
  14915. if ( type.indexOf( "." ) > -1 ) {
  14916. // Namespaced trigger; create a regexp to match event type in handle()
  14917. namespaces = type.split( "." );
  14918. type = namespaces.shift();
  14919. namespaces.sort();
  14920. }
  14921. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  14922. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  14923. event = event[ jQuery.expando ] ?
  14924. event :
  14925. new jQuery.Event( type, typeof event === "object" && event );
  14926. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  14927. event.isTrigger = onlyHandlers ? 2 : 3;
  14928. event.namespace = namespaces.join( "." );
  14929. event.rnamespace = event.namespace ?
  14930. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  14931. null;
  14932. // Clean up the event in case it is being reused
  14933. event.result = undefined;
  14934. if ( !event.target ) {
  14935. event.target = elem;
  14936. }
  14937. // Clone any incoming data and prepend the event, creating the handler arg list
  14938. data = data == null ?
  14939. [ event ] :
  14940. jQuery.makeArray( data, [ event ] );
  14941. // Allow special events to draw outside the lines
  14942. special = jQuery.event.special[ type ] || {};
  14943. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  14944. return;
  14945. }
  14946. // Determine event propagation path in advance, per W3C events spec (#9951)
  14947. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  14948. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  14949. bubbleType = special.delegateType || type;
  14950. if ( !rfocusMorph.test( bubbleType + type ) ) {
  14951. cur = cur.parentNode;
  14952. }
  14953. for ( ; cur; cur = cur.parentNode ) {
  14954. eventPath.push( cur );
  14955. tmp = cur;
  14956. }
  14957. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  14958. if ( tmp === ( elem.ownerDocument || document ) ) {
  14959. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  14960. }
  14961. }
  14962. // Fire handlers on the event path
  14963. i = 0;
  14964. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  14965. lastElement = cur;
  14966. event.type = i > 1 ?
  14967. bubbleType :
  14968. special.bindType || type;
  14969. // jQuery handler
  14970. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  14971. dataPriv.get( cur, "handle" );
  14972. if ( handle ) {
  14973. handle.apply( cur, data );
  14974. }
  14975. // Native handler
  14976. handle = ontype && cur[ ontype ];
  14977. if ( handle && handle.apply && acceptData( cur ) ) {
  14978. event.result = handle.apply( cur, data );
  14979. if ( event.result === false ) {
  14980. event.preventDefault();
  14981. }
  14982. }
  14983. }
  14984. event.type = type;
  14985. // If nobody prevented the default action, do it now
  14986. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  14987. if ( ( !special._default ||
  14988. special._default.apply( eventPath.pop(), data ) === false ) &&
  14989. acceptData( elem ) ) {
  14990. // Call a native DOM method on the target with the same name as the event.
  14991. // Don't do default actions on window, that's where global variables be (#6170)
  14992. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  14993. // Don't re-trigger an onFOO event when we call its FOO() method
  14994. tmp = elem[ ontype ];
  14995. if ( tmp ) {
  14996. elem[ ontype ] = null;
  14997. }
  14998. // Prevent re-triggering of the same event, since we already bubbled it above
  14999. jQuery.event.triggered = type;
  15000. if ( event.isPropagationStopped() ) {
  15001. lastElement.addEventListener( type, stopPropagationCallback );
  15002. }
  15003. elem[ type ]();
  15004. if ( event.isPropagationStopped() ) {
  15005. lastElement.removeEventListener( type, stopPropagationCallback );
  15006. }
  15007. jQuery.event.triggered = undefined;
  15008. if ( tmp ) {
  15009. elem[ ontype ] = tmp;
  15010. }
  15011. }
  15012. }
  15013. }
  15014. return event.result;
  15015. },
  15016. // Piggyback on a donor event to simulate a different one
  15017. // Used only for `focus(in | out)` events
  15018. simulate: function( type, elem, event ) {
  15019. var e = jQuery.extend(
  15020. new jQuery.Event(),
  15021. event,
  15022. {
  15023. type: type,
  15024. isSimulated: true
  15025. }
  15026. );
  15027. jQuery.event.trigger( e, null, elem );
  15028. }
  15029. } );
  15030. jQuery.fn.extend( {
  15031. trigger: function( type, data ) {
  15032. return this.each( function() {
  15033. jQuery.event.trigger( type, data, this );
  15034. } );
  15035. },
  15036. triggerHandler: function( type, data ) {
  15037. var elem = this[ 0 ];
  15038. if ( elem ) {
  15039. return jQuery.event.trigger( type, data, elem, true );
  15040. }
  15041. }
  15042. } );
  15043. // Support: Firefox <=44
  15044. // Firefox doesn't have focus(in | out) events
  15045. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15046. //
  15047. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15048. // focus(in | out) events fire after focus & blur events,
  15049. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15050. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15051. if ( !support.focusin ) {
  15052. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15053. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15054. var handler = function( event ) {
  15055. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15056. };
  15057. jQuery.event.special[ fix ] = {
  15058. setup: function() {
  15059. var doc = this.ownerDocument || this,
  15060. attaches = dataPriv.access( doc, fix );
  15061. if ( !attaches ) {
  15062. doc.addEventListener( orig, handler, true );
  15063. }
  15064. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15065. },
  15066. teardown: function() {
  15067. var doc = this.ownerDocument || this,
  15068. attaches = dataPriv.access( doc, fix ) - 1;
  15069. if ( !attaches ) {
  15070. doc.removeEventListener( orig, handler, true );
  15071. dataPriv.remove( doc, fix );
  15072. } else {
  15073. dataPriv.access( doc, fix, attaches );
  15074. }
  15075. }
  15076. };
  15077. } );
  15078. }
  15079. var location = window.location;
  15080. var nonce = Date.now();
  15081. var rquery = ( /\?/ );
  15082. // Cross-browser xml parsing
  15083. jQuery.parseXML = function( data ) {
  15084. var xml;
  15085. if ( !data || typeof data !== "string" ) {
  15086. return null;
  15087. }
  15088. // Support: IE 9 - 11 only
  15089. // IE throws on parseFromString with invalid input.
  15090. try {
  15091. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15092. } catch ( e ) {
  15093. xml = undefined;
  15094. }
  15095. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15096. jQuery.error( "Invalid XML: " + data );
  15097. }
  15098. return xml;
  15099. };
  15100. var
  15101. rbracket = /\[\]$/,
  15102. rCRLF = /\r?\n/g,
  15103. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15104. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15105. function buildParams( prefix, obj, traditional, add ) {
  15106. var name;
  15107. if ( Array.isArray( obj ) ) {
  15108. // Serialize array item.
  15109. jQuery.each( obj, function( i, v ) {
  15110. if ( traditional || rbracket.test( prefix ) ) {
  15111. // Treat each array item as a scalar.
  15112. add( prefix, v );
  15113. } else {
  15114. // Item is non-scalar (array or object), encode its numeric index.
  15115. buildParams(
  15116. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15117. v,
  15118. traditional,
  15119. add
  15120. );
  15121. }
  15122. } );
  15123. } else if ( !traditional && toType( obj ) === "object" ) {
  15124. // Serialize object item.
  15125. for ( name in obj ) {
  15126. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15127. }
  15128. } else {
  15129. // Serialize scalar item.
  15130. add( prefix, obj );
  15131. }
  15132. }
  15133. // Serialize an array of form elements or a set of
  15134. // key/values into a query string
  15135. jQuery.param = function( a, traditional ) {
  15136. var prefix,
  15137. s = [],
  15138. add = function( key, valueOrFunction ) {
  15139. // If value is a function, invoke it and use its return value
  15140. var value = isFunction( valueOrFunction ) ?
  15141. valueOrFunction() :
  15142. valueOrFunction;
  15143. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15144. encodeURIComponent( value == null ? "" : value );
  15145. };
  15146. if ( a == null ) {
  15147. return "";
  15148. }
  15149. // If an array was passed in, assume that it is an array of form elements.
  15150. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15151. // Serialize the form elements
  15152. jQuery.each( a, function() {
  15153. add( this.name, this.value );
  15154. } );
  15155. } else {
  15156. // If traditional, encode the "old" way (the way 1.3.2 or older
  15157. // did it), otherwise encode params recursively.
  15158. for ( prefix in a ) {
  15159. buildParams( prefix, a[ prefix ], traditional, add );
  15160. }
  15161. }
  15162. // Return the resulting serialization
  15163. return s.join( "&" );
  15164. };
  15165. jQuery.fn.extend( {
  15166. serialize: function() {
  15167. return jQuery.param( this.serializeArray() );
  15168. },
  15169. serializeArray: function() {
  15170. return this.map( function() {
  15171. // Can add propHook for "elements" to filter or add form elements
  15172. var elements = jQuery.prop( this, "elements" );
  15173. return elements ? jQuery.makeArray( elements ) : this;
  15174. } )
  15175. .filter( function() {
  15176. var type = this.type;
  15177. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15178. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15179. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15180. ( this.checked || !rcheckableType.test( type ) );
  15181. } )
  15182. .map( function( i, elem ) {
  15183. var val = jQuery( this ).val();
  15184. if ( val == null ) {
  15185. return null;
  15186. }
  15187. if ( Array.isArray( val ) ) {
  15188. return jQuery.map( val, function( val ) {
  15189. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15190. } );
  15191. }
  15192. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15193. } ).get();
  15194. }
  15195. } );
  15196. var
  15197. r20 = /%20/g,
  15198. rhash = /#.*$/,
  15199. rantiCache = /([?&])_=[^&]*/,
  15200. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15201. // #7653, #8125, #8152: local protocol detection
  15202. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15203. rnoContent = /^(?:GET|HEAD)$/,
  15204. rprotocol = /^\/\//,
  15205. /* Prefilters
  15206. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15207. * 2) These are called:
  15208. * - BEFORE asking for a transport
  15209. * - AFTER param serialization (s.data is a string if s.processData is true)
  15210. * 3) key is the dataType
  15211. * 4) the catchall symbol "*" can be used
  15212. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15213. */
  15214. prefilters = {},
  15215. /* Transports bindings
  15216. * 1) key is the dataType
  15217. * 2) the catchall symbol "*" can be used
  15218. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15219. */
  15220. transports = {},
  15221. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15222. allTypes = "*/".concat( "*" ),
  15223. // Anchor tag for parsing the document origin
  15224. originAnchor = document.createElement( "a" );
  15225. originAnchor.href = location.href;
  15226. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15227. function addToPrefiltersOrTransports( structure ) {
  15228. // dataTypeExpression is optional and defaults to "*"
  15229. return function( dataTypeExpression, func ) {
  15230. if ( typeof dataTypeExpression !== "string" ) {
  15231. func = dataTypeExpression;
  15232. dataTypeExpression = "*";
  15233. }
  15234. var dataType,
  15235. i = 0,
  15236. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15237. if ( isFunction( func ) ) {
  15238. // For each dataType in the dataTypeExpression
  15239. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15240. // Prepend if requested
  15241. if ( dataType[ 0 ] === "+" ) {
  15242. dataType = dataType.slice( 1 ) || "*";
  15243. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15244. // Otherwise append
  15245. } else {
  15246. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15247. }
  15248. }
  15249. }
  15250. };
  15251. }
  15252. // Base inspection function for prefilters and transports
  15253. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15254. var inspected = {},
  15255. seekingTransport = ( structure === transports );
  15256. function inspect( dataType ) {
  15257. var selected;
  15258. inspected[ dataType ] = true;
  15259. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15260. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15261. if ( typeof dataTypeOrTransport === "string" &&
  15262. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15263. options.dataTypes.unshift( dataTypeOrTransport );
  15264. inspect( dataTypeOrTransport );
  15265. return false;
  15266. } else if ( seekingTransport ) {
  15267. return !( selected = dataTypeOrTransport );
  15268. }
  15269. } );
  15270. return selected;
  15271. }
  15272. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15273. }
  15274. // A special extend for ajax options
  15275. // that takes "flat" options (not to be deep extended)
  15276. // Fixes #9887
  15277. function ajaxExtend( target, src ) {
  15278. var key, deep,
  15279. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15280. for ( key in src ) {
  15281. if ( src[ key ] !== undefined ) {
  15282. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15283. }
  15284. }
  15285. if ( deep ) {
  15286. jQuery.extend( true, target, deep );
  15287. }
  15288. return target;
  15289. }
  15290. /* Handles responses to an ajax request:
  15291. * - finds the right dataType (mediates between content-type and expected dataType)
  15292. * - returns the corresponding response
  15293. */
  15294. function ajaxHandleResponses( s, jqXHR, responses ) {
  15295. var ct, type, finalDataType, firstDataType,
  15296. contents = s.contents,
  15297. dataTypes = s.dataTypes;
  15298. // Remove auto dataType and get content-type in the process
  15299. while ( dataTypes[ 0 ] === "*" ) {
  15300. dataTypes.shift();
  15301. if ( ct === undefined ) {
  15302. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15303. }
  15304. }
  15305. // Check if we're dealing with a known content-type
  15306. if ( ct ) {
  15307. for ( type in contents ) {
  15308. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15309. dataTypes.unshift( type );
  15310. break;
  15311. }
  15312. }
  15313. }
  15314. // Check to see if we have a response for the expected dataType
  15315. if ( dataTypes[ 0 ] in responses ) {
  15316. finalDataType = dataTypes[ 0 ];
  15317. } else {
  15318. // Try convertible dataTypes
  15319. for ( type in responses ) {
  15320. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15321. finalDataType = type;
  15322. break;
  15323. }
  15324. if ( !firstDataType ) {
  15325. firstDataType = type;
  15326. }
  15327. }
  15328. // Or just use first one
  15329. finalDataType = finalDataType || firstDataType;
  15330. }
  15331. // If we found a dataType
  15332. // We add the dataType to the list if needed
  15333. // and return the corresponding response
  15334. if ( finalDataType ) {
  15335. if ( finalDataType !== dataTypes[ 0 ] ) {
  15336. dataTypes.unshift( finalDataType );
  15337. }
  15338. return responses[ finalDataType ];
  15339. }
  15340. }
  15341. /* Chain conversions given the request and the original response
  15342. * Also sets the responseXXX fields on the jqXHR instance
  15343. */
  15344. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15345. var conv2, current, conv, tmp, prev,
  15346. converters = {},
  15347. // Work with a copy of dataTypes in case we need to modify it for conversion
  15348. dataTypes = s.dataTypes.slice();
  15349. // Create converters map with lowercased keys
  15350. if ( dataTypes[ 1 ] ) {
  15351. for ( conv in s.converters ) {
  15352. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15353. }
  15354. }
  15355. current = dataTypes.shift();
  15356. // Convert to each sequential dataType
  15357. while ( current ) {
  15358. if ( s.responseFields[ current ] ) {
  15359. jqXHR[ s.responseFields[ current ] ] = response;
  15360. }
  15361. // Apply the dataFilter if provided
  15362. if ( !prev && isSuccess && s.dataFilter ) {
  15363. response = s.dataFilter( response, s.dataType );
  15364. }
  15365. prev = current;
  15366. current = dataTypes.shift();
  15367. if ( current ) {
  15368. // There's only work to do if current dataType is non-auto
  15369. if ( current === "*" ) {
  15370. current = prev;
  15371. // Convert response if prev dataType is non-auto and differs from current
  15372. } else if ( prev !== "*" && prev !== current ) {
  15373. // Seek a direct converter
  15374. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15375. // If none found, seek a pair
  15376. if ( !conv ) {
  15377. for ( conv2 in converters ) {
  15378. // If conv2 outputs current
  15379. tmp = conv2.split( " " );
  15380. if ( tmp[ 1 ] === current ) {
  15381. // If prev can be converted to accepted input
  15382. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15383. converters[ "* " + tmp[ 0 ] ];
  15384. if ( conv ) {
  15385. // Condense equivalence converters
  15386. if ( conv === true ) {
  15387. conv = converters[ conv2 ];
  15388. // Otherwise, insert the intermediate dataType
  15389. } else if ( converters[ conv2 ] !== true ) {
  15390. current = tmp[ 0 ];
  15391. dataTypes.unshift( tmp[ 1 ] );
  15392. }
  15393. break;
  15394. }
  15395. }
  15396. }
  15397. }
  15398. // Apply converter (if not an equivalence)
  15399. if ( conv !== true ) {
  15400. // Unless errors are allowed to bubble, catch and return them
  15401. if ( conv && s.throws ) {
  15402. response = conv( response );
  15403. } else {
  15404. try {
  15405. response = conv( response );
  15406. } catch ( e ) {
  15407. return {
  15408. state: "parsererror",
  15409. error: conv ? e : "No conversion from " + prev + " to " + current
  15410. };
  15411. }
  15412. }
  15413. }
  15414. }
  15415. }
  15416. }
  15417. return { state: "success", data: response };
  15418. }
  15419. jQuery.extend( {
  15420. // Counter for holding the number of active queries
  15421. active: 0,
  15422. // Last-Modified header cache for next request
  15423. lastModified: {},
  15424. etag: {},
  15425. ajaxSettings: {
  15426. url: location.href,
  15427. type: "GET",
  15428. isLocal: rlocalProtocol.test( location.protocol ),
  15429. global: true,
  15430. processData: true,
  15431. async: true,
  15432. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15433. /*
  15434. timeout: 0,
  15435. data: null,
  15436. dataType: null,
  15437. username: null,
  15438. password: null,
  15439. cache: null,
  15440. throws: false,
  15441. traditional: false,
  15442. headers: {},
  15443. */
  15444. accepts: {
  15445. "*": allTypes,
  15446. text: "text/plain",
  15447. html: "text/html",
  15448. xml: "application/xml, text/xml",
  15449. json: "application/json, text/javascript"
  15450. },
  15451. contents: {
  15452. xml: /\bxml\b/,
  15453. html: /\bhtml/,
  15454. json: /\bjson\b/
  15455. },
  15456. responseFields: {
  15457. xml: "responseXML",
  15458. text: "responseText",
  15459. json: "responseJSON"
  15460. },
  15461. // Data converters
  15462. // Keys separate source (or catchall "*") and destination types with a single space
  15463. converters: {
  15464. // Convert anything to text
  15465. "* text": String,
  15466. // Text to html (true = no transformation)
  15467. "text html": true,
  15468. // Evaluate text as a json expression
  15469. "text json": JSON.parse,
  15470. // Parse text as xml
  15471. "text xml": jQuery.parseXML
  15472. },
  15473. // For options that shouldn't be deep extended:
  15474. // you can add your own custom options here if
  15475. // and when you create one that shouldn't be
  15476. // deep extended (see ajaxExtend)
  15477. flatOptions: {
  15478. url: true,
  15479. context: true
  15480. }
  15481. },
  15482. // Creates a full fledged settings object into target
  15483. // with both ajaxSettings and settings fields.
  15484. // If target is omitted, writes into ajaxSettings.
  15485. ajaxSetup: function( target, settings ) {
  15486. return settings ?
  15487. // Building a settings object
  15488. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15489. // Extending ajaxSettings
  15490. ajaxExtend( jQuery.ajaxSettings, target );
  15491. },
  15492. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15493. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15494. // Main method
  15495. ajax: function( url, options ) {
  15496. // If url is an object, simulate pre-1.5 signature
  15497. if ( typeof url === "object" ) {
  15498. options = url;
  15499. url = undefined;
  15500. }
  15501. // Force options to be an object
  15502. options = options || {};
  15503. var transport,
  15504. // URL without anti-cache param
  15505. cacheURL,
  15506. // Response headers
  15507. responseHeadersString,
  15508. responseHeaders,
  15509. // timeout handle
  15510. timeoutTimer,
  15511. // Url cleanup var
  15512. urlAnchor,
  15513. // Request state (becomes false upon send and true upon completion)
  15514. completed,
  15515. // To know if global events are to be dispatched
  15516. fireGlobals,
  15517. // Loop variable
  15518. i,
  15519. // uncached part of the url
  15520. uncached,
  15521. // Create the final options object
  15522. s = jQuery.ajaxSetup( {}, options ),
  15523. // Callbacks context
  15524. callbackContext = s.context || s,
  15525. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15526. globalEventContext = s.context &&
  15527. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15528. jQuery( callbackContext ) :
  15529. jQuery.event,
  15530. // Deferreds
  15531. deferred = jQuery.Deferred(),
  15532. completeDeferred = jQuery.Callbacks( "once memory" ),
  15533. // Status-dependent callbacks
  15534. statusCode = s.statusCode || {},
  15535. // Headers (they are sent all at once)
  15536. requestHeaders = {},
  15537. requestHeadersNames = {},
  15538. // Default abort message
  15539. strAbort = "canceled",
  15540. // Fake xhr
  15541. jqXHR = {
  15542. readyState: 0,
  15543. // Builds headers hashtable if needed
  15544. getResponseHeader: function( key ) {
  15545. var match;
  15546. if ( completed ) {
  15547. if ( !responseHeaders ) {
  15548. responseHeaders = {};
  15549. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15550. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15551. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15552. .concat( match[ 2 ] );
  15553. }
  15554. }
  15555. match = responseHeaders[ key.toLowerCase() + " " ];
  15556. }
  15557. return match == null ? null : match.join( ", " );
  15558. },
  15559. // Raw string
  15560. getAllResponseHeaders: function() {
  15561. return completed ? responseHeadersString : null;
  15562. },
  15563. // Caches the header
  15564. setRequestHeader: function( name, value ) {
  15565. if ( completed == null ) {
  15566. name = requestHeadersNames[ name.toLowerCase() ] =
  15567. requestHeadersNames[ name.toLowerCase() ] || name;
  15568. requestHeaders[ name ] = value;
  15569. }
  15570. return this;
  15571. },
  15572. // Overrides response content-type header
  15573. overrideMimeType: function( type ) {
  15574. if ( completed == null ) {
  15575. s.mimeType = type;
  15576. }
  15577. return this;
  15578. },
  15579. // Status-dependent callbacks
  15580. statusCode: function( map ) {
  15581. var code;
  15582. if ( map ) {
  15583. if ( completed ) {
  15584. // Execute the appropriate callbacks
  15585. jqXHR.always( map[ jqXHR.status ] );
  15586. } else {
  15587. // Lazy-add the new callbacks in a way that preserves old ones
  15588. for ( code in map ) {
  15589. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15590. }
  15591. }
  15592. }
  15593. return this;
  15594. },
  15595. // Cancel the request
  15596. abort: function( statusText ) {
  15597. var finalText = statusText || strAbort;
  15598. if ( transport ) {
  15599. transport.abort( finalText );
  15600. }
  15601. done( 0, finalText );
  15602. return this;
  15603. }
  15604. };
  15605. // Attach deferreds
  15606. deferred.promise( jqXHR );
  15607. // Add protocol if not provided (prefilters might expect it)
  15608. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15609. // We also use the url parameter if available
  15610. s.url = ( ( url || s.url || location.href ) + "" )
  15611. .replace( rprotocol, location.protocol + "//" );
  15612. // Alias method option to type as per ticket #12004
  15613. s.type = options.method || options.type || s.method || s.type;
  15614. // Extract dataTypes list
  15615. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15616. // A cross-domain request is in order when the origin doesn't match the current origin.
  15617. if ( s.crossDomain == null ) {
  15618. urlAnchor = document.createElement( "a" );
  15619. // Support: IE <=8 - 11, Edge 12 - 15
  15620. // IE throws exception on accessing the href property if url is malformed,
  15621. // e.g. http://example.com:80x/
  15622. try {
  15623. urlAnchor.href = s.url;
  15624. // Support: IE <=8 - 11 only
  15625. // Anchor's host property isn't correctly set when s.url is relative
  15626. urlAnchor.href = urlAnchor.href;
  15627. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15628. urlAnchor.protocol + "//" + urlAnchor.host;
  15629. } catch ( e ) {
  15630. // If there is an error parsing the URL, assume it is crossDomain,
  15631. // it can be rejected by the transport if it is invalid
  15632. s.crossDomain = true;
  15633. }
  15634. }
  15635. // Convert data if not already a string
  15636. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15637. s.data = jQuery.param( s.data, s.traditional );
  15638. }
  15639. // Apply prefilters
  15640. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15641. // If request was aborted inside a prefilter, stop there
  15642. if ( completed ) {
  15643. return jqXHR;
  15644. }
  15645. // We can fire global events as of now if asked to
  15646. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15647. fireGlobals = jQuery.event && s.global;
  15648. // Watch for a new set of requests
  15649. if ( fireGlobals && jQuery.active++ === 0 ) {
  15650. jQuery.event.trigger( "ajaxStart" );
  15651. }
  15652. // Uppercase the type
  15653. s.type = s.type.toUpperCase();
  15654. // Determine if request has content
  15655. s.hasContent = !rnoContent.test( s.type );
  15656. // Save the URL in case we're toying with the If-Modified-Since
  15657. // and/or If-None-Match header later on
  15658. // Remove hash to simplify url manipulation
  15659. cacheURL = s.url.replace( rhash, "" );
  15660. // More options handling for requests with no content
  15661. if ( !s.hasContent ) {
  15662. // Remember the hash so we can put it back
  15663. uncached = s.url.slice( cacheURL.length );
  15664. // If data is available and should be processed, append data to url
  15665. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15666. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15667. // #9682: remove data so that it's not used in an eventual retry
  15668. delete s.data;
  15669. }
  15670. // Add or update anti-cache param if needed
  15671. if ( s.cache === false ) {
  15672. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15673. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15674. }
  15675. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15676. s.url = cacheURL + uncached;
  15677. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15678. } else if ( s.data && s.processData &&
  15679. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15680. s.data = s.data.replace( r20, "+" );
  15681. }
  15682. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15683. if ( s.ifModified ) {
  15684. if ( jQuery.lastModified[ cacheURL ] ) {
  15685. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15686. }
  15687. if ( jQuery.etag[ cacheURL ] ) {
  15688. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15689. }
  15690. }
  15691. // Set the correct header, if data is being sent
  15692. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15693. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15694. }
  15695. // Set the Accepts header for the server, depending on the dataType
  15696. jqXHR.setRequestHeader(
  15697. "Accept",
  15698. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15699. s.accepts[ s.dataTypes[ 0 ] ] +
  15700. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15701. s.accepts[ "*" ]
  15702. );
  15703. // Check for headers option
  15704. for ( i in s.headers ) {
  15705. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15706. }
  15707. // Allow custom headers/mimetypes and early abort
  15708. if ( s.beforeSend &&
  15709. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15710. // Abort if not done already and return
  15711. return jqXHR.abort();
  15712. }
  15713. // Aborting is no longer a cancellation
  15714. strAbort = "abort";
  15715. // Install callbacks on deferreds
  15716. completeDeferred.add( s.complete );
  15717. jqXHR.done( s.success );
  15718. jqXHR.fail( s.error );
  15719. // Get transport
  15720. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15721. // If no transport, we auto-abort
  15722. if ( !transport ) {
  15723. done( -1, "No Transport" );
  15724. } else {
  15725. jqXHR.readyState = 1;
  15726. // Send global event
  15727. if ( fireGlobals ) {
  15728. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15729. }
  15730. // If request was aborted inside ajaxSend, stop there
  15731. if ( completed ) {
  15732. return jqXHR;
  15733. }
  15734. // Timeout
  15735. if ( s.async && s.timeout > 0 ) {
  15736. timeoutTimer = window.setTimeout( function() {
  15737. jqXHR.abort( "timeout" );
  15738. }, s.timeout );
  15739. }
  15740. try {
  15741. completed = false;
  15742. transport.send( requestHeaders, done );
  15743. } catch ( e ) {
  15744. // Rethrow post-completion exceptions
  15745. if ( completed ) {
  15746. throw e;
  15747. }
  15748. // Propagate others as results
  15749. done( -1, e );
  15750. }
  15751. }
  15752. // Callback for when everything is done
  15753. function done( status, nativeStatusText, responses, headers ) {
  15754. var isSuccess, success, error, response, modified,
  15755. statusText = nativeStatusText;
  15756. // Ignore repeat invocations
  15757. if ( completed ) {
  15758. return;
  15759. }
  15760. completed = true;
  15761. // Clear timeout if it exists
  15762. if ( timeoutTimer ) {
  15763. window.clearTimeout( timeoutTimer );
  15764. }
  15765. // Dereference transport for early garbage collection
  15766. // (no matter how long the jqXHR object will be used)
  15767. transport = undefined;
  15768. // Cache response headers
  15769. responseHeadersString = headers || "";
  15770. // Set readyState
  15771. jqXHR.readyState = status > 0 ? 4 : 0;
  15772. // Determine if successful
  15773. isSuccess = status >= 200 && status < 300 || status === 304;
  15774. // Get response data
  15775. if ( responses ) {
  15776. response = ajaxHandleResponses( s, jqXHR, responses );
  15777. }
  15778. // Convert no matter what (that way responseXXX fields are always set)
  15779. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15780. // If successful, handle type chaining
  15781. if ( isSuccess ) {
  15782. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15783. if ( s.ifModified ) {
  15784. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15785. if ( modified ) {
  15786. jQuery.lastModified[ cacheURL ] = modified;
  15787. }
  15788. modified = jqXHR.getResponseHeader( "etag" );
  15789. if ( modified ) {
  15790. jQuery.etag[ cacheURL ] = modified;
  15791. }
  15792. }
  15793. // if no content
  15794. if ( status === 204 || s.type === "HEAD" ) {
  15795. statusText = "nocontent";
  15796. // if not modified
  15797. } else if ( status === 304 ) {
  15798. statusText = "notmodified";
  15799. // If we have data, let's convert it
  15800. } else {
  15801. statusText = response.state;
  15802. success = response.data;
  15803. error = response.error;
  15804. isSuccess = !error;
  15805. }
  15806. } else {
  15807. // Extract error from statusText and normalize for non-aborts
  15808. error = statusText;
  15809. if ( status || !statusText ) {
  15810. statusText = "error";
  15811. if ( status < 0 ) {
  15812. status = 0;
  15813. }
  15814. }
  15815. }
  15816. // Set data for the fake xhr object
  15817. jqXHR.status = status;
  15818. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15819. // Success/Error
  15820. if ( isSuccess ) {
  15821. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15822. } else {
  15823. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15824. }
  15825. // Status-dependent callbacks
  15826. jqXHR.statusCode( statusCode );
  15827. statusCode = undefined;
  15828. if ( fireGlobals ) {
  15829. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15830. [ jqXHR, s, isSuccess ? success : error ] );
  15831. }
  15832. // Complete
  15833. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15834. if ( fireGlobals ) {
  15835. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15836. // Handle the global AJAX counter
  15837. if ( !( --jQuery.active ) ) {
  15838. jQuery.event.trigger( "ajaxStop" );
  15839. }
  15840. }
  15841. }
  15842. return jqXHR;
  15843. },
  15844. getJSON: function( url, data, callback ) {
  15845. return jQuery.get( url, data, callback, "json" );
  15846. },
  15847. getScript: function( url, callback ) {
  15848. return jQuery.get( url, undefined, callback, "script" );
  15849. }
  15850. } );
  15851. jQuery.each( [ "get", "post" ], function( i, method ) {
  15852. jQuery[ method ] = function( url, data, callback, type ) {
  15853. // Shift arguments if data argument was omitted
  15854. if ( isFunction( data ) ) {
  15855. type = type || callback;
  15856. callback = data;
  15857. data = undefined;
  15858. }
  15859. // The url can be an options object (which then must have .url)
  15860. return jQuery.ajax( jQuery.extend( {
  15861. url: url,
  15862. type: method,
  15863. dataType: type,
  15864. data: data,
  15865. success: callback
  15866. }, jQuery.isPlainObject( url ) && url ) );
  15867. };
  15868. } );
  15869. jQuery._evalUrl = function( url, options ) {
  15870. return jQuery.ajax( {
  15871. url: url,
  15872. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15873. type: "GET",
  15874. dataType: "script",
  15875. cache: true,
  15876. async: false,
  15877. global: false,
  15878. // Only evaluate the response if it is successful (gh-4126)
  15879. // dataFilter is not invoked for failure responses, so using it instead
  15880. // of the default converter is kludgy but it works.
  15881. converters: {
  15882. "text script": function() {}
  15883. },
  15884. dataFilter: function( response ) {
  15885. jQuery.globalEval( response, options );
  15886. }
  15887. } );
  15888. };
  15889. jQuery.fn.extend( {
  15890. wrapAll: function( html ) {
  15891. var wrap;
  15892. if ( this[ 0 ] ) {
  15893. if ( isFunction( html ) ) {
  15894. html = html.call( this[ 0 ] );
  15895. }
  15896. // The elements to wrap the target around
  15897. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  15898. if ( this[ 0 ].parentNode ) {
  15899. wrap.insertBefore( this[ 0 ] );
  15900. }
  15901. wrap.map( function() {
  15902. var elem = this;
  15903. while ( elem.firstElementChild ) {
  15904. elem = elem.firstElementChild;
  15905. }
  15906. return elem;
  15907. } ).append( this );
  15908. }
  15909. return this;
  15910. },
  15911. wrapInner: function( html ) {
  15912. if ( isFunction( html ) ) {
  15913. return this.each( function( i ) {
  15914. jQuery( this ).wrapInner( html.call( this, i ) );
  15915. } );
  15916. }
  15917. return this.each( function() {
  15918. var self = jQuery( this ),
  15919. contents = self.contents();
  15920. if ( contents.length ) {
  15921. contents.wrapAll( html );
  15922. } else {
  15923. self.append( html );
  15924. }
  15925. } );
  15926. },
  15927. wrap: function( html ) {
  15928. var htmlIsFunction = isFunction( html );
  15929. return this.each( function( i ) {
  15930. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  15931. } );
  15932. },
  15933. unwrap: function( selector ) {
  15934. this.parent( selector ).not( "body" ).each( function() {
  15935. jQuery( this ).replaceWith( this.childNodes );
  15936. } );
  15937. return this;
  15938. }
  15939. } );
  15940. jQuery.expr.pseudos.hidden = function( elem ) {
  15941. return !jQuery.expr.pseudos.visible( elem );
  15942. };
  15943. jQuery.expr.pseudos.visible = function( elem ) {
  15944. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  15945. };
  15946. jQuery.ajaxSettings.xhr = function() {
  15947. try {
  15948. return new window.XMLHttpRequest();
  15949. } catch ( e ) {}
  15950. };
  15951. var xhrSuccessStatus = {
  15952. // File protocol always yields status code 0, assume 200
  15953. 0: 200,
  15954. // Support: IE <=9 only
  15955. // #1450: sometimes IE returns 1223 when it should be 204
  15956. 1223: 204
  15957. },
  15958. xhrSupported = jQuery.ajaxSettings.xhr();
  15959. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  15960. support.ajax = xhrSupported = !!xhrSupported;
  15961. jQuery.ajaxTransport( function( options ) {
  15962. var callback, errorCallback;
  15963. // Cross domain only allowed if supported through XMLHttpRequest
  15964. if ( support.cors || xhrSupported && !options.crossDomain ) {
  15965. return {
  15966. send: function( headers, complete ) {
  15967. var i,
  15968. xhr = options.xhr();
  15969. xhr.open(
  15970. options.type,
  15971. options.url,
  15972. options.async,
  15973. options.username,
  15974. options.password
  15975. );
  15976. // Apply custom fields if provided
  15977. if ( options.xhrFields ) {
  15978. for ( i in options.xhrFields ) {
  15979. xhr[ i ] = options.xhrFields[ i ];
  15980. }
  15981. }
  15982. // Override mime type if needed
  15983. if ( options.mimeType && xhr.overrideMimeType ) {
  15984. xhr.overrideMimeType( options.mimeType );
  15985. }
  15986. // X-Requested-With header
  15987. // For cross-domain requests, seeing as conditions for a preflight are
  15988. // akin to a jigsaw puzzle, we simply never set it to be sure.
  15989. // (it can always be set on a per-request basis or even using ajaxSetup)
  15990. // For same-domain requests, won't change header if already provided.
  15991. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  15992. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  15993. }
  15994. // Set headers
  15995. for ( i in headers ) {
  15996. xhr.setRequestHeader( i, headers[ i ] );
  15997. }
  15998. // Callback
  15999. callback = function( type ) {
  16000. return function() {
  16001. if ( callback ) {
  16002. callback = errorCallback = xhr.onload =
  16003. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16004. xhr.onreadystatechange = null;
  16005. if ( type === "abort" ) {
  16006. xhr.abort();
  16007. } else if ( type === "error" ) {
  16008. // Support: IE <=9 only
  16009. // On a manual native abort, IE9 throws
  16010. // errors on any property access that is not readyState
  16011. if ( typeof xhr.status !== "number" ) {
  16012. complete( 0, "error" );
  16013. } else {
  16014. complete(
  16015. // File: protocol always yields status 0; see #8605, #14207
  16016. xhr.status,
  16017. xhr.statusText
  16018. );
  16019. }
  16020. } else {
  16021. complete(
  16022. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16023. xhr.statusText,
  16024. // Support: IE <=9 only
  16025. // IE9 has no XHR2 but throws on binary (trac-11426)
  16026. // For XHR2 non-text, let the caller handle it (gh-2498)
  16027. ( xhr.responseType || "text" ) !== "text" ||
  16028. typeof xhr.responseText !== "string" ?
  16029. { binary: xhr.response } :
  16030. { text: xhr.responseText },
  16031. xhr.getAllResponseHeaders()
  16032. );
  16033. }
  16034. }
  16035. };
  16036. };
  16037. // Listen to events
  16038. xhr.onload = callback();
  16039. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16040. // Support: IE 9 only
  16041. // Use onreadystatechange to replace onabort
  16042. // to handle uncaught aborts
  16043. if ( xhr.onabort !== undefined ) {
  16044. xhr.onabort = errorCallback;
  16045. } else {
  16046. xhr.onreadystatechange = function() {
  16047. // Check readyState before timeout as it changes
  16048. if ( xhr.readyState === 4 ) {
  16049. // Allow onerror to be called first,
  16050. // but that will not handle a native abort
  16051. // Also, save errorCallback to a variable
  16052. // as xhr.onerror cannot be accessed
  16053. window.setTimeout( function() {
  16054. if ( callback ) {
  16055. errorCallback();
  16056. }
  16057. } );
  16058. }
  16059. };
  16060. }
  16061. // Create the abort callback
  16062. callback = callback( "abort" );
  16063. try {
  16064. // Do send the request (this may raise an exception)
  16065. xhr.send( options.hasContent && options.data || null );
  16066. } catch ( e ) {
  16067. // #14683: Only rethrow if this hasn't been notified as an error yet
  16068. if ( callback ) {
  16069. throw e;
  16070. }
  16071. }
  16072. },
  16073. abort: function() {
  16074. if ( callback ) {
  16075. callback();
  16076. }
  16077. }
  16078. };
  16079. }
  16080. } );
  16081. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16082. jQuery.ajaxPrefilter( function( s ) {
  16083. if ( s.crossDomain ) {
  16084. s.contents.script = false;
  16085. }
  16086. } );
  16087. // Install script dataType
  16088. jQuery.ajaxSetup( {
  16089. accepts: {
  16090. script: "text/javascript, application/javascript, " +
  16091. "application/ecmascript, application/x-ecmascript"
  16092. },
  16093. contents: {
  16094. script: /\b(?:java|ecma)script\b/
  16095. },
  16096. converters: {
  16097. "text script": function( text ) {
  16098. jQuery.globalEval( text );
  16099. return text;
  16100. }
  16101. }
  16102. } );
  16103. // Handle cache's special case and crossDomain
  16104. jQuery.ajaxPrefilter( "script", function( s ) {
  16105. if ( s.cache === undefined ) {
  16106. s.cache = false;
  16107. }
  16108. if ( s.crossDomain ) {
  16109. s.type = "GET";
  16110. }
  16111. } );
  16112. // Bind script tag hack transport
  16113. jQuery.ajaxTransport( "script", function( s ) {
  16114. // This transport only deals with cross domain or forced-by-attrs requests
  16115. if ( s.crossDomain || s.scriptAttrs ) {
  16116. var script, callback;
  16117. return {
  16118. send: function( _, complete ) {
  16119. script = jQuery( "<script>" )
  16120. .attr( s.scriptAttrs || {} )
  16121. .prop( { charset: s.scriptCharset, src: s.url } )
  16122. .on( "load error", callback = function( evt ) {
  16123. script.remove();
  16124. callback = null;
  16125. if ( evt ) {
  16126. complete( evt.type === "error" ? 404 : 200, evt.type );
  16127. }
  16128. } );
  16129. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16130. document.head.appendChild( script[ 0 ] );
  16131. },
  16132. abort: function() {
  16133. if ( callback ) {
  16134. callback();
  16135. }
  16136. }
  16137. };
  16138. }
  16139. } );
  16140. var oldCallbacks = [],
  16141. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16142. // Default jsonp settings
  16143. jQuery.ajaxSetup( {
  16144. jsonp: "callback",
  16145. jsonpCallback: function() {
  16146. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16147. this[ callback ] = true;
  16148. return callback;
  16149. }
  16150. } );
  16151. // Detect, normalize options and install callbacks for jsonp requests
  16152. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16153. var callbackName, overwritten, responseContainer,
  16154. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16155. "url" :
  16156. typeof s.data === "string" &&
  16157. ( s.contentType || "" )
  16158. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16159. rjsonp.test( s.data ) && "data"
  16160. );
  16161. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16162. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16163. // Get callback name, remembering preexisting value associated with it
  16164. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16165. s.jsonpCallback() :
  16166. s.jsonpCallback;
  16167. // Insert callback into url or form data
  16168. if ( jsonProp ) {
  16169. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16170. } else if ( s.jsonp !== false ) {
  16171. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16172. }
  16173. // Use data converter to retrieve json after script execution
  16174. s.converters[ "script json" ] = function() {
  16175. if ( !responseContainer ) {
  16176. jQuery.error( callbackName + " was not called" );
  16177. }
  16178. return responseContainer[ 0 ];
  16179. };
  16180. // Force json dataType
  16181. s.dataTypes[ 0 ] = "json";
  16182. // Install callback
  16183. overwritten = window[ callbackName ];
  16184. window[ callbackName ] = function() {
  16185. responseContainer = arguments;
  16186. };
  16187. // Clean-up function (fires after converters)
  16188. jqXHR.always( function() {
  16189. // If previous value didn't exist - remove it
  16190. if ( overwritten === undefined ) {
  16191. jQuery( window ).removeProp( callbackName );
  16192. // Otherwise restore preexisting value
  16193. } else {
  16194. window[ callbackName ] = overwritten;
  16195. }
  16196. // Save back as free
  16197. if ( s[ callbackName ] ) {
  16198. // Make sure that re-using the options doesn't screw things around
  16199. s.jsonpCallback = originalSettings.jsonpCallback;
  16200. // Save the callback name for future use
  16201. oldCallbacks.push( callbackName );
  16202. }
  16203. // Call if it was a function and we have a response
  16204. if ( responseContainer && isFunction( overwritten ) ) {
  16205. overwritten( responseContainer[ 0 ] );
  16206. }
  16207. responseContainer = overwritten = undefined;
  16208. } );
  16209. // Delegate to script
  16210. return "script";
  16211. }
  16212. } );
  16213. // Support: Safari 8 only
  16214. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16215. // collapse sibling forms: the second one becomes a child of the first one.
  16216. // Because of that, this security measure has to be disabled in Safari 8.
  16217. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16218. support.createHTMLDocument = ( function() {
  16219. var body = document.implementation.createHTMLDocument( "" ).body;
  16220. body.innerHTML = "<form></form><form></form>";
  16221. return body.childNodes.length === 2;
  16222. } )();
  16223. // Argument "data" should be string of html
  16224. // context (optional): If specified, the fragment will be created in this context,
  16225. // defaults to document
  16226. // keepScripts (optional): If true, will include scripts passed in the html string
  16227. jQuery.parseHTML = function( data, context, keepScripts ) {
  16228. if ( typeof data !== "string" ) {
  16229. return [];
  16230. }
  16231. if ( typeof context === "boolean" ) {
  16232. keepScripts = context;
  16233. context = false;
  16234. }
  16235. var base, parsed, scripts;
  16236. if ( !context ) {
  16237. // Stop scripts or inline event handlers from being executed immediately
  16238. // by using document.implementation
  16239. if ( support.createHTMLDocument ) {
  16240. context = document.implementation.createHTMLDocument( "" );
  16241. // Set the base href for the created document
  16242. // so any parsed elements with URLs
  16243. // are based on the document's URL (gh-2965)
  16244. base = context.createElement( "base" );
  16245. base.href = document.location.href;
  16246. context.head.appendChild( base );
  16247. } else {
  16248. context = document;
  16249. }
  16250. }
  16251. parsed = rsingleTag.exec( data );
  16252. scripts = !keepScripts && [];
  16253. // Single tag
  16254. if ( parsed ) {
  16255. return [ context.createElement( parsed[ 1 ] ) ];
  16256. }
  16257. parsed = buildFragment( [ data ], context, scripts );
  16258. if ( scripts && scripts.length ) {
  16259. jQuery( scripts ).remove();
  16260. }
  16261. return jQuery.merge( [], parsed.childNodes );
  16262. };
  16263. /**
  16264. * Load a url into a page
  16265. */
  16266. jQuery.fn.load = function( url, params, callback ) {
  16267. var selector, type, response,
  16268. self = this,
  16269. off = url.indexOf( " " );
  16270. if ( off > -1 ) {
  16271. selector = stripAndCollapse( url.slice( off ) );
  16272. url = url.slice( 0, off );
  16273. }
  16274. // If it's a function
  16275. if ( isFunction( params ) ) {
  16276. // We assume that it's the callback
  16277. callback = params;
  16278. params = undefined;
  16279. // Otherwise, build a param string
  16280. } else if ( params && typeof params === "object" ) {
  16281. type = "POST";
  16282. }
  16283. // If we have elements to modify, make the request
  16284. if ( self.length > 0 ) {
  16285. jQuery.ajax( {
  16286. url: url,
  16287. // If "type" variable is undefined, then "GET" method will be used.
  16288. // Make value of this field explicit since
  16289. // user can override it through ajaxSetup method
  16290. type: type || "GET",
  16291. dataType: "html",
  16292. data: params
  16293. } ).done( function( responseText ) {
  16294. // Save response for use in complete callback
  16295. response = arguments;
  16296. self.html( selector ?
  16297. // If a selector was specified, locate the right elements in a dummy div
  16298. // Exclude scripts to avoid IE 'Permission Denied' errors
  16299. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16300. // Otherwise use the full result
  16301. responseText );
  16302. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16303. // but they are ignored because response was set above.
  16304. // If it fails, this function gets "jqXHR", "status", "error"
  16305. } ).always( callback && function( jqXHR, status ) {
  16306. self.each( function() {
  16307. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16308. } );
  16309. } );
  16310. }
  16311. return this;
  16312. };
  16313. // Attach a bunch of functions for handling common AJAX events
  16314. jQuery.each( [
  16315. "ajaxStart",
  16316. "ajaxStop",
  16317. "ajaxComplete",
  16318. "ajaxError",
  16319. "ajaxSuccess",
  16320. "ajaxSend"
  16321. ], function( i, type ) {
  16322. jQuery.fn[ type ] = function( fn ) {
  16323. return this.on( type, fn );
  16324. };
  16325. } );
  16326. jQuery.expr.pseudos.animated = function( elem ) {
  16327. return jQuery.grep( jQuery.timers, function( fn ) {
  16328. return elem === fn.elem;
  16329. } ).length;
  16330. };
  16331. jQuery.offset = {
  16332. setOffset: function( elem, options, i ) {
  16333. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16334. position = jQuery.css( elem, "position" ),
  16335. curElem = jQuery( elem ),
  16336. props = {};
  16337. // Set position first, in-case top/left are set even on static elem
  16338. if ( position === "static" ) {
  16339. elem.style.position = "relative";
  16340. }
  16341. curOffset = curElem.offset();
  16342. curCSSTop = jQuery.css( elem, "top" );
  16343. curCSSLeft = jQuery.css( elem, "left" );
  16344. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16345. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16346. // Need to be able to calculate position if either
  16347. // top or left is auto and position is either absolute or fixed
  16348. if ( calculatePosition ) {
  16349. curPosition = curElem.position();
  16350. curTop = curPosition.top;
  16351. curLeft = curPosition.left;
  16352. } else {
  16353. curTop = parseFloat( curCSSTop ) || 0;
  16354. curLeft = parseFloat( curCSSLeft ) || 0;
  16355. }
  16356. if ( isFunction( options ) ) {
  16357. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16358. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16359. }
  16360. if ( options.top != null ) {
  16361. props.top = ( options.top - curOffset.top ) + curTop;
  16362. }
  16363. if ( options.left != null ) {
  16364. props.left = ( options.left - curOffset.left ) + curLeft;
  16365. }
  16366. if ( "using" in options ) {
  16367. options.using.call( elem, props );
  16368. } else {
  16369. curElem.css( props );
  16370. }
  16371. }
  16372. };
  16373. jQuery.fn.extend( {
  16374. // offset() relates an element's border box to the document origin
  16375. offset: function( options ) {
  16376. // Preserve chaining for setter
  16377. if ( arguments.length ) {
  16378. return options === undefined ?
  16379. this :
  16380. this.each( function( i ) {
  16381. jQuery.offset.setOffset( this, options, i );
  16382. } );
  16383. }
  16384. var rect, win,
  16385. elem = this[ 0 ];
  16386. if ( !elem ) {
  16387. return;
  16388. }
  16389. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16390. // Support: IE <=11 only
  16391. // Running getBoundingClientRect on a
  16392. // disconnected node in IE throws an error
  16393. if ( !elem.getClientRects().length ) {
  16394. return { top: 0, left: 0 };
  16395. }
  16396. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16397. rect = elem.getBoundingClientRect();
  16398. win = elem.ownerDocument.defaultView;
  16399. return {
  16400. top: rect.top + win.pageYOffset,
  16401. left: rect.left + win.pageXOffset
  16402. };
  16403. },
  16404. // position() relates an element's margin box to its offset parent's padding box
  16405. // This corresponds to the behavior of CSS absolute positioning
  16406. position: function() {
  16407. if ( !this[ 0 ] ) {
  16408. return;
  16409. }
  16410. var offsetParent, offset, doc,
  16411. elem = this[ 0 ],
  16412. parentOffset = { top: 0, left: 0 };
  16413. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16414. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16415. // Assume position:fixed implies availability of getBoundingClientRect
  16416. offset = elem.getBoundingClientRect();
  16417. } else {
  16418. offset = this.offset();
  16419. // Account for the *real* offset parent, which can be the document or its root element
  16420. // when a statically positioned element is identified
  16421. doc = elem.ownerDocument;
  16422. offsetParent = elem.offsetParent || doc.documentElement;
  16423. while ( offsetParent &&
  16424. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16425. jQuery.css( offsetParent, "position" ) === "static" ) {
  16426. offsetParent = offsetParent.parentNode;
  16427. }
  16428. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16429. // Incorporate borders into its offset, since they are outside its content origin
  16430. parentOffset = jQuery( offsetParent ).offset();
  16431. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16432. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16433. }
  16434. }
  16435. // Subtract parent offsets and element margins
  16436. return {
  16437. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16438. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16439. };
  16440. },
  16441. // This method will return documentElement in the following cases:
  16442. // 1) For the element inside the iframe without offsetParent, this method will return
  16443. // documentElement of the parent window
  16444. // 2) For the hidden or detached element
  16445. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16446. //
  16447. // but those exceptions were never presented as a real life use-cases
  16448. // and might be considered as more preferable results.
  16449. //
  16450. // This logic, however, is not guaranteed and can change at any point in the future
  16451. offsetParent: function() {
  16452. return this.map( function() {
  16453. var offsetParent = this.offsetParent;
  16454. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16455. offsetParent = offsetParent.offsetParent;
  16456. }
  16457. return offsetParent || documentElement;
  16458. } );
  16459. }
  16460. } );
  16461. // Create scrollLeft and scrollTop methods
  16462. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16463. var top = "pageYOffset" === prop;
  16464. jQuery.fn[ method ] = function( val ) {
  16465. return access( this, function( elem, method, val ) {
  16466. // Coalesce documents and windows
  16467. var win;
  16468. if ( isWindow( elem ) ) {
  16469. win = elem;
  16470. } else if ( elem.nodeType === 9 ) {
  16471. win = elem.defaultView;
  16472. }
  16473. if ( val === undefined ) {
  16474. return win ? win[ prop ] : elem[ method ];
  16475. }
  16476. if ( win ) {
  16477. win.scrollTo(
  16478. !top ? val : win.pageXOffset,
  16479. top ? val : win.pageYOffset
  16480. );
  16481. } else {
  16482. elem[ method ] = val;
  16483. }
  16484. }, method, val, arguments.length );
  16485. };
  16486. } );
  16487. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16488. // Add the top/left cssHooks using jQuery.fn.position
  16489. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16490. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16491. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16492. // rather than make the css module depend on the offset module, just check for it here
  16493. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16494. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16495. function( elem, computed ) {
  16496. if ( computed ) {
  16497. computed = curCSS( elem, prop );
  16498. // If curCSS returns percentage, fallback to offset
  16499. return rnumnonpx.test( computed ) ?
  16500. jQuery( elem ).position()[ prop ] + "px" :
  16501. computed;
  16502. }
  16503. }
  16504. );
  16505. } );
  16506. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16507. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16508. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16509. function( defaultExtra, funcName ) {
  16510. // Margin is only for outerHeight, outerWidth
  16511. jQuery.fn[ funcName ] = function( margin, value ) {
  16512. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16513. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16514. return access( this, function( elem, type, value ) {
  16515. var doc;
  16516. if ( isWindow( elem ) ) {
  16517. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16518. return funcName.indexOf( "outer" ) === 0 ?
  16519. elem[ "inner" + name ] :
  16520. elem.document.documentElement[ "client" + name ];
  16521. }
  16522. // Get document width or height
  16523. if ( elem.nodeType === 9 ) {
  16524. doc = elem.documentElement;
  16525. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16526. // whichever is greatest
  16527. return Math.max(
  16528. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16529. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16530. doc[ "client" + name ]
  16531. );
  16532. }
  16533. return value === undefined ?
  16534. // Get width or height on the element, requesting but not forcing parseFloat
  16535. jQuery.css( elem, type, extra ) :
  16536. // Set width or height on the element
  16537. jQuery.style( elem, type, value, extra );
  16538. }, type, chainable ? margin : undefined, chainable );
  16539. };
  16540. } );
  16541. } );
  16542. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16543. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16544. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16545. function( i, name ) {
  16546. // Handle event binding
  16547. jQuery.fn[ name ] = function( data, fn ) {
  16548. return arguments.length > 0 ?
  16549. this.on( name, null, data, fn ) :
  16550. this.trigger( name );
  16551. };
  16552. } );
  16553. jQuery.fn.extend( {
  16554. hover: function( fnOver, fnOut ) {
  16555. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16556. }
  16557. } );
  16558. jQuery.fn.extend( {
  16559. bind: function( types, data, fn ) {
  16560. return this.on( types, null, data, fn );
  16561. },
  16562. unbind: function( types, fn ) {
  16563. return this.off( types, null, fn );
  16564. },
  16565. delegate: function( selector, types, data, fn ) {
  16566. return this.on( types, selector, data, fn );
  16567. },
  16568. undelegate: function( selector, types, fn ) {
  16569. // ( namespace ) or ( selector, types [, fn] )
  16570. return arguments.length === 1 ?
  16571. this.off( selector, "**" ) :
  16572. this.off( types, selector || "**", fn );
  16573. }
  16574. } );
  16575. // Bind a function to a context, optionally partially applying any
  16576. // arguments.
  16577. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16578. // However, it is not slated for removal any time soon
  16579. jQuery.proxy = function( fn, context ) {
  16580. var tmp, args, proxy;
  16581. if ( typeof context === "string" ) {
  16582. tmp = fn[ context ];
  16583. context = fn;
  16584. fn = tmp;
  16585. }
  16586. // Quick check to determine if target is callable, in the spec
  16587. // this throws a TypeError, but we will just return undefined.
  16588. if ( !isFunction( fn ) ) {
  16589. return undefined;
  16590. }
  16591. // Simulated bind
  16592. args = slice.call( arguments, 2 );
  16593. proxy = function() {
  16594. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16595. };
  16596. // Set the guid of unique handler to the same of original handler, so it can be removed
  16597. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16598. return proxy;
  16599. };
  16600. jQuery.holdReady = function( hold ) {
  16601. if ( hold ) {
  16602. jQuery.readyWait++;
  16603. } else {
  16604. jQuery.ready( true );
  16605. }
  16606. };
  16607. jQuery.isArray = Array.isArray;
  16608. jQuery.parseJSON = JSON.parse;
  16609. jQuery.nodeName = nodeName;
  16610. jQuery.isFunction = isFunction;
  16611. jQuery.isWindow = isWindow;
  16612. jQuery.camelCase = camelCase;
  16613. jQuery.type = toType;
  16614. jQuery.now = Date.now;
  16615. jQuery.isNumeric = function( obj ) {
  16616. // As of jQuery 3.0, isNumeric is limited to
  16617. // strings and numbers (primitives or objects)
  16618. // that can be coerced to finite numbers (gh-2662)
  16619. var type = jQuery.type( obj );
  16620. return ( type === "number" || type === "string" ) &&
  16621. // parseFloat NaNs numeric-cast false positives ("")
  16622. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16623. // subtraction forces infinities to NaN
  16624. !isNaN( obj - parseFloat( obj ) );
  16625. };
  16626. // Register as a named AMD module, since jQuery can be concatenated with other
  16627. // files that may use define, but not via a proper concatenation script that
  16628. // understands anonymous AMD modules. A named AMD is safest and most robust
  16629. // way to register. Lowercase jquery is used because AMD module names are
  16630. // derived from file names, and jQuery is normally delivered in a lowercase
  16631. // file name. Do this after creating the global so that if an AMD module wants
  16632. // to call noConflict to hide this version of jQuery, it will work.
  16633. // Note that for maximum portability, libraries that are not jQuery should
  16634. // declare themselves as anonymous modules, and avoid setting a global if an
  16635. // AMD loader is present. jQuery is a special case. For more information, see
  16636. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16637. if ( true ) {
  16638. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16639. return jQuery;
  16640. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16641. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16642. }
  16643. var
  16644. // Map over jQuery in case of overwrite
  16645. _jQuery = window.jQuery,
  16646. // Map over the $ in case of overwrite
  16647. _$ = window.$;
  16648. jQuery.noConflict = function( deep ) {
  16649. if ( window.$ === jQuery ) {
  16650. window.$ = _$;
  16651. }
  16652. if ( deep && window.jQuery === jQuery ) {
  16653. window.jQuery = _jQuery;
  16654. }
  16655. return jQuery;
  16656. };
  16657. // Expose jQuery and $ identifiers, even in AMD
  16658. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16659. // and CommonJS for browser emulators (#13566)
  16660. if ( !noGlobal ) {
  16661. window.jQuery = window.$ = jQuery;
  16662. }
  16663. return jQuery;
  16664. } );
  16665. /***/ }),
  16666. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16667. /*!************************************************!*\
  16668. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16669. \************************************************/
  16670. /*! exports provided: default */
  16671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16672. "use strict";
  16673. __webpack_require__.r(__webpack_exports__);
  16674. var classCallCheck = function (instance, Constructor) {
  16675. if (!(instance instanceof Constructor)) {
  16676. throw new TypeError("Cannot call a class as a function");
  16677. }
  16678. };
  16679. var createClass = function () {
  16680. function defineProperties(target, props) {
  16681. for (var i = 0; i < props.length; i++) {
  16682. var descriptor = props[i];
  16683. descriptor.enumerable = descriptor.enumerable || false;
  16684. descriptor.configurable = true;
  16685. if ("value" in descriptor) descriptor.writable = true;
  16686. Object.defineProperty(target, descriptor.key, descriptor);
  16687. }
  16688. }
  16689. return function (Constructor, protoProps, staticProps) {
  16690. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16691. if (staticProps) defineProperties(Constructor, staticProps);
  16692. return Constructor;
  16693. };
  16694. }();
  16695. var _extends = Object.assign || function (target) {
  16696. for (var i = 1; i < arguments.length; i++) {
  16697. var source = arguments[i];
  16698. for (var key in source) {
  16699. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16700. target[key] = source[key];
  16701. }
  16702. }
  16703. }
  16704. return target;
  16705. };
  16706. var inherits = function (subClass, superClass) {
  16707. if (typeof superClass !== "function" && superClass !== null) {
  16708. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16709. }
  16710. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16711. constructor: {
  16712. value: subClass,
  16713. enumerable: false,
  16714. writable: true,
  16715. configurable: true
  16716. }
  16717. });
  16718. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16719. };
  16720. var possibleConstructorReturn = function (self, call) {
  16721. if (!self) {
  16722. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16723. }
  16724. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16725. };
  16726. var Connector = function () {
  16727. /**
  16728. * Create a new class instance.
  16729. */
  16730. function Connector(options) {
  16731. classCallCheck(this, Connector);
  16732. /**
  16733. * Default connector options.
  16734. */
  16735. this._defaultOptions = {
  16736. auth: {
  16737. headers: {}
  16738. },
  16739. authEndpoint: '/broadcasting/auth',
  16740. broadcaster: 'pusher',
  16741. csrfToken: null,
  16742. host: null,
  16743. key: null,
  16744. namespace: 'App.Events'
  16745. };
  16746. this.setOptions(options);
  16747. this.connect();
  16748. }
  16749. /**
  16750. * Merge the custom options with the defaults.
  16751. */
  16752. createClass(Connector, [{
  16753. key: 'setOptions',
  16754. value: function setOptions(options) {
  16755. this.options = _extends(this._defaultOptions, options);
  16756. if (this.csrfToken()) {
  16757. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16758. }
  16759. return options;
  16760. }
  16761. /**
  16762. * Extract the CSRF token from the page.
  16763. */
  16764. }, {
  16765. key: 'csrfToken',
  16766. value: function csrfToken() {
  16767. var selector = void 0;
  16768. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16769. return window['Laravel'].csrfToken;
  16770. } else if (this.options.csrfToken) {
  16771. return this.options.csrfToken;
  16772. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16773. return selector.getAttribute('content');
  16774. }
  16775. return null;
  16776. }
  16777. }]);
  16778. return Connector;
  16779. }();
  16780. /**
  16781. * This class represents a basic channel.
  16782. */
  16783. var Channel = function () {
  16784. function Channel() {
  16785. classCallCheck(this, Channel);
  16786. }
  16787. createClass(Channel, [{
  16788. key: 'listenForWhisper',
  16789. /**
  16790. * Listen for a whisper event on the channel instance.
  16791. */
  16792. value: function listenForWhisper(event, callback) {
  16793. return this.listen('.client-' + event, callback);
  16794. }
  16795. /**
  16796. * Listen for an event on the channel instance.
  16797. */
  16798. }, {
  16799. key: 'notification',
  16800. value: function notification(callback) {
  16801. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16802. }
  16803. /**
  16804. * Stop listening for a whispser event on the channel instance.
  16805. */
  16806. }, {
  16807. key: 'stopListeningForWhisper',
  16808. value: function stopListeningForWhisper(event) {
  16809. return this.stopListening('.client-' + event);
  16810. }
  16811. }]);
  16812. return Channel;
  16813. }();
  16814. /**
  16815. * Event name formatter
  16816. */
  16817. var EventFormatter = function () {
  16818. /**
  16819. * Create a new class instance.
  16820. */
  16821. function EventFormatter(namespace) {
  16822. classCallCheck(this, EventFormatter);
  16823. this.setNamespace(namespace);
  16824. }
  16825. /**
  16826. * Format the given event name.
  16827. */
  16828. createClass(EventFormatter, [{
  16829. key: 'format',
  16830. value: function format(event) {
  16831. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16832. return event.substr(1);
  16833. } else if (this.namespace) {
  16834. event = this.namespace + '.' + event;
  16835. }
  16836. return event.replace(/\./g, '\\');
  16837. }
  16838. /**
  16839. * Set the event namespace.
  16840. */
  16841. }, {
  16842. key: 'setNamespace',
  16843. value: function setNamespace(value) {
  16844. this.namespace = value;
  16845. }
  16846. }]);
  16847. return EventFormatter;
  16848. }();
  16849. /**
  16850. * This class represents a Pusher channel.
  16851. */
  16852. var PusherChannel = function (_Channel) {
  16853. inherits(PusherChannel, _Channel);
  16854. /**
  16855. * Create a new class instance.
  16856. */
  16857. function PusherChannel(pusher, name, options) {
  16858. classCallCheck(this, PusherChannel);
  16859. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16860. _this.name = name;
  16861. _this.pusher = pusher;
  16862. _this.options = options;
  16863. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16864. _this.subscribe();
  16865. return _this;
  16866. }
  16867. /**
  16868. * Subscribe to a Pusher channel.
  16869. */
  16870. createClass(PusherChannel, [{
  16871. key: 'subscribe',
  16872. value: function subscribe() {
  16873. this.subscription = this.pusher.subscribe(this.name);
  16874. }
  16875. /**
  16876. * Unsubscribe from a Pusher channel.
  16877. */
  16878. }, {
  16879. key: 'unsubscribe',
  16880. value: function unsubscribe() {
  16881. this.pusher.unsubscribe(this.name);
  16882. }
  16883. /**
  16884. * Listen for an event on the channel instance.
  16885. */
  16886. }, {
  16887. key: 'listen',
  16888. value: function listen(event, callback) {
  16889. this.on(this.eventFormatter.format(event), callback);
  16890. return this;
  16891. }
  16892. /**
  16893. * Stop listening for an event on the channel instance.
  16894. */
  16895. }, {
  16896. key: 'stopListening',
  16897. value: function stopListening(event) {
  16898. this.subscription.unbind(this.eventFormatter.format(event));
  16899. return this;
  16900. }
  16901. /**
  16902. * Bind a channel to an event.
  16903. */
  16904. }, {
  16905. key: 'on',
  16906. value: function on(event, callback) {
  16907. this.subscription.bind(event, callback);
  16908. return this;
  16909. }
  16910. }]);
  16911. return PusherChannel;
  16912. }(Channel);
  16913. /**
  16914. * This class represents a Pusher private channel.
  16915. */
  16916. var PusherPrivateChannel = function (_PusherChannel) {
  16917. inherits(PusherPrivateChannel, _PusherChannel);
  16918. function PusherPrivateChannel() {
  16919. classCallCheck(this, PusherPrivateChannel);
  16920. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  16921. }
  16922. createClass(PusherPrivateChannel, [{
  16923. key: 'whisper',
  16924. /**
  16925. * Trigger client event on the channel.
  16926. */
  16927. value: function whisper(eventName, data) {
  16928. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16929. return this;
  16930. }
  16931. }]);
  16932. return PusherPrivateChannel;
  16933. }(PusherChannel);
  16934. /**
  16935. * This class represents a Pusher presence channel.
  16936. */
  16937. var PusherPresenceChannel = function (_PusherChannel) {
  16938. inherits(PusherPresenceChannel, _PusherChannel);
  16939. function PusherPresenceChannel() {
  16940. classCallCheck(this, PusherPresenceChannel);
  16941. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  16942. }
  16943. createClass(PusherPresenceChannel, [{
  16944. key: 'here',
  16945. /**
  16946. * Register a callback to be called anytime the member list changes.
  16947. */
  16948. value: function here(callback) {
  16949. this.on('pusher:subscription_succeeded', function (data) {
  16950. callback(Object.keys(data.members).map(function (k) {
  16951. return data.members[k];
  16952. }));
  16953. });
  16954. return this;
  16955. }
  16956. /**
  16957. * Listen for someone joining the channel.
  16958. */
  16959. }, {
  16960. key: 'joining',
  16961. value: function joining(callback) {
  16962. this.on('pusher:member_added', function (member) {
  16963. callback(member.info);
  16964. });
  16965. return this;
  16966. }
  16967. /**
  16968. * Listen for someone leaving the channel.
  16969. */
  16970. }, {
  16971. key: 'leaving',
  16972. value: function leaving(callback) {
  16973. this.on('pusher:member_removed', function (member) {
  16974. callback(member.info);
  16975. });
  16976. return this;
  16977. }
  16978. /**
  16979. * Trigger client event on the channel.
  16980. */
  16981. }, {
  16982. key: 'whisper',
  16983. value: function whisper(eventName, data) {
  16984. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16985. return this;
  16986. }
  16987. }]);
  16988. return PusherPresenceChannel;
  16989. }(PusherChannel);
  16990. /**
  16991. * This class represents a Socket.io channel.
  16992. */
  16993. var SocketIoChannel = function (_Channel) {
  16994. inherits(SocketIoChannel, _Channel);
  16995. /**
  16996. * Create a new class instance.
  16997. */
  16998. function SocketIoChannel(socket, name, options) {
  16999. classCallCheck(this, SocketIoChannel);
  17000. /**
  17001. * The event callbacks applied to the channel.
  17002. */
  17003. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17004. _this.events = {};
  17005. _this.name = name;
  17006. _this.socket = socket;
  17007. _this.options = options;
  17008. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17009. _this.subscribe();
  17010. _this.configureReconnector();
  17011. return _this;
  17012. }
  17013. /**
  17014. * Subscribe to a Socket.io channel.
  17015. */
  17016. createClass(SocketIoChannel, [{
  17017. key: 'subscribe',
  17018. value: function subscribe() {
  17019. this.socket.emit('subscribe', {
  17020. channel: this.name,
  17021. auth: this.options.auth || {}
  17022. });
  17023. }
  17024. /**
  17025. * Unsubscribe from channel and ubind event callbacks.
  17026. */
  17027. }, {
  17028. key: 'unsubscribe',
  17029. value: function unsubscribe() {
  17030. this.unbind();
  17031. this.socket.emit('unsubscribe', {
  17032. channel: this.name,
  17033. auth: this.options.auth || {}
  17034. });
  17035. }
  17036. /**
  17037. * Listen for an event on the channel instance.
  17038. */
  17039. }, {
  17040. key: 'listen',
  17041. value: function listen(event, callback) {
  17042. this.on(this.eventFormatter.format(event), callback);
  17043. return this;
  17044. }
  17045. /**
  17046. * Stop listening for an event on the channel instance.
  17047. */
  17048. }, {
  17049. key: 'stopListening',
  17050. value: function stopListening(event) {
  17051. var name = this.eventFormatter.format(event);
  17052. this.socket.removeListener(name);
  17053. delete this.events[name];
  17054. return this;
  17055. }
  17056. /**
  17057. * Bind the channel's socket to an event and store the callback.
  17058. */
  17059. }, {
  17060. key: 'on',
  17061. value: function on(event, callback) {
  17062. var _this2 = this;
  17063. var listener = function listener(channel, data) {
  17064. if (_this2.name == channel) {
  17065. callback(data);
  17066. }
  17067. };
  17068. this.socket.on(event, listener);
  17069. this.bind(event, listener);
  17070. }
  17071. /**
  17072. * Attach a 'reconnect' listener and bind the event.
  17073. */
  17074. }, {
  17075. key: 'configureReconnector',
  17076. value: function configureReconnector() {
  17077. var _this3 = this;
  17078. var listener = function listener() {
  17079. _this3.subscribe();
  17080. };
  17081. this.socket.on('reconnect', listener);
  17082. this.bind('reconnect', listener);
  17083. }
  17084. /**
  17085. * Bind the channel's socket to an event and store the callback.
  17086. */
  17087. }, {
  17088. key: 'bind',
  17089. value: function bind(event, callback) {
  17090. this.events[event] = this.events[event] || [];
  17091. this.events[event].push(callback);
  17092. }
  17093. /**
  17094. * Unbind the channel's socket from all stored event callbacks.
  17095. */
  17096. }, {
  17097. key: 'unbind',
  17098. value: function unbind() {
  17099. var _this4 = this;
  17100. Object.keys(this.events).forEach(function (event) {
  17101. _this4.events[event].forEach(function (callback) {
  17102. _this4.socket.removeListener(event, callback);
  17103. });
  17104. delete _this4.events[event];
  17105. });
  17106. }
  17107. }]);
  17108. return SocketIoChannel;
  17109. }(Channel);
  17110. /**
  17111. * This class represents a Socket.io presence channel.
  17112. */
  17113. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17114. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17115. function SocketIoPrivateChannel() {
  17116. classCallCheck(this, SocketIoPrivateChannel);
  17117. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17118. }
  17119. createClass(SocketIoPrivateChannel, [{
  17120. key: 'whisper',
  17121. /**
  17122. * Trigger client event on the channel.
  17123. */
  17124. value: function whisper(eventName, data) {
  17125. this.socket.emit('client event', {
  17126. channel: this.name,
  17127. event: 'client-' + eventName,
  17128. data: data
  17129. });
  17130. return this;
  17131. }
  17132. }]);
  17133. return SocketIoPrivateChannel;
  17134. }(SocketIoChannel);
  17135. /**
  17136. * This class represents a Socket.io presence channel.
  17137. */
  17138. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17139. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17140. function SocketIoPresenceChannel() {
  17141. classCallCheck(this, SocketIoPresenceChannel);
  17142. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17143. }
  17144. createClass(SocketIoPresenceChannel, [{
  17145. key: 'here',
  17146. /**
  17147. * Register a callback to be called anytime the member list changes.
  17148. */
  17149. value: function here(callback) {
  17150. this.on('presence:subscribed', function (members) {
  17151. callback(members.map(function (m) {
  17152. return m.user_info;
  17153. }));
  17154. });
  17155. return this;
  17156. }
  17157. /**
  17158. * Listen for someone joining the channel.
  17159. */
  17160. }, {
  17161. key: 'joining',
  17162. value: function joining(callback) {
  17163. this.on('presence:joining', function (member) {
  17164. return callback(member.user_info);
  17165. });
  17166. return this;
  17167. }
  17168. /**
  17169. * Listen for someone leaving the channel.
  17170. */
  17171. }, {
  17172. key: 'leaving',
  17173. value: function leaving(callback) {
  17174. this.on('presence:leaving', function (member) {
  17175. return callback(member.user_info);
  17176. });
  17177. return this;
  17178. }
  17179. }]);
  17180. return SocketIoPresenceChannel;
  17181. }(SocketIoPrivateChannel);
  17182. /**
  17183. * This class represents a null channel.
  17184. */
  17185. var NullChannel = function (_Channel) {
  17186. inherits(NullChannel, _Channel);
  17187. function NullChannel() {
  17188. classCallCheck(this, NullChannel);
  17189. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17190. }
  17191. createClass(NullChannel, [{
  17192. key: 'subscribe',
  17193. /**
  17194. * Subscribe to a channel.
  17195. */
  17196. value: function subscribe() {}
  17197. //
  17198. /**
  17199. * Unsubscribe from a channel.
  17200. */
  17201. }, {
  17202. key: 'unsubscribe',
  17203. value: function unsubscribe() {}
  17204. //
  17205. /**
  17206. * Listen for an event on the channel instance.
  17207. */
  17208. }, {
  17209. key: 'listen',
  17210. value: function listen(event, callback) {
  17211. return this;
  17212. }
  17213. /**
  17214. * Stop listening for an event on the channel instance.
  17215. */
  17216. }, {
  17217. key: 'stopListening',
  17218. value: function stopListening(event) {
  17219. return this;
  17220. }
  17221. /**
  17222. * Bind a channel to an event.
  17223. */
  17224. }, {
  17225. key: 'on',
  17226. value: function on(event, callback) {
  17227. return this;
  17228. }
  17229. }]);
  17230. return NullChannel;
  17231. }(Channel);
  17232. /**
  17233. * This class represents a null private channel.
  17234. */
  17235. var NullPrivateChannel = function (_NullChannel) {
  17236. inherits(NullPrivateChannel, _NullChannel);
  17237. function NullPrivateChannel() {
  17238. classCallCheck(this, NullPrivateChannel);
  17239. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17240. }
  17241. createClass(NullPrivateChannel, [{
  17242. key: 'whisper',
  17243. /**
  17244. * Trigger client event on the channel.
  17245. */
  17246. value: function whisper(eventName, data) {
  17247. return this;
  17248. }
  17249. }]);
  17250. return NullPrivateChannel;
  17251. }(NullChannel);
  17252. /**
  17253. * This class represents a null presence channel.
  17254. */
  17255. var NullPresenceChannel = function (_NullChannel) {
  17256. inherits(NullPresenceChannel, _NullChannel);
  17257. function NullPresenceChannel() {
  17258. classCallCheck(this, NullPresenceChannel);
  17259. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17260. }
  17261. createClass(NullPresenceChannel, [{
  17262. key: 'here',
  17263. /**
  17264. * Register a callback to be called anytime the member list changes.
  17265. */
  17266. value: function here(callback) {
  17267. return this;
  17268. }
  17269. /**
  17270. * Listen for someone joining the channel.
  17271. */
  17272. }, {
  17273. key: 'joining',
  17274. value: function joining(callback) {
  17275. return this;
  17276. }
  17277. /**
  17278. * Listen for someone leaving the channel.
  17279. */
  17280. }, {
  17281. key: 'leaving',
  17282. value: function leaving(callback) {
  17283. return this;
  17284. }
  17285. /**
  17286. * Trigger client event on the channel.
  17287. */
  17288. }, {
  17289. key: 'whisper',
  17290. value: function whisper(eventName, data) {
  17291. return this;
  17292. }
  17293. }]);
  17294. return NullPresenceChannel;
  17295. }(NullChannel);
  17296. /**
  17297. * This class creates a connector to Pusher.
  17298. */
  17299. var PusherConnector = function (_Connector) {
  17300. inherits(PusherConnector, _Connector);
  17301. function PusherConnector() {
  17302. classCallCheck(this, PusherConnector);
  17303. /**
  17304. * All of the subscribed channel names.
  17305. */
  17306. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17307. _this.channels = {};
  17308. return _this;
  17309. }
  17310. /**
  17311. * Create a fresh Pusher connection.
  17312. */
  17313. createClass(PusherConnector, [{
  17314. key: 'connect',
  17315. value: function connect() {
  17316. if (typeof this.options.client !== 'undefined') {
  17317. this.pusher = this.options.client;
  17318. } else {
  17319. this.pusher = new Pusher(this.options.key, this.options);
  17320. }
  17321. }
  17322. /**
  17323. * Listen for an event on a channel instance.
  17324. */
  17325. }, {
  17326. key: 'listen',
  17327. value: function listen(name, event, callback) {
  17328. return this.channel(name).listen(event, callback);
  17329. }
  17330. /**
  17331. * Get a channel instance by name.
  17332. */
  17333. }, {
  17334. key: 'channel',
  17335. value: function channel(name) {
  17336. if (!this.channels[name]) {
  17337. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17338. }
  17339. return this.channels[name];
  17340. }
  17341. /**
  17342. * Get a private channel instance by name.
  17343. */
  17344. }, {
  17345. key: 'privateChannel',
  17346. value: function privateChannel(name) {
  17347. if (!this.channels['private-' + name]) {
  17348. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17349. }
  17350. return this.channels['private-' + name];
  17351. }
  17352. /**
  17353. * Get a presence channel instance by name.
  17354. */
  17355. }, {
  17356. key: 'presenceChannel',
  17357. value: function presenceChannel(name) {
  17358. if (!this.channels['presence-' + name]) {
  17359. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17360. }
  17361. return this.channels['presence-' + name];
  17362. }
  17363. /**
  17364. * Leave the given channel, as well as its private and presence variants.
  17365. */
  17366. }, {
  17367. key: 'leave',
  17368. value: function leave(name) {
  17369. var _this2 = this;
  17370. var channels = [name, 'private-' + name, 'presence-' + name];
  17371. channels.forEach(function (name, index) {
  17372. _this2.leaveChannel(name);
  17373. });
  17374. }
  17375. /**
  17376. * Leave the given channel.
  17377. */
  17378. }, {
  17379. key: 'leaveChannel',
  17380. value: function leaveChannel(name) {
  17381. if (this.channels[name]) {
  17382. this.channels[name].unsubscribe();
  17383. delete this.channels[name];
  17384. }
  17385. }
  17386. /**
  17387. * Get the socket ID for the connection.
  17388. */
  17389. }, {
  17390. key: 'socketId',
  17391. value: function socketId() {
  17392. return this.pusher.connection.socket_id;
  17393. }
  17394. /**
  17395. * Disconnect Pusher connection.
  17396. */
  17397. }, {
  17398. key: 'disconnect',
  17399. value: function disconnect() {
  17400. this.pusher.disconnect();
  17401. }
  17402. }]);
  17403. return PusherConnector;
  17404. }(Connector);
  17405. /**
  17406. * This class creates a connnector to a Socket.io server.
  17407. */
  17408. var SocketIoConnector = function (_Connector) {
  17409. inherits(SocketIoConnector, _Connector);
  17410. function SocketIoConnector() {
  17411. classCallCheck(this, SocketIoConnector);
  17412. /**
  17413. * All of the subscribed channel names.
  17414. */
  17415. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17416. _this.channels = {};
  17417. return _this;
  17418. }
  17419. /**
  17420. * Create a fresh Socket.io connection.
  17421. */
  17422. createClass(SocketIoConnector, [{
  17423. key: 'connect',
  17424. value: function connect() {
  17425. var io = this.getSocketIO();
  17426. this.socket = io(this.options.host, this.options);
  17427. return this.socket;
  17428. }
  17429. /**
  17430. * Get socket.io module from global scope or options.
  17431. */
  17432. }, {
  17433. key: 'getSocketIO',
  17434. value: function getSocketIO() {
  17435. if (typeof this.options.client !== 'undefined') {
  17436. return this.options.client;
  17437. }
  17438. if (typeof io !== 'undefined') {
  17439. return io;
  17440. }
  17441. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17442. }
  17443. /**
  17444. * Listen for an event on a channel instance.
  17445. */
  17446. }, {
  17447. key: 'listen',
  17448. value: function listen(name, event, callback) {
  17449. return this.channel(name).listen(event, callback);
  17450. }
  17451. /**
  17452. * Get a channel instance by name.
  17453. */
  17454. }, {
  17455. key: 'channel',
  17456. value: function channel(name) {
  17457. if (!this.channels[name]) {
  17458. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17459. }
  17460. return this.channels[name];
  17461. }
  17462. /**
  17463. * Get a private channel instance by name.
  17464. */
  17465. }, {
  17466. key: 'privateChannel',
  17467. value: function privateChannel(name) {
  17468. if (!this.channels['private-' + name]) {
  17469. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17470. }
  17471. return this.channels['private-' + name];
  17472. }
  17473. /**
  17474. * Get a presence channel instance by name.
  17475. */
  17476. }, {
  17477. key: 'presenceChannel',
  17478. value: function presenceChannel(name) {
  17479. if (!this.channels['presence-' + name]) {
  17480. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17481. }
  17482. return this.channels['presence-' + name];
  17483. }
  17484. /**
  17485. * Leave the given channel, as well as its private and presence variants.
  17486. */
  17487. }, {
  17488. key: 'leave',
  17489. value: function leave(name) {
  17490. var _this2 = this;
  17491. var channels = [name, 'private-' + name, 'presence-' + name];
  17492. channels.forEach(function (name) {
  17493. _this2.leaveChannel(name);
  17494. });
  17495. }
  17496. /**
  17497. * Leave the given channel.
  17498. */
  17499. }, {
  17500. key: 'leaveChannel',
  17501. value: function leaveChannel(name) {
  17502. if (this.channels[name]) {
  17503. this.channels[name].unsubscribe();
  17504. delete this.channels[name];
  17505. }
  17506. }
  17507. /**
  17508. * Get the socket ID for the connection.
  17509. */
  17510. }, {
  17511. key: 'socketId',
  17512. value: function socketId() {
  17513. return this.socket.id;
  17514. }
  17515. /**
  17516. * Disconnect Socketio connection.
  17517. */
  17518. }, {
  17519. key: 'disconnect',
  17520. value: function disconnect() {
  17521. this.socket.disconnect();
  17522. }
  17523. }]);
  17524. return SocketIoConnector;
  17525. }(Connector);
  17526. /**
  17527. * This class creates a null connector.
  17528. */
  17529. var NullConnector = function (_Connector) {
  17530. inherits(NullConnector, _Connector);
  17531. function NullConnector() {
  17532. classCallCheck(this, NullConnector);
  17533. /**
  17534. * All of the subscribed channel names.
  17535. */
  17536. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17537. _this.channels = {};
  17538. return _this;
  17539. }
  17540. /**
  17541. * Create a fresh connection.
  17542. */
  17543. createClass(NullConnector, [{
  17544. key: 'connect',
  17545. value: function connect() {}
  17546. //
  17547. /**
  17548. * Listen for an event on a channel instance.
  17549. */
  17550. }, {
  17551. key: 'listen',
  17552. value: function listen(name, event, callback) {
  17553. return new NullChannel();
  17554. }
  17555. /**
  17556. * Get a channel instance by name.
  17557. */
  17558. }, {
  17559. key: 'channel',
  17560. value: function channel(name) {
  17561. return new NullChannel();
  17562. }
  17563. /**
  17564. * Get a private channel instance by name.
  17565. */
  17566. }, {
  17567. key: 'privateChannel',
  17568. value: function privateChannel(name) {
  17569. return new NullPrivateChannel();
  17570. }
  17571. /**
  17572. * Get a presence channel instance by name.
  17573. */
  17574. }, {
  17575. key: 'presenceChannel',
  17576. value: function presenceChannel(name) {
  17577. return new NullPresenceChannel();
  17578. }
  17579. /**
  17580. * Leave the given channel, as well as its private and presence variants.
  17581. */
  17582. }, {
  17583. key: 'leave',
  17584. value: function leave(name) {}
  17585. //
  17586. /**
  17587. * Leave the given channel.
  17588. */
  17589. }, {
  17590. key: 'leaveChannel',
  17591. value: function leaveChannel(name) {}
  17592. //
  17593. /**
  17594. * Get the socket ID for the connection.
  17595. */
  17596. }, {
  17597. key: 'socketId',
  17598. value: function socketId() {
  17599. return 'fake-socket-id';
  17600. }
  17601. /**
  17602. * Disconnect the connection.
  17603. */
  17604. }, {
  17605. key: 'disconnect',
  17606. value: function disconnect() {
  17607. //
  17608. }
  17609. }]);
  17610. return NullConnector;
  17611. }(Connector);
  17612. /**
  17613. * This class is the primary API for interacting with broadcasting.
  17614. */
  17615. var Echo = function () {
  17616. /**
  17617. * Create a new class instance.
  17618. */
  17619. function Echo(options) {
  17620. classCallCheck(this, Echo);
  17621. this.options = options;
  17622. this.connect();
  17623. if (!this.options.withoutInterceptors) {
  17624. this.registerInterceptors();
  17625. }
  17626. }
  17627. /**
  17628. * Get a channel instance by name.
  17629. */
  17630. createClass(Echo, [{
  17631. key: 'channel',
  17632. value: function channel(_channel) {
  17633. return this.connector.channel(_channel);
  17634. }
  17635. /**
  17636. * Create a new connection.
  17637. */
  17638. }, {
  17639. key: 'connect',
  17640. value: function connect() {
  17641. if (this.options.broadcaster == 'pusher') {
  17642. this.connector = new PusherConnector(this.options);
  17643. } else if (this.options.broadcaster == 'socket.io') {
  17644. this.connector = new SocketIoConnector(this.options);
  17645. } else if (this.options.broadcaster == 'null') {
  17646. this.connector = new NullConnector(this.options);
  17647. } else if (typeof this.options.broadcaster == 'function') {
  17648. this.connector = new this.options.broadcaster(this.options);
  17649. }
  17650. }
  17651. /**
  17652. * Disconnect from the Echo server.
  17653. */
  17654. }, {
  17655. key: 'disconnect',
  17656. value: function disconnect() {
  17657. this.connector.disconnect();
  17658. }
  17659. /**
  17660. * Get a presence channel instance by name.
  17661. */
  17662. }, {
  17663. key: 'join',
  17664. value: function join(channel) {
  17665. return this.connector.presenceChannel(channel);
  17666. }
  17667. /**
  17668. * Leave the given channel, as well as its private and presence variants.
  17669. */
  17670. }, {
  17671. key: 'leave',
  17672. value: function leave(channel) {
  17673. this.connector.leave(channel);
  17674. }
  17675. /**
  17676. * Leave the given channel.
  17677. */
  17678. }, {
  17679. key: 'leaveChannel',
  17680. value: function leaveChannel(channel) {
  17681. this.connector.leaveChannel(channel);
  17682. }
  17683. /**
  17684. * Listen for an event on a channel instance.
  17685. */
  17686. }, {
  17687. key: 'listen',
  17688. value: function listen(channel, event, callback) {
  17689. return this.connector.listen(channel, event, callback);
  17690. }
  17691. /**
  17692. * Get a private channel instance by name.
  17693. */
  17694. }, {
  17695. key: 'private',
  17696. value: function _private(channel) {
  17697. return this.connector.privateChannel(channel);
  17698. }
  17699. /**
  17700. * Get the Socket ID for the connection.
  17701. */
  17702. }, {
  17703. key: 'socketId',
  17704. value: function socketId() {
  17705. return this.connector.socketId();
  17706. }
  17707. /**
  17708. * Register 3rd party request interceptiors. These are used to automatically
  17709. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17710. */
  17711. }, {
  17712. key: 'registerInterceptors',
  17713. value: function registerInterceptors() {
  17714. if (typeof Vue === 'function' && Vue.http) {
  17715. this.registerVueRequestInterceptor();
  17716. }
  17717. if (typeof axios === 'function') {
  17718. this.registerAxiosRequestInterceptor();
  17719. }
  17720. if (typeof jQuery === 'function') {
  17721. this.registerjQueryAjaxSetup();
  17722. }
  17723. }
  17724. /**
  17725. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17726. */
  17727. }, {
  17728. key: 'registerVueRequestInterceptor',
  17729. value: function registerVueRequestInterceptor() {
  17730. var _this = this;
  17731. Vue.http.interceptors.push(function (request, next) {
  17732. if (_this.socketId()) {
  17733. request.headers.set('X-Socket-ID', _this.socketId());
  17734. }
  17735. next();
  17736. });
  17737. }
  17738. /**
  17739. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17740. */
  17741. }, {
  17742. key: 'registerAxiosRequestInterceptor',
  17743. value: function registerAxiosRequestInterceptor() {
  17744. var _this2 = this;
  17745. axios.interceptors.request.use(function (config) {
  17746. if (_this2.socketId()) {
  17747. config.headers['X-Socket-Id'] = _this2.socketId();
  17748. }
  17749. return config;
  17750. });
  17751. }
  17752. /**
  17753. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17754. */
  17755. }, {
  17756. key: 'registerjQueryAjaxSetup',
  17757. value: function registerjQueryAjaxSetup() {
  17758. var _this3 = this;
  17759. if (typeof jQuery.ajax != 'undefined') {
  17760. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17761. if (_this3.socketId()) {
  17762. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17763. }
  17764. });
  17765. }
  17766. }
  17767. }]);
  17768. return Echo;
  17769. }();
  17770. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17771. /***/ }),
  17772. /***/ "./node_modules/lodash/lodash.js":
  17773. /*!***************************************!*\
  17774. !*** ./node_modules/lodash/lodash.js ***!
  17775. \***************************************/
  17776. /*! no static exports found */
  17777. /***/ (function(module, exports, __webpack_require__) {
  17778. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17779. * @license
  17780. * Lodash <https://lodash.com/>
  17781. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17782. * Released under MIT license <https://lodash.com/license>
  17783. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17784. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17785. */
  17786. ;(function() {
  17787. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17788. var undefined;
  17789. /** Used as the semantic version number. */
  17790. var VERSION = '4.17.15';
  17791. /** Used as the size to enable large array optimizations. */
  17792. var LARGE_ARRAY_SIZE = 200;
  17793. /** Error message constants. */
  17794. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17795. FUNC_ERROR_TEXT = 'Expected a function';
  17796. /** Used to stand-in for `undefined` hash values. */
  17797. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17798. /** Used as the maximum memoize cache size. */
  17799. var MAX_MEMOIZE_SIZE = 500;
  17800. /** Used as the internal argument placeholder. */
  17801. var PLACEHOLDER = '__lodash_placeholder__';
  17802. /** Used to compose bitmasks for cloning. */
  17803. var CLONE_DEEP_FLAG = 1,
  17804. CLONE_FLAT_FLAG = 2,
  17805. CLONE_SYMBOLS_FLAG = 4;
  17806. /** Used to compose bitmasks for value comparisons. */
  17807. var COMPARE_PARTIAL_FLAG = 1,
  17808. COMPARE_UNORDERED_FLAG = 2;
  17809. /** Used to compose bitmasks for function metadata. */
  17810. var WRAP_BIND_FLAG = 1,
  17811. WRAP_BIND_KEY_FLAG = 2,
  17812. WRAP_CURRY_BOUND_FLAG = 4,
  17813. WRAP_CURRY_FLAG = 8,
  17814. WRAP_CURRY_RIGHT_FLAG = 16,
  17815. WRAP_PARTIAL_FLAG = 32,
  17816. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17817. WRAP_ARY_FLAG = 128,
  17818. WRAP_REARG_FLAG = 256,
  17819. WRAP_FLIP_FLAG = 512;
  17820. /** Used as default options for `_.truncate`. */
  17821. var DEFAULT_TRUNC_LENGTH = 30,
  17822. DEFAULT_TRUNC_OMISSION = '...';
  17823. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17824. var HOT_COUNT = 800,
  17825. HOT_SPAN = 16;
  17826. /** Used to indicate the type of lazy iteratees. */
  17827. var LAZY_FILTER_FLAG = 1,
  17828. LAZY_MAP_FLAG = 2,
  17829. LAZY_WHILE_FLAG = 3;
  17830. /** Used as references for various `Number` constants. */
  17831. var INFINITY = 1 / 0,
  17832. MAX_SAFE_INTEGER = 9007199254740991,
  17833. MAX_INTEGER = 1.7976931348623157e+308,
  17834. NAN = 0 / 0;
  17835. /** Used as references for the maximum length and index of an array. */
  17836. var MAX_ARRAY_LENGTH = 4294967295,
  17837. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17838. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17839. /** Used to associate wrap methods with their bit flags. */
  17840. var wrapFlags = [
  17841. ['ary', WRAP_ARY_FLAG],
  17842. ['bind', WRAP_BIND_FLAG],
  17843. ['bindKey', WRAP_BIND_KEY_FLAG],
  17844. ['curry', WRAP_CURRY_FLAG],
  17845. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17846. ['flip', WRAP_FLIP_FLAG],
  17847. ['partial', WRAP_PARTIAL_FLAG],
  17848. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17849. ['rearg', WRAP_REARG_FLAG]
  17850. ];
  17851. /** `Object#toString` result references. */
  17852. var argsTag = '[object Arguments]',
  17853. arrayTag = '[object Array]',
  17854. asyncTag = '[object AsyncFunction]',
  17855. boolTag = '[object Boolean]',
  17856. dateTag = '[object Date]',
  17857. domExcTag = '[object DOMException]',
  17858. errorTag = '[object Error]',
  17859. funcTag = '[object Function]',
  17860. genTag = '[object GeneratorFunction]',
  17861. mapTag = '[object Map]',
  17862. numberTag = '[object Number]',
  17863. nullTag = '[object Null]',
  17864. objectTag = '[object Object]',
  17865. promiseTag = '[object Promise]',
  17866. proxyTag = '[object Proxy]',
  17867. regexpTag = '[object RegExp]',
  17868. setTag = '[object Set]',
  17869. stringTag = '[object String]',
  17870. symbolTag = '[object Symbol]',
  17871. undefinedTag = '[object Undefined]',
  17872. weakMapTag = '[object WeakMap]',
  17873. weakSetTag = '[object WeakSet]';
  17874. var arrayBufferTag = '[object ArrayBuffer]',
  17875. dataViewTag = '[object DataView]',
  17876. float32Tag = '[object Float32Array]',
  17877. float64Tag = '[object Float64Array]',
  17878. int8Tag = '[object Int8Array]',
  17879. int16Tag = '[object Int16Array]',
  17880. int32Tag = '[object Int32Array]',
  17881. uint8Tag = '[object Uint8Array]',
  17882. uint8ClampedTag = '[object Uint8ClampedArray]',
  17883. uint16Tag = '[object Uint16Array]',
  17884. uint32Tag = '[object Uint32Array]';
  17885. /** Used to match empty string literals in compiled template source. */
  17886. var reEmptyStringLeading = /\b__p \+= '';/g,
  17887. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  17888. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  17889. /** Used to match HTML entities and HTML characters. */
  17890. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  17891. reUnescapedHtml = /[&<>"']/g,
  17892. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  17893. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  17894. /** Used to match template delimiters. */
  17895. var reEscape = /<%-([\s\S]+?)%>/g,
  17896. reEvaluate = /<%([\s\S]+?)%>/g,
  17897. reInterpolate = /<%=([\s\S]+?)%>/g;
  17898. /** Used to match property names within property paths. */
  17899. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  17900. reIsPlainProp = /^\w*$/,
  17901. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  17902. /**
  17903. * Used to match `RegExp`
  17904. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  17905. */
  17906. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  17907. reHasRegExpChar = RegExp(reRegExpChar.source);
  17908. /** Used to match leading and trailing whitespace. */
  17909. var reTrim = /^\s+|\s+$/g,
  17910. reTrimStart = /^\s+/,
  17911. reTrimEnd = /\s+$/;
  17912. /** Used to match wrap detail comments. */
  17913. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  17914. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  17915. reSplitDetails = /,? & /;
  17916. /** Used to match words composed of alphanumeric characters. */
  17917. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  17918. /** Used to match backslashes in property paths. */
  17919. var reEscapeChar = /\\(\\)?/g;
  17920. /**
  17921. * Used to match
  17922. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  17923. */
  17924. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  17925. /** Used to match `RegExp` flags from their coerced string values. */
  17926. var reFlags = /\w*$/;
  17927. /** Used to detect bad signed hexadecimal string values. */
  17928. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  17929. /** Used to detect binary string values. */
  17930. var reIsBinary = /^0b[01]+$/i;
  17931. /** Used to detect host constructors (Safari). */
  17932. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  17933. /** Used to detect octal string values. */
  17934. var reIsOctal = /^0o[0-7]+$/i;
  17935. /** Used to detect unsigned integer values. */
  17936. var reIsUint = /^(?:0|[1-9]\d*)$/;
  17937. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  17938. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  17939. /** Used to ensure capturing order of template delimiters. */
  17940. var reNoMatch = /($^)/;
  17941. /** Used to match unescaped characters in compiled string literals. */
  17942. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  17943. /** Used to compose unicode character classes. */
  17944. var rsAstralRange = '\\ud800-\\udfff',
  17945. rsComboMarksRange = '\\u0300-\\u036f',
  17946. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  17947. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  17948. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  17949. rsDingbatRange = '\\u2700-\\u27bf',
  17950. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  17951. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  17952. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  17953. rsPunctuationRange = '\\u2000-\\u206f',
  17954. 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',
  17955. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  17956. rsVarRange = '\\ufe0e\\ufe0f',
  17957. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  17958. /** Used to compose unicode capture groups. */
  17959. var rsApos = "['\u2019]",
  17960. rsAstral = '[' + rsAstralRange + ']',
  17961. rsBreak = '[' + rsBreakRange + ']',
  17962. rsCombo = '[' + rsComboRange + ']',
  17963. rsDigits = '\\d+',
  17964. rsDingbat = '[' + rsDingbatRange + ']',
  17965. rsLower = '[' + rsLowerRange + ']',
  17966. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  17967. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  17968. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  17969. rsNonAstral = '[^' + rsAstralRange + ']',
  17970. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  17971. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  17972. rsUpper = '[' + rsUpperRange + ']',
  17973. rsZWJ = '\\u200d';
  17974. /** Used to compose unicode regexes. */
  17975. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  17976. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  17977. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  17978. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  17979. reOptMod = rsModifier + '?',
  17980. rsOptVar = '[' + rsVarRange + ']?',
  17981. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  17982. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  17983. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  17984. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  17985. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  17986. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  17987. /** Used to match apostrophes. */
  17988. var reApos = RegExp(rsApos, 'g');
  17989. /**
  17990. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  17991. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  17992. */
  17993. var reComboMark = RegExp(rsCombo, 'g');
  17994. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  17995. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  17996. /** Used to match complex or compound words. */
  17997. var reUnicodeWord = RegExp([
  17998. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  17999. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18000. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18001. rsUpper + '+' + rsOptContrUpper,
  18002. rsOrdUpper,
  18003. rsOrdLower,
  18004. rsDigits,
  18005. rsEmoji
  18006. ].join('|'), 'g');
  18007. /** 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/). */
  18008. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18009. /** Used to detect strings that need a more robust regexp to match words. */
  18010. 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 ]/;
  18011. /** Used to assign default `context` object properties. */
  18012. var contextProps = [
  18013. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18014. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18015. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18016. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18017. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18018. ];
  18019. /** Used to make template sourceURLs easier to identify. */
  18020. var templateCounter = -1;
  18021. /** Used to identify `toStringTag` values of typed arrays. */
  18022. var typedArrayTags = {};
  18023. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18024. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18025. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18026. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18027. typedArrayTags[uint32Tag] = true;
  18028. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18029. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18030. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18031. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18032. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18033. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18034. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18035. typedArrayTags[weakMapTag] = false;
  18036. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18037. var cloneableTags = {};
  18038. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18039. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18040. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18041. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18042. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18043. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18044. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18045. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18046. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18047. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18048. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18049. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18050. cloneableTags[weakMapTag] = false;
  18051. /** Used to map Latin Unicode letters to basic Latin letters. */
  18052. var deburredLetters = {
  18053. // Latin-1 Supplement block.
  18054. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18055. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18056. '\xc7': 'C', '\xe7': 'c',
  18057. '\xd0': 'D', '\xf0': 'd',
  18058. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18059. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18060. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18061. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18062. '\xd1': 'N', '\xf1': 'n',
  18063. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18064. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18065. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18066. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18067. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18068. '\xc6': 'Ae', '\xe6': 'ae',
  18069. '\xde': 'Th', '\xfe': 'th',
  18070. '\xdf': 'ss',
  18071. // Latin Extended-A block.
  18072. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18073. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18074. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18075. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18076. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18077. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18078. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18079. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18080. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18081. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18082. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18083. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18084. '\u0134': 'J', '\u0135': 'j',
  18085. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18086. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18087. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18088. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18089. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18090. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18091. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18092. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18093. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18094. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18095. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18096. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18097. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18098. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18099. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18100. '\u0174': 'W', '\u0175': 'w',
  18101. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18102. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18103. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18104. '\u0132': 'IJ', '\u0133': 'ij',
  18105. '\u0152': 'Oe', '\u0153': 'oe',
  18106. '\u0149': "'n", '\u017f': 's'
  18107. };
  18108. /** Used to map characters to HTML entities. */
  18109. var htmlEscapes = {
  18110. '&': '&amp;',
  18111. '<': '&lt;',
  18112. '>': '&gt;',
  18113. '"': '&quot;',
  18114. "'": '&#39;'
  18115. };
  18116. /** Used to map HTML entities to characters. */
  18117. var htmlUnescapes = {
  18118. '&amp;': '&',
  18119. '&lt;': '<',
  18120. '&gt;': '>',
  18121. '&quot;': '"',
  18122. '&#39;': "'"
  18123. };
  18124. /** Used to escape characters for inclusion in compiled string literals. */
  18125. var stringEscapes = {
  18126. '\\': '\\',
  18127. "'": "'",
  18128. '\n': 'n',
  18129. '\r': 'r',
  18130. '\u2028': 'u2028',
  18131. '\u2029': 'u2029'
  18132. };
  18133. /** Built-in method references without a dependency on `root`. */
  18134. var freeParseFloat = parseFloat,
  18135. freeParseInt = parseInt;
  18136. /** Detect free variable `global` from Node.js. */
  18137. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18138. /** Detect free variable `self`. */
  18139. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18140. /** Used as a reference to the global object. */
  18141. var root = freeGlobal || freeSelf || Function('return this')();
  18142. /** Detect free variable `exports`. */
  18143. var freeExports = true && exports && !exports.nodeType && exports;
  18144. /** Detect free variable `module`. */
  18145. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18146. /** Detect the popular CommonJS extension `module.exports`. */
  18147. var moduleExports = freeModule && freeModule.exports === freeExports;
  18148. /** Detect free variable `process` from Node.js. */
  18149. var freeProcess = moduleExports && freeGlobal.process;
  18150. /** Used to access faster Node.js helpers. */
  18151. var nodeUtil = (function() {
  18152. try {
  18153. // Use `util.types` for Node.js 10+.
  18154. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18155. if (types) {
  18156. return types;
  18157. }
  18158. // Legacy `process.binding('util')` for Node.js < 10.
  18159. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18160. } catch (e) {}
  18161. }());
  18162. /* Node.js helper references. */
  18163. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18164. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18165. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18166. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18167. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18168. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18169. /*--------------------------------------------------------------------------*/
  18170. /**
  18171. * A faster alternative to `Function#apply`, this function invokes `func`
  18172. * with the `this` binding of `thisArg` and the arguments of `args`.
  18173. *
  18174. * @private
  18175. * @param {Function} func The function to invoke.
  18176. * @param {*} thisArg The `this` binding of `func`.
  18177. * @param {Array} args The arguments to invoke `func` with.
  18178. * @returns {*} Returns the result of `func`.
  18179. */
  18180. function apply(func, thisArg, args) {
  18181. switch (args.length) {
  18182. case 0: return func.call(thisArg);
  18183. case 1: return func.call(thisArg, args[0]);
  18184. case 2: return func.call(thisArg, args[0], args[1]);
  18185. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18186. }
  18187. return func.apply(thisArg, args);
  18188. }
  18189. /**
  18190. * A specialized version of `baseAggregator` for arrays.
  18191. *
  18192. * @private
  18193. * @param {Array} [array] The array to iterate over.
  18194. * @param {Function} setter The function to set `accumulator` values.
  18195. * @param {Function} iteratee The iteratee to transform keys.
  18196. * @param {Object} accumulator The initial aggregated object.
  18197. * @returns {Function} Returns `accumulator`.
  18198. */
  18199. function arrayAggregator(array, setter, iteratee, accumulator) {
  18200. var index = -1,
  18201. length = array == null ? 0 : array.length;
  18202. while (++index < length) {
  18203. var value = array[index];
  18204. setter(accumulator, value, iteratee(value), array);
  18205. }
  18206. return accumulator;
  18207. }
  18208. /**
  18209. * A specialized version of `_.forEach` for arrays without support for
  18210. * iteratee shorthands.
  18211. *
  18212. * @private
  18213. * @param {Array} [array] The array to iterate over.
  18214. * @param {Function} iteratee The function invoked per iteration.
  18215. * @returns {Array} Returns `array`.
  18216. */
  18217. function arrayEach(array, iteratee) {
  18218. var index = -1,
  18219. length = array == null ? 0 : array.length;
  18220. while (++index < length) {
  18221. if (iteratee(array[index], index, array) === false) {
  18222. break;
  18223. }
  18224. }
  18225. return array;
  18226. }
  18227. /**
  18228. * A specialized version of `_.forEachRight` for arrays without support for
  18229. * iteratee shorthands.
  18230. *
  18231. * @private
  18232. * @param {Array} [array] The array to iterate over.
  18233. * @param {Function} iteratee The function invoked per iteration.
  18234. * @returns {Array} Returns `array`.
  18235. */
  18236. function arrayEachRight(array, iteratee) {
  18237. var length = array == null ? 0 : array.length;
  18238. while (length--) {
  18239. if (iteratee(array[length], length, array) === false) {
  18240. break;
  18241. }
  18242. }
  18243. return array;
  18244. }
  18245. /**
  18246. * A specialized version of `_.every` for arrays without support for
  18247. * iteratee shorthands.
  18248. *
  18249. * @private
  18250. * @param {Array} [array] The array to iterate over.
  18251. * @param {Function} predicate The function invoked per iteration.
  18252. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18253. * else `false`.
  18254. */
  18255. function arrayEvery(array, predicate) {
  18256. var index = -1,
  18257. length = array == null ? 0 : array.length;
  18258. while (++index < length) {
  18259. if (!predicate(array[index], index, array)) {
  18260. return false;
  18261. }
  18262. }
  18263. return true;
  18264. }
  18265. /**
  18266. * A specialized version of `_.filter` for arrays without support for
  18267. * iteratee shorthands.
  18268. *
  18269. * @private
  18270. * @param {Array} [array] The array to iterate over.
  18271. * @param {Function} predicate The function invoked per iteration.
  18272. * @returns {Array} Returns the new filtered array.
  18273. */
  18274. function arrayFilter(array, predicate) {
  18275. var index = -1,
  18276. length = array == null ? 0 : array.length,
  18277. resIndex = 0,
  18278. result = [];
  18279. while (++index < length) {
  18280. var value = array[index];
  18281. if (predicate(value, index, array)) {
  18282. result[resIndex++] = value;
  18283. }
  18284. }
  18285. return result;
  18286. }
  18287. /**
  18288. * A specialized version of `_.includes` for arrays without support for
  18289. * specifying an index to search from.
  18290. *
  18291. * @private
  18292. * @param {Array} [array] The array to inspect.
  18293. * @param {*} target The value to search for.
  18294. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18295. */
  18296. function arrayIncludes(array, value) {
  18297. var length = array == null ? 0 : array.length;
  18298. return !!length && baseIndexOf(array, value, 0) > -1;
  18299. }
  18300. /**
  18301. * This function is like `arrayIncludes` except that it accepts a comparator.
  18302. *
  18303. * @private
  18304. * @param {Array} [array] The array to inspect.
  18305. * @param {*} target The value to search for.
  18306. * @param {Function} comparator The comparator invoked per element.
  18307. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18308. */
  18309. function arrayIncludesWith(array, value, comparator) {
  18310. var index = -1,
  18311. length = array == null ? 0 : array.length;
  18312. while (++index < length) {
  18313. if (comparator(value, array[index])) {
  18314. return true;
  18315. }
  18316. }
  18317. return false;
  18318. }
  18319. /**
  18320. * A specialized version of `_.map` for arrays without support for iteratee
  18321. * shorthands.
  18322. *
  18323. * @private
  18324. * @param {Array} [array] The array to iterate over.
  18325. * @param {Function} iteratee The function invoked per iteration.
  18326. * @returns {Array} Returns the new mapped array.
  18327. */
  18328. function arrayMap(array, iteratee) {
  18329. var index = -1,
  18330. length = array == null ? 0 : array.length,
  18331. result = Array(length);
  18332. while (++index < length) {
  18333. result[index] = iteratee(array[index], index, array);
  18334. }
  18335. return result;
  18336. }
  18337. /**
  18338. * Appends the elements of `values` to `array`.
  18339. *
  18340. * @private
  18341. * @param {Array} array The array to modify.
  18342. * @param {Array} values The values to append.
  18343. * @returns {Array} Returns `array`.
  18344. */
  18345. function arrayPush(array, values) {
  18346. var index = -1,
  18347. length = values.length,
  18348. offset = array.length;
  18349. while (++index < length) {
  18350. array[offset + index] = values[index];
  18351. }
  18352. return array;
  18353. }
  18354. /**
  18355. * A specialized version of `_.reduce` for arrays without support for
  18356. * iteratee shorthands.
  18357. *
  18358. * @private
  18359. * @param {Array} [array] The array to iterate over.
  18360. * @param {Function} iteratee The function invoked per iteration.
  18361. * @param {*} [accumulator] The initial value.
  18362. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18363. * the initial value.
  18364. * @returns {*} Returns the accumulated value.
  18365. */
  18366. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18367. var index = -1,
  18368. length = array == null ? 0 : array.length;
  18369. if (initAccum && length) {
  18370. accumulator = array[++index];
  18371. }
  18372. while (++index < length) {
  18373. accumulator = iteratee(accumulator, array[index], index, array);
  18374. }
  18375. return accumulator;
  18376. }
  18377. /**
  18378. * A specialized version of `_.reduceRight` for arrays without support for
  18379. * iteratee shorthands.
  18380. *
  18381. * @private
  18382. * @param {Array} [array] The array to iterate over.
  18383. * @param {Function} iteratee The function invoked per iteration.
  18384. * @param {*} [accumulator] The initial value.
  18385. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18386. * the initial value.
  18387. * @returns {*} Returns the accumulated value.
  18388. */
  18389. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18390. var length = array == null ? 0 : array.length;
  18391. if (initAccum && length) {
  18392. accumulator = array[--length];
  18393. }
  18394. while (length--) {
  18395. accumulator = iteratee(accumulator, array[length], length, array);
  18396. }
  18397. return accumulator;
  18398. }
  18399. /**
  18400. * A specialized version of `_.some` for arrays without support for iteratee
  18401. * shorthands.
  18402. *
  18403. * @private
  18404. * @param {Array} [array] The array to iterate over.
  18405. * @param {Function} predicate The function invoked per iteration.
  18406. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18407. * else `false`.
  18408. */
  18409. function arraySome(array, predicate) {
  18410. var index = -1,
  18411. length = array == null ? 0 : array.length;
  18412. while (++index < length) {
  18413. if (predicate(array[index], index, array)) {
  18414. return true;
  18415. }
  18416. }
  18417. return false;
  18418. }
  18419. /**
  18420. * Gets the size of an ASCII `string`.
  18421. *
  18422. * @private
  18423. * @param {string} string The string inspect.
  18424. * @returns {number} Returns the string size.
  18425. */
  18426. var asciiSize = baseProperty('length');
  18427. /**
  18428. * Converts an ASCII `string` to an array.
  18429. *
  18430. * @private
  18431. * @param {string} string The string to convert.
  18432. * @returns {Array} Returns the converted array.
  18433. */
  18434. function asciiToArray(string) {
  18435. return string.split('');
  18436. }
  18437. /**
  18438. * Splits an ASCII `string` into an array of its words.
  18439. *
  18440. * @private
  18441. * @param {string} The string to inspect.
  18442. * @returns {Array} Returns the words of `string`.
  18443. */
  18444. function asciiWords(string) {
  18445. return string.match(reAsciiWord) || [];
  18446. }
  18447. /**
  18448. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18449. * without support for iteratee shorthands, which iterates over `collection`
  18450. * using `eachFunc`.
  18451. *
  18452. * @private
  18453. * @param {Array|Object} collection The collection to inspect.
  18454. * @param {Function} predicate The function invoked per iteration.
  18455. * @param {Function} eachFunc The function to iterate over `collection`.
  18456. * @returns {*} Returns the found element or its key, else `undefined`.
  18457. */
  18458. function baseFindKey(collection, predicate, eachFunc) {
  18459. var result;
  18460. eachFunc(collection, function(value, key, collection) {
  18461. if (predicate(value, key, collection)) {
  18462. result = key;
  18463. return false;
  18464. }
  18465. });
  18466. return result;
  18467. }
  18468. /**
  18469. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18470. * support for iteratee shorthands.
  18471. *
  18472. * @private
  18473. * @param {Array} array The array to inspect.
  18474. * @param {Function} predicate The function invoked per iteration.
  18475. * @param {number} fromIndex The index to search from.
  18476. * @param {boolean} [fromRight] Specify iterating from right to left.
  18477. * @returns {number} Returns the index of the matched value, else `-1`.
  18478. */
  18479. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18480. var length = array.length,
  18481. index = fromIndex + (fromRight ? 1 : -1);
  18482. while ((fromRight ? index-- : ++index < length)) {
  18483. if (predicate(array[index], index, array)) {
  18484. return index;
  18485. }
  18486. }
  18487. return -1;
  18488. }
  18489. /**
  18490. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18491. *
  18492. * @private
  18493. * @param {Array} array The array to inspect.
  18494. * @param {*} value The value to search for.
  18495. * @param {number} fromIndex The index to search from.
  18496. * @returns {number} Returns the index of the matched value, else `-1`.
  18497. */
  18498. function baseIndexOf(array, value, fromIndex) {
  18499. return value === value
  18500. ? strictIndexOf(array, value, fromIndex)
  18501. : baseFindIndex(array, baseIsNaN, fromIndex);
  18502. }
  18503. /**
  18504. * This function is like `baseIndexOf` except that it accepts a comparator.
  18505. *
  18506. * @private
  18507. * @param {Array} array The array to inspect.
  18508. * @param {*} value The value to search for.
  18509. * @param {number} fromIndex The index to search from.
  18510. * @param {Function} comparator The comparator invoked per element.
  18511. * @returns {number} Returns the index of the matched value, else `-1`.
  18512. */
  18513. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18514. var index = fromIndex - 1,
  18515. length = array.length;
  18516. while (++index < length) {
  18517. if (comparator(array[index], value)) {
  18518. return index;
  18519. }
  18520. }
  18521. return -1;
  18522. }
  18523. /**
  18524. * The base implementation of `_.isNaN` without support for number objects.
  18525. *
  18526. * @private
  18527. * @param {*} value The value to check.
  18528. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18529. */
  18530. function baseIsNaN(value) {
  18531. return value !== value;
  18532. }
  18533. /**
  18534. * The base implementation of `_.mean` and `_.meanBy` without support for
  18535. * iteratee shorthands.
  18536. *
  18537. * @private
  18538. * @param {Array} array The array to iterate over.
  18539. * @param {Function} iteratee The function invoked per iteration.
  18540. * @returns {number} Returns the mean.
  18541. */
  18542. function baseMean(array, iteratee) {
  18543. var length = array == null ? 0 : array.length;
  18544. return length ? (baseSum(array, iteratee) / length) : NAN;
  18545. }
  18546. /**
  18547. * The base implementation of `_.property` without support for deep paths.
  18548. *
  18549. * @private
  18550. * @param {string} key The key of the property to get.
  18551. * @returns {Function} Returns the new accessor function.
  18552. */
  18553. function baseProperty(key) {
  18554. return function(object) {
  18555. return object == null ? undefined : object[key];
  18556. };
  18557. }
  18558. /**
  18559. * The base implementation of `_.propertyOf` without support for deep paths.
  18560. *
  18561. * @private
  18562. * @param {Object} object The object to query.
  18563. * @returns {Function} Returns the new accessor function.
  18564. */
  18565. function basePropertyOf(object) {
  18566. return function(key) {
  18567. return object == null ? undefined : object[key];
  18568. };
  18569. }
  18570. /**
  18571. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18572. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18573. *
  18574. * @private
  18575. * @param {Array|Object} collection The collection to iterate over.
  18576. * @param {Function} iteratee The function invoked per iteration.
  18577. * @param {*} accumulator The initial value.
  18578. * @param {boolean} initAccum Specify using the first or last element of
  18579. * `collection` as the initial value.
  18580. * @param {Function} eachFunc The function to iterate over `collection`.
  18581. * @returns {*} Returns the accumulated value.
  18582. */
  18583. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18584. eachFunc(collection, function(value, index, collection) {
  18585. accumulator = initAccum
  18586. ? (initAccum = false, value)
  18587. : iteratee(accumulator, value, index, collection);
  18588. });
  18589. return accumulator;
  18590. }
  18591. /**
  18592. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18593. * sort order of `array` and replaces criteria objects with their corresponding
  18594. * values.
  18595. *
  18596. * @private
  18597. * @param {Array} array The array to sort.
  18598. * @param {Function} comparer The function to define sort order.
  18599. * @returns {Array} Returns `array`.
  18600. */
  18601. function baseSortBy(array, comparer) {
  18602. var length = array.length;
  18603. array.sort(comparer);
  18604. while (length--) {
  18605. array[length] = array[length].value;
  18606. }
  18607. return array;
  18608. }
  18609. /**
  18610. * The base implementation of `_.sum` and `_.sumBy` without support for
  18611. * iteratee shorthands.
  18612. *
  18613. * @private
  18614. * @param {Array} array The array to iterate over.
  18615. * @param {Function} iteratee The function invoked per iteration.
  18616. * @returns {number} Returns the sum.
  18617. */
  18618. function baseSum(array, iteratee) {
  18619. var result,
  18620. index = -1,
  18621. length = array.length;
  18622. while (++index < length) {
  18623. var current = iteratee(array[index]);
  18624. if (current !== undefined) {
  18625. result = result === undefined ? current : (result + current);
  18626. }
  18627. }
  18628. return result;
  18629. }
  18630. /**
  18631. * The base implementation of `_.times` without support for iteratee shorthands
  18632. * or max array length checks.
  18633. *
  18634. * @private
  18635. * @param {number} n The number of times to invoke `iteratee`.
  18636. * @param {Function} iteratee The function invoked per iteration.
  18637. * @returns {Array} Returns the array of results.
  18638. */
  18639. function baseTimes(n, iteratee) {
  18640. var index = -1,
  18641. result = Array(n);
  18642. while (++index < n) {
  18643. result[index] = iteratee(index);
  18644. }
  18645. return result;
  18646. }
  18647. /**
  18648. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18649. * of key-value pairs for `object` corresponding to the property names of `props`.
  18650. *
  18651. * @private
  18652. * @param {Object} object The object to query.
  18653. * @param {Array} props The property names to get values for.
  18654. * @returns {Object} Returns the key-value pairs.
  18655. */
  18656. function baseToPairs(object, props) {
  18657. return arrayMap(props, function(key) {
  18658. return [key, object[key]];
  18659. });
  18660. }
  18661. /**
  18662. * The base implementation of `_.unary` without support for storing metadata.
  18663. *
  18664. * @private
  18665. * @param {Function} func The function to cap arguments for.
  18666. * @returns {Function} Returns the new capped function.
  18667. */
  18668. function baseUnary(func) {
  18669. return function(value) {
  18670. return func(value);
  18671. };
  18672. }
  18673. /**
  18674. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18675. * array of `object` property values corresponding to the property names
  18676. * of `props`.
  18677. *
  18678. * @private
  18679. * @param {Object} object The object to query.
  18680. * @param {Array} props The property names to get values for.
  18681. * @returns {Object} Returns the array of property values.
  18682. */
  18683. function baseValues(object, props) {
  18684. return arrayMap(props, function(key) {
  18685. return object[key];
  18686. });
  18687. }
  18688. /**
  18689. * Checks if a `cache` value for `key` exists.
  18690. *
  18691. * @private
  18692. * @param {Object} cache The cache to query.
  18693. * @param {string} key The key of the entry to check.
  18694. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18695. */
  18696. function cacheHas(cache, key) {
  18697. return cache.has(key);
  18698. }
  18699. /**
  18700. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18701. * that is not found in the character symbols.
  18702. *
  18703. * @private
  18704. * @param {Array} strSymbols The string symbols to inspect.
  18705. * @param {Array} chrSymbols The character symbols to find.
  18706. * @returns {number} Returns the index of the first unmatched string symbol.
  18707. */
  18708. function charsStartIndex(strSymbols, chrSymbols) {
  18709. var index = -1,
  18710. length = strSymbols.length;
  18711. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18712. return index;
  18713. }
  18714. /**
  18715. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18716. * that is not found in the character symbols.
  18717. *
  18718. * @private
  18719. * @param {Array} strSymbols The string symbols to inspect.
  18720. * @param {Array} chrSymbols The character symbols to find.
  18721. * @returns {number} Returns the index of the last unmatched string symbol.
  18722. */
  18723. function charsEndIndex(strSymbols, chrSymbols) {
  18724. var index = strSymbols.length;
  18725. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18726. return index;
  18727. }
  18728. /**
  18729. * Gets the number of `placeholder` occurrences in `array`.
  18730. *
  18731. * @private
  18732. * @param {Array} array The array to inspect.
  18733. * @param {*} placeholder The placeholder to search for.
  18734. * @returns {number} Returns the placeholder count.
  18735. */
  18736. function countHolders(array, placeholder) {
  18737. var length = array.length,
  18738. result = 0;
  18739. while (length--) {
  18740. if (array[length] === placeholder) {
  18741. ++result;
  18742. }
  18743. }
  18744. return result;
  18745. }
  18746. /**
  18747. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18748. * letters to basic Latin letters.
  18749. *
  18750. * @private
  18751. * @param {string} letter The matched letter to deburr.
  18752. * @returns {string} Returns the deburred letter.
  18753. */
  18754. var deburrLetter = basePropertyOf(deburredLetters);
  18755. /**
  18756. * Used by `_.escape` to convert characters to HTML entities.
  18757. *
  18758. * @private
  18759. * @param {string} chr The matched character to escape.
  18760. * @returns {string} Returns the escaped character.
  18761. */
  18762. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18763. /**
  18764. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18765. *
  18766. * @private
  18767. * @param {string} chr The matched character to escape.
  18768. * @returns {string} Returns the escaped character.
  18769. */
  18770. function escapeStringChar(chr) {
  18771. return '\\' + stringEscapes[chr];
  18772. }
  18773. /**
  18774. * Gets the value at `key` of `object`.
  18775. *
  18776. * @private
  18777. * @param {Object} [object] The object to query.
  18778. * @param {string} key The key of the property to get.
  18779. * @returns {*} Returns the property value.
  18780. */
  18781. function getValue(object, key) {
  18782. return object == null ? undefined : object[key];
  18783. }
  18784. /**
  18785. * Checks if `string` contains Unicode symbols.
  18786. *
  18787. * @private
  18788. * @param {string} string The string to inspect.
  18789. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18790. */
  18791. function hasUnicode(string) {
  18792. return reHasUnicode.test(string);
  18793. }
  18794. /**
  18795. * Checks if `string` contains a word composed of Unicode symbols.
  18796. *
  18797. * @private
  18798. * @param {string} string The string to inspect.
  18799. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18800. */
  18801. function hasUnicodeWord(string) {
  18802. return reHasUnicodeWord.test(string);
  18803. }
  18804. /**
  18805. * Converts `iterator` to an array.
  18806. *
  18807. * @private
  18808. * @param {Object} iterator The iterator to convert.
  18809. * @returns {Array} Returns the converted array.
  18810. */
  18811. function iteratorToArray(iterator) {
  18812. var data,
  18813. result = [];
  18814. while (!(data = iterator.next()).done) {
  18815. result.push(data.value);
  18816. }
  18817. return result;
  18818. }
  18819. /**
  18820. * Converts `map` to its key-value pairs.
  18821. *
  18822. * @private
  18823. * @param {Object} map The map to convert.
  18824. * @returns {Array} Returns the key-value pairs.
  18825. */
  18826. function mapToArray(map) {
  18827. var index = -1,
  18828. result = Array(map.size);
  18829. map.forEach(function(value, key) {
  18830. result[++index] = [key, value];
  18831. });
  18832. return result;
  18833. }
  18834. /**
  18835. * Creates a unary function that invokes `func` with its argument transformed.
  18836. *
  18837. * @private
  18838. * @param {Function} func The function to wrap.
  18839. * @param {Function} transform The argument transform.
  18840. * @returns {Function} Returns the new function.
  18841. */
  18842. function overArg(func, transform) {
  18843. return function(arg) {
  18844. return func(transform(arg));
  18845. };
  18846. }
  18847. /**
  18848. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18849. * and returns an array of their indexes.
  18850. *
  18851. * @private
  18852. * @param {Array} array The array to modify.
  18853. * @param {*} placeholder The placeholder to replace.
  18854. * @returns {Array} Returns the new array of placeholder indexes.
  18855. */
  18856. function replaceHolders(array, placeholder) {
  18857. var index = -1,
  18858. length = array.length,
  18859. resIndex = 0,
  18860. result = [];
  18861. while (++index < length) {
  18862. var value = array[index];
  18863. if (value === placeholder || value === PLACEHOLDER) {
  18864. array[index] = PLACEHOLDER;
  18865. result[resIndex++] = index;
  18866. }
  18867. }
  18868. return result;
  18869. }
  18870. /**
  18871. * Converts `set` to an array of its values.
  18872. *
  18873. * @private
  18874. * @param {Object} set The set to convert.
  18875. * @returns {Array} Returns the values.
  18876. */
  18877. function setToArray(set) {
  18878. var index = -1,
  18879. result = Array(set.size);
  18880. set.forEach(function(value) {
  18881. result[++index] = value;
  18882. });
  18883. return result;
  18884. }
  18885. /**
  18886. * Converts `set` to its value-value pairs.
  18887. *
  18888. * @private
  18889. * @param {Object} set The set to convert.
  18890. * @returns {Array} Returns the value-value pairs.
  18891. */
  18892. function setToPairs(set) {
  18893. var index = -1,
  18894. result = Array(set.size);
  18895. set.forEach(function(value) {
  18896. result[++index] = [value, value];
  18897. });
  18898. return result;
  18899. }
  18900. /**
  18901. * A specialized version of `_.indexOf` which performs strict equality
  18902. * comparisons of values, i.e. `===`.
  18903. *
  18904. * @private
  18905. * @param {Array} array The array to inspect.
  18906. * @param {*} value The value to search for.
  18907. * @param {number} fromIndex The index to search from.
  18908. * @returns {number} Returns the index of the matched value, else `-1`.
  18909. */
  18910. function strictIndexOf(array, value, fromIndex) {
  18911. var index = fromIndex - 1,
  18912. length = array.length;
  18913. while (++index < length) {
  18914. if (array[index] === value) {
  18915. return index;
  18916. }
  18917. }
  18918. return -1;
  18919. }
  18920. /**
  18921. * A specialized version of `_.lastIndexOf` which performs strict equality
  18922. * comparisons of values, i.e. `===`.
  18923. *
  18924. * @private
  18925. * @param {Array} array The array to inspect.
  18926. * @param {*} value The value to search for.
  18927. * @param {number} fromIndex The index to search from.
  18928. * @returns {number} Returns the index of the matched value, else `-1`.
  18929. */
  18930. function strictLastIndexOf(array, value, fromIndex) {
  18931. var index = fromIndex + 1;
  18932. while (index--) {
  18933. if (array[index] === value) {
  18934. return index;
  18935. }
  18936. }
  18937. return index;
  18938. }
  18939. /**
  18940. * Gets the number of symbols in `string`.
  18941. *
  18942. * @private
  18943. * @param {string} string The string to inspect.
  18944. * @returns {number} Returns the string size.
  18945. */
  18946. function stringSize(string) {
  18947. return hasUnicode(string)
  18948. ? unicodeSize(string)
  18949. : asciiSize(string);
  18950. }
  18951. /**
  18952. * Converts `string` to an array.
  18953. *
  18954. * @private
  18955. * @param {string} string The string to convert.
  18956. * @returns {Array} Returns the converted array.
  18957. */
  18958. function stringToArray(string) {
  18959. return hasUnicode(string)
  18960. ? unicodeToArray(string)
  18961. : asciiToArray(string);
  18962. }
  18963. /**
  18964. * Used by `_.unescape` to convert HTML entities to characters.
  18965. *
  18966. * @private
  18967. * @param {string} chr The matched character to unescape.
  18968. * @returns {string} Returns the unescaped character.
  18969. */
  18970. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  18971. /**
  18972. * Gets the size of a Unicode `string`.
  18973. *
  18974. * @private
  18975. * @param {string} string The string inspect.
  18976. * @returns {number} Returns the string size.
  18977. */
  18978. function unicodeSize(string) {
  18979. var result = reUnicode.lastIndex = 0;
  18980. while (reUnicode.test(string)) {
  18981. ++result;
  18982. }
  18983. return result;
  18984. }
  18985. /**
  18986. * Converts a Unicode `string` to an array.
  18987. *
  18988. * @private
  18989. * @param {string} string The string to convert.
  18990. * @returns {Array} Returns the converted array.
  18991. */
  18992. function unicodeToArray(string) {
  18993. return string.match(reUnicode) || [];
  18994. }
  18995. /**
  18996. * Splits a Unicode `string` into an array of its words.
  18997. *
  18998. * @private
  18999. * @param {string} The string to inspect.
  19000. * @returns {Array} Returns the words of `string`.
  19001. */
  19002. function unicodeWords(string) {
  19003. return string.match(reUnicodeWord) || [];
  19004. }
  19005. /*--------------------------------------------------------------------------*/
  19006. /**
  19007. * Create a new pristine `lodash` function using the `context` object.
  19008. *
  19009. * @static
  19010. * @memberOf _
  19011. * @since 1.1.0
  19012. * @category Util
  19013. * @param {Object} [context=root] The context object.
  19014. * @returns {Function} Returns a new `lodash` function.
  19015. * @example
  19016. *
  19017. * _.mixin({ 'foo': _.constant('foo') });
  19018. *
  19019. * var lodash = _.runInContext();
  19020. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19021. *
  19022. * _.isFunction(_.foo);
  19023. * // => true
  19024. * _.isFunction(_.bar);
  19025. * // => false
  19026. *
  19027. * lodash.isFunction(lodash.foo);
  19028. * // => false
  19029. * lodash.isFunction(lodash.bar);
  19030. * // => true
  19031. *
  19032. * // Create a suped-up `defer` in Node.js.
  19033. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19034. */
  19035. var runInContext = (function runInContext(context) {
  19036. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19037. /** Built-in constructor references. */
  19038. var Array = context.Array,
  19039. Date = context.Date,
  19040. Error = context.Error,
  19041. Function = context.Function,
  19042. Math = context.Math,
  19043. Object = context.Object,
  19044. RegExp = context.RegExp,
  19045. String = context.String,
  19046. TypeError = context.TypeError;
  19047. /** Used for built-in method references. */
  19048. var arrayProto = Array.prototype,
  19049. funcProto = Function.prototype,
  19050. objectProto = Object.prototype;
  19051. /** Used to detect overreaching core-js shims. */
  19052. var coreJsData = context['__core-js_shared__'];
  19053. /** Used to resolve the decompiled source of functions. */
  19054. var funcToString = funcProto.toString;
  19055. /** Used to check objects for own properties. */
  19056. var hasOwnProperty = objectProto.hasOwnProperty;
  19057. /** Used to generate unique IDs. */
  19058. var idCounter = 0;
  19059. /** Used to detect methods masquerading as native. */
  19060. var maskSrcKey = (function() {
  19061. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19062. return uid ? ('Symbol(src)_1.' + uid) : '';
  19063. }());
  19064. /**
  19065. * Used to resolve the
  19066. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19067. * of values.
  19068. */
  19069. var nativeObjectToString = objectProto.toString;
  19070. /** Used to infer the `Object` constructor. */
  19071. var objectCtorString = funcToString.call(Object);
  19072. /** Used to restore the original `_` reference in `_.noConflict`. */
  19073. var oldDash = root._;
  19074. /** Used to detect if a method is native. */
  19075. var reIsNative = RegExp('^' +
  19076. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19077. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19078. );
  19079. /** Built-in value references. */
  19080. var Buffer = moduleExports ? context.Buffer : undefined,
  19081. Symbol = context.Symbol,
  19082. Uint8Array = context.Uint8Array,
  19083. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19084. getPrototype = overArg(Object.getPrototypeOf, Object),
  19085. objectCreate = Object.create,
  19086. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19087. splice = arrayProto.splice,
  19088. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19089. symIterator = Symbol ? Symbol.iterator : undefined,
  19090. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19091. var defineProperty = (function() {
  19092. try {
  19093. var func = getNative(Object, 'defineProperty');
  19094. func({}, '', {});
  19095. return func;
  19096. } catch (e) {}
  19097. }());
  19098. /** Mocked built-ins. */
  19099. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19100. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19101. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19102. /* Built-in method references for those with the same name as other `lodash` methods. */
  19103. var nativeCeil = Math.ceil,
  19104. nativeFloor = Math.floor,
  19105. nativeGetSymbols = Object.getOwnPropertySymbols,
  19106. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19107. nativeIsFinite = context.isFinite,
  19108. nativeJoin = arrayProto.join,
  19109. nativeKeys = overArg(Object.keys, Object),
  19110. nativeMax = Math.max,
  19111. nativeMin = Math.min,
  19112. nativeNow = Date.now,
  19113. nativeParseInt = context.parseInt,
  19114. nativeRandom = Math.random,
  19115. nativeReverse = arrayProto.reverse;
  19116. /* Built-in method references that are verified to be native. */
  19117. var DataView = getNative(context, 'DataView'),
  19118. Map = getNative(context, 'Map'),
  19119. Promise = getNative(context, 'Promise'),
  19120. Set = getNative(context, 'Set'),
  19121. WeakMap = getNative(context, 'WeakMap'),
  19122. nativeCreate = getNative(Object, 'create');
  19123. /** Used to store function metadata. */
  19124. var metaMap = WeakMap && new WeakMap;
  19125. /** Used to lookup unminified function names. */
  19126. var realNames = {};
  19127. /** Used to detect maps, sets, and weakmaps. */
  19128. var dataViewCtorString = toSource(DataView),
  19129. mapCtorString = toSource(Map),
  19130. promiseCtorString = toSource(Promise),
  19131. setCtorString = toSource(Set),
  19132. weakMapCtorString = toSource(WeakMap);
  19133. /** Used to convert symbols to primitives and strings. */
  19134. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19135. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19136. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19137. /*------------------------------------------------------------------------*/
  19138. /**
  19139. * Creates a `lodash` object which wraps `value` to enable implicit method
  19140. * chain sequences. Methods that operate on and return arrays, collections,
  19141. * and functions can be chained together. Methods that retrieve a single value
  19142. * or may return a primitive value will automatically end the chain sequence
  19143. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19144. * with `_#value`.
  19145. *
  19146. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19147. * enabled using `_.chain`.
  19148. *
  19149. * The execution of chained methods is lazy, that is, it's deferred until
  19150. * `_#value` is implicitly or explicitly called.
  19151. *
  19152. * Lazy evaluation allows several methods to support shortcut fusion.
  19153. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19154. * the creation of intermediate arrays and can greatly reduce the number of
  19155. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19156. * fusion if the section is applied to an array and iteratees accept only
  19157. * one argument. The heuristic for whether a section qualifies for shortcut
  19158. * fusion is subject to change.
  19159. *
  19160. * Chaining is supported in custom builds as long as the `_#value` method is
  19161. * directly or indirectly included in the build.
  19162. *
  19163. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19164. *
  19165. * The wrapper `Array` methods are:
  19166. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19167. *
  19168. * The wrapper `String` methods are:
  19169. * `replace` and `split`
  19170. *
  19171. * The wrapper methods that support shortcut fusion are:
  19172. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19173. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19174. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19175. *
  19176. * The chainable wrapper methods are:
  19177. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19178. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19179. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19180. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19181. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19182. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19183. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19184. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19185. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19186. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19187. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19188. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19189. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19190. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19191. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19192. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19193. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19194. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19195. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19196. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19197. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19198. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19199. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19200. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19201. *
  19202. * The wrapper methods that are **not** chainable by default are:
  19203. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19204. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19205. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19206. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19207. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19208. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19209. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19210. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19211. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19212. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19213. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19214. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19215. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19216. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19217. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19218. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19219. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19220. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19221. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19222. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19223. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19224. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19225. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19226. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19227. * `upperFirst`, `value`, and `words`
  19228. *
  19229. * @name _
  19230. * @constructor
  19231. * @category Seq
  19232. * @param {*} value The value to wrap in a `lodash` instance.
  19233. * @returns {Object} Returns the new `lodash` wrapper instance.
  19234. * @example
  19235. *
  19236. * function square(n) {
  19237. * return n * n;
  19238. * }
  19239. *
  19240. * var wrapped = _([1, 2, 3]);
  19241. *
  19242. * // Returns an unwrapped value.
  19243. * wrapped.reduce(_.add);
  19244. * // => 6
  19245. *
  19246. * // Returns a wrapped value.
  19247. * var squares = wrapped.map(square);
  19248. *
  19249. * _.isArray(squares);
  19250. * // => false
  19251. *
  19252. * _.isArray(squares.value());
  19253. * // => true
  19254. */
  19255. function lodash(value) {
  19256. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19257. if (value instanceof LodashWrapper) {
  19258. return value;
  19259. }
  19260. if (hasOwnProperty.call(value, '__wrapped__')) {
  19261. return wrapperClone(value);
  19262. }
  19263. }
  19264. return new LodashWrapper(value);
  19265. }
  19266. /**
  19267. * The base implementation of `_.create` without support for assigning
  19268. * properties to the created object.
  19269. *
  19270. * @private
  19271. * @param {Object} proto The object to inherit from.
  19272. * @returns {Object} Returns the new object.
  19273. */
  19274. var baseCreate = (function() {
  19275. function object() {}
  19276. return function(proto) {
  19277. if (!isObject(proto)) {
  19278. return {};
  19279. }
  19280. if (objectCreate) {
  19281. return objectCreate(proto);
  19282. }
  19283. object.prototype = proto;
  19284. var result = new object;
  19285. object.prototype = undefined;
  19286. return result;
  19287. };
  19288. }());
  19289. /**
  19290. * The function whose prototype chain sequence wrappers inherit from.
  19291. *
  19292. * @private
  19293. */
  19294. function baseLodash() {
  19295. // No operation performed.
  19296. }
  19297. /**
  19298. * The base constructor for creating `lodash` wrapper objects.
  19299. *
  19300. * @private
  19301. * @param {*} value The value to wrap.
  19302. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19303. */
  19304. function LodashWrapper(value, chainAll) {
  19305. this.__wrapped__ = value;
  19306. this.__actions__ = [];
  19307. this.__chain__ = !!chainAll;
  19308. this.__index__ = 0;
  19309. this.__values__ = undefined;
  19310. }
  19311. /**
  19312. * By default, the template delimiters used by lodash are like those in
  19313. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19314. * following template settings to use alternative delimiters.
  19315. *
  19316. * @static
  19317. * @memberOf _
  19318. * @type {Object}
  19319. */
  19320. lodash.templateSettings = {
  19321. /**
  19322. * Used to detect `data` property values to be HTML-escaped.
  19323. *
  19324. * @memberOf _.templateSettings
  19325. * @type {RegExp}
  19326. */
  19327. 'escape': reEscape,
  19328. /**
  19329. * Used to detect code to be evaluated.
  19330. *
  19331. * @memberOf _.templateSettings
  19332. * @type {RegExp}
  19333. */
  19334. 'evaluate': reEvaluate,
  19335. /**
  19336. * Used to detect `data` property values to inject.
  19337. *
  19338. * @memberOf _.templateSettings
  19339. * @type {RegExp}
  19340. */
  19341. 'interpolate': reInterpolate,
  19342. /**
  19343. * Used to reference the data object in the template text.
  19344. *
  19345. * @memberOf _.templateSettings
  19346. * @type {string}
  19347. */
  19348. 'variable': '',
  19349. /**
  19350. * Used to import variables into the compiled template.
  19351. *
  19352. * @memberOf _.templateSettings
  19353. * @type {Object}
  19354. */
  19355. 'imports': {
  19356. /**
  19357. * A reference to the `lodash` function.
  19358. *
  19359. * @memberOf _.templateSettings.imports
  19360. * @type {Function}
  19361. */
  19362. '_': lodash
  19363. }
  19364. };
  19365. // Ensure wrappers are instances of `baseLodash`.
  19366. lodash.prototype = baseLodash.prototype;
  19367. lodash.prototype.constructor = lodash;
  19368. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19369. LodashWrapper.prototype.constructor = LodashWrapper;
  19370. /*------------------------------------------------------------------------*/
  19371. /**
  19372. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19373. *
  19374. * @private
  19375. * @constructor
  19376. * @param {*} value The value to wrap.
  19377. */
  19378. function LazyWrapper(value) {
  19379. this.__wrapped__ = value;
  19380. this.__actions__ = [];
  19381. this.__dir__ = 1;
  19382. this.__filtered__ = false;
  19383. this.__iteratees__ = [];
  19384. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19385. this.__views__ = [];
  19386. }
  19387. /**
  19388. * Creates a clone of the lazy wrapper object.
  19389. *
  19390. * @private
  19391. * @name clone
  19392. * @memberOf LazyWrapper
  19393. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19394. */
  19395. function lazyClone() {
  19396. var result = new LazyWrapper(this.__wrapped__);
  19397. result.__actions__ = copyArray(this.__actions__);
  19398. result.__dir__ = this.__dir__;
  19399. result.__filtered__ = this.__filtered__;
  19400. result.__iteratees__ = copyArray(this.__iteratees__);
  19401. result.__takeCount__ = this.__takeCount__;
  19402. result.__views__ = copyArray(this.__views__);
  19403. return result;
  19404. }
  19405. /**
  19406. * Reverses the direction of lazy iteration.
  19407. *
  19408. * @private
  19409. * @name reverse
  19410. * @memberOf LazyWrapper
  19411. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19412. */
  19413. function lazyReverse() {
  19414. if (this.__filtered__) {
  19415. var result = new LazyWrapper(this);
  19416. result.__dir__ = -1;
  19417. result.__filtered__ = true;
  19418. } else {
  19419. result = this.clone();
  19420. result.__dir__ *= -1;
  19421. }
  19422. return result;
  19423. }
  19424. /**
  19425. * Extracts the unwrapped value from its lazy wrapper.
  19426. *
  19427. * @private
  19428. * @name value
  19429. * @memberOf LazyWrapper
  19430. * @returns {*} Returns the unwrapped value.
  19431. */
  19432. function lazyValue() {
  19433. var array = this.__wrapped__.value(),
  19434. dir = this.__dir__,
  19435. isArr = isArray(array),
  19436. isRight = dir < 0,
  19437. arrLength = isArr ? array.length : 0,
  19438. view = getView(0, arrLength, this.__views__),
  19439. start = view.start,
  19440. end = view.end,
  19441. length = end - start,
  19442. index = isRight ? end : (start - 1),
  19443. iteratees = this.__iteratees__,
  19444. iterLength = iteratees.length,
  19445. resIndex = 0,
  19446. takeCount = nativeMin(length, this.__takeCount__);
  19447. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19448. return baseWrapperValue(array, this.__actions__);
  19449. }
  19450. var result = [];
  19451. outer:
  19452. while (length-- && resIndex < takeCount) {
  19453. index += dir;
  19454. var iterIndex = -1,
  19455. value = array[index];
  19456. while (++iterIndex < iterLength) {
  19457. var data = iteratees[iterIndex],
  19458. iteratee = data.iteratee,
  19459. type = data.type,
  19460. computed = iteratee(value);
  19461. if (type == LAZY_MAP_FLAG) {
  19462. value = computed;
  19463. } else if (!computed) {
  19464. if (type == LAZY_FILTER_FLAG) {
  19465. continue outer;
  19466. } else {
  19467. break outer;
  19468. }
  19469. }
  19470. }
  19471. result[resIndex++] = value;
  19472. }
  19473. return result;
  19474. }
  19475. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19476. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19477. LazyWrapper.prototype.constructor = LazyWrapper;
  19478. /*------------------------------------------------------------------------*/
  19479. /**
  19480. * Creates a hash object.
  19481. *
  19482. * @private
  19483. * @constructor
  19484. * @param {Array} [entries] The key-value pairs to cache.
  19485. */
  19486. function Hash(entries) {
  19487. var index = -1,
  19488. length = entries == null ? 0 : entries.length;
  19489. this.clear();
  19490. while (++index < length) {
  19491. var entry = entries[index];
  19492. this.set(entry[0], entry[1]);
  19493. }
  19494. }
  19495. /**
  19496. * Removes all key-value entries from the hash.
  19497. *
  19498. * @private
  19499. * @name clear
  19500. * @memberOf Hash
  19501. */
  19502. function hashClear() {
  19503. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19504. this.size = 0;
  19505. }
  19506. /**
  19507. * Removes `key` and its value from the hash.
  19508. *
  19509. * @private
  19510. * @name delete
  19511. * @memberOf Hash
  19512. * @param {Object} hash The hash to modify.
  19513. * @param {string} key The key of the value to remove.
  19514. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19515. */
  19516. function hashDelete(key) {
  19517. var result = this.has(key) && delete this.__data__[key];
  19518. this.size -= result ? 1 : 0;
  19519. return result;
  19520. }
  19521. /**
  19522. * Gets the hash value for `key`.
  19523. *
  19524. * @private
  19525. * @name get
  19526. * @memberOf Hash
  19527. * @param {string} key The key of the value to get.
  19528. * @returns {*} Returns the entry value.
  19529. */
  19530. function hashGet(key) {
  19531. var data = this.__data__;
  19532. if (nativeCreate) {
  19533. var result = data[key];
  19534. return result === HASH_UNDEFINED ? undefined : result;
  19535. }
  19536. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19537. }
  19538. /**
  19539. * Checks if a hash value for `key` exists.
  19540. *
  19541. * @private
  19542. * @name has
  19543. * @memberOf Hash
  19544. * @param {string} key The key of the entry to check.
  19545. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19546. */
  19547. function hashHas(key) {
  19548. var data = this.__data__;
  19549. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19550. }
  19551. /**
  19552. * Sets the hash `key` to `value`.
  19553. *
  19554. * @private
  19555. * @name set
  19556. * @memberOf Hash
  19557. * @param {string} key The key of the value to set.
  19558. * @param {*} value The value to set.
  19559. * @returns {Object} Returns the hash instance.
  19560. */
  19561. function hashSet(key, value) {
  19562. var data = this.__data__;
  19563. this.size += this.has(key) ? 0 : 1;
  19564. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19565. return this;
  19566. }
  19567. // Add methods to `Hash`.
  19568. Hash.prototype.clear = hashClear;
  19569. Hash.prototype['delete'] = hashDelete;
  19570. Hash.prototype.get = hashGet;
  19571. Hash.prototype.has = hashHas;
  19572. Hash.prototype.set = hashSet;
  19573. /*------------------------------------------------------------------------*/
  19574. /**
  19575. * Creates an list cache object.
  19576. *
  19577. * @private
  19578. * @constructor
  19579. * @param {Array} [entries] The key-value pairs to cache.
  19580. */
  19581. function ListCache(entries) {
  19582. var index = -1,
  19583. length = entries == null ? 0 : entries.length;
  19584. this.clear();
  19585. while (++index < length) {
  19586. var entry = entries[index];
  19587. this.set(entry[0], entry[1]);
  19588. }
  19589. }
  19590. /**
  19591. * Removes all key-value entries from the list cache.
  19592. *
  19593. * @private
  19594. * @name clear
  19595. * @memberOf ListCache
  19596. */
  19597. function listCacheClear() {
  19598. this.__data__ = [];
  19599. this.size = 0;
  19600. }
  19601. /**
  19602. * Removes `key` and its value from the list cache.
  19603. *
  19604. * @private
  19605. * @name delete
  19606. * @memberOf ListCache
  19607. * @param {string} key The key of the value to remove.
  19608. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19609. */
  19610. function listCacheDelete(key) {
  19611. var data = this.__data__,
  19612. index = assocIndexOf(data, key);
  19613. if (index < 0) {
  19614. return false;
  19615. }
  19616. var lastIndex = data.length - 1;
  19617. if (index == lastIndex) {
  19618. data.pop();
  19619. } else {
  19620. splice.call(data, index, 1);
  19621. }
  19622. --this.size;
  19623. return true;
  19624. }
  19625. /**
  19626. * Gets the list cache value for `key`.
  19627. *
  19628. * @private
  19629. * @name get
  19630. * @memberOf ListCache
  19631. * @param {string} key The key of the value to get.
  19632. * @returns {*} Returns the entry value.
  19633. */
  19634. function listCacheGet(key) {
  19635. var data = this.__data__,
  19636. index = assocIndexOf(data, key);
  19637. return index < 0 ? undefined : data[index][1];
  19638. }
  19639. /**
  19640. * Checks if a list cache value for `key` exists.
  19641. *
  19642. * @private
  19643. * @name has
  19644. * @memberOf ListCache
  19645. * @param {string} key The key of the entry to check.
  19646. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19647. */
  19648. function listCacheHas(key) {
  19649. return assocIndexOf(this.__data__, key) > -1;
  19650. }
  19651. /**
  19652. * Sets the list cache `key` to `value`.
  19653. *
  19654. * @private
  19655. * @name set
  19656. * @memberOf ListCache
  19657. * @param {string} key The key of the value to set.
  19658. * @param {*} value The value to set.
  19659. * @returns {Object} Returns the list cache instance.
  19660. */
  19661. function listCacheSet(key, value) {
  19662. var data = this.__data__,
  19663. index = assocIndexOf(data, key);
  19664. if (index < 0) {
  19665. ++this.size;
  19666. data.push([key, value]);
  19667. } else {
  19668. data[index][1] = value;
  19669. }
  19670. return this;
  19671. }
  19672. // Add methods to `ListCache`.
  19673. ListCache.prototype.clear = listCacheClear;
  19674. ListCache.prototype['delete'] = listCacheDelete;
  19675. ListCache.prototype.get = listCacheGet;
  19676. ListCache.prototype.has = listCacheHas;
  19677. ListCache.prototype.set = listCacheSet;
  19678. /*------------------------------------------------------------------------*/
  19679. /**
  19680. * Creates a map cache object to store key-value pairs.
  19681. *
  19682. * @private
  19683. * @constructor
  19684. * @param {Array} [entries] The key-value pairs to cache.
  19685. */
  19686. function MapCache(entries) {
  19687. var index = -1,
  19688. length = entries == null ? 0 : entries.length;
  19689. this.clear();
  19690. while (++index < length) {
  19691. var entry = entries[index];
  19692. this.set(entry[0], entry[1]);
  19693. }
  19694. }
  19695. /**
  19696. * Removes all key-value entries from the map.
  19697. *
  19698. * @private
  19699. * @name clear
  19700. * @memberOf MapCache
  19701. */
  19702. function mapCacheClear() {
  19703. this.size = 0;
  19704. this.__data__ = {
  19705. 'hash': new Hash,
  19706. 'map': new (Map || ListCache),
  19707. 'string': new Hash
  19708. };
  19709. }
  19710. /**
  19711. * Removes `key` and its value from the map.
  19712. *
  19713. * @private
  19714. * @name delete
  19715. * @memberOf MapCache
  19716. * @param {string} key The key of the value to remove.
  19717. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19718. */
  19719. function mapCacheDelete(key) {
  19720. var result = getMapData(this, key)['delete'](key);
  19721. this.size -= result ? 1 : 0;
  19722. return result;
  19723. }
  19724. /**
  19725. * Gets the map value for `key`.
  19726. *
  19727. * @private
  19728. * @name get
  19729. * @memberOf MapCache
  19730. * @param {string} key The key of the value to get.
  19731. * @returns {*} Returns the entry value.
  19732. */
  19733. function mapCacheGet(key) {
  19734. return getMapData(this, key).get(key);
  19735. }
  19736. /**
  19737. * Checks if a map value for `key` exists.
  19738. *
  19739. * @private
  19740. * @name has
  19741. * @memberOf MapCache
  19742. * @param {string} key The key of the entry to check.
  19743. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19744. */
  19745. function mapCacheHas(key) {
  19746. return getMapData(this, key).has(key);
  19747. }
  19748. /**
  19749. * Sets the map `key` to `value`.
  19750. *
  19751. * @private
  19752. * @name set
  19753. * @memberOf MapCache
  19754. * @param {string} key The key of the value to set.
  19755. * @param {*} value The value to set.
  19756. * @returns {Object} Returns the map cache instance.
  19757. */
  19758. function mapCacheSet(key, value) {
  19759. var data = getMapData(this, key),
  19760. size = data.size;
  19761. data.set(key, value);
  19762. this.size += data.size == size ? 0 : 1;
  19763. return this;
  19764. }
  19765. // Add methods to `MapCache`.
  19766. MapCache.prototype.clear = mapCacheClear;
  19767. MapCache.prototype['delete'] = mapCacheDelete;
  19768. MapCache.prototype.get = mapCacheGet;
  19769. MapCache.prototype.has = mapCacheHas;
  19770. MapCache.prototype.set = mapCacheSet;
  19771. /*------------------------------------------------------------------------*/
  19772. /**
  19773. *
  19774. * Creates an array cache object to store unique values.
  19775. *
  19776. * @private
  19777. * @constructor
  19778. * @param {Array} [values] The values to cache.
  19779. */
  19780. function SetCache(values) {
  19781. var index = -1,
  19782. length = values == null ? 0 : values.length;
  19783. this.__data__ = new MapCache;
  19784. while (++index < length) {
  19785. this.add(values[index]);
  19786. }
  19787. }
  19788. /**
  19789. * Adds `value` to the array cache.
  19790. *
  19791. * @private
  19792. * @name add
  19793. * @memberOf SetCache
  19794. * @alias push
  19795. * @param {*} value The value to cache.
  19796. * @returns {Object} Returns the cache instance.
  19797. */
  19798. function setCacheAdd(value) {
  19799. this.__data__.set(value, HASH_UNDEFINED);
  19800. return this;
  19801. }
  19802. /**
  19803. * Checks if `value` is in the array cache.
  19804. *
  19805. * @private
  19806. * @name has
  19807. * @memberOf SetCache
  19808. * @param {*} value The value to search for.
  19809. * @returns {number} Returns `true` if `value` is found, else `false`.
  19810. */
  19811. function setCacheHas(value) {
  19812. return this.__data__.has(value);
  19813. }
  19814. // Add methods to `SetCache`.
  19815. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19816. SetCache.prototype.has = setCacheHas;
  19817. /*------------------------------------------------------------------------*/
  19818. /**
  19819. * Creates a stack cache object to store key-value pairs.
  19820. *
  19821. * @private
  19822. * @constructor
  19823. * @param {Array} [entries] The key-value pairs to cache.
  19824. */
  19825. function Stack(entries) {
  19826. var data = this.__data__ = new ListCache(entries);
  19827. this.size = data.size;
  19828. }
  19829. /**
  19830. * Removes all key-value entries from the stack.
  19831. *
  19832. * @private
  19833. * @name clear
  19834. * @memberOf Stack
  19835. */
  19836. function stackClear() {
  19837. this.__data__ = new ListCache;
  19838. this.size = 0;
  19839. }
  19840. /**
  19841. * Removes `key` and its value from the stack.
  19842. *
  19843. * @private
  19844. * @name delete
  19845. * @memberOf Stack
  19846. * @param {string} key The key of the value to remove.
  19847. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19848. */
  19849. function stackDelete(key) {
  19850. var data = this.__data__,
  19851. result = data['delete'](key);
  19852. this.size = data.size;
  19853. return result;
  19854. }
  19855. /**
  19856. * Gets the stack value for `key`.
  19857. *
  19858. * @private
  19859. * @name get
  19860. * @memberOf Stack
  19861. * @param {string} key The key of the value to get.
  19862. * @returns {*} Returns the entry value.
  19863. */
  19864. function stackGet(key) {
  19865. return this.__data__.get(key);
  19866. }
  19867. /**
  19868. * Checks if a stack value for `key` exists.
  19869. *
  19870. * @private
  19871. * @name has
  19872. * @memberOf Stack
  19873. * @param {string} key The key of the entry to check.
  19874. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19875. */
  19876. function stackHas(key) {
  19877. return this.__data__.has(key);
  19878. }
  19879. /**
  19880. * Sets the stack `key` to `value`.
  19881. *
  19882. * @private
  19883. * @name set
  19884. * @memberOf Stack
  19885. * @param {string} key The key of the value to set.
  19886. * @param {*} value The value to set.
  19887. * @returns {Object} Returns the stack cache instance.
  19888. */
  19889. function stackSet(key, value) {
  19890. var data = this.__data__;
  19891. if (data instanceof ListCache) {
  19892. var pairs = data.__data__;
  19893. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  19894. pairs.push([key, value]);
  19895. this.size = ++data.size;
  19896. return this;
  19897. }
  19898. data = this.__data__ = new MapCache(pairs);
  19899. }
  19900. data.set(key, value);
  19901. this.size = data.size;
  19902. return this;
  19903. }
  19904. // Add methods to `Stack`.
  19905. Stack.prototype.clear = stackClear;
  19906. Stack.prototype['delete'] = stackDelete;
  19907. Stack.prototype.get = stackGet;
  19908. Stack.prototype.has = stackHas;
  19909. Stack.prototype.set = stackSet;
  19910. /*------------------------------------------------------------------------*/
  19911. /**
  19912. * Creates an array of the enumerable property names of the array-like `value`.
  19913. *
  19914. * @private
  19915. * @param {*} value The value to query.
  19916. * @param {boolean} inherited Specify returning inherited property names.
  19917. * @returns {Array} Returns the array of property names.
  19918. */
  19919. function arrayLikeKeys(value, inherited) {
  19920. var isArr = isArray(value),
  19921. isArg = !isArr && isArguments(value),
  19922. isBuff = !isArr && !isArg && isBuffer(value),
  19923. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  19924. skipIndexes = isArr || isArg || isBuff || isType,
  19925. result = skipIndexes ? baseTimes(value.length, String) : [],
  19926. length = result.length;
  19927. for (var key in value) {
  19928. if ((inherited || hasOwnProperty.call(value, key)) &&
  19929. !(skipIndexes && (
  19930. // Safari 9 has enumerable `arguments.length` in strict mode.
  19931. key == 'length' ||
  19932. // Node.js 0.10 has enumerable non-index properties on buffers.
  19933. (isBuff && (key == 'offset' || key == 'parent')) ||
  19934. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  19935. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  19936. // Skip index properties.
  19937. isIndex(key, length)
  19938. ))) {
  19939. result.push(key);
  19940. }
  19941. }
  19942. return result;
  19943. }
  19944. /**
  19945. * A specialized version of `_.sample` for arrays.
  19946. *
  19947. * @private
  19948. * @param {Array} array The array to sample.
  19949. * @returns {*} Returns the random element.
  19950. */
  19951. function arraySample(array) {
  19952. var length = array.length;
  19953. return length ? array[baseRandom(0, length - 1)] : undefined;
  19954. }
  19955. /**
  19956. * A specialized version of `_.sampleSize` for arrays.
  19957. *
  19958. * @private
  19959. * @param {Array} array The array to sample.
  19960. * @param {number} n The number of elements to sample.
  19961. * @returns {Array} Returns the random elements.
  19962. */
  19963. function arraySampleSize(array, n) {
  19964. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  19965. }
  19966. /**
  19967. * A specialized version of `_.shuffle` for arrays.
  19968. *
  19969. * @private
  19970. * @param {Array} array The array to shuffle.
  19971. * @returns {Array} Returns the new shuffled array.
  19972. */
  19973. function arrayShuffle(array) {
  19974. return shuffleSelf(copyArray(array));
  19975. }
  19976. /**
  19977. * This function is like `assignValue` except that it doesn't assign
  19978. * `undefined` values.
  19979. *
  19980. * @private
  19981. * @param {Object} object The object to modify.
  19982. * @param {string} key The key of the property to assign.
  19983. * @param {*} value The value to assign.
  19984. */
  19985. function assignMergeValue(object, key, value) {
  19986. if ((value !== undefined && !eq(object[key], value)) ||
  19987. (value === undefined && !(key in object))) {
  19988. baseAssignValue(object, key, value);
  19989. }
  19990. }
  19991. /**
  19992. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  19993. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19994. * for equality comparisons.
  19995. *
  19996. * @private
  19997. * @param {Object} object The object to modify.
  19998. * @param {string} key The key of the property to assign.
  19999. * @param {*} value The value to assign.
  20000. */
  20001. function assignValue(object, key, value) {
  20002. var objValue = object[key];
  20003. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20004. (value === undefined && !(key in object))) {
  20005. baseAssignValue(object, key, value);
  20006. }
  20007. }
  20008. /**
  20009. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20010. *
  20011. * @private
  20012. * @param {Array} array The array to inspect.
  20013. * @param {*} key The key to search for.
  20014. * @returns {number} Returns the index of the matched value, else `-1`.
  20015. */
  20016. function assocIndexOf(array, key) {
  20017. var length = array.length;
  20018. while (length--) {
  20019. if (eq(array[length][0], key)) {
  20020. return length;
  20021. }
  20022. }
  20023. return -1;
  20024. }
  20025. /**
  20026. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20027. * by `iteratee` and values set by `setter`.
  20028. *
  20029. * @private
  20030. * @param {Array|Object} collection The collection to iterate over.
  20031. * @param {Function} setter The function to set `accumulator` values.
  20032. * @param {Function} iteratee The iteratee to transform keys.
  20033. * @param {Object} accumulator The initial aggregated object.
  20034. * @returns {Function} Returns `accumulator`.
  20035. */
  20036. function baseAggregator(collection, setter, iteratee, accumulator) {
  20037. baseEach(collection, function(value, key, collection) {
  20038. setter(accumulator, value, iteratee(value), collection);
  20039. });
  20040. return accumulator;
  20041. }
  20042. /**
  20043. * The base implementation of `_.assign` without support for multiple sources
  20044. * or `customizer` functions.
  20045. *
  20046. * @private
  20047. * @param {Object} object The destination object.
  20048. * @param {Object} source The source object.
  20049. * @returns {Object} Returns `object`.
  20050. */
  20051. function baseAssign(object, source) {
  20052. return object && copyObject(source, keys(source), object);
  20053. }
  20054. /**
  20055. * The base implementation of `_.assignIn` without support for multiple sources
  20056. * or `customizer` functions.
  20057. *
  20058. * @private
  20059. * @param {Object} object The destination object.
  20060. * @param {Object} source The source object.
  20061. * @returns {Object} Returns `object`.
  20062. */
  20063. function baseAssignIn(object, source) {
  20064. return object && copyObject(source, keysIn(source), object);
  20065. }
  20066. /**
  20067. * The base implementation of `assignValue` and `assignMergeValue` without
  20068. * value checks.
  20069. *
  20070. * @private
  20071. * @param {Object} object The object to modify.
  20072. * @param {string} key The key of the property to assign.
  20073. * @param {*} value The value to assign.
  20074. */
  20075. function baseAssignValue(object, key, value) {
  20076. if (key == '__proto__' && defineProperty) {
  20077. defineProperty(object, key, {
  20078. 'configurable': true,
  20079. 'enumerable': true,
  20080. 'value': value,
  20081. 'writable': true
  20082. });
  20083. } else {
  20084. object[key] = value;
  20085. }
  20086. }
  20087. /**
  20088. * The base implementation of `_.at` without support for individual paths.
  20089. *
  20090. * @private
  20091. * @param {Object} object The object to iterate over.
  20092. * @param {string[]} paths The property paths to pick.
  20093. * @returns {Array} Returns the picked elements.
  20094. */
  20095. function baseAt(object, paths) {
  20096. var index = -1,
  20097. length = paths.length,
  20098. result = Array(length),
  20099. skip = object == null;
  20100. while (++index < length) {
  20101. result[index] = skip ? undefined : get(object, paths[index]);
  20102. }
  20103. return result;
  20104. }
  20105. /**
  20106. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20107. *
  20108. * @private
  20109. * @param {number} number The number to clamp.
  20110. * @param {number} [lower] The lower bound.
  20111. * @param {number} upper The upper bound.
  20112. * @returns {number} Returns the clamped number.
  20113. */
  20114. function baseClamp(number, lower, upper) {
  20115. if (number === number) {
  20116. if (upper !== undefined) {
  20117. number = number <= upper ? number : upper;
  20118. }
  20119. if (lower !== undefined) {
  20120. number = number >= lower ? number : lower;
  20121. }
  20122. }
  20123. return number;
  20124. }
  20125. /**
  20126. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20127. * traversed objects.
  20128. *
  20129. * @private
  20130. * @param {*} value The value to clone.
  20131. * @param {boolean} bitmask The bitmask flags.
  20132. * 1 - Deep clone
  20133. * 2 - Flatten inherited properties
  20134. * 4 - Clone symbols
  20135. * @param {Function} [customizer] The function to customize cloning.
  20136. * @param {string} [key] The key of `value`.
  20137. * @param {Object} [object] The parent object of `value`.
  20138. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20139. * @returns {*} Returns the cloned value.
  20140. */
  20141. function baseClone(value, bitmask, customizer, key, object, stack) {
  20142. var result,
  20143. isDeep = bitmask & CLONE_DEEP_FLAG,
  20144. isFlat = bitmask & CLONE_FLAT_FLAG,
  20145. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20146. if (customizer) {
  20147. result = object ? customizer(value, key, object, stack) : customizer(value);
  20148. }
  20149. if (result !== undefined) {
  20150. return result;
  20151. }
  20152. if (!isObject(value)) {
  20153. return value;
  20154. }
  20155. var isArr = isArray(value);
  20156. if (isArr) {
  20157. result = initCloneArray(value);
  20158. if (!isDeep) {
  20159. return copyArray(value, result);
  20160. }
  20161. } else {
  20162. var tag = getTag(value),
  20163. isFunc = tag == funcTag || tag == genTag;
  20164. if (isBuffer(value)) {
  20165. return cloneBuffer(value, isDeep);
  20166. }
  20167. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20168. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20169. if (!isDeep) {
  20170. return isFlat
  20171. ? copySymbolsIn(value, baseAssignIn(result, value))
  20172. : copySymbols(value, baseAssign(result, value));
  20173. }
  20174. } else {
  20175. if (!cloneableTags[tag]) {
  20176. return object ? value : {};
  20177. }
  20178. result = initCloneByTag(value, tag, isDeep);
  20179. }
  20180. }
  20181. // Check for circular references and return its corresponding clone.
  20182. stack || (stack = new Stack);
  20183. var stacked = stack.get(value);
  20184. if (stacked) {
  20185. return stacked;
  20186. }
  20187. stack.set(value, result);
  20188. if (isSet(value)) {
  20189. value.forEach(function(subValue) {
  20190. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20191. });
  20192. } else if (isMap(value)) {
  20193. value.forEach(function(subValue, key) {
  20194. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20195. });
  20196. }
  20197. var keysFunc = isFull
  20198. ? (isFlat ? getAllKeysIn : getAllKeys)
  20199. : (isFlat ? keysIn : keys);
  20200. var props = isArr ? undefined : keysFunc(value);
  20201. arrayEach(props || value, function(subValue, key) {
  20202. if (props) {
  20203. key = subValue;
  20204. subValue = value[key];
  20205. }
  20206. // Recursively populate clone (susceptible to call stack limits).
  20207. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20208. });
  20209. return result;
  20210. }
  20211. /**
  20212. * The base implementation of `_.conforms` which doesn't clone `source`.
  20213. *
  20214. * @private
  20215. * @param {Object} source The object of property predicates to conform to.
  20216. * @returns {Function} Returns the new spec function.
  20217. */
  20218. function baseConforms(source) {
  20219. var props = keys(source);
  20220. return function(object) {
  20221. return baseConformsTo(object, source, props);
  20222. };
  20223. }
  20224. /**
  20225. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20226. *
  20227. * @private
  20228. * @param {Object} object The object to inspect.
  20229. * @param {Object} source The object of property predicates to conform to.
  20230. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20231. */
  20232. function baseConformsTo(object, source, props) {
  20233. var length = props.length;
  20234. if (object == null) {
  20235. return !length;
  20236. }
  20237. object = Object(object);
  20238. while (length--) {
  20239. var key = props[length],
  20240. predicate = source[key],
  20241. value = object[key];
  20242. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20243. return false;
  20244. }
  20245. }
  20246. return true;
  20247. }
  20248. /**
  20249. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20250. * to provide to `func`.
  20251. *
  20252. * @private
  20253. * @param {Function} func The function to delay.
  20254. * @param {number} wait The number of milliseconds to delay invocation.
  20255. * @param {Array} args The arguments to provide to `func`.
  20256. * @returns {number|Object} Returns the timer id or timeout object.
  20257. */
  20258. function baseDelay(func, wait, args) {
  20259. if (typeof func != 'function') {
  20260. throw new TypeError(FUNC_ERROR_TEXT);
  20261. }
  20262. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20263. }
  20264. /**
  20265. * The base implementation of methods like `_.difference` without support
  20266. * for excluding multiple arrays or iteratee shorthands.
  20267. *
  20268. * @private
  20269. * @param {Array} array The array to inspect.
  20270. * @param {Array} values The values to exclude.
  20271. * @param {Function} [iteratee] The iteratee invoked per element.
  20272. * @param {Function} [comparator] The comparator invoked per element.
  20273. * @returns {Array} Returns the new array of filtered values.
  20274. */
  20275. function baseDifference(array, values, iteratee, comparator) {
  20276. var index = -1,
  20277. includes = arrayIncludes,
  20278. isCommon = true,
  20279. length = array.length,
  20280. result = [],
  20281. valuesLength = values.length;
  20282. if (!length) {
  20283. return result;
  20284. }
  20285. if (iteratee) {
  20286. values = arrayMap(values, baseUnary(iteratee));
  20287. }
  20288. if (comparator) {
  20289. includes = arrayIncludesWith;
  20290. isCommon = false;
  20291. }
  20292. else if (values.length >= LARGE_ARRAY_SIZE) {
  20293. includes = cacheHas;
  20294. isCommon = false;
  20295. values = new SetCache(values);
  20296. }
  20297. outer:
  20298. while (++index < length) {
  20299. var value = array[index],
  20300. computed = iteratee == null ? value : iteratee(value);
  20301. value = (comparator || value !== 0) ? value : 0;
  20302. if (isCommon && computed === computed) {
  20303. var valuesIndex = valuesLength;
  20304. while (valuesIndex--) {
  20305. if (values[valuesIndex] === computed) {
  20306. continue outer;
  20307. }
  20308. }
  20309. result.push(value);
  20310. }
  20311. else if (!includes(values, computed, comparator)) {
  20312. result.push(value);
  20313. }
  20314. }
  20315. return result;
  20316. }
  20317. /**
  20318. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20319. *
  20320. * @private
  20321. * @param {Array|Object} collection The collection to iterate over.
  20322. * @param {Function} iteratee The function invoked per iteration.
  20323. * @returns {Array|Object} Returns `collection`.
  20324. */
  20325. var baseEach = createBaseEach(baseForOwn);
  20326. /**
  20327. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20328. *
  20329. * @private
  20330. * @param {Array|Object} collection The collection to iterate over.
  20331. * @param {Function} iteratee The function invoked per iteration.
  20332. * @returns {Array|Object} Returns `collection`.
  20333. */
  20334. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20335. /**
  20336. * The base implementation of `_.every` without support for iteratee shorthands.
  20337. *
  20338. * @private
  20339. * @param {Array|Object} collection The collection to iterate over.
  20340. * @param {Function} predicate The function invoked per iteration.
  20341. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20342. * else `false`
  20343. */
  20344. function baseEvery(collection, predicate) {
  20345. var result = true;
  20346. baseEach(collection, function(value, index, collection) {
  20347. result = !!predicate(value, index, collection);
  20348. return result;
  20349. });
  20350. return result;
  20351. }
  20352. /**
  20353. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20354. * `comparator` to determine the extremum value.
  20355. *
  20356. * @private
  20357. * @param {Array} array The array to iterate over.
  20358. * @param {Function} iteratee The iteratee invoked per iteration.
  20359. * @param {Function} comparator The comparator used to compare values.
  20360. * @returns {*} Returns the extremum value.
  20361. */
  20362. function baseExtremum(array, iteratee, comparator) {
  20363. var index = -1,
  20364. length = array.length;
  20365. while (++index < length) {
  20366. var value = array[index],
  20367. current = iteratee(value);
  20368. if (current != null && (computed === undefined
  20369. ? (current === current && !isSymbol(current))
  20370. : comparator(current, computed)
  20371. )) {
  20372. var computed = current,
  20373. result = value;
  20374. }
  20375. }
  20376. return result;
  20377. }
  20378. /**
  20379. * The base implementation of `_.fill` without an iteratee call guard.
  20380. *
  20381. * @private
  20382. * @param {Array} array The array to fill.
  20383. * @param {*} value The value to fill `array` with.
  20384. * @param {number} [start=0] The start position.
  20385. * @param {number} [end=array.length] The end position.
  20386. * @returns {Array} Returns `array`.
  20387. */
  20388. function baseFill(array, value, start, end) {
  20389. var length = array.length;
  20390. start = toInteger(start);
  20391. if (start < 0) {
  20392. start = -start > length ? 0 : (length + start);
  20393. }
  20394. end = (end === undefined || end > length) ? length : toInteger(end);
  20395. if (end < 0) {
  20396. end += length;
  20397. }
  20398. end = start > end ? 0 : toLength(end);
  20399. while (start < end) {
  20400. array[start++] = value;
  20401. }
  20402. return array;
  20403. }
  20404. /**
  20405. * The base implementation of `_.filter` without support for iteratee shorthands.
  20406. *
  20407. * @private
  20408. * @param {Array|Object} collection The collection to iterate over.
  20409. * @param {Function} predicate The function invoked per iteration.
  20410. * @returns {Array} Returns the new filtered array.
  20411. */
  20412. function baseFilter(collection, predicate) {
  20413. var result = [];
  20414. baseEach(collection, function(value, index, collection) {
  20415. if (predicate(value, index, collection)) {
  20416. result.push(value);
  20417. }
  20418. });
  20419. return result;
  20420. }
  20421. /**
  20422. * The base implementation of `_.flatten` with support for restricting flattening.
  20423. *
  20424. * @private
  20425. * @param {Array} array The array to flatten.
  20426. * @param {number} depth The maximum recursion depth.
  20427. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20428. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20429. * @param {Array} [result=[]] The initial result value.
  20430. * @returns {Array} Returns the new flattened array.
  20431. */
  20432. function baseFlatten(array, depth, predicate, isStrict, result) {
  20433. var index = -1,
  20434. length = array.length;
  20435. predicate || (predicate = isFlattenable);
  20436. result || (result = []);
  20437. while (++index < length) {
  20438. var value = array[index];
  20439. if (depth > 0 && predicate(value)) {
  20440. if (depth > 1) {
  20441. // Recursively flatten arrays (susceptible to call stack limits).
  20442. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20443. } else {
  20444. arrayPush(result, value);
  20445. }
  20446. } else if (!isStrict) {
  20447. result[result.length] = value;
  20448. }
  20449. }
  20450. return result;
  20451. }
  20452. /**
  20453. * The base implementation of `baseForOwn` which iterates over `object`
  20454. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20455. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20456. *
  20457. * @private
  20458. * @param {Object} object The object to iterate over.
  20459. * @param {Function} iteratee The function invoked per iteration.
  20460. * @param {Function} keysFunc The function to get the keys of `object`.
  20461. * @returns {Object} Returns `object`.
  20462. */
  20463. var baseFor = createBaseFor();
  20464. /**
  20465. * This function is like `baseFor` except that it iterates over properties
  20466. * in the opposite order.
  20467. *
  20468. * @private
  20469. * @param {Object} object The object to iterate over.
  20470. * @param {Function} iteratee The function invoked per iteration.
  20471. * @param {Function} keysFunc The function to get the keys of `object`.
  20472. * @returns {Object} Returns `object`.
  20473. */
  20474. var baseForRight = createBaseFor(true);
  20475. /**
  20476. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20477. *
  20478. * @private
  20479. * @param {Object} object The object to iterate over.
  20480. * @param {Function} iteratee The function invoked per iteration.
  20481. * @returns {Object} Returns `object`.
  20482. */
  20483. function baseForOwn(object, iteratee) {
  20484. return object && baseFor(object, iteratee, keys);
  20485. }
  20486. /**
  20487. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20488. *
  20489. * @private
  20490. * @param {Object} object The object to iterate over.
  20491. * @param {Function} iteratee The function invoked per iteration.
  20492. * @returns {Object} Returns `object`.
  20493. */
  20494. function baseForOwnRight(object, iteratee) {
  20495. return object && baseForRight(object, iteratee, keys);
  20496. }
  20497. /**
  20498. * The base implementation of `_.functions` which creates an array of
  20499. * `object` function property names filtered from `props`.
  20500. *
  20501. * @private
  20502. * @param {Object} object The object to inspect.
  20503. * @param {Array} props The property names to filter.
  20504. * @returns {Array} Returns the function names.
  20505. */
  20506. function baseFunctions(object, props) {
  20507. return arrayFilter(props, function(key) {
  20508. return isFunction(object[key]);
  20509. });
  20510. }
  20511. /**
  20512. * The base implementation of `_.get` without support for default values.
  20513. *
  20514. * @private
  20515. * @param {Object} object The object to query.
  20516. * @param {Array|string} path The path of the property to get.
  20517. * @returns {*} Returns the resolved value.
  20518. */
  20519. function baseGet(object, path) {
  20520. path = castPath(path, object);
  20521. var index = 0,
  20522. length = path.length;
  20523. while (object != null && index < length) {
  20524. object = object[toKey(path[index++])];
  20525. }
  20526. return (index && index == length) ? object : undefined;
  20527. }
  20528. /**
  20529. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20530. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20531. * symbols of `object`.
  20532. *
  20533. * @private
  20534. * @param {Object} object The object to query.
  20535. * @param {Function} keysFunc The function to get the keys of `object`.
  20536. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20537. * @returns {Array} Returns the array of property names and symbols.
  20538. */
  20539. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20540. var result = keysFunc(object);
  20541. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20542. }
  20543. /**
  20544. * The base implementation of `getTag` without fallbacks for buggy environments.
  20545. *
  20546. * @private
  20547. * @param {*} value The value to query.
  20548. * @returns {string} Returns the `toStringTag`.
  20549. */
  20550. function baseGetTag(value) {
  20551. if (value == null) {
  20552. return value === undefined ? undefinedTag : nullTag;
  20553. }
  20554. return (symToStringTag && symToStringTag in Object(value))
  20555. ? getRawTag(value)
  20556. : objectToString(value);
  20557. }
  20558. /**
  20559. * The base implementation of `_.gt` which doesn't coerce arguments.
  20560. *
  20561. * @private
  20562. * @param {*} value The value to compare.
  20563. * @param {*} other The other value to compare.
  20564. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20565. * else `false`.
  20566. */
  20567. function baseGt(value, other) {
  20568. return value > other;
  20569. }
  20570. /**
  20571. * The base implementation of `_.has` without support for deep paths.
  20572. *
  20573. * @private
  20574. * @param {Object} [object] The object to query.
  20575. * @param {Array|string} key The key to check.
  20576. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20577. */
  20578. function baseHas(object, key) {
  20579. return object != null && hasOwnProperty.call(object, key);
  20580. }
  20581. /**
  20582. * The base implementation of `_.hasIn` without support for deep paths.
  20583. *
  20584. * @private
  20585. * @param {Object} [object] The object to query.
  20586. * @param {Array|string} key The key to check.
  20587. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20588. */
  20589. function baseHasIn(object, key) {
  20590. return object != null && key in Object(object);
  20591. }
  20592. /**
  20593. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20594. *
  20595. * @private
  20596. * @param {number} number The number to check.
  20597. * @param {number} start The start of the range.
  20598. * @param {number} end The end of the range.
  20599. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20600. */
  20601. function baseInRange(number, start, end) {
  20602. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20603. }
  20604. /**
  20605. * The base implementation of methods like `_.intersection`, without support
  20606. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20607. *
  20608. * @private
  20609. * @param {Array} arrays The arrays to inspect.
  20610. * @param {Function} [iteratee] The iteratee invoked per element.
  20611. * @param {Function} [comparator] The comparator invoked per element.
  20612. * @returns {Array} Returns the new array of shared values.
  20613. */
  20614. function baseIntersection(arrays, iteratee, comparator) {
  20615. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20616. length = arrays[0].length,
  20617. othLength = arrays.length,
  20618. othIndex = othLength,
  20619. caches = Array(othLength),
  20620. maxLength = Infinity,
  20621. result = [];
  20622. while (othIndex--) {
  20623. var array = arrays[othIndex];
  20624. if (othIndex && iteratee) {
  20625. array = arrayMap(array, baseUnary(iteratee));
  20626. }
  20627. maxLength = nativeMin(array.length, maxLength);
  20628. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20629. ? new SetCache(othIndex && array)
  20630. : undefined;
  20631. }
  20632. array = arrays[0];
  20633. var index = -1,
  20634. seen = caches[0];
  20635. outer:
  20636. while (++index < length && result.length < maxLength) {
  20637. var value = array[index],
  20638. computed = iteratee ? iteratee(value) : value;
  20639. value = (comparator || value !== 0) ? value : 0;
  20640. if (!(seen
  20641. ? cacheHas(seen, computed)
  20642. : includes(result, computed, comparator)
  20643. )) {
  20644. othIndex = othLength;
  20645. while (--othIndex) {
  20646. var cache = caches[othIndex];
  20647. if (!(cache
  20648. ? cacheHas(cache, computed)
  20649. : includes(arrays[othIndex], computed, comparator))
  20650. ) {
  20651. continue outer;
  20652. }
  20653. }
  20654. if (seen) {
  20655. seen.push(computed);
  20656. }
  20657. result.push(value);
  20658. }
  20659. }
  20660. return result;
  20661. }
  20662. /**
  20663. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20664. * `object` with values transformed by `iteratee` and set by `setter`.
  20665. *
  20666. * @private
  20667. * @param {Object} object The object to iterate over.
  20668. * @param {Function} setter The function to set `accumulator` values.
  20669. * @param {Function} iteratee The iteratee to transform values.
  20670. * @param {Object} accumulator The initial inverted object.
  20671. * @returns {Function} Returns `accumulator`.
  20672. */
  20673. function baseInverter(object, setter, iteratee, accumulator) {
  20674. baseForOwn(object, function(value, key, object) {
  20675. setter(accumulator, iteratee(value), key, object);
  20676. });
  20677. return accumulator;
  20678. }
  20679. /**
  20680. * The base implementation of `_.invoke` without support for individual
  20681. * method arguments.
  20682. *
  20683. * @private
  20684. * @param {Object} object The object to query.
  20685. * @param {Array|string} path The path of the method to invoke.
  20686. * @param {Array} args The arguments to invoke the method with.
  20687. * @returns {*} Returns the result of the invoked method.
  20688. */
  20689. function baseInvoke(object, path, args) {
  20690. path = castPath(path, object);
  20691. object = parent(object, path);
  20692. var func = object == null ? object : object[toKey(last(path))];
  20693. return func == null ? undefined : apply(func, object, args);
  20694. }
  20695. /**
  20696. * The base implementation of `_.isArguments`.
  20697. *
  20698. * @private
  20699. * @param {*} value The value to check.
  20700. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20701. */
  20702. function baseIsArguments(value) {
  20703. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20704. }
  20705. /**
  20706. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20707. *
  20708. * @private
  20709. * @param {*} value The value to check.
  20710. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20711. */
  20712. function baseIsArrayBuffer(value) {
  20713. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20714. }
  20715. /**
  20716. * The base implementation of `_.isDate` without Node.js optimizations.
  20717. *
  20718. * @private
  20719. * @param {*} value The value to check.
  20720. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20721. */
  20722. function baseIsDate(value) {
  20723. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20724. }
  20725. /**
  20726. * The base implementation of `_.isEqual` which supports partial comparisons
  20727. * and tracks traversed objects.
  20728. *
  20729. * @private
  20730. * @param {*} value The value to compare.
  20731. * @param {*} other The other value to compare.
  20732. * @param {boolean} bitmask The bitmask flags.
  20733. * 1 - Unordered comparison
  20734. * 2 - Partial comparison
  20735. * @param {Function} [customizer] The function to customize comparisons.
  20736. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20737. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20738. */
  20739. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20740. if (value === other) {
  20741. return true;
  20742. }
  20743. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20744. return value !== value && other !== other;
  20745. }
  20746. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20747. }
  20748. /**
  20749. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20750. * deep comparisons and tracks traversed objects enabling objects with circular
  20751. * references to be compared.
  20752. *
  20753. * @private
  20754. * @param {Object} object The object to compare.
  20755. * @param {Object} other The other object to compare.
  20756. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20757. * @param {Function} customizer The function to customize comparisons.
  20758. * @param {Function} equalFunc The function to determine equivalents of values.
  20759. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20760. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20761. */
  20762. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20763. var objIsArr = isArray(object),
  20764. othIsArr = isArray(other),
  20765. objTag = objIsArr ? arrayTag : getTag(object),
  20766. othTag = othIsArr ? arrayTag : getTag(other);
  20767. objTag = objTag == argsTag ? objectTag : objTag;
  20768. othTag = othTag == argsTag ? objectTag : othTag;
  20769. var objIsObj = objTag == objectTag,
  20770. othIsObj = othTag == objectTag,
  20771. isSameTag = objTag == othTag;
  20772. if (isSameTag && isBuffer(object)) {
  20773. if (!isBuffer(other)) {
  20774. return false;
  20775. }
  20776. objIsArr = true;
  20777. objIsObj = false;
  20778. }
  20779. if (isSameTag && !objIsObj) {
  20780. stack || (stack = new Stack);
  20781. return (objIsArr || isTypedArray(object))
  20782. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20783. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20784. }
  20785. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20786. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20787. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20788. if (objIsWrapped || othIsWrapped) {
  20789. var objUnwrapped = objIsWrapped ? object.value() : object,
  20790. othUnwrapped = othIsWrapped ? other.value() : other;
  20791. stack || (stack = new Stack);
  20792. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20793. }
  20794. }
  20795. if (!isSameTag) {
  20796. return false;
  20797. }
  20798. stack || (stack = new Stack);
  20799. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20800. }
  20801. /**
  20802. * The base implementation of `_.isMap` without Node.js optimizations.
  20803. *
  20804. * @private
  20805. * @param {*} value The value to check.
  20806. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20807. */
  20808. function baseIsMap(value) {
  20809. return isObjectLike(value) && getTag(value) == mapTag;
  20810. }
  20811. /**
  20812. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20813. *
  20814. * @private
  20815. * @param {Object} object The object to inspect.
  20816. * @param {Object} source The object of property values to match.
  20817. * @param {Array} matchData The property names, values, and compare flags to match.
  20818. * @param {Function} [customizer] The function to customize comparisons.
  20819. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20820. */
  20821. function baseIsMatch(object, source, matchData, customizer) {
  20822. var index = matchData.length,
  20823. length = index,
  20824. noCustomizer = !customizer;
  20825. if (object == null) {
  20826. return !length;
  20827. }
  20828. object = Object(object);
  20829. while (index--) {
  20830. var data = matchData[index];
  20831. if ((noCustomizer && data[2])
  20832. ? data[1] !== object[data[0]]
  20833. : !(data[0] in object)
  20834. ) {
  20835. return false;
  20836. }
  20837. }
  20838. while (++index < length) {
  20839. data = matchData[index];
  20840. var key = data[0],
  20841. objValue = object[key],
  20842. srcValue = data[1];
  20843. if (noCustomizer && data[2]) {
  20844. if (objValue === undefined && !(key in object)) {
  20845. return false;
  20846. }
  20847. } else {
  20848. var stack = new Stack;
  20849. if (customizer) {
  20850. var result = customizer(objValue, srcValue, key, object, source, stack);
  20851. }
  20852. if (!(result === undefined
  20853. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20854. : result
  20855. )) {
  20856. return false;
  20857. }
  20858. }
  20859. }
  20860. return true;
  20861. }
  20862. /**
  20863. * The base implementation of `_.isNative` without bad shim checks.
  20864. *
  20865. * @private
  20866. * @param {*} value The value to check.
  20867. * @returns {boolean} Returns `true` if `value` is a native function,
  20868. * else `false`.
  20869. */
  20870. function baseIsNative(value) {
  20871. if (!isObject(value) || isMasked(value)) {
  20872. return false;
  20873. }
  20874. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20875. return pattern.test(toSource(value));
  20876. }
  20877. /**
  20878. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20879. *
  20880. * @private
  20881. * @param {*} value The value to check.
  20882. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20883. */
  20884. function baseIsRegExp(value) {
  20885. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20886. }
  20887. /**
  20888. * The base implementation of `_.isSet` without Node.js optimizations.
  20889. *
  20890. * @private
  20891. * @param {*} value The value to check.
  20892. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20893. */
  20894. function baseIsSet(value) {
  20895. return isObjectLike(value) && getTag(value) == setTag;
  20896. }
  20897. /**
  20898. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  20899. *
  20900. * @private
  20901. * @param {*} value The value to check.
  20902. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20903. */
  20904. function baseIsTypedArray(value) {
  20905. return isObjectLike(value) &&
  20906. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  20907. }
  20908. /**
  20909. * The base implementation of `_.iteratee`.
  20910. *
  20911. * @private
  20912. * @param {*} [value=_.identity] The value to convert to an iteratee.
  20913. * @returns {Function} Returns the iteratee.
  20914. */
  20915. function baseIteratee(value) {
  20916. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  20917. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  20918. if (typeof value == 'function') {
  20919. return value;
  20920. }
  20921. if (value == null) {
  20922. return identity;
  20923. }
  20924. if (typeof value == 'object') {
  20925. return isArray(value)
  20926. ? baseMatchesProperty(value[0], value[1])
  20927. : baseMatches(value);
  20928. }
  20929. return property(value);
  20930. }
  20931. /**
  20932. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  20933. *
  20934. * @private
  20935. * @param {Object} object The object to query.
  20936. * @returns {Array} Returns the array of property names.
  20937. */
  20938. function baseKeys(object) {
  20939. if (!isPrototype(object)) {
  20940. return nativeKeys(object);
  20941. }
  20942. var result = [];
  20943. for (var key in Object(object)) {
  20944. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  20945. result.push(key);
  20946. }
  20947. }
  20948. return result;
  20949. }
  20950. /**
  20951. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  20952. *
  20953. * @private
  20954. * @param {Object} object The object to query.
  20955. * @returns {Array} Returns the array of property names.
  20956. */
  20957. function baseKeysIn(object) {
  20958. if (!isObject(object)) {
  20959. return nativeKeysIn(object);
  20960. }
  20961. var isProto = isPrototype(object),
  20962. result = [];
  20963. for (var key in object) {
  20964. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  20965. result.push(key);
  20966. }
  20967. }
  20968. return result;
  20969. }
  20970. /**
  20971. * The base implementation of `_.lt` which doesn't coerce arguments.
  20972. *
  20973. * @private
  20974. * @param {*} value The value to compare.
  20975. * @param {*} other The other value to compare.
  20976. * @returns {boolean} Returns `true` if `value` is less than `other`,
  20977. * else `false`.
  20978. */
  20979. function baseLt(value, other) {
  20980. return value < other;
  20981. }
  20982. /**
  20983. * The base implementation of `_.map` without support for iteratee shorthands.
  20984. *
  20985. * @private
  20986. * @param {Array|Object} collection The collection to iterate over.
  20987. * @param {Function} iteratee The function invoked per iteration.
  20988. * @returns {Array} Returns the new mapped array.
  20989. */
  20990. function baseMap(collection, iteratee) {
  20991. var index = -1,
  20992. result = isArrayLike(collection) ? Array(collection.length) : [];
  20993. baseEach(collection, function(value, key, collection) {
  20994. result[++index] = iteratee(value, key, collection);
  20995. });
  20996. return result;
  20997. }
  20998. /**
  20999. * The base implementation of `_.matches` which doesn't clone `source`.
  21000. *
  21001. * @private
  21002. * @param {Object} source The object of property values to match.
  21003. * @returns {Function} Returns the new spec function.
  21004. */
  21005. function baseMatches(source) {
  21006. var matchData = getMatchData(source);
  21007. if (matchData.length == 1 && matchData[0][2]) {
  21008. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21009. }
  21010. return function(object) {
  21011. return object === source || baseIsMatch(object, source, matchData);
  21012. };
  21013. }
  21014. /**
  21015. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21016. *
  21017. * @private
  21018. * @param {string} path The path of the property to get.
  21019. * @param {*} srcValue The value to match.
  21020. * @returns {Function} Returns the new spec function.
  21021. */
  21022. function baseMatchesProperty(path, srcValue) {
  21023. if (isKey(path) && isStrictComparable(srcValue)) {
  21024. return matchesStrictComparable(toKey(path), srcValue);
  21025. }
  21026. return function(object) {
  21027. var objValue = get(object, path);
  21028. return (objValue === undefined && objValue === srcValue)
  21029. ? hasIn(object, path)
  21030. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21031. };
  21032. }
  21033. /**
  21034. * The base implementation of `_.merge` without support for multiple sources.
  21035. *
  21036. * @private
  21037. * @param {Object} object The destination object.
  21038. * @param {Object} source The source object.
  21039. * @param {number} srcIndex The index of `source`.
  21040. * @param {Function} [customizer] The function to customize merged values.
  21041. * @param {Object} [stack] Tracks traversed source values and their merged
  21042. * counterparts.
  21043. */
  21044. function baseMerge(object, source, srcIndex, customizer, stack) {
  21045. if (object === source) {
  21046. return;
  21047. }
  21048. baseFor(source, function(srcValue, key) {
  21049. stack || (stack = new Stack);
  21050. if (isObject(srcValue)) {
  21051. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21052. }
  21053. else {
  21054. var newValue = customizer
  21055. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21056. : undefined;
  21057. if (newValue === undefined) {
  21058. newValue = srcValue;
  21059. }
  21060. assignMergeValue(object, key, newValue);
  21061. }
  21062. }, keysIn);
  21063. }
  21064. /**
  21065. * A specialized version of `baseMerge` for arrays and objects which performs
  21066. * deep merges and tracks traversed objects enabling objects with circular
  21067. * references to be merged.
  21068. *
  21069. * @private
  21070. * @param {Object} object The destination object.
  21071. * @param {Object} source The source object.
  21072. * @param {string} key The key of the value to merge.
  21073. * @param {number} srcIndex The index of `source`.
  21074. * @param {Function} mergeFunc The function to merge values.
  21075. * @param {Function} [customizer] The function to customize assigned values.
  21076. * @param {Object} [stack] Tracks traversed source values and their merged
  21077. * counterparts.
  21078. */
  21079. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21080. var objValue = safeGet(object, key),
  21081. srcValue = safeGet(source, key),
  21082. stacked = stack.get(srcValue);
  21083. if (stacked) {
  21084. assignMergeValue(object, key, stacked);
  21085. return;
  21086. }
  21087. var newValue = customizer
  21088. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21089. : undefined;
  21090. var isCommon = newValue === undefined;
  21091. if (isCommon) {
  21092. var isArr = isArray(srcValue),
  21093. isBuff = !isArr && isBuffer(srcValue),
  21094. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21095. newValue = srcValue;
  21096. if (isArr || isBuff || isTyped) {
  21097. if (isArray(objValue)) {
  21098. newValue = objValue;
  21099. }
  21100. else if (isArrayLikeObject(objValue)) {
  21101. newValue = copyArray(objValue);
  21102. }
  21103. else if (isBuff) {
  21104. isCommon = false;
  21105. newValue = cloneBuffer(srcValue, true);
  21106. }
  21107. else if (isTyped) {
  21108. isCommon = false;
  21109. newValue = cloneTypedArray(srcValue, true);
  21110. }
  21111. else {
  21112. newValue = [];
  21113. }
  21114. }
  21115. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21116. newValue = objValue;
  21117. if (isArguments(objValue)) {
  21118. newValue = toPlainObject(objValue);
  21119. }
  21120. else if (!isObject(objValue) || isFunction(objValue)) {
  21121. newValue = initCloneObject(srcValue);
  21122. }
  21123. }
  21124. else {
  21125. isCommon = false;
  21126. }
  21127. }
  21128. if (isCommon) {
  21129. // Recursively merge objects and arrays (susceptible to call stack limits).
  21130. stack.set(srcValue, newValue);
  21131. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21132. stack['delete'](srcValue);
  21133. }
  21134. assignMergeValue(object, key, newValue);
  21135. }
  21136. /**
  21137. * The base implementation of `_.nth` which doesn't coerce arguments.
  21138. *
  21139. * @private
  21140. * @param {Array} array The array to query.
  21141. * @param {number} n The index of the element to return.
  21142. * @returns {*} Returns the nth element of `array`.
  21143. */
  21144. function baseNth(array, n) {
  21145. var length = array.length;
  21146. if (!length) {
  21147. return;
  21148. }
  21149. n += n < 0 ? length : 0;
  21150. return isIndex(n, length) ? array[n] : undefined;
  21151. }
  21152. /**
  21153. * The base implementation of `_.orderBy` without param guards.
  21154. *
  21155. * @private
  21156. * @param {Array|Object} collection The collection to iterate over.
  21157. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21158. * @param {string[]} orders The sort orders of `iteratees`.
  21159. * @returns {Array} Returns the new sorted array.
  21160. */
  21161. function baseOrderBy(collection, iteratees, orders) {
  21162. var index = -1;
  21163. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21164. var result = baseMap(collection, function(value, key, collection) {
  21165. var criteria = arrayMap(iteratees, function(iteratee) {
  21166. return iteratee(value);
  21167. });
  21168. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21169. });
  21170. return baseSortBy(result, function(object, other) {
  21171. return compareMultiple(object, other, orders);
  21172. });
  21173. }
  21174. /**
  21175. * The base implementation of `_.pick` without support for individual
  21176. * property identifiers.
  21177. *
  21178. * @private
  21179. * @param {Object} object The source object.
  21180. * @param {string[]} paths The property paths to pick.
  21181. * @returns {Object} Returns the new object.
  21182. */
  21183. function basePick(object, paths) {
  21184. return basePickBy(object, paths, function(value, path) {
  21185. return hasIn(object, path);
  21186. });
  21187. }
  21188. /**
  21189. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21190. *
  21191. * @private
  21192. * @param {Object} object The source object.
  21193. * @param {string[]} paths The property paths to pick.
  21194. * @param {Function} predicate The function invoked per property.
  21195. * @returns {Object} Returns the new object.
  21196. */
  21197. function basePickBy(object, paths, predicate) {
  21198. var index = -1,
  21199. length = paths.length,
  21200. result = {};
  21201. while (++index < length) {
  21202. var path = paths[index],
  21203. value = baseGet(object, path);
  21204. if (predicate(value, path)) {
  21205. baseSet(result, castPath(path, object), value);
  21206. }
  21207. }
  21208. return result;
  21209. }
  21210. /**
  21211. * A specialized version of `baseProperty` which supports deep paths.
  21212. *
  21213. * @private
  21214. * @param {Array|string} path The path of the property to get.
  21215. * @returns {Function} Returns the new accessor function.
  21216. */
  21217. function basePropertyDeep(path) {
  21218. return function(object) {
  21219. return baseGet(object, path);
  21220. };
  21221. }
  21222. /**
  21223. * The base implementation of `_.pullAllBy` without support for iteratee
  21224. * shorthands.
  21225. *
  21226. * @private
  21227. * @param {Array} array The array to modify.
  21228. * @param {Array} values The values to remove.
  21229. * @param {Function} [iteratee] The iteratee invoked per element.
  21230. * @param {Function} [comparator] The comparator invoked per element.
  21231. * @returns {Array} Returns `array`.
  21232. */
  21233. function basePullAll(array, values, iteratee, comparator) {
  21234. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21235. index = -1,
  21236. length = values.length,
  21237. seen = array;
  21238. if (array === values) {
  21239. values = copyArray(values);
  21240. }
  21241. if (iteratee) {
  21242. seen = arrayMap(array, baseUnary(iteratee));
  21243. }
  21244. while (++index < length) {
  21245. var fromIndex = 0,
  21246. value = values[index],
  21247. computed = iteratee ? iteratee(value) : value;
  21248. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21249. if (seen !== array) {
  21250. splice.call(seen, fromIndex, 1);
  21251. }
  21252. splice.call(array, fromIndex, 1);
  21253. }
  21254. }
  21255. return array;
  21256. }
  21257. /**
  21258. * The base implementation of `_.pullAt` without support for individual
  21259. * indexes or capturing the removed elements.
  21260. *
  21261. * @private
  21262. * @param {Array} array The array to modify.
  21263. * @param {number[]} indexes The indexes of elements to remove.
  21264. * @returns {Array} Returns `array`.
  21265. */
  21266. function basePullAt(array, indexes) {
  21267. var length = array ? indexes.length : 0,
  21268. lastIndex = length - 1;
  21269. while (length--) {
  21270. var index = indexes[length];
  21271. if (length == lastIndex || index !== previous) {
  21272. var previous = index;
  21273. if (isIndex(index)) {
  21274. splice.call(array, index, 1);
  21275. } else {
  21276. baseUnset(array, index);
  21277. }
  21278. }
  21279. }
  21280. return array;
  21281. }
  21282. /**
  21283. * The base implementation of `_.random` without support for returning
  21284. * floating-point numbers.
  21285. *
  21286. * @private
  21287. * @param {number} lower The lower bound.
  21288. * @param {number} upper The upper bound.
  21289. * @returns {number} Returns the random number.
  21290. */
  21291. function baseRandom(lower, upper) {
  21292. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21293. }
  21294. /**
  21295. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21296. * coerce arguments.
  21297. *
  21298. * @private
  21299. * @param {number} start The start of the range.
  21300. * @param {number} end The end of the range.
  21301. * @param {number} step The value to increment or decrement by.
  21302. * @param {boolean} [fromRight] Specify iterating from right to left.
  21303. * @returns {Array} Returns the range of numbers.
  21304. */
  21305. function baseRange(start, end, step, fromRight) {
  21306. var index = -1,
  21307. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21308. result = Array(length);
  21309. while (length--) {
  21310. result[fromRight ? length : ++index] = start;
  21311. start += step;
  21312. }
  21313. return result;
  21314. }
  21315. /**
  21316. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21317. *
  21318. * @private
  21319. * @param {string} string The string to repeat.
  21320. * @param {number} n The number of times to repeat the string.
  21321. * @returns {string} Returns the repeated string.
  21322. */
  21323. function baseRepeat(string, n) {
  21324. var result = '';
  21325. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21326. return result;
  21327. }
  21328. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21329. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21330. do {
  21331. if (n % 2) {
  21332. result += string;
  21333. }
  21334. n = nativeFloor(n / 2);
  21335. if (n) {
  21336. string += string;
  21337. }
  21338. } while (n);
  21339. return result;
  21340. }
  21341. /**
  21342. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21343. *
  21344. * @private
  21345. * @param {Function} func The function to apply a rest parameter to.
  21346. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21347. * @returns {Function} Returns the new function.
  21348. */
  21349. function baseRest(func, start) {
  21350. return setToString(overRest(func, start, identity), func + '');
  21351. }
  21352. /**
  21353. * The base implementation of `_.sample`.
  21354. *
  21355. * @private
  21356. * @param {Array|Object} collection The collection to sample.
  21357. * @returns {*} Returns the random element.
  21358. */
  21359. function baseSample(collection) {
  21360. return arraySample(values(collection));
  21361. }
  21362. /**
  21363. * The base implementation of `_.sampleSize` without param guards.
  21364. *
  21365. * @private
  21366. * @param {Array|Object} collection The collection to sample.
  21367. * @param {number} n The number of elements to sample.
  21368. * @returns {Array} Returns the random elements.
  21369. */
  21370. function baseSampleSize(collection, n) {
  21371. var array = values(collection);
  21372. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21373. }
  21374. /**
  21375. * The base implementation of `_.set`.
  21376. *
  21377. * @private
  21378. * @param {Object} object The object to modify.
  21379. * @param {Array|string} path The path of the property to set.
  21380. * @param {*} value The value to set.
  21381. * @param {Function} [customizer] The function to customize path creation.
  21382. * @returns {Object} Returns `object`.
  21383. */
  21384. function baseSet(object, path, value, customizer) {
  21385. if (!isObject(object)) {
  21386. return object;
  21387. }
  21388. path = castPath(path, object);
  21389. var index = -1,
  21390. length = path.length,
  21391. lastIndex = length - 1,
  21392. nested = object;
  21393. while (nested != null && ++index < length) {
  21394. var key = toKey(path[index]),
  21395. newValue = value;
  21396. if (index != lastIndex) {
  21397. var objValue = nested[key];
  21398. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21399. if (newValue === undefined) {
  21400. newValue = isObject(objValue)
  21401. ? objValue
  21402. : (isIndex(path[index + 1]) ? [] : {});
  21403. }
  21404. }
  21405. assignValue(nested, key, newValue);
  21406. nested = nested[key];
  21407. }
  21408. return object;
  21409. }
  21410. /**
  21411. * The base implementation of `setData` without support for hot loop shorting.
  21412. *
  21413. * @private
  21414. * @param {Function} func The function to associate metadata with.
  21415. * @param {*} data The metadata.
  21416. * @returns {Function} Returns `func`.
  21417. */
  21418. var baseSetData = !metaMap ? identity : function(func, data) {
  21419. metaMap.set(func, data);
  21420. return func;
  21421. };
  21422. /**
  21423. * The base implementation of `setToString` without support for hot loop shorting.
  21424. *
  21425. * @private
  21426. * @param {Function} func The function to modify.
  21427. * @param {Function} string The `toString` result.
  21428. * @returns {Function} Returns `func`.
  21429. */
  21430. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21431. return defineProperty(func, 'toString', {
  21432. 'configurable': true,
  21433. 'enumerable': false,
  21434. 'value': constant(string),
  21435. 'writable': true
  21436. });
  21437. };
  21438. /**
  21439. * The base implementation of `_.shuffle`.
  21440. *
  21441. * @private
  21442. * @param {Array|Object} collection The collection to shuffle.
  21443. * @returns {Array} Returns the new shuffled array.
  21444. */
  21445. function baseShuffle(collection) {
  21446. return shuffleSelf(values(collection));
  21447. }
  21448. /**
  21449. * The base implementation of `_.slice` without an iteratee call guard.
  21450. *
  21451. * @private
  21452. * @param {Array} array The array to slice.
  21453. * @param {number} [start=0] The start position.
  21454. * @param {number} [end=array.length] The end position.
  21455. * @returns {Array} Returns the slice of `array`.
  21456. */
  21457. function baseSlice(array, start, end) {
  21458. var index = -1,
  21459. length = array.length;
  21460. if (start < 0) {
  21461. start = -start > length ? 0 : (length + start);
  21462. }
  21463. end = end > length ? length : end;
  21464. if (end < 0) {
  21465. end += length;
  21466. }
  21467. length = start > end ? 0 : ((end - start) >>> 0);
  21468. start >>>= 0;
  21469. var result = Array(length);
  21470. while (++index < length) {
  21471. result[index] = array[index + start];
  21472. }
  21473. return result;
  21474. }
  21475. /**
  21476. * The base implementation of `_.some` without support for iteratee shorthands.
  21477. *
  21478. * @private
  21479. * @param {Array|Object} collection The collection to iterate over.
  21480. * @param {Function} predicate The function invoked per iteration.
  21481. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21482. * else `false`.
  21483. */
  21484. function baseSome(collection, predicate) {
  21485. var result;
  21486. baseEach(collection, function(value, index, collection) {
  21487. result = predicate(value, index, collection);
  21488. return !result;
  21489. });
  21490. return !!result;
  21491. }
  21492. /**
  21493. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21494. * performs a binary search of `array` to determine the index at which `value`
  21495. * should be inserted into `array` in order to maintain its sort order.
  21496. *
  21497. * @private
  21498. * @param {Array} array The sorted array to inspect.
  21499. * @param {*} value The value to evaluate.
  21500. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21501. * @returns {number} Returns the index at which `value` should be inserted
  21502. * into `array`.
  21503. */
  21504. function baseSortedIndex(array, value, retHighest) {
  21505. var low = 0,
  21506. high = array == null ? low : array.length;
  21507. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21508. while (low < high) {
  21509. var mid = (low + high) >>> 1,
  21510. computed = array[mid];
  21511. if (computed !== null && !isSymbol(computed) &&
  21512. (retHighest ? (computed <= value) : (computed < value))) {
  21513. low = mid + 1;
  21514. } else {
  21515. high = mid;
  21516. }
  21517. }
  21518. return high;
  21519. }
  21520. return baseSortedIndexBy(array, value, identity, retHighest);
  21521. }
  21522. /**
  21523. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21524. * which invokes `iteratee` for `value` and each element of `array` to compute
  21525. * their sort ranking. The iteratee is invoked with one argument; (value).
  21526. *
  21527. * @private
  21528. * @param {Array} array The sorted array to inspect.
  21529. * @param {*} value The value to evaluate.
  21530. * @param {Function} iteratee The iteratee invoked per element.
  21531. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21532. * @returns {number} Returns the index at which `value` should be inserted
  21533. * into `array`.
  21534. */
  21535. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21536. value = iteratee(value);
  21537. var low = 0,
  21538. high = array == null ? 0 : array.length,
  21539. valIsNaN = value !== value,
  21540. valIsNull = value === null,
  21541. valIsSymbol = isSymbol(value),
  21542. valIsUndefined = value === undefined;
  21543. while (low < high) {
  21544. var mid = nativeFloor((low + high) / 2),
  21545. computed = iteratee(array[mid]),
  21546. othIsDefined = computed !== undefined,
  21547. othIsNull = computed === null,
  21548. othIsReflexive = computed === computed,
  21549. othIsSymbol = isSymbol(computed);
  21550. if (valIsNaN) {
  21551. var setLow = retHighest || othIsReflexive;
  21552. } else if (valIsUndefined) {
  21553. setLow = othIsReflexive && (retHighest || othIsDefined);
  21554. } else if (valIsNull) {
  21555. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21556. } else if (valIsSymbol) {
  21557. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21558. } else if (othIsNull || othIsSymbol) {
  21559. setLow = false;
  21560. } else {
  21561. setLow = retHighest ? (computed <= value) : (computed < value);
  21562. }
  21563. if (setLow) {
  21564. low = mid + 1;
  21565. } else {
  21566. high = mid;
  21567. }
  21568. }
  21569. return nativeMin(high, MAX_ARRAY_INDEX);
  21570. }
  21571. /**
  21572. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21573. * support for iteratee shorthands.
  21574. *
  21575. * @private
  21576. * @param {Array} array The array to inspect.
  21577. * @param {Function} [iteratee] The iteratee invoked per element.
  21578. * @returns {Array} Returns the new duplicate free array.
  21579. */
  21580. function baseSortedUniq(array, iteratee) {
  21581. var index = -1,
  21582. length = array.length,
  21583. resIndex = 0,
  21584. result = [];
  21585. while (++index < length) {
  21586. var value = array[index],
  21587. computed = iteratee ? iteratee(value) : value;
  21588. if (!index || !eq(computed, seen)) {
  21589. var seen = computed;
  21590. result[resIndex++] = value === 0 ? 0 : value;
  21591. }
  21592. }
  21593. return result;
  21594. }
  21595. /**
  21596. * The base implementation of `_.toNumber` which doesn't ensure correct
  21597. * conversions of binary, hexadecimal, or octal string values.
  21598. *
  21599. * @private
  21600. * @param {*} value The value to process.
  21601. * @returns {number} Returns the number.
  21602. */
  21603. function baseToNumber(value) {
  21604. if (typeof value == 'number') {
  21605. return value;
  21606. }
  21607. if (isSymbol(value)) {
  21608. return NAN;
  21609. }
  21610. return +value;
  21611. }
  21612. /**
  21613. * The base implementation of `_.toString` which doesn't convert nullish
  21614. * values to empty strings.
  21615. *
  21616. * @private
  21617. * @param {*} value The value to process.
  21618. * @returns {string} Returns the string.
  21619. */
  21620. function baseToString(value) {
  21621. // Exit early for strings to avoid a performance hit in some environments.
  21622. if (typeof value == 'string') {
  21623. return value;
  21624. }
  21625. if (isArray(value)) {
  21626. // Recursively convert values (susceptible to call stack limits).
  21627. return arrayMap(value, baseToString) + '';
  21628. }
  21629. if (isSymbol(value)) {
  21630. return symbolToString ? symbolToString.call(value) : '';
  21631. }
  21632. var result = (value + '');
  21633. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21634. }
  21635. /**
  21636. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21637. *
  21638. * @private
  21639. * @param {Array} array The array to inspect.
  21640. * @param {Function} [iteratee] The iteratee invoked per element.
  21641. * @param {Function} [comparator] The comparator invoked per element.
  21642. * @returns {Array} Returns the new duplicate free array.
  21643. */
  21644. function baseUniq(array, iteratee, comparator) {
  21645. var index = -1,
  21646. includes = arrayIncludes,
  21647. length = array.length,
  21648. isCommon = true,
  21649. result = [],
  21650. seen = result;
  21651. if (comparator) {
  21652. isCommon = false;
  21653. includes = arrayIncludesWith;
  21654. }
  21655. else if (length >= LARGE_ARRAY_SIZE) {
  21656. var set = iteratee ? null : createSet(array);
  21657. if (set) {
  21658. return setToArray(set);
  21659. }
  21660. isCommon = false;
  21661. includes = cacheHas;
  21662. seen = new SetCache;
  21663. }
  21664. else {
  21665. seen = iteratee ? [] : result;
  21666. }
  21667. outer:
  21668. while (++index < length) {
  21669. var value = array[index],
  21670. computed = iteratee ? iteratee(value) : value;
  21671. value = (comparator || value !== 0) ? value : 0;
  21672. if (isCommon && computed === computed) {
  21673. var seenIndex = seen.length;
  21674. while (seenIndex--) {
  21675. if (seen[seenIndex] === computed) {
  21676. continue outer;
  21677. }
  21678. }
  21679. if (iteratee) {
  21680. seen.push(computed);
  21681. }
  21682. result.push(value);
  21683. }
  21684. else if (!includes(seen, computed, comparator)) {
  21685. if (seen !== result) {
  21686. seen.push(computed);
  21687. }
  21688. result.push(value);
  21689. }
  21690. }
  21691. return result;
  21692. }
  21693. /**
  21694. * The base implementation of `_.unset`.
  21695. *
  21696. * @private
  21697. * @param {Object} object The object to modify.
  21698. * @param {Array|string} path The property path to unset.
  21699. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21700. */
  21701. function baseUnset(object, path) {
  21702. path = castPath(path, object);
  21703. object = parent(object, path);
  21704. return object == null || delete object[toKey(last(path))];
  21705. }
  21706. /**
  21707. * The base implementation of `_.update`.
  21708. *
  21709. * @private
  21710. * @param {Object} object The object to modify.
  21711. * @param {Array|string} path The path of the property to update.
  21712. * @param {Function} updater The function to produce the updated value.
  21713. * @param {Function} [customizer] The function to customize path creation.
  21714. * @returns {Object} Returns `object`.
  21715. */
  21716. function baseUpdate(object, path, updater, customizer) {
  21717. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21718. }
  21719. /**
  21720. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21721. * without support for iteratee shorthands.
  21722. *
  21723. * @private
  21724. * @param {Array} array The array to query.
  21725. * @param {Function} predicate The function invoked per iteration.
  21726. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21727. * @param {boolean} [fromRight] Specify iterating from right to left.
  21728. * @returns {Array} Returns the slice of `array`.
  21729. */
  21730. function baseWhile(array, predicate, isDrop, fromRight) {
  21731. var length = array.length,
  21732. index = fromRight ? length : -1;
  21733. while ((fromRight ? index-- : ++index < length) &&
  21734. predicate(array[index], index, array)) {}
  21735. return isDrop
  21736. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21737. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21738. }
  21739. /**
  21740. * The base implementation of `wrapperValue` which returns the result of
  21741. * performing a sequence of actions on the unwrapped `value`, where each
  21742. * successive action is supplied the return value of the previous.
  21743. *
  21744. * @private
  21745. * @param {*} value The unwrapped value.
  21746. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21747. * @returns {*} Returns the resolved value.
  21748. */
  21749. function baseWrapperValue(value, actions) {
  21750. var result = value;
  21751. if (result instanceof LazyWrapper) {
  21752. result = result.value();
  21753. }
  21754. return arrayReduce(actions, function(result, action) {
  21755. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21756. }, result);
  21757. }
  21758. /**
  21759. * The base implementation of methods like `_.xor`, without support for
  21760. * iteratee shorthands, that accepts an array of arrays to inspect.
  21761. *
  21762. * @private
  21763. * @param {Array} arrays The arrays to inspect.
  21764. * @param {Function} [iteratee] The iteratee invoked per element.
  21765. * @param {Function} [comparator] The comparator invoked per element.
  21766. * @returns {Array} Returns the new array of values.
  21767. */
  21768. function baseXor(arrays, iteratee, comparator) {
  21769. var length = arrays.length;
  21770. if (length < 2) {
  21771. return length ? baseUniq(arrays[0]) : [];
  21772. }
  21773. var index = -1,
  21774. result = Array(length);
  21775. while (++index < length) {
  21776. var array = arrays[index],
  21777. othIndex = -1;
  21778. while (++othIndex < length) {
  21779. if (othIndex != index) {
  21780. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21781. }
  21782. }
  21783. }
  21784. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21785. }
  21786. /**
  21787. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21788. *
  21789. * @private
  21790. * @param {Array} props The property identifiers.
  21791. * @param {Array} values The property values.
  21792. * @param {Function} assignFunc The function to assign values.
  21793. * @returns {Object} Returns the new object.
  21794. */
  21795. function baseZipObject(props, values, assignFunc) {
  21796. var index = -1,
  21797. length = props.length,
  21798. valsLength = values.length,
  21799. result = {};
  21800. while (++index < length) {
  21801. var value = index < valsLength ? values[index] : undefined;
  21802. assignFunc(result, props[index], value);
  21803. }
  21804. return result;
  21805. }
  21806. /**
  21807. * Casts `value` to an empty array if it's not an array like object.
  21808. *
  21809. * @private
  21810. * @param {*} value The value to inspect.
  21811. * @returns {Array|Object} Returns the cast array-like object.
  21812. */
  21813. function castArrayLikeObject(value) {
  21814. return isArrayLikeObject(value) ? value : [];
  21815. }
  21816. /**
  21817. * Casts `value` to `identity` if it's not a function.
  21818. *
  21819. * @private
  21820. * @param {*} value The value to inspect.
  21821. * @returns {Function} Returns cast function.
  21822. */
  21823. function castFunction(value) {
  21824. return typeof value == 'function' ? value : identity;
  21825. }
  21826. /**
  21827. * Casts `value` to a path array if it's not one.
  21828. *
  21829. * @private
  21830. * @param {*} value The value to inspect.
  21831. * @param {Object} [object] The object to query keys on.
  21832. * @returns {Array} Returns the cast property path array.
  21833. */
  21834. function castPath(value, object) {
  21835. if (isArray(value)) {
  21836. return value;
  21837. }
  21838. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21839. }
  21840. /**
  21841. * A `baseRest` alias which can be replaced with `identity` by module
  21842. * replacement plugins.
  21843. *
  21844. * @private
  21845. * @type {Function}
  21846. * @param {Function} func The function to apply a rest parameter to.
  21847. * @returns {Function} Returns the new function.
  21848. */
  21849. var castRest = baseRest;
  21850. /**
  21851. * Casts `array` to a slice if it's needed.
  21852. *
  21853. * @private
  21854. * @param {Array} array The array to inspect.
  21855. * @param {number} start The start position.
  21856. * @param {number} [end=array.length] The end position.
  21857. * @returns {Array} Returns the cast slice.
  21858. */
  21859. function castSlice(array, start, end) {
  21860. var length = array.length;
  21861. end = end === undefined ? length : end;
  21862. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21863. }
  21864. /**
  21865. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21866. *
  21867. * @private
  21868. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21869. */
  21870. var clearTimeout = ctxClearTimeout || function(id) {
  21871. return root.clearTimeout(id);
  21872. };
  21873. /**
  21874. * Creates a clone of `buffer`.
  21875. *
  21876. * @private
  21877. * @param {Buffer} buffer The buffer to clone.
  21878. * @param {boolean} [isDeep] Specify a deep clone.
  21879. * @returns {Buffer} Returns the cloned buffer.
  21880. */
  21881. function cloneBuffer(buffer, isDeep) {
  21882. if (isDeep) {
  21883. return buffer.slice();
  21884. }
  21885. var length = buffer.length,
  21886. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21887. buffer.copy(result);
  21888. return result;
  21889. }
  21890. /**
  21891. * Creates a clone of `arrayBuffer`.
  21892. *
  21893. * @private
  21894. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  21895. * @returns {ArrayBuffer} Returns the cloned array buffer.
  21896. */
  21897. function cloneArrayBuffer(arrayBuffer) {
  21898. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  21899. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  21900. return result;
  21901. }
  21902. /**
  21903. * Creates a clone of `dataView`.
  21904. *
  21905. * @private
  21906. * @param {Object} dataView The data view to clone.
  21907. * @param {boolean} [isDeep] Specify a deep clone.
  21908. * @returns {Object} Returns the cloned data view.
  21909. */
  21910. function cloneDataView(dataView, isDeep) {
  21911. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  21912. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  21913. }
  21914. /**
  21915. * Creates a clone of `regexp`.
  21916. *
  21917. * @private
  21918. * @param {Object} regexp The regexp to clone.
  21919. * @returns {Object} Returns the cloned regexp.
  21920. */
  21921. function cloneRegExp(regexp) {
  21922. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  21923. result.lastIndex = regexp.lastIndex;
  21924. return result;
  21925. }
  21926. /**
  21927. * Creates a clone of the `symbol` object.
  21928. *
  21929. * @private
  21930. * @param {Object} symbol The symbol object to clone.
  21931. * @returns {Object} Returns the cloned symbol object.
  21932. */
  21933. function cloneSymbol(symbol) {
  21934. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  21935. }
  21936. /**
  21937. * Creates a clone of `typedArray`.
  21938. *
  21939. * @private
  21940. * @param {Object} typedArray The typed array to clone.
  21941. * @param {boolean} [isDeep] Specify a deep clone.
  21942. * @returns {Object} Returns the cloned typed array.
  21943. */
  21944. function cloneTypedArray(typedArray, isDeep) {
  21945. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  21946. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  21947. }
  21948. /**
  21949. * Compares values to sort them in ascending order.
  21950. *
  21951. * @private
  21952. * @param {*} value The value to compare.
  21953. * @param {*} other The other value to compare.
  21954. * @returns {number} Returns the sort order indicator for `value`.
  21955. */
  21956. function compareAscending(value, other) {
  21957. if (value !== other) {
  21958. var valIsDefined = value !== undefined,
  21959. valIsNull = value === null,
  21960. valIsReflexive = value === value,
  21961. valIsSymbol = isSymbol(value);
  21962. var othIsDefined = other !== undefined,
  21963. othIsNull = other === null,
  21964. othIsReflexive = other === other,
  21965. othIsSymbol = isSymbol(other);
  21966. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  21967. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  21968. (valIsNull && othIsDefined && othIsReflexive) ||
  21969. (!valIsDefined && othIsReflexive) ||
  21970. !valIsReflexive) {
  21971. return 1;
  21972. }
  21973. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  21974. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  21975. (othIsNull && valIsDefined && valIsReflexive) ||
  21976. (!othIsDefined && valIsReflexive) ||
  21977. !othIsReflexive) {
  21978. return -1;
  21979. }
  21980. }
  21981. return 0;
  21982. }
  21983. /**
  21984. * Used by `_.orderBy` to compare multiple properties of a value to another
  21985. * and stable sort them.
  21986. *
  21987. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  21988. * specify an order of "desc" for descending or "asc" for ascending sort order
  21989. * of corresponding values.
  21990. *
  21991. * @private
  21992. * @param {Object} object The object to compare.
  21993. * @param {Object} other The other object to compare.
  21994. * @param {boolean[]|string[]} orders The order to sort by for each property.
  21995. * @returns {number} Returns the sort order indicator for `object`.
  21996. */
  21997. function compareMultiple(object, other, orders) {
  21998. var index = -1,
  21999. objCriteria = object.criteria,
  22000. othCriteria = other.criteria,
  22001. length = objCriteria.length,
  22002. ordersLength = orders.length;
  22003. while (++index < length) {
  22004. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22005. if (result) {
  22006. if (index >= ordersLength) {
  22007. return result;
  22008. }
  22009. var order = orders[index];
  22010. return result * (order == 'desc' ? -1 : 1);
  22011. }
  22012. }
  22013. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22014. // that causes it, under certain circumstances, to provide the same value for
  22015. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22016. // for more details.
  22017. //
  22018. // This also ensures a stable sort in V8 and other engines.
  22019. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22020. return object.index - other.index;
  22021. }
  22022. /**
  22023. * Creates an array that is the composition of partially applied arguments,
  22024. * placeholders, and provided arguments into a single array of arguments.
  22025. *
  22026. * @private
  22027. * @param {Array} args The provided arguments.
  22028. * @param {Array} partials The arguments to prepend to those provided.
  22029. * @param {Array} holders The `partials` placeholder indexes.
  22030. * @params {boolean} [isCurried] Specify composing for a curried function.
  22031. * @returns {Array} Returns the new array of composed arguments.
  22032. */
  22033. function composeArgs(args, partials, holders, isCurried) {
  22034. var argsIndex = -1,
  22035. argsLength = args.length,
  22036. holdersLength = holders.length,
  22037. leftIndex = -1,
  22038. leftLength = partials.length,
  22039. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22040. result = Array(leftLength + rangeLength),
  22041. isUncurried = !isCurried;
  22042. while (++leftIndex < leftLength) {
  22043. result[leftIndex] = partials[leftIndex];
  22044. }
  22045. while (++argsIndex < holdersLength) {
  22046. if (isUncurried || argsIndex < argsLength) {
  22047. result[holders[argsIndex]] = args[argsIndex];
  22048. }
  22049. }
  22050. while (rangeLength--) {
  22051. result[leftIndex++] = args[argsIndex++];
  22052. }
  22053. return result;
  22054. }
  22055. /**
  22056. * This function is like `composeArgs` except that the arguments composition
  22057. * is tailored for `_.partialRight`.
  22058. *
  22059. * @private
  22060. * @param {Array} args The provided arguments.
  22061. * @param {Array} partials The arguments to append to those provided.
  22062. * @param {Array} holders The `partials` placeholder indexes.
  22063. * @params {boolean} [isCurried] Specify composing for a curried function.
  22064. * @returns {Array} Returns the new array of composed arguments.
  22065. */
  22066. function composeArgsRight(args, partials, holders, isCurried) {
  22067. var argsIndex = -1,
  22068. argsLength = args.length,
  22069. holdersIndex = -1,
  22070. holdersLength = holders.length,
  22071. rightIndex = -1,
  22072. rightLength = partials.length,
  22073. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22074. result = Array(rangeLength + rightLength),
  22075. isUncurried = !isCurried;
  22076. while (++argsIndex < rangeLength) {
  22077. result[argsIndex] = args[argsIndex];
  22078. }
  22079. var offset = argsIndex;
  22080. while (++rightIndex < rightLength) {
  22081. result[offset + rightIndex] = partials[rightIndex];
  22082. }
  22083. while (++holdersIndex < holdersLength) {
  22084. if (isUncurried || argsIndex < argsLength) {
  22085. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22086. }
  22087. }
  22088. return result;
  22089. }
  22090. /**
  22091. * Copies the values of `source` to `array`.
  22092. *
  22093. * @private
  22094. * @param {Array} source The array to copy values from.
  22095. * @param {Array} [array=[]] The array to copy values to.
  22096. * @returns {Array} Returns `array`.
  22097. */
  22098. function copyArray(source, array) {
  22099. var index = -1,
  22100. length = source.length;
  22101. array || (array = Array(length));
  22102. while (++index < length) {
  22103. array[index] = source[index];
  22104. }
  22105. return array;
  22106. }
  22107. /**
  22108. * Copies properties of `source` to `object`.
  22109. *
  22110. * @private
  22111. * @param {Object} source The object to copy properties from.
  22112. * @param {Array} props The property identifiers to copy.
  22113. * @param {Object} [object={}] The object to copy properties to.
  22114. * @param {Function} [customizer] The function to customize copied values.
  22115. * @returns {Object} Returns `object`.
  22116. */
  22117. function copyObject(source, props, object, customizer) {
  22118. var isNew = !object;
  22119. object || (object = {});
  22120. var index = -1,
  22121. length = props.length;
  22122. while (++index < length) {
  22123. var key = props[index];
  22124. var newValue = customizer
  22125. ? customizer(object[key], source[key], key, object, source)
  22126. : undefined;
  22127. if (newValue === undefined) {
  22128. newValue = source[key];
  22129. }
  22130. if (isNew) {
  22131. baseAssignValue(object, key, newValue);
  22132. } else {
  22133. assignValue(object, key, newValue);
  22134. }
  22135. }
  22136. return object;
  22137. }
  22138. /**
  22139. * Copies own symbols of `source` to `object`.
  22140. *
  22141. * @private
  22142. * @param {Object} source The object to copy symbols from.
  22143. * @param {Object} [object={}] The object to copy symbols to.
  22144. * @returns {Object} Returns `object`.
  22145. */
  22146. function copySymbols(source, object) {
  22147. return copyObject(source, getSymbols(source), object);
  22148. }
  22149. /**
  22150. * Copies own and inherited symbols of `source` to `object`.
  22151. *
  22152. * @private
  22153. * @param {Object} source The object to copy symbols from.
  22154. * @param {Object} [object={}] The object to copy symbols to.
  22155. * @returns {Object} Returns `object`.
  22156. */
  22157. function copySymbolsIn(source, object) {
  22158. return copyObject(source, getSymbolsIn(source), object);
  22159. }
  22160. /**
  22161. * Creates a function like `_.groupBy`.
  22162. *
  22163. * @private
  22164. * @param {Function} setter The function to set accumulator values.
  22165. * @param {Function} [initializer] The accumulator object initializer.
  22166. * @returns {Function} Returns the new aggregator function.
  22167. */
  22168. function createAggregator(setter, initializer) {
  22169. return function(collection, iteratee) {
  22170. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22171. accumulator = initializer ? initializer() : {};
  22172. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22173. };
  22174. }
  22175. /**
  22176. * Creates a function like `_.assign`.
  22177. *
  22178. * @private
  22179. * @param {Function} assigner The function to assign values.
  22180. * @returns {Function} Returns the new assigner function.
  22181. */
  22182. function createAssigner(assigner) {
  22183. return baseRest(function(object, sources) {
  22184. var index = -1,
  22185. length = sources.length,
  22186. customizer = length > 1 ? sources[length - 1] : undefined,
  22187. guard = length > 2 ? sources[2] : undefined;
  22188. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22189. ? (length--, customizer)
  22190. : undefined;
  22191. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22192. customizer = length < 3 ? undefined : customizer;
  22193. length = 1;
  22194. }
  22195. object = Object(object);
  22196. while (++index < length) {
  22197. var source = sources[index];
  22198. if (source) {
  22199. assigner(object, source, index, customizer);
  22200. }
  22201. }
  22202. return object;
  22203. });
  22204. }
  22205. /**
  22206. * Creates a `baseEach` or `baseEachRight` function.
  22207. *
  22208. * @private
  22209. * @param {Function} eachFunc The function to iterate over a collection.
  22210. * @param {boolean} [fromRight] Specify iterating from right to left.
  22211. * @returns {Function} Returns the new base function.
  22212. */
  22213. function createBaseEach(eachFunc, fromRight) {
  22214. return function(collection, iteratee) {
  22215. if (collection == null) {
  22216. return collection;
  22217. }
  22218. if (!isArrayLike(collection)) {
  22219. return eachFunc(collection, iteratee);
  22220. }
  22221. var length = collection.length,
  22222. index = fromRight ? length : -1,
  22223. iterable = Object(collection);
  22224. while ((fromRight ? index-- : ++index < length)) {
  22225. if (iteratee(iterable[index], index, iterable) === false) {
  22226. break;
  22227. }
  22228. }
  22229. return collection;
  22230. };
  22231. }
  22232. /**
  22233. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22234. *
  22235. * @private
  22236. * @param {boolean} [fromRight] Specify iterating from right to left.
  22237. * @returns {Function} Returns the new base function.
  22238. */
  22239. function createBaseFor(fromRight) {
  22240. return function(object, iteratee, keysFunc) {
  22241. var index = -1,
  22242. iterable = Object(object),
  22243. props = keysFunc(object),
  22244. length = props.length;
  22245. while (length--) {
  22246. var key = props[fromRight ? length : ++index];
  22247. if (iteratee(iterable[key], key, iterable) === false) {
  22248. break;
  22249. }
  22250. }
  22251. return object;
  22252. };
  22253. }
  22254. /**
  22255. * Creates a function that wraps `func` to invoke it with the optional `this`
  22256. * binding of `thisArg`.
  22257. *
  22258. * @private
  22259. * @param {Function} func The function to wrap.
  22260. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22261. * @param {*} [thisArg] The `this` binding of `func`.
  22262. * @returns {Function} Returns the new wrapped function.
  22263. */
  22264. function createBind(func, bitmask, thisArg) {
  22265. var isBind = bitmask & WRAP_BIND_FLAG,
  22266. Ctor = createCtor(func);
  22267. function wrapper() {
  22268. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22269. return fn.apply(isBind ? thisArg : this, arguments);
  22270. }
  22271. return wrapper;
  22272. }
  22273. /**
  22274. * Creates a function like `_.lowerFirst`.
  22275. *
  22276. * @private
  22277. * @param {string} methodName The name of the `String` case method to use.
  22278. * @returns {Function} Returns the new case function.
  22279. */
  22280. function createCaseFirst(methodName) {
  22281. return function(string) {
  22282. string = toString(string);
  22283. var strSymbols = hasUnicode(string)
  22284. ? stringToArray(string)
  22285. : undefined;
  22286. var chr = strSymbols
  22287. ? strSymbols[0]
  22288. : string.charAt(0);
  22289. var trailing = strSymbols
  22290. ? castSlice(strSymbols, 1).join('')
  22291. : string.slice(1);
  22292. return chr[methodName]() + trailing;
  22293. };
  22294. }
  22295. /**
  22296. * Creates a function like `_.camelCase`.
  22297. *
  22298. * @private
  22299. * @param {Function} callback The function to combine each word.
  22300. * @returns {Function} Returns the new compounder function.
  22301. */
  22302. function createCompounder(callback) {
  22303. return function(string) {
  22304. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22305. };
  22306. }
  22307. /**
  22308. * Creates a function that produces an instance of `Ctor` regardless of
  22309. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22310. *
  22311. * @private
  22312. * @param {Function} Ctor The constructor to wrap.
  22313. * @returns {Function} Returns the new wrapped function.
  22314. */
  22315. function createCtor(Ctor) {
  22316. return function() {
  22317. // Use a `switch` statement to work with class constructors. See
  22318. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22319. // for more details.
  22320. var args = arguments;
  22321. switch (args.length) {
  22322. case 0: return new Ctor;
  22323. case 1: return new Ctor(args[0]);
  22324. case 2: return new Ctor(args[0], args[1]);
  22325. case 3: return new Ctor(args[0], args[1], args[2]);
  22326. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22327. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22328. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22329. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22330. }
  22331. var thisBinding = baseCreate(Ctor.prototype),
  22332. result = Ctor.apply(thisBinding, args);
  22333. // Mimic the constructor's `return` behavior.
  22334. // See https://es5.github.io/#x13.2.2 for more details.
  22335. return isObject(result) ? result : thisBinding;
  22336. };
  22337. }
  22338. /**
  22339. * Creates a function that wraps `func` to enable currying.
  22340. *
  22341. * @private
  22342. * @param {Function} func The function to wrap.
  22343. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22344. * @param {number} arity The arity of `func`.
  22345. * @returns {Function} Returns the new wrapped function.
  22346. */
  22347. function createCurry(func, bitmask, arity) {
  22348. var Ctor = createCtor(func);
  22349. function wrapper() {
  22350. var length = arguments.length,
  22351. args = Array(length),
  22352. index = length,
  22353. placeholder = getHolder(wrapper);
  22354. while (index--) {
  22355. args[index] = arguments[index];
  22356. }
  22357. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22358. ? []
  22359. : replaceHolders(args, placeholder);
  22360. length -= holders.length;
  22361. if (length < arity) {
  22362. return createRecurry(
  22363. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22364. args, holders, undefined, undefined, arity - length);
  22365. }
  22366. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22367. return apply(fn, this, args);
  22368. }
  22369. return wrapper;
  22370. }
  22371. /**
  22372. * Creates a `_.find` or `_.findLast` function.
  22373. *
  22374. * @private
  22375. * @param {Function} findIndexFunc The function to find the collection index.
  22376. * @returns {Function} Returns the new find function.
  22377. */
  22378. function createFind(findIndexFunc) {
  22379. return function(collection, predicate, fromIndex) {
  22380. var iterable = Object(collection);
  22381. if (!isArrayLike(collection)) {
  22382. var iteratee = getIteratee(predicate, 3);
  22383. collection = keys(collection);
  22384. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22385. }
  22386. var index = findIndexFunc(collection, predicate, fromIndex);
  22387. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22388. };
  22389. }
  22390. /**
  22391. * Creates a `_.flow` or `_.flowRight` function.
  22392. *
  22393. * @private
  22394. * @param {boolean} [fromRight] Specify iterating from right to left.
  22395. * @returns {Function} Returns the new flow function.
  22396. */
  22397. function createFlow(fromRight) {
  22398. return flatRest(function(funcs) {
  22399. var length = funcs.length,
  22400. index = length,
  22401. prereq = LodashWrapper.prototype.thru;
  22402. if (fromRight) {
  22403. funcs.reverse();
  22404. }
  22405. while (index--) {
  22406. var func = funcs[index];
  22407. if (typeof func != 'function') {
  22408. throw new TypeError(FUNC_ERROR_TEXT);
  22409. }
  22410. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22411. var wrapper = new LodashWrapper([], true);
  22412. }
  22413. }
  22414. index = wrapper ? index : length;
  22415. while (++index < length) {
  22416. func = funcs[index];
  22417. var funcName = getFuncName(func),
  22418. data = funcName == 'wrapper' ? getData(func) : undefined;
  22419. if (data && isLaziable(data[0]) &&
  22420. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22421. !data[4].length && data[9] == 1
  22422. ) {
  22423. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22424. } else {
  22425. wrapper = (func.length == 1 && isLaziable(func))
  22426. ? wrapper[funcName]()
  22427. : wrapper.thru(func);
  22428. }
  22429. }
  22430. return function() {
  22431. var args = arguments,
  22432. value = args[0];
  22433. if (wrapper && args.length == 1 && isArray(value)) {
  22434. return wrapper.plant(value).value();
  22435. }
  22436. var index = 0,
  22437. result = length ? funcs[index].apply(this, args) : value;
  22438. while (++index < length) {
  22439. result = funcs[index].call(this, result);
  22440. }
  22441. return result;
  22442. };
  22443. });
  22444. }
  22445. /**
  22446. * Creates a function that wraps `func` to invoke it with optional `this`
  22447. * binding of `thisArg`, partial application, and currying.
  22448. *
  22449. * @private
  22450. * @param {Function|string} func The function or method name to wrap.
  22451. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22452. * @param {*} [thisArg] The `this` binding of `func`.
  22453. * @param {Array} [partials] The arguments to prepend to those provided to
  22454. * the new function.
  22455. * @param {Array} [holders] The `partials` placeholder indexes.
  22456. * @param {Array} [partialsRight] The arguments to append to those provided
  22457. * to the new function.
  22458. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22459. * @param {Array} [argPos] The argument positions of the new function.
  22460. * @param {number} [ary] The arity cap of `func`.
  22461. * @param {number} [arity] The arity of `func`.
  22462. * @returns {Function} Returns the new wrapped function.
  22463. */
  22464. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22465. var isAry = bitmask & WRAP_ARY_FLAG,
  22466. isBind = bitmask & WRAP_BIND_FLAG,
  22467. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22468. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22469. isFlip = bitmask & WRAP_FLIP_FLAG,
  22470. Ctor = isBindKey ? undefined : createCtor(func);
  22471. function wrapper() {
  22472. var length = arguments.length,
  22473. args = Array(length),
  22474. index = length;
  22475. while (index--) {
  22476. args[index] = arguments[index];
  22477. }
  22478. if (isCurried) {
  22479. var placeholder = getHolder(wrapper),
  22480. holdersCount = countHolders(args, placeholder);
  22481. }
  22482. if (partials) {
  22483. args = composeArgs(args, partials, holders, isCurried);
  22484. }
  22485. if (partialsRight) {
  22486. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22487. }
  22488. length -= holdersCount;
  22489. if (isCurried && length < arity) {
  22490. var newHolders = replaceHolders(args, placeholder);
  22491. return createRecurry(
  22492. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22493. args, newHolders, argPos, ary, arity - length
  22494. );
  22495. }
  22496. var thisBinding = isBind ? thisArg : this,
  22497. fn = isBindKey ? thisBinding[func] : func;
  22498. length = args.length;
  22499. if (argPos) {
  22500. args = reorder(args, argPos);
  22501. } else if (isFlip && length > 1) {
  22502. args.reverse();
  22503. }
  22504. if (isAry && ary < length) {
  22505. args.length = ary;
  22506. }
  22507. if (this && this !== root && this instanceof wrapper) {
  22508. fn = Ctor || createCtor(fn);
  22509. }
  22510. return fn.apply(thisBinding, args);
  22511. }
  22512. return wrapper;
  22513. }
  22514. /**
  22515. * Creates a function like `_.invertBy`.
  22516. *
  22517. * @private
  22518. * @param {Function} setter The function to set accumulator values.
  22519. * @param {Function} toIteratee The function to resolve iteratees.
  22520. * @returns {Function} Returns the new inverter function.
  22521. */
  22522. function createInverter(setter, toIteratee) {
  22523. return function(object, iteratee) {
  22524. return baseInverter(object, setter, toIteratee(iteratee), {});
  22525. };
  22526. }
  22527. /**
  22528. * Creates a function that performs a mathematical operation on two values.
  22529. *
  22530. * @private
  22531. * @param {Function} operator The function to perform the operation.
  22532. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22533. * @returns {Function} Returns the new mathematical operation function.
  22534. */
  22535. function createMathOperation(operator, defaultValue) {
  22536. return function(value, other) {
  22537. var result;
  22538. if (value === undefined && other === undefined) {
  22539. return defaultValue;
  22540. }
  22541. if (value !== undefined) {
  22542. result = value;
  22543. }
  22544. if (other !== undefined) {
  22545. if (result === undefined) {
  22546. return other;
  22547. }
  22548. if (typeof value == 'string' || typeof other == 'string') {
  22549. value = baseToString(value);
  22550. other = baseToString(other);
  22551. } else {
  22552. value = baseToNumber(value);
  22553. other = baseToNumber(other);
  22554. }
  22555. result = operator(value, other);
  22556. }
  22557. return result;
  22558. };
  22559. }
  22560. /**
  22561. * Creates a function like `_.over`.
  22562. *
  22563. * @private
  22564. * @param {Function} arrayFunc The function to iterate over iteratees.
  22565. * @returns {Function} Returns the new over function.
  22566. */
  22567. function createOver(arrayFunc) {
  22568. return flatRest(function(iteratees) {
  22569. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22570. return baseRest(function(args) {
  22571. var thisArg = this;
  22572. return arrayFunc(iteratees, function(iteratee) {
  22573. return apply(iteratee, thisArg, args);
  22574. });
  22575. });
  22576. });
  22577. }
  22578. /**
  22579. * Creates the padding for `string` based on `length`. The `chars` string
  22580. * is truncated if the number of characters exceeds `length`.
  22581. *
  22582. * @private
  22583. * @param {number} length The padding length.
  22584. * @param {string} [chars=' '] The string used as padding.
  22585. * @returns {string} Returns the padding for `string`.
  22586. */
  22587. function createPadding(length, chars) {
  22588. chars = chars === undefined ? ' ' : baseToString(chars);
  22589. var charsLength = chars.length;
  22590. if (charsLength < 2) {
  22591. return charsLength ? baseRepeat(chars, length) : chars;
  22592. }
  22593. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22594. return hasUnicode(chars)
  22595. ? castSlice(stringToArray(result), 0, length).join('')
  22596. : result.slice(0, length);
  22597. }
  22598. /**
  22599. * Creates a function that wraps `func` to invoke it with the `this` binding
  22600. * of `thisArg` and `partials` prepended to the arguments it receives.
  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 {*} thisArg The `this` binding of `func`.
  22606. * @param {Array} partials The arguments to prepend to those provided to
  22607. * the new function.
  22608. * @returns {Function} Returns the new wrapped function.
  22609. */
  22610. function createPartial(func, bitmask, thisArg, partials) {
  22611. var isBind = bitmask & WRAP_BIND_FLAG,
  22612. Ctor = createCtor(func);
  22613. function wrapper() {
  22614. var argsIndex = -1,
  22615. argsLength = arguments.length,
  22616. leftIndex = -1,
  22617. leftLength = partials.length,
  22618. args = Array(leftLength + argsLength),
  22619. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22620. while (++leftIndex < leftLength) {
  22621. args[leftIndex] = partials[leftIndex];
  22622. }
  22623. while (argsLength--) {
  22624. args[leftIndex++] = arguments[++argsIndex];
  22625. }
  22626. return apply(fn, isBind ? thisArg : this, args);
  22627. }
  22628. return wrapper;
  22629. }
  22630. /**
  22631. * Creates a `_.range` or `_.rangeRight` function.
  22632. *
  22633. * @private
  22634. * @param {boolean} [fromRight] Specify iterating from right to left.
  22635. * @returns {Function} Returns the new range function.
  22636. */
  22637. function createRange(fromRight) {
  22638. return function(start, end, step) {
  22639. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22640. end = step = undefined;
  22641. }
  22642. // Ensure the sign of `-0` is preserved.
  22643. start = toFinite(start);
  22644. if (end === undefined) {
  22645. end = start;
  22646. start = 0;
  22647. } else {
  22648. end = toFinite(end);
  22649. }
  22650. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22651. return baseRange(start, end, step, fromRight);
  22652. };
  22653. }
  22654. /**
  22655. * Creates a function that performs a relational operation on two values.
  22656. *
  22657. * @private
  22658. * @param {Function} operator The function to perform the operation.
  22659. * @returns {Function} Returns the new relational operation function.
  22660. */
  22661. function createRelationalOperation(operator) {
  22662. return function(value, other) {
  22663. if (!(typeof value == 'string' && typeof other == 'string')) {
  22664. value = toNumber(value);
  22665. other = toNumber(other);
  22666. }
  22667. return operator(value, other);
  22668. };
  22669. }
  22670. /**
  22671. * Creates a function that wraps `func` to continue currying.
  22672. *
  22673. * @private
  22674. * @param {Function} func The function to wrap.
  22675. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22676. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22677. * @param {*} placeholder The placeholder value.
  22678. * @param {*} [thisArg] The `this` binding of `func`.
  22679. * @param {Array} [partials] The arguments to prepend to those provided to
  22680. * the new function.
  22681. * @param {Array} [holders] The `partials` placeholder indexes.
  22682. * @param {Array} [argPos] The argument positions of the new function.
  22683. * @param {number} [ary] The arity cap of `func`.
  22684. * @param {number} [arity] The arity of `func`.
  22685. * @returns {Function} Returns the new wrapped function.
  22686. */
  22687. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22688. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22689. newHolders = isCurry ? holders : undefined,
  22690. newHoldersRight = isCurry ? undefined : holders,
  22691. newPartials = isCurry ? partials : undefined,
  22692. newPartialsRight = isCurry ? undefined : partials;
  22693. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22694. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22695. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22696. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22697. }
  22698. var newData = [
  22699. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22700. newHoldersRight, argPos, ary, arity
  22701. ];
  22702. var result = wrapFunc.apply(undefined, newData);
  22703. if (isLaziable(func)) {
  22704. setData(result, newData);
  22705. }
  22706. result.placeholder = placeholder;
  22707. return setWrapToString(result, func, bitmask);
  22708. }
  22709. /**
  22710. * Creates a function like `_.round`.
  22711. *
  22712. * @private
  22713. * @param {string} methodName The name of the `Math` method to use when rounding.
  22714. * @returns {Function} Returns the new round function.
  22715. */
  22716. function createRound(methodName) {
  22717. var func = Math[methodName];
  22718. return function(number, precision) {
  22719. number = toNumber(number);
  22720. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22721. if (precision && nativeIsFinite(number)) {
  22722. // Shift with exponential notation to avoid floating-point issues.
  22723. // See [MDN](https://mdn.io/round#Examples) for more details.
  22724. var pair = (toString(number) + 'e').split('e'),
  22725. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22726. pair = (toString(value) + 'e').split('e');
  22727. return +(pair[0] + 'e' + (+pair[1] - precision));
  22728. }
  22729. return func(number);
  22730. };
  22731. }
  22732. /**
  22733. * Creates a set object of `values`.
  22734. *
  22735. * @private
  22736. * @param {Array} values The values to add to the set.
  22737. * @returns {Object} Returns the new set.
  22738. */
  22739. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22740. return new Set(values);
  22741. };
  22742. /**
  22743. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22744. *
  22745. * @private
  22746. * @param {Function} keysFunc The function to get the keys of a given object.
  22747. * @returns {Function} Returns the new pairs function.
  22748. */
  22749. function createToPairs(keysFunc) {
  22750. return function(object) {
  22751. var tag = getTag(object);
  22752. if (tag == mapTag) {
  22753. return mapToArray(object);
  22754. }
  22755. if (tag == setTag) {
  22756. return setToPairs(object);
  22757. }
  22758. return baseToPairs(object, keysFunc(object));
  22759. };
  22760. }
  22761. /**
  22762. * Creates a function that either curries or invokes `func` with optional
  22763. * `this` binding and partially applied arguments.
  22764. *
  22765. * @private
  22766. * @param {Function|string} func The function or method name to wrap.
  22767. * @param {number} bitmask The bitmask flags.
  22768. * 1 - `_.bind`
  22769. * 2 - `_.bindKey`
  22770. * 4 - `_.curry` or `_.curryRight` of a bound function
  22771. * 8 - `_.curry`
  22772. * 16 - `_.curryRight`
  22773. * 32 - `_.partial`
  22774. * 64 - `_.partialRight`
  22775. * 128 - `_.rearg`
  22776. * 256 - `_.ary`
  22777. * 512 - `_.flip`
  22778. * @param {*} [thisArg] The `this` binding of `func`.
  22779. * @param {Array} [partials] The arguments to be partially applied.
  22780. * @param {Array} [holders] The `partials` placeholder indexes.
  22781. * @param {Array} [argPos] The argument positions of the new function.
  22782. * @param {number} [ary] The arity cap of `func`.
  22783. * @param {number} [arity] The arity of `func`.
  22784. * @returns {Function} Returns the new wrapped function.
  22785. */
  22786. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22787. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22788. if (!isBindKey && typeof func != 'function') {
  22789. throw new TypeError(FUNC_ERROR_TEXT);
  22790. }
  22791. var length = partials ? partials.length : 0;
  22792. if (!length) {
  22793. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22794. partials = holders = undefined;
  22795. }
  22796. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22797. arity = arity === undefined ? arity : toInteger(arity);
  22798. length -= holders ? holders.length : 0;
  22799. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22800. var partialsRight = partials,
  22801. holdersRight = holders;
  22802. partials = holders = undefined;
  22803. }
  22804. var data = isBindKey ? undefined : getData(func);
  22805. var newData = [
  22806. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22807. argPos, ary, arity
  22808. ];
  22809. if (data) {
  22810. mergeData(newData, data);
  22811. }
  22812. func = newData[0];
  22813. bitmask = newData[1];
  22814. thisArg = newData[2];
  22815. partials = newData[3];
  22816. holders = newData[4];
  22817. arity = newData[9] = newData[9] === undefined
  22818. ? (isBindKey ? 0 : func.length)
  22819. : nativeMax(newData[9] - length, 0);
  22820. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22821. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22822. }
  22823. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22824. var result = createBind(func, bitmask, thisArg);
  22825. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22826. result = createCurry(func, bitmask, arity);
  22827. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22828. result = createPartial(func, bitmask, thisArg, partials);
  22829. } else {
  22830. result = createHybrid.apply(undefined, newData);
  22831. }
  22832. var setter = data ? baseSetData : setData;
  22833. return setWrapToString(setter(result, newData), func, bitmask);
  22834. }
  22835. /**
  22836. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22837. * of source objects to the destination object for all destination properties
  22838. * that resolve to `undefined`.
  22839. *
  22840. * @private
  22841. * @param {*} objValue The destination value.
  22842. * @param {*} srcValue The source value.
  22843. * @param {string} key The key of the property to assign.
  22844. * @param {Object} object The parent object of `objValue`.
  22845. * @returns {*} Returns the value to assign.
  22846. */
  22847. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22848. if (objValue === undefined ||
  22849. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22850. return srcValue;
  22851. }
  22852. return objValue;
  22853. }
  22854. /**
  22855. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22856. * objects into destination objects that are passed thru.
  22857. *
  22858. * @private
  22859. * @param {*} objValue The destination value.
  22860. * @param {*} srcValue The source value.
  22861. * @param {string} key The key of the property to merge.
  22862. * @param {Object} object The parent object of `objValue`.
  22863. * @param {Object} source The parent object of `srcValue`.
  22864. * @param {Object} [stack] Tracks traversed source values and their merged
  22865. * counterparts.
  22866. * @returns {*} Returns the value to assign.
  22867. */
  22868. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22869. if (isObject(objValue) && isObject(srcValue)) {
  22870. // Recursively merge objects and arrays (susceptible to call stack limits).
  22871. stack.set(srcValue, objValue);
  22872. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22873. stack['delete'](srcValue);
  22874. }
  22875. return objValue;
  22876. }
  22877. /**
  22878. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22879. * objects.
  22880. *
  22881. * @private
  22882. * @param {*} value The value to inspect.
  22883. * @param {string} key The key of the property to inspect.
  22884. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22885. */
  22886. function customOmitClone(value) {
  22887. return isPlainObject(value) ? undefined : value;
  22888. }
  22889. /**
  22890. * A specialized version of `baseIsEqualDeep` for arrays with support for
  22891. * partial deep comparisons.
  22892. *
  22893. * @private
  22894. * @param {Array} array The array to compare.
  22895. * @param {Array} other The other array to compare.
  22896. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22897. * @param {Function} customizer The function to customize comparisons.
  22898. * @param {Function} equalFunc The function to determine equivalents of values.
  22899. * @param {Object} stack Tracks traversed `array` and `other` objects.
  22900. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  22901. */
  22902. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  22903. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  22904. arrLength = array.length,
  22905. othLength = other.length;
  22906. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  22907. return false;
  22908. }
  22909. // Assume cyclic values are equal.
  22910. var stacked = stack.get(array);
  22911. if (stacked && stack.get(other)) {
  22912. return stacked == other;
  22913. }
  22914. var index = -1,
  22915. result = true,
  22916. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  22917. stack.set(array, other);
  22918. stack.set(other, array);
  22919. // Ignore non-index properties.
  22920. while (++index < arrLength) {
  22921. var arrValue = array[index],
  22922. othValue = other[index];
  22923. if (customizer) {
  22924. var compared = isPartial
  22925. ? customizer(othValue, arrValue, index, other, array, stack)
  22926. : customizer(arrValue, othValue, index, array, other, stack);
  22927. }
  22928. if (compared !== undefined) {
  22929. if (compared) {
  22930. continue;
  22931. }
  22932. result = false;
  22933. break;
  22934. }
  22935. // Recursively compare arrays (susceptible to call stack limits).
  22936. if (seen) {
  22937. if (!arraySome(other, function(othValue, othIndex) {
  22938. if (!cacheHas(seen, othIndex) &&
  22939. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  22940. return seen.push(othIndex);
  22941. }
  22942. })) {
  22943. result = false;
  22944. break;
  22945. }
  22946. } else if (!(
  22947. arrValue === othValue ||
  22948. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  22949. )) {
  22950. result = false;
  22951. break;
  22952. }
  22953. }
  22954. stack['delete'](array);
  22955. stack['delete'](other);
  22956. return result;
  22957. }
  22958. /**
  22959. * A specialized version of `baseIsEqualDeep` for comparing objects of
  22960. * the same `toStringTag`.
  22961. *
  22962. * **Note:** This function only supports comparing values with tags of
  22963. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  22964. *
  22965. * @private
  22966. * @param {Object} object The object to compare.
  22967. * @param {Object} other The other object to compare.
  22968. * @param {string} tag The `toStringTag` of the objects to compare.
  22969. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22970. * @param {Function} customizer The function to customize comparisons.
  22971. * @param {Function} equalFunc The function to determine equivalents of values.
  22972. * @param {Object} stack Tracks traversed `object` and `other` objects.
  22973. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22974. */
  22975. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  22976. switch (tag) {
  22977. case dataViewTag:
  22978. if ((object.byteLength != other.byteLength) ||
  22979. (object.byteOffset != other.byteOffset)) {
  22980. return false;
  22981. }
  22982. object = object.buffer;
  22983. other = other.buffer;
  22984. case arrayBufferTag:
  22985. if ((object.byteLength != other.byteLength) ||
  22986. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  22987. return false;
  22988. }
  22989. return true;
  22990. case boolTag:
  22991. case dateTag:
  22992. case numberTag:
  22993. // Coerce booleans to `1` or `0` and dates to milliseconds.
  22994. // Invalid dates are coerced to `NaN`.
  22995. return eq(+object, +other);
  22996. case errorTag:
  22997. return object.name == other.name && object.message == other.message;
  22998. case regexpTag:
  22999. case stringTag:
  23000. // Coerce regexes to strings and treat strings, primitives and objects,
  23001. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23002. // for more details.
  23003. return object == (other + '');
  23004. case mapTag:
  23005. var convert = mapToArray;
  23006. case setTag:
  23007. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23008. convert || (convert = setToArray);
  23009. if (object.size != other.size && !isPartial) {
  23010. return false;
  23011. }
  23012. // Assume cyclic values are equal.
  23013. var stacked = stack.get(object);
  23014. if (stacked) {
  23015. return stacked == other;
  23016. }
  23017. bitmask |= COMPARE_UNORDERED_FLAG;
  23018. // Recursively compare objects (susceptible to call stack limits).
  23019. stack.set(object, other);
  23020. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23021. stack['delete'](object);
  23022. return result;
  23023. case symbolTag:
  23024. if (symbolValueOf) {
  23025. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23026. }
  23027. }
  23028. return false;
  23029. }
  23030. /**
  23031. * A specialized version of `baseIsEqualDeep` for objects with support for
  23032. * partial deep comparisons.
  23033. *
  23034. * @private
  23035. * @param {Object} object The object to compare.
  23036. * @param {Object} other The other object to compare.
  23037. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23038. * @param {Function} customizer The function to customize comparisons.
  23039. * @param {Function} equalFunc The function to determine equivalents of values.
  23040. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23041. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23042. */
  23043. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23044. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23045. objProps = getAllKeys(object),
  23046. objLength = objProps.length,
  23047. othProps = getAllKeys(other),
  23048. othLength = othProps.length;
  23049. if (objLength != othLength && !isPartial) {
  23050. return false;
  23051. }
  23052. var index = objLength;
  23053. while (index--) {
  23054. var key = objProps[index];
  23055. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23056. return false;
  23057. }
  23058. }
  23059. // Assume cyclic values are equal.
  23060. var stacked = stack.get(object);
  23061. if (stacked && stack.get(other)) {
  23062. return stacked == other;
  23063. }
  23064. var result = true;
  23065. stack.set(object, other);
  23066. stack.set(other, object);
  23067. var skipCtor = isPartial;
  23068. while (++index < objLength) {
  23069. key = objProps[index];
  23070. var objValue = object[key],
  23071. othValue = other[key];
  23072. if (customizer) {
  23073. var compared = isPartial
  23074. ? customizer(othValue, objValue, key, other, object, stack)
  23075. : customizer(objValue, othValue, key, object, other, stack);
  23076. }
  23077. // Recursively compare objects (susceptible to call stack limits).
  23078. if (!(compared === undefined
  23079. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23080. : compared
  23081. )) {
  23082. result = false;
  23083. break;
  23084. }
  23085. skipCtor || (skipCtor = key == 'constructor');
  23086. }
  23087. if (result && !skipCtor) {
  23088. var objCtor = object.constructor,
  23089. othCtor = other.constructor;
  23090. // Non `Object` object instances with different constructors are not equal.
  23091. if (objCtor != othCtor &&
  23092. ('constructor' in object && 'constructor' in other) &&
  23093. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23094. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23095. result = false;
  23096. }
  23097. }
  23098. stack['delete'](object);
  23099. stack['delete'](other);
  23100. return result;
  23101. }
  23102. /**
  23103. * A specialized version of `baseRest` which flattens the rest array.
  23104. *
  23105. * @private
  23106. * @param {Function} func The function to apply a rest parameter to.
  23107. * @returns {Function} Returns the new function.
  23108. */
  23109. function flatRest(func) {
  23110. return setToString(overRest(func, undefined, flatten), func + '');
  23111. }
  23112. /**
  23113. * Creates an array of own enumerable property names and symbols of `object`.
  23114. *
  23115. * @private
  23116. * @param {Object} object The object to query.
  23117. * @returns {Array} Returns the array of property names and symbols.
  23118. */
  23119. function getAllKeys(object) {
  23120. return baseGetAllKeys(object, keys, getSymbols);
  23121. }
  23122. /**
  23123. * Creates an array of own and inherited enumerable property names and
  23124. * symbols of `object`.
  23125. *
  23126. * @private
  23127. * @param {Object} object The object to query.
  23128. * @returns {Array} Returns the array of property names and symbols.
  23129. */
  23130. function getAllKeysIn(object) {
  23131. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23132. }
  23133. /**
  23134. * Gets metadata for `func`.
  23135. *
  23136. * @private
  23137. * @param {Function} func The function to query.
  23138. * @returns {*} Returns the metadata for `func`.
  23139. */
  23140. var getData = !metaMap ? noop : function(func) {
  23141. return metaMap.get(func);
  23142. };
  23143. /**
  23144. * Gets the name of `func`.
  23145. *
  23146. * @private
  23147. * @param {Function} func The function to query.
  23148. * @returns {string} Returns the function name.
  23149. */
  23150. function getFuncName(func) {
  23151. var result = (func.name + ''),
  23152. array = realNames[result],
  23153. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23154. while (length--) {
  23155. var data = array[length],
  23156. otherFunc = data.func;
  23157. if (otherFunc == null || otherFunc == func) {
  23158. return data.name;
  23159. }
  23160. }
  23161. return result;
  23162. }
  23163. /**
  23164. * Gets the argument placeholder value for `func`.
  23165. *
  23166. * @private
  23167. * @param {Function} func The function to inspect.
  23168. * @returns {*} Returns the placeholder value.
  23169. */
  23170. function getHolder(func) {
  23171. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23172. return object.placeholder;
  23173. }
  23174. /**
  23175. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23176. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23177. * If arguments are provided, the chosen function is invoked with them and
  23178. * its result is returned.
  23179. *
  23180. * @private
  23181. * @param {*} [value] The value to convert to an iteratee.
  23182. * @param {number} [arity] The arity of the created iteratee.
  23183. * @returns {Function} Returns the chosen function or its result.
  23184. */
  23185. function getIteratee() {
  23186. var result = lodash.iteratee || iteratee;
  23187. result = result === iteratee ? baseIteratee : result;
  23188. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23189. }
  23190. /**
  23191. * Gets the data for `map`.
  23192. *
  23193. * @private
  23194. * @param {Object} map The map to query.
  23195. * @param {string} key The reference key.
  23196. * @returns {*} Returns the map data.
  23197. */
  23198. function getMapData(map, key) {
  23199. var data = map.__data__;
  23200. return isKeyable(key)
  23201. ? data[typeof key == 'string' ? 'string' : 'hash']
  23202. : data.map;
  23203. }
  23204. /**
  23205. * Gets the property names, values, and compare flags of `object`.
  23206. *
  23207. * @private
  23208. * @param {Object} object The object to query.
  23209. * @returns {Array} Returns the match data of `object`.
  23210. */
  23211. function getMatchData(object) {
  23212. var result = keys(object),
  23213. length = result.length;
  23214. while (length--) {
  23215. var key = result[length],
  23216. value = object[key];
  23217. result[length] = [key, value, isStrictComparable(value)];
  23218. }
  23219. return result;
  23220. }
  23221. /**
  23222. * Gets the native function at `key` of `object`.
  23223. *
  23224. * @private
  23225. * @param {Object} object The object to query.
  23226. * @param {string} key The key of the method to get.
  23227. * @returns {*} Returns the function if it's native, else `undefined`.
  23228. */
  23229. function getNative(object, key) {
  23230. var value = getValue(object, key);
  23231. return baseIsNative(value) ? value : undefined;
  23232. }
  23233. /**
  23234. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23235. *
  23236. * @private
  23237. * @param {*} value The value to query.
  23238. * @returns {string} Returns the raw `toStringTag`.
  23239. */
  23240. function getRawTag(value) {
  23241. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23242. tag = value[symToStringTag];
  23243. try {
  23244. value[symToStringTag] = undefined;
  23245. var unmasked = true;
  23246. } catch (e) {}
  23247. var result = nativeObjectToString.call(value);
  23248. if (unmasked) {
  23249. if (isOwn) {
  23250. value[symToStringTag] = tag;
  23251. } else {
  23252. delete value[symToStringTag];
  23253. }
  23254. }
  23255. return result;
  23256. }
  23257. /**
  23258. * Creates an array of the own enumerable symbols of `object`.
  23259. *
  23260. * @private
  23261. * @param {Object} object The object to query.
  23262. * @returns {Array} Returns the array of symbols.
  23263. */
  23264. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23265. if (object == null) {
  23266. return [];
  23267. }
  23268. object = Object(object);
  23269. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23270. return propertyIsEnumerable.call(object, symbol);
  23271. });
  23272. };
  23273. /**
  23274. * Creates an array of the own and inherited enumerable symbols of `object`.
  23275. *
  23276. * @private
  23277. * @param {Object} object The object to query.
  23278. * @returns {Array} Returns the array of symbols.
  23279. */
  23280. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23281. var result = [];
  23282. while (object) {
  23283. arrayPush(result, getSymbols(object));
  23284. object = getPrototype(object);
  23285. }
  23286. return result;
  23287. };
  23288. /**
  23289. * Gets the `toStringTag` of `value`.
  23290. *
  23291. * @private
  23292. * @param {*} value The value to query.
  23293. * @returns {string} Returns the `toStringTag`.
  23294. */
  23295. var getTag = baseGetTag;
  23296. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23297. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23298. (Map && getTag(new Map) != mapTag) ||
  23299. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23300. (Set && getTag(new Set) != setTag) ||
  23301. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23302. getTag = function(value) {
  23303. var result = baseGetTag(value),
  23304. Ctor = result == objectTag ? value.constructor : undefined,
  23305. ctorString = Ctor ? toSource(Ctor) : '';
  23306. if (ctorString) {
  23307. switch (ctorString) {
  23308. case dataViewCtorString: return dataViewTag;
  23309. case mapCtorString: return mapTag;
  23310. case promiseCtorString: return promiseTag;
  23311. case setCtorString: return setTag;
  23312. case weakMapCtorString: return weakMapTag;
  23313. }
  23314. }
  23315. return result;
  23316. };
  23317. }
  23318. /**
  23319. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23320. *
  23321. * @private
  23322. * @param {number} start The start of the view.
  23323. * @param {number} end The end of the view.
  23324. * @param {Array} transforms The transformations to apply to the view.
  23325. * @returns {Object} Returns an object containing the `start` and `end`
  23326. * positions of the view.
  23327. */
  23328. function getView(start, end, transforms) {
  23329. var index = -1,
  23330. length = transforms.length;
  23331. while (++index < length) {
  23332. var data = transforms[index],
  23333. size = data.size;
  23334. switch (data.type) {
  23335. case 'drop': start += size; break;
  23336. case 'dropRight': end -= size; break;
  23337. case 'take': end = nativeMin(end, start + size); break;
  23338. case 'takeRight': start = nativeMax(start, end - size); break;
  23339. }
  23340. }
  23341. return { 'start': start, 'end': end };
  23342. }
  23343. /**
  23344. * Extracts wrapper details from the `source` body comment.
  23345. *
  23346. * @private
  23347. * @param {string} source The source to inspect.
  23348. * @returns {Array} Returns the wrapper details.
  23349. */
  23350. function getWrapDetails(source) {
  23351. var match = source.match(reWrapDetails);
  23352. return match ? match[1].split(reSplitDetails) : [];
  23353. }
  23354. /**
  23355. * Checks if `path` exists on `object`.
  23356. *
  23357. * @private
  23358. * @param {Object} object The object to query.
  23359. * @param {Array|string} path The path to check.
  23360. * @param {Function} hasFunc The function to check properties.
  23361. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23362. */
  23363. function hasPath(object, path, hasFunc) {
  23364. path = castPath(path, object);
  23365. var index = -1,
  23366. length = path.length,
  23367. result = false;
  23368. while (++index < length) {
  23369. var key = toKey(path[index]);
  23370. if (!(result = object != null && hasFunc(object, key))) {
  23371. break;
  23372. }
  23373. object = object[key];
  23374. }
  23375. if (result || ++index != length) {
  23376. return result;
  23377. }
  23378. length = object == null ? 0 : object.length;
  23379. return !!length && isLength(length) && isIndex(key, length) &&
  23380. (isArray(object) || isArguments(object));
  23381. }
  23382. /**
  23383. * Initializes an array clone.
  23384. *
  23385. * @private
  23386. * @param {Array} array The array to clone.
  23387. * @returns {Array} Returns the initialized clone.
  23388. */
  23389. function initCloneArray(array) {
  23390. var length = array.length,
  23391. result = new array.constructor(length);
  23392. // Add properties assigned by `RegExp#exec`.
  23393. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23394. result.index = array.index;
  23395. result.input = array.input;
  23396. }
  23397. return result;
  23398. }
  23399. /**
  23400. * Initializes an object clone.
  23401. *
  23402. * @private
  23403. * @param {Object} object The object to clone.
  23404. * @returns {Object} Returns the initialized clone.
  23405. */
  23406. function initCloneObject(object) {
  23407. return (typeof object.constructor == 'function' && !isPrototype(object))
  23408. ? baseCreate(getPrototype(object))
  23409. : {};
  23410. }
  23411. /**
  23412. * Initializes an object clone based on its `toStringTag`.
  23413. *
  23414. * **Note:** This function only supports cloning values with tags of
  23415. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23416. *
  23417. * @private
  23418. * @param {Object} object The object to clone.
  23419. * @param {string} tag The `toStringTag` of the object to clone.
  23420. * @param {boolean} [isDeep] Specify a deep clone.
  23421. * @returns {Object} Returns the initialized clone.
  23422. */
  23423. function initCloneByTag(object, tag, isDeep) {
  23424. var Ctor = object.constructor;
  23425. switch (tag) {
  23426. case arrayBufferTag:
  23427. return cloneArrayBuffer(object);
  23428. case boolTag:
  23429. case dateTag:
  23430. return new Ctor(+object);
  23431. case dataViewTag:
  23432. return cloneDataView(object, isDeep);
  23433. case float32Tag: case float64Tag:
  23434. case int8Tag: case int16Tag: case int32Tag:
  23435. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23436. return cloneTypedArray(object, isDeep);
  23437. case mapTag:
  23438. return new Ctor;
  23439. case numberTag:
  23440. case stringTag:
  23441. return new Ctor(object);
  23442. case regexpTag:
  23443. return cloneRegExp(object);
  23444. case setTag:
  23445. return new Ctor;
  23446. case symbolTag:
  23447. return cloneSymbol(object);
  23448. }
  23449. }
  23450. /**
  23451. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23452. *
  23453. * @private
  23454. * @param {string} source The source to modify.
  23455. * @returns {Array} details The details to insert.
  23456. * @returns {string} Returns the modified source.
  23457. */
  23458. function insertWrapDetails(source, details) {
  23459. var length = details.length;
  23460. if (!length) {
  23461. return source;
  23462. }
  23463. var lastIndex = length - 1;
  23464. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23465. details = details.join(length > 2 ? ', ' : ' ');
  23466. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23467. }
  23468. /**
  23469. * Checks if `value` is a flattenable `arguments` object or array.
  23470. *
  23471. * @private
  23472. * @param {*} value The value to check.
  23473. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23474. */
  23475. function isFlattenable(value) {
  23476. return isArray(value) || isArguments(value) ||
  23477. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23478. }
  23479. /**
  23480. * Checks if `value` is a valid array-like index.
  23481. *
  23482. * @private
  23483. * @param {*} value The value to check.
  23484. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23485. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23486. */
  23487. function isIndex(value, length) {
  23488. var type = typeof value;
  23489. length = length == null ? MAX_SAFE_INTEGER : length;
  23490. return !!length &&
  23491. (type == 'number' ||
  23492. (type != 'symbol' && reIsUint.test(value))) &&
  23493. (value > -1 && value % 1 == 0 && value < length);
  23494. }
  23495. /**
  23496. * Checks if the given arguments are from an iteratee call.
  23497. *
  23498. * @private
  23499. * @param {*} value The potential iteratee value argument.
  23500. * @param {*} index The potential iteratee index or key argument.
  23501. * @param {*} object The potential iteratee object argument.
  23502. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23503. * else `false`.
  23504. */
  23505. function isIterateeCall(value, index, object) {
  23506. if (!isObject(object)) {
  23507. return false;
  23508. }
  23509. var type = typeof index;
  23510. if (type == 'number'
  23511. ? (isArrayLike(object) && isIndex(index, object.length))
  23512. : (type == 'string' && index in object)
  23513. ) {
  23514. return eq(object[index], value);
  23515. }
  23516. return false;
  23517. }
  23518. /**
  23519. * Checks if `value` is a property name and not a property path.
  23520. *
  23521. * @private
  23522. * @param {*} value The value to check.
  23523. * @param {Object} [object] The object to query keys on.
  23524. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23525. */
  23526. function isKey(value, object) {
  23527. if (isArray(value)) {
  23528. return false;
  23529. }
  23530. var type = typeof value;
  23531. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23532. value == null || isSymbol(value)) {
  23533. return true;
  23534. }
  23535. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23536. (object != null && value in Object(object));
  23537. }
  23538. /**
  23539. * Checks if `value` is suitable for use as unique object key.
  23540. *
  23541. * @private
  23542. * @param {*} value The value to check.
  23543. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23544. */
  23545. function isKeyable(value) {
  23546. var type = typeof value;
  23547. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23548. ? (value !== '__proto__')
  23549. : (value === null);
  23550. }
  23551. /**
  23552. * Checks if `func` has a lazy counterpart.
  23553. *
  23554. * @private
  23555. * @param {Function} func The function to check.
  23556. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23557. * else `false`.
  23558. */
  23559. function isLaziable(func) {
  23560. var funcName = getFuncName(func),
  23561. other = lodash[funcName];
  23562. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23563. return false;
  23564. }
  23565. if (func === other) {
  23566. return true;
  23567. }
  23568. var data = getData(other);
  23569. return !!data && func === data[0];
  23570. }
  23571. /**
  23572. * Checks if `func` has its source masked.
  23573. *
  23574. * @private
  23575. * @param {Function} func The function to check.
  23576. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23577. */
  23578. function isMasked(func) {
  23579. return !!maskSrcKey && (maskSrcKey in func);
  23580. }
  23581. /**
  23582. * Checks if `func` is capable of being masked.
  23583. *
  23584. * @private
  23585. * @param {*} value The value to check.
  23586. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23587. */
  23588. var isMaskable = coreJsData ? isFunction : stubFalse;
  23589. /**
  23590. * Checks if `value` is likely a prototype object.
  23591. *
  23592. * @private
  23593. * @param {*} value The value to check.
  23594. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23595. */
  23596. function isPrototype(value) {
  23597. var Ctor = value && value.constructor,
  23598. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23599. return value === proto;
  23600. }
  23601. /**
  23602. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23603. *
  23604. * @private
  23605. * @param {*} value The value to check.
  23606. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23607. * equality comparisons, else `false`.
  23608. */
  23609. function isStrictComparable(value) {
  23610. return value === value && !isObject(value);
  23611. }
  23612. /**
  23613. * A specialized version of `matchesProperty` for source values suitable
  23614. * for strict equality comparisons, i.e. `===`.
  23615. *
  23616. * @private
  23617. * @param {string} key The key of the property to get.
  23618. * @param {*} srcValue The value to match.
  23619. * @returns {Function} Returns the new spec function.
  23620. */
  23621. function matchesStrictComparable(key, srcValue) {
  23622. return function(object) {
  23623. if (object == null) {
  23624. return false;
  23625. }
  23626. return object[key] === srcValue &&
  23627. (srcValue !== undefined || (key in Object(object)));
  23628. };
  23629. }
  23630. /**
  23631. * A specialized version of `_.memoize` which clears the memoized function's
  23632. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23633. *
  23634. * @private
  23635. * @param {Function} func The function to have its output memoized.
  23636. * @returns {Function} Returns the new memoized function.
  23637. */
  23638. function memoizeCapped(func) {
  23639. var result = memoize(func, function(key) {
  23640. if (cache.size === MAX_MEMOIZE_SIZE) {
  23641. cache.clear();
  23642. }
  23643. return key;
  23644. });
  23645. var cache = result.cache;
  23646. return result;
  23647. }
  23648. /**
  23649. * Merges the function metadata of `source` into `data`.
  23650. *
  23651. * Merging metadata reduces the number of wrappers used to invoke a function.
  23652. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23653. * may be applied regardless of execution order. Methods like `_.ary` and
  23654. * `_.rearg` modify function arguments, making the order in which they are
  23655. * executed important, preventing the merging of metadata. However, we make
  23656. * an exception for a safe combined case where curried functions have `_.ary`
  23657. * and or `_.rearg` applied.
  23658. *
  23659. * @private
  23660. * @param {Array} data The destination metadata.
  23661. * @param {Array} source The source metadata.
  23662. * @returns {Array} Returns `data`.
  23663. */
  23664. function mergeData(data, source) {
  23665. var bitmask = data[1],
  23666. srcBitmask = source[1],
  23667. newBitmask = bitmask | srcBitmask,
  23668. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23669. var isCombo =
  23670. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23671. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23672. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23673. // Exit early if metadata can't be merged.
  23674. if (!(isCommon || isCombo)) {
  23675. return data;
  23676. }
  23677. // Use source `thisArg` if available.
  23678. if (srcBitmask & WRAP_BIND_FLAG) {
  23679. data[2] = source[2];
  23680. // Set when currying a bound function.
  23681. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23682. }
  23683. // Compose partial arguments.
  23684. var value = source[3];
  23685. if (value) {
  23686. var partials = data[3];
  23687. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23688. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23689. }
  23690. // Compose partial right arguments.
  23691. value = source[5];
  23692. if (value) {
  23693. partials = data[5];
  23694. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23695. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23696. }
  23697. // Use source `argPos` if available.
  23698. value = source[7];
  23699. if (value) {
  23700. data[7] = value;
  23701. }
  23702. // Use source `ary` if it's smaller.
  23703. if (srcBitmask & WRAP_ARY_FLAG) {
  23704. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23705. }
  23706. // Use source `arity` if one is not provided.
  23707. if (data[9] == null) {
  23708. data[9] = source[9];
  23709. }
  23710. // Use source `func` and merge bitmasks.
  23711. data[0] = source[0];
  23712. data[1] = newBitmask;
  23713. return data;
  23714. }
  23715. /**
  23716. * This function is like
  23717. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23718. * except that it includes inherited enumerable properties.
  23719. *
  23720. * @private
  23721. * @param {Object} object The object to query.
  23722. * @returns {Array} Returns the array of property names.
  23723. */
  23724. function nativeKeysIn(object) {
  23725. var result = [];
  23726. if (object != null) {
  23727. for (var key in Object(object)) {
  23728. result.push(key);
  23729. }
  23730. }
  23731. return result;
  23732. }
  23733. /**
  23734. * Converts `value` to a string using `Object.prototype.toString`.
  23735. *
  23736. * @private
  23737. * @param {*} value The value to convert.
  23738. * @returns {string} Returns the converted string.
  23739. */
  23740. function objectToString(value) {
  23741. return nativeObjectToString.call(value);
  23742. }
  23743. /**
  23744. * A specialized version of `baseRest` which transforms the rest array.
  23745. *
  23746. * @private
  23747. * @param {Function} func The function to apply a rest parameter to.
  23748. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23749. * @param {Function} transform The rest array transform.
  23750. * @returns {Function} Returns the new function.
  23751. */
  23752. function overRest(func, start, transform) {
  23753. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23754. return function() {
  23755. var args = arguments,
  23756. index = -1,
  23757. length = nativeMax(args.length - start, 0),
  23758. array = Array(length);
  23759. while (++index < length) {
  23760. array[index] = args[start + index];
  23761. }
  23762. index = -1;
  23763. var otherArgs = Array(start + 1);
  23764. while (++index < start) {
  23765. otherArgs[index] = args[index];
  23766. }
  23767. otherArgs[start] = transform(array);
  23768. return apply(func, this, otherArgs);
  23769. };
  23770. }
  23771. /**
  23772. * Gets the parent value at `path` of `object`.
  23773. *
  23774. * @private
  23775. * @param {Object} object The object to query.
  23776. * @param {Array} path The path to get the parent value of.
  23777. * @returns {*} Returns the parent value.
  23778. */
  23779. function parent(object, path) {
  23780. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23781. }
  23782. /**
  23783. * Reorder `array` according to the specified indexes where the element at
  23784. * the first index is assigned as the first element, the element at
  23785. * the second index is assigned as the second element, and so on.
  23786. *
  23787. * @private
  23788. * @param {Array} array The array to reorder.
  23789. * @param {Array} indexes The arranged array indexes.
  23790. * @returns {Array} Returns `array`.
  23791. */
  23792. function reorder(array, indexes) {
  23793. var arrLength = array.length,
  23794. length = nativeMin(indexes.length, arrLength),
  23795. oldArray = copyArray(array);
  23796. while (length--) {
  23797. var index = indexes[length];
  23798. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23799. }
  23800. return array;
  23801. }
  23802. /**
  23803. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23804. *
  23805. * @private
  23806. * @param {Object} object The object to query.
  23807. * @param {string} key The key of the property to get.
  23808. * @returns {*} Returns the property value.
  23809. */
  23810. function safeGet(object, key) {
  23811. if (key === 'constructor' && typeof object[key] === 'function') {
  23812. return;
  23813. }
  23814. if (key == '__proto__') {
  23815. return;
  23816. }
  23817. return object[key];
  23818. }
  23819. /**
  23820. * Sets metadata for `func`.
  23821. *
  23822. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23823. * period of time, it will trip its breaker and transition to an identity
  23824. * function to avoid garbage collection pauses in V8. See
  23825. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23826. * for more details.
  23827. *
  23828. * @private
  23829. * @param {Function} func The function to associate metadata with.
  23830. * @param {*} data The metadata.
  23831. * @returns {Function} Returns `func`.
  23832. */
  23833. var setData = shortOut(baseSetData);
  23834. /**
  23835. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23836. *
  23837. * @private
  23838. * @param {Function} func The function to delay.
  23839. * @param {number} wait The number of milliseconds to delay invocation.
  23840. * @returns {number|Object} Returns the timer id or timeout object.
  23841. */
  23842. var setTimeout = ctxSetTimeout || function(func, wait) {
  23843. return root.setTimeout(func, wait);
  23844. };
  23845. /**
  23846. * Sets the `toString` method of `func` to return `string`.
  23847. *
  23848. * @private
  23849. * @param {Function} func The function to modify.
  23850. * @param {Function} string The `toString` result.
  23851. * @returns {Function} Returns `func`.
  23852. */
  23853. var setToString = shortOut(baseSetToString);
  23854. /**
  23855. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23856. * with wrapper details in a comment at the top of the source body.
  23857. *
  23858. * @private
  23859. * @param {Function} wrapper The function to modify.
  23860. * @param {Function} reference The reference function.
  23861. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23862. * @returns {Function} Returns `wrapper`.
  23863. */
  23864. function setWrapToString(wrapper, reference, bitmask) {
  23865. var source = (reference + '');
  23866. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23867. }
  23868. /**
  23869. * Creates a function that'll short out and invoke `identity` instead
  23870. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23871. * milliseconds.
  23872. *
  23873. * @private
  23874. * @param {Function} func The function to restrict.
  23875. * @returns {Function} Returns the new shortable function.
  23876. */
  23877. function shortOut(func) {
  23878. var count = 0,
  23879. lastCalled = 0;
  23880. return function() {
  23881. var stamp = nativeNow(),
  23882. remaining = HOT_SPAN - (stamp - lastCalled);
  23883. lastCalled = stamp;
  23884. if (remaining > 0) {
  23885. if (++count >= HOT_COUNT) {
  23886. return arguments[0];
  23887. }
  23888. } else {
  23889. count = 0;
  23890. }
  23891. return func.apply(undefined, arguments);
  23892. };
  23893. }
  23894. /**
  23895. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  23896. *
  23897. * @private
  23898. * @param {Array} array The array to shuffle.
  23899. * @param {number} [size=array.length] The size of `array`.
  23900. * @returns {Array} Returns `array`.
  23901. */
  23902. function shuffleSelf(array, size) {
  23903. var index = -1,
  23904. length = array.length,
  23905. lastIndex = length - 1;
  23906. size = size === undefined ? length : size;
  23907. while (++index < size) {
  23908. var rand = baseRandom(index, lastIndex),
  23909. value = array[rand];
  23910. array[rand] = array[index];
  23911. array[index] = value;
  23912. }
  23913. array.length = size;
  23914. return array;
  23915. }
  23916. /**
  23917. * Converts `string` to a property path array.
  23918. *
  23919. * @private
  23920. * @param {string} string The string to convert.
  23921. * @returns {Array} Returns the property path array.
  23922. */
  23923. var stringToPath = memoizeCapped(function(string) {
  23924. var result = [];
  23925. if (string.charCodeAt(0) === 46 /* . */) {
  23926. result.push('');
  23927. }
  23928. string.replace(rePropName, function(match, number, quote, subString) {
  23929. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  23930. });
  23931. return result;
  23932. });
  23933. /**
  23934. * Converts `value` to a string key if it's not a string or symbol.
  23935. *
  23936. * @private
  23937. * @param {*} value The value to inspect.
  23938. * @returns {string|symbol} Returns the key.
  23939. */
  23940. function toKey(value) {
  23941. if (typeof value == 'string' || isSymbol(value)) {
  23942. return value;
  23943. }
  23944. var result = (value + '');
  23945. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23946. }
  23947. /**
  23948. * Converts `func` to its source code.
  23949. *
  23950. * @private
  23951. * @param {Function} func The function to convert.
  23952. * @returns {string} Returns the source code.
  23953. */
  23954. function toSource(func) {
  23955. if (func != null) {
  23956. try {
  23957. return funcToString.call(func);
  23958. } catch (e) {}
  23959. try {
  23960. return (func + '');
  23961. } catch (e) {}
  23962. }
  23963. return '';
  23964. }
  23965. /**
  23966. * Updates wrapper `details` based on `bitmask` flags.
  23967. *
  23968. * @private
  23969. * @returns {Array} details The details to modify.
  23970. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23971. * @returns {Array} Returns `details`.
  23972. */
  23973. function updateWrapDetails(details, bitmask) {
  23974. arrayEach(wrapFlags, function(pair) {
  23975. var value = '_.' + pair[0];
  23976. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  23977. details.push(value);
  23978. }
  23979. });
  23980. return details.sort();
  23981. }
  23982. /**
  23983. * Creates a clone of `wrapper`.
  23984. *
  23985. * @private
  23986. * @param {Object} wrapper The wrapper to clone.
  23987. * @returns {Object} Returns the cloned wrapper.
  23988. */
  23989. function wrapperClone(wrapper) {
  23990. if (wrapper instanceof LazyWrapper) {
  23991. return wrapper.clone();
  23992. }
  23993. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  23994. result.__actions__ = copyArray(wrapper.__actions__);
  23995. result.__index__ = wrapper.__index__;
  23996. result.__values__ = wrapper.__values__;
  23997. return result;
  23998. }
  23999. /*------------------------------------------------------------------------*/
  24000. /**
  24001. * Creates an array of elements split into groups the length of `size`.
  24002. * If `array` can't be split evenly, the final chunk will be the remaining
  24003. * elements.
  24004. *
  24005. * @static
  24006. * @memberOf _
  24007. * @since 3.0.0
  24008. * @category Array
  24009. * @param {Array} array The array to process.
  24010. * @param {number} [size=1] The length of each chunk
  24011. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24012. * @returns {Array} Returns the new array of chunks.
  24013. * @example
  24014. *
  24015. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24016. * // => [['a', 'b'], ['c', 'd']]
  24017. *
  24018. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24019. * // => [['a', 'b', 'c'], ['d']]
  24020. */
  24021. function chunk(array, size, guard) {
  24022. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24023. size = 1;
  24024. } else {
  24025. size = nativeMax(toInteger(size), 0);
  24026. }
  24027. var length = array == null ? 0 : array.length;
  24028. if (!length || size < 1) {
  24029. return [];
  24030. }
  24031. var index = 0,
  24032. resIndex = 0,
  24033. result = Array(nativeCeil(length / size));
  24034. while (index < length) {
  24035. result[resIndex++] = baseSlice(array, index, (index += size));
  24036. }
  24037. return result;
  24038. }
  24039. /**
  24040. * Creates an array with all falsey values removed. The values `false`, `null`,
  24041. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24042. *
  24043. * @static
  24044. * @memberOf _
  24045. * @since 0.1.0
  24046. * @category Array
  24047. * @param {Array} array The array to compact.
  24048. * @returns {Array} Returns the new array of filtered values.
  24049. * @example
  24050. *
  24051. * _.compact([0, 1, false, 2, '', 3]);
  24052. * // => [1, 2, 3]
  24053. */
  24054. function compact(array) {
  24055. var index = -1,
  24056. length = array == null ? 0 : array.length,
  24057. resIndex = 0,
  24058. result = [];
  24059. while (++index < length) {
  24060. var value = array[index];
  24061. if (value) {
  24062. result[resIndex++] = value;
  24063. }
  24064. }
  24065. return result;
  24066. }
  24067. /**
  24068. * Creates a new array concatenating `array` with any additional arrays
  24069. * and/or values.
  24070. *
  24071. * @static
  24072. * @memberOf _
  24073. * @since 4.0.0
  24074. * @category Array
  24075. * @param {Array} array The array to concatenate.
  24076. * @param {...*} [values] The values to concatenate.
  24077. * @returns {Array} Returns the new concatenated array.
  24078. * @example
  24079. *
  24080. * var array = [1];
  24081. * var other = _.concat(array, 2, [3], [[4]]);
  24082. *
  24083. * console.log(other);
  24084. * // => [1, 2, 3, [4]]
  24085. *
  24086. * console.log(array);
  24087. * // => [1]
  24088. */
  24089. function concat() {
  24090. var length = arguments.length;
  24091. if (!length) {
  24092. return [];
  24093. }
  24094. var args = Array(length - 1),
  24095. array = arguments[0],
  24096. index = length;
  24097. while (index--) {
  24098. args[index - 1] = arguments[index];
  24099. }
  24100. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24101. }
  24102. /**
  24103. * Creates an array of `array` values not included in the other given arrays
  24104. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24105. * for equality comparisons. The order and references of result values are
  24106. * determined by the first array.
  24107. *
  24108. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24109. *
  24110. * @static
  24111. * @memberOf _
  24112. * @since 0.1.0
  24113. * @category Array
  24114. * @param {Array} array The array to inspect.
  24115. * @param {...Array} [values] The values to exclude.
  24116. * @returns {Array} Returns the new array of filtered values.
  24117. * @see _.without, _.xor
  24118. * @example
  24119. *
  24120. * _.difference([2, 1], [2, 3]);
  24121. * // => [1]
  24122. */
  24123. var difference = baseRest(function(array, values) {
  24124. return isArrayLikeObject(array)
  24125. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24126. : [];
  24127. });
  24128. /**
  24129. * This method is like `_.difference` except that it accepts `iteratee` which
  24130. * is invoked for each element of `array` and `values` to generate the criterion
  24131. * by which they're compared. The order and references of result values are
  24132. * determined by the first array. The iteratee is invoked with one argument:
  24133. * (value).
  24134. *
  24135. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24136. *
  24137. * @static
  24138. * @memberOf _
  24139. * @since 4.0.0
  24140. * @category Array
  24141. * @param {Array} array The array to inspect.
  24142. * @param {...Array} [values] The values to exclude.
  24143. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24144. * @returns {Array} Returns the new array of filtered values.
  24145. * @example
  24146. *
  24147. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24148. * // => [1.2]
  24149. *
  24150. * // The `_.property` iteratee shorthand.
  24151. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24152. * // => [{ 'x': 2 }]
  24153. */
  24154. var differenceBy = baseRest(function(array, values) {
  24155. var iteratee = last(values);
  24156. if (isArrayLikeObject(iteratee)) {
  24157. iteratee = undefined;
  24158. }
  24159. return isArrayLikeObject(array)
  24160. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24161. : [];
  24162. });
  24163. /**
  24164. * This method is like `_.difference` except that it accepts `comparator`
  24165. * which is invoked to compare elements of `array` to `values`. The order and
  24166. * references of result values are determined by the first array. The comparator
  24167. * is invoked with two arguments: (arrVal, othVal).
  24168. *
  24169. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24170. *
  24171. * @static
  24172. * @memberOf _
  24173. * @since 4.0.0
  24174. * @category Array
  24175. * @param {Array} array The array to inspect.
  24176. * @param {...Array} [values] The values to exclude.
  24177. * @param {Function} [comparator] The comparator invoked per element.
  24178. * @returns {Array} Returns the new array of filtered values.
  24179. * @example
  24180. *
  24181. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24182. *
  24183. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24184. * // => [{ 'x': 2, 'y': 1 }]
  24185. */
  24186. var differenceWith = baseRest(function(array, values) {
  24187. var comparator = last(values);
  24188. if (isArrayLikeObject(comparator)) {
  24189. comparator = undefined;
  24190. }
  24191. return isArrayLikeObject(array)
  24192. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24193. : [];
  24194. });
  24195. /**
  24196. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24197. *
  24198. * @static
  24199. * @memberOf _
  24200. * @since 0.5.0
  24201. * @category Array
  24202. * @param {Array} array The array to query.
  24203. * @param {number} [n=1] The number of elements to drop.
  24204. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24205. * @returns {Array} Returns the slice of `array`.
  24206. * @example
  24207. *
  24208. * _.drop([1, 2, 3]);
  24209. * // => [2, 3]
  24210. *
  24211. * _.drop([1, 2, 3], 2);
  24212. * // => [3]
  24213. *
  24214. * _.drop([1, 2, 3], 5);
  24215. * // => []
  24216. *
  24217. * _.drop([1, 2, 3], 0);
  24218. * // => [1, 2, 3]
  24219. */
  24220. function drop(array, n, guard) {
  24221. var length = array == null ? 0 : array.length;
  24222. if (!length) {
  24223. return [];
  24224. }
  24225. n = (guard || n === undefined) ? 1 : toInteger(n);
  24226. return baseSlice(array, n < 0 ? 0 : n, length);
  24227. }
  24228. /**
  24229. * Creates a slice of `array` with `n` elements dropped from the end.
  24230. *
  24231. * @static
  24232. * @memberOf _
  24233. * @since 3.0.0
  24234. * @category Array
  24235. * @param {Array} array The array to query.
  24236. * @param {number} [n=1] The number of elements to drop.
  24237. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24238. * @returns {Array} Returns the slice of `array`.
  24239. * @example
  24240. *
  24241. * _.dropRight([1, 2, 3]);
  24242. * // => [1, 2]
  24243. *
  24244. * _.dropRight([1, 2, 3], 2);
  24245. * // => [1]
  24246. *
  24247. * _.dropRight([1, 2, 3], 5);
  24248. * // => []
  24249. *
  24250. * _.dropRight([1, 2, 3], 0);
  24251. * // => [1, 2, 3]
  24252. */
  24253. function dropRight(array, n, guard) {
  24254. var length = array == null ? 0 : array.length;
  24255. if (!length) {
  24256. return [];
  24257. }
  24258. n = (guard || n === undefined) ? 1 : toInteger(n);
  24259. n = length - n;
  24260. return baseSlice(array, 0, n < 0 ? 0 : n);
  24261. }
  24262. /**
  24263. * Creates a slice of `array` excluding elements dropped from the end.
  24264. * Elements are dropped until `predicate` returns falsey. The predicate is
  24265. * invoked with three arguments: (value, index, array).
  24266. *
  24267. * @static
  24268. * @memberOf _
  24269. * @since 3.0.0
  24270. * @category Array
  24271. * @param {Array} array The array to query.
  24272. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24273. * @returns {Array} Returns the slice of `array`.
  24274. * @example
  24275. *
  24276. * var users = [
  24277. * { 'user': 'barney', 'active': true },
  24278. * { 'user': 'fred', 'active': false },
  24279. * { 'user': 'pebbles', 'active': false }
  24280. * ];
  24281. *
  24282. * _.dropRightWhile(users, function(o) { return !o.active; });
  24283. * // => objects for ['barney']
  24284. *
  24285. * // The `_.matches` iteratee shorthand.
  24286. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24287. * // => objects for ['barney', 'fred']
  24288. *
  24289. * // The `_.matchesProperty` iteratee shorthand.
  24290. * _.dropRightWhile(users, ['active', false]);
  24291. * // => objects for ['barney']
  24292. *
  24293. * // The `_.property` iteratee shorthand.
  24294. * _.dropRightWhile(users, 'active');
  24295. * // => objects for ['barney', 'fred', 'pebbles']
  24296. */
  24297. function dropRightWhile(array, predicate) {
  24298. return (array && array.length)
  24299. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24300. : [];
  24301. }
  24302. /**
  24303. * Creates a slice of `array` excluding elements dropped from the beginning.
  24304. * Elements are dropped until `predicate` returns falsey. The predicate is
  24305. * invoked with three arguments: (value, index, array).
  24306. *
  24307. * @static
  24308. * @memberOf _
  24309. * @since 3.0.0
  24310. * @category Array
  24311. * @param {Array} array The array to query.
  24312. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24313. * @returns {Array} Returns the slice of `array`.
  24314. * @example
  24315. *
  24316. * var users = [
  24317. * { 'user': 'barney', 'active': false },
  24318. * { 'user': 'fred', 'active': false },
  24319. * { 'user': 'pebbles', 'active': true }
  24320. * ];
  24321. *
  24322. * _.dropWhile(users, function(o) { return !o.active; });
  24323. * // => objects for ['pebbles']
  24324. *
  24325. * // The `_.matches` iteratee shorthand.
  24326. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24327. * // => objects for ['fred', 'pebbles']
  24328. *
  24329. * // The `_.matchesProperty` iteratee shorthand.
  24330. * _.dropWhile(users, ['active', false]);
  24331. * // => objects for ['pebbles']
  24332. *
  24333. * // The `_.property` iteratee shorthand.
  24334. * _.dropWhile(users, 'active');
  24335. * // => objects for ['barney', 'fred', 'pebbles']
  24336. */
  24337. function dropWhile(array, predicate) {
  24338. return (array && array.length)
  24339. ? baseWhile(array, getIteratee(predicate, 3), true)
  24340. : [];
  24341. }
  24342. /**
  24343. * Fills elements of `array` with `value` from `start` up to, but not
  24344. * including, `end`.
  24345. *
  24346. * **Note:** This method mutates `array`.
  24347. *
  24348. * @static
  24349. * @memberOf _
  24350. * @since 3.2.0
  24351. * @category Array
  24352. * @param {Array} array The array to fill.
  24353. * @param {*} value The value to fill `array` with.
  24354. * @param {number} [start=0] The start position.
  24355. * @param {number} [end=array.length] The end position.
  24356. * @returns {Array} Returns `array`.
  24357. * @example
  24358. *
  24359. * var array = [1, 2, 3];
  24360. *
  24361. * _.fill(array, 'a');
  24362. * console.log(array);
  24363. * // => ['a', 'a', 'a']
  24364. *
  24365. * _.fill(Array(3), 2);
  24366. * // => [2, 2, 2]
  24367. *
  24368. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24369. * // => [4, '*', '*', 10]
  24370. */
  24371. function fill(array, value, start, end) {
  24372. var length = array == null ? 0 : array.length;
  24373. if (!length) {
  24374. return [];
  24375. }
  24376. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24377. start = 0;
  24378. end = length;
  24379. }
  24380. return baseFill(array, value, start, end);
  24381. }
  24382. /**
  24383. * This method is like `_.find` except that it returns the index of the first
  24384. * element `predicate` returns truthy for instead of the element itself.
  24385. *
  24386. * @static
  24387. * @memberOf _
  24388. * @since 1.1.0
  24389. * @category Array
  24390. * @param {Array} array The array to inspect.
  24391. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24392. * @param {number} [fromIndex=0] The index to search from.
  24393. * @returns {number} Returns the index of the found element, else `-1`.
  24394. * @example
  24395. *
  24396. * var users = [
  24397. * { 'user': 'barney', 'active': false },
  24398. * { 'user': 'fred', 'active': false },
  24399. * { 'user': 'pebbles', 'active': true }
  24400. * ];
  24401. *
  24402. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24403. * // => 0
  24404. *
  24405. * // The `_.matches` iteratee shorthand.
  24406. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24407. * // => 1
  24408. *
  24409. * // The `_.matchesProperty` iteratee shorthand.
  24410. * _.findIndex(users, ['active', false]);
  24411. * // => 0
  24412. *
  24413. * // The `_.property` iteratee shorthand.
  24414. * _.findIndex(users, 'active');
  24415. * // => 2
  24416. */
  24417. function findIndex(array, predicate, fromIndex) {
  24418. var length = array == null ? 0 : array.length;
  24419. if (!length) {
  24420. return -1;
  24421. }
  24422. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24423. if (index < 0) {
  24424. index = nativeMax(length + index, 0);
  24425. }
  24426. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24427. }
  24428. /**
  24429. * This method is like `_.findIndex` except that it iterates over elements
  24430. * of `collection` from right to left.
  24431. *
  24432. * @static
  24433. * @memberOf _
  24434. * @since 2.0.0
  24435. * @category Array
  24436. * @param {Array} array The array to inspect.
  24437. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24438. * @param {number} [fromIndex=array.length-1] The index to search from.
  24439. * @returns {number} Returns the index of the found element, else `-1`.
  24440. * @example
  24441. *
  24442. * var users = [
  24443. * { 'user': 'barney', 'active': true },
  24444. * { 'user': 'fred', 'active': false },
  24445. * { 'user': 'pebbles', 'active': false }
  24446. * ];
  24447. *
  24448. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24449. * // => 2
  24450. *
  24451. * // The `_.matches` iteratee shorthand.
  24452. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24453. * // => 0
  24454. *
  24455. * // The `_.matchesProperty` iteratee shorthand.
  24456. * _.findLastIndex(users, ['active', false]);
  24457. * // => 2
  24458. *
  24459. * // The `_.property` iteratee shorthand.
  24460. * _.findLastIndex(users, 'active');
  24461. * // => 0
  24462. */
  24463. function findLastIndex(array, predicate, fromIndex) {
  24464. var length = array == null ? 0 : array.length;
  24465. if (!length) {
  24466. return -1;
  24467. }
  24468. var index = length - 1;
  24469. if (fromIndex !== undefined) {
  24470. index = toInteger(fromIndex);
  24471. index = fromIndex < 0
  24472. ? nativeMax(length + index, 0)
  24473. : nativeMin(index, length - 1);
  24474. }
  24475. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24476. }
  24477. /**
  24478. * Flattens `array` a single level deep.
  24479. *
  24480. * @static
  24481. * @memberOf _
  24482. * @since 0.1.0
  24483. * @category Array
  24484. * @param {Array} array The array to flatten.
  24485. * @returns {Array} Returns the new flattened array.
  24486. * @example
  24487. *
  24488. * _.flatten([1, [2, [3, [4]], 5]]);
  24489. * // => [1, 2, [3, [4]], 5]
  24490. */
  24491. function flatten(array) {
  24492. var length = array == null ? 0 : array.length;
  24493. return length ? baseFlatten(array, 1) : [];
  24494. }
  24495. /**
  24496. * Recursively flattens `array`.
  24497. *
  24498. * @static
  24499. * @memberOf _
  24500. * @since 3.0.0
  24501. * @category Array
  24502. * @param {Array} array The array to flatten.
  24503. * @returns {Array} Returns the new flattened array.
  24504. * @example
  24505. *
  24506. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24507. * // => [1, 2, 3, 4, 5]
  24508. */
  24509. function flattenDeep(array) {
  24510. var length = array == null ? 0 : array.length;
  24511. return length ? baseFlatten(array, INFINITY) : [];
  24512. }
  24513. /**
  24514. * Recursively flatten `array` up to `depth` times.
  24515. *
  24516. * @static
  24517. * @memberOf _
  24518. * @since 4.4.0
  24519. * @category Array
  24520. * @param {Array} array The array to flatten.
  24521. * @param {number} [depth=1] The maximum recursion depth.
  24522. * @returns {Array} Returns the new flattened array.
  24523. * @example
  24524. *
  24525. * var array = [1, [2, [3, [4]], 5]];
  24526. *
  24527. * _.flattenDepth(array, 1);
  24528. * // => [1, 2, [3, [4]], 5]
  24529. *
  24530. * _.flattenDepth(array, 2);
  24531. * // => [1, 2, 3, [4], 5]
  24532. */
  24533. function flattenDepth(array, depth) {
  24534. var length = array == null ? 0 : array.length;
  24535. if (!length) {
  24536. return [];
  24537. }
  24538. depth = depth === undefined ? 1 : toInteger(depth);
  24539. return baseFlatten(array, depth);
  24540. }
  24541. /**
  24542. * The inverse of `_.toPairs`; this method returns an object composed
  24543. * from key-value `pairs`.
  24544. *
  24545. * @static
  24546. * @memberOf _
  24547. * @since 4.0.0
  24548. * @category Array
  24549. * @param {Array} pairs The key-value pairs.
  24550. * @returns {Object} Returns the new object.
  24551. * @example
  24552. *
  24553. * _.fromPairs([['a', 1], ['b', 2]]);
  24554. * // => { 'a': 1, 'b': 2 }
  24555. */
  24556. function fromPairs(pairs) {
  24557. var index = -1,
  24558. length = pairs == null ? 0 : pairs.length,
  24559. result = {};
  24560. while (++index < length) {
  24561. var pair = pairs[index];
  24562. result[pair[0]] = pair[1];
  24563. }
  24564. return result;
  24565. }
  24566. /**
  24567. * Gets the first element of `array`.
  24568. *
  24569. * @static
  24570. * @memberOf _
  24571. * @since 0.1.0
  24572. * @alias first
  24573. * @category Array
  24574. * @param {Array} array The array to query.
  24575. * @returns {*} Returns the first element of `array`.
  24576. * @example
  24577. *
  24578. * _.head([1, 2, 3]);
  24579. * // => 1
  24580. *
  24581. * _.head([]);
  24582. * // => undefined
  24583. */
  24584. function head(array) {
  24585. return (array && array.length) ? array[0] : undefined;
  24586. }
  24587. /**
  24588. * Gets the index at which the first occurrence of `value` is found in `array`
  24589. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24590. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24591. * offset from the end of `array`.
  24592. *
  24593. * @static
  24594. * @memberOf _
  24595. * @since 0.1.0
  24596. * @category Array
  24597. * @param {Array} array The array to inspect.
  24598. * @param {*} value The value to search for.
  24599. * @param {number} [fromIndex=0] The index to search from.
  24600. * @returns {number} Returns the index of the matched value, else `-1`.
  24601. * @example
  24602. *
  24603. * _.indexOf([1, 2, 1, 2], 2);
  24604. * // => 1
  24605. *
  24606. * // Search from the `fromIndex`.
  24607. * _.indexOf([1, 2, 1, 2], 2, 2);
  24608. * // => 3
  24609. */
  24610. function indexOf(array, value, fromIndex) {
  24611. var length = array == null ? 0 : array.length;
  24612. if (!length) {
  24613. return -1;
  24614. }
  24615. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24616. if (index < 0) {
  24617. index = nativeMax(length + index, 0);
  24618. }
  24619. return baseIndexOf(array, value, index);
  24620. }
  24621. /**
  24622. * Gets all but the last element of `array`.
  24623. *
  24624. * @static
  24625. * @memberOf _
  24626. * @since 0.1.0
  24627. * @category Array
  24628. * @param {Array} array The array to query.
  24629. * @returns {Array} Returns the slice of `array`.
  24630. * @example
  24631. *
  24632. * _.initial([1, 2, 3]);
  24633. * // => [1, 2]
  24634. */
  24635. function initial(array) {
  24636. var length = array == null ? 0 : array.length;
  24637. return length ? baseSlice(array, 0, -1) : [];
  24638. }
  24639. /**
  24640. * Creates an array of unique values that are included in all given arrays
  24641. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24642. * for equality comparisons. The order and references of result values are
  24643. * determined by the first array.
  24644. *
  24645. * @static
  24646. * @memberOf _
  24647. * @since 0.1.0
  24648. * @category Array
  24649. * @param {...Array} [arrays] The arrays to inspect.
  24650. * @returns {Array} Returns the new array of intersecting values.
  24651. * @example
  24652. *
  24653. * _.intersection([2, 1], [2, 3]);
  24654. * // => [2]
  24655. */
  24656. var intersection = baseRest(function(arrays) {
  24657. var mapped = arrayMap(arrays, castArrayLikeObject);
  24658. return (mapped.length && mapped[0] === arrays[0])
  24659. ? baseIntersection(mapped)
  24660. : [];
  24661. });
  24662. /**
  24663. * This method is like `_.intersection` except that it accepts `iteratee`
  24664. * which is invoked for each element of each `arrays` to generate the criterion
  24665. * by which they're compared. The order and references of result values are
  24666. * determined by the first array. The iteratee is invoked with one argument:
  24667. * (value).
  24668. *
  24669. * @static
  24670. * @memberOf _
  24671. * @since 4.0.0
  24672. * @category Array
  24673. * @param {...Array} [arrays] The arrays to inspect.
  24674. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24675. * @returns {Array} Returns the new array of intersecting values.
  24676. * @example
  24677. *
  24678. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24679. * // => [2.1]
  24680. *
  24681. * // The `_.property` iteratee shorthand.
  24682. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24683. * // => [{ 'x': 1 }]
  24684. */
  24685. var intersectionBy = baseRest(function(arrays) {
  24686. var iteratee = last(arrays),
  24687. mapped = arrayMap(arrays, castArrayLikeObject);
  24688. if (iteratee === last(mapped)) {
  24689. iteratee = undefined;
  24690. } else {
  24691. mapped.pop();
  24692. }
  24693. return (mapped.length && mapped[0] === arrays[0])
  24694. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24695. : [];
  24696. });
  24697. /**
  24698. * This method is like `_.intersection` except that it accepts `comparator`
  24699. * which is invoked to compare elements of `arrays`. The order and references
  24700. * of result values are determined by the first array. The comparator is
  24701. * invoked with two arguments: (arrVal, othVal).
  24702. *
  24703. * @static
  24704. * @memberOf _
  24705. * @since 4.0.0
  24706. * @category Array
  24707. * @param {...Array} [arrays] The arrays to inspect.
  24708. * @param {Function} [comparator] The comparator invoked per element.
  24709. * @returns {Array} Returns the new array of intersecting values.
  24710. * @example
  24711. *
  24712. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24713. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24714. *
  24715. * _.intersectionWith(objects, others, _.isEqual);
  24716. * // => [{ 'x': 1, 'y': 2 }]
  24717. */
  24718. var intersectionWith = baseRest(function(arrays) {
  24719. var comparator = last(arrays),
  24720. mapped = arrayMap(arrays, castArrayLikeObject);
  24721. comparator = typeof comparator == 'function' ? comparator : undefined;
  24722. if (comparator) {
  24723. mapped.pop();
  24724. }
  24725. return (mapped.length && mapped[0] === arrays[0])
  24726. ? baseIntersection(mapped, undefined, comparator)
  24727. : [];
  24728. });
  24729. /**
  24730. * Converts all elements in `array` into a string separated by `separator`.
  24731. *
  24732. * @static
  24733. * @memberOf _
  24734. * @since 4.0.0
  24735. * @category Array
  24736. * @param {Array} array The array to convert.
  24737. * @param {string} [separator=','] The element separator.
  24738. * @returns {string} Returns the joined string.
  24739. * @example
  24740. *
  24741. * _.join(['a', 'b', 'c'], '~');
  24742. * // => 'a~b~c'
  24743. */
  24744. function join(array, separator) {
  24745. return array == null ? '' : nativeJoin.call(array, separator);
  24746. }
  24747. /**
  24748. * Gets the last element of `array`.
  24749. *
  24750. * @static
  24751. * @memberOf _
  24752. * @since 0.1.0
  24753. * @category Array
  24754. * @param {Array} array The array to query.
  24755. * @returns {*} Returns the last element of `array`.
  24756. * @example
  24757. *
  24758. * _.last([1, 2, 3]);
  24759. * // => 3
  24760. */
  24761. function last(array) {
  24762. var length = array == null ? 0 : array.length;
  24763. return length ? array[length - 1] : undefined;
  24764. }
  24765. /**
  24766. * This method is like `_.indexOf` except that it iterates over elements of
  24767. * `array` from right to left.
  24768. *
  24769. * @static
  24770. * @memberOf _
  24771. * @since 0.1.0
  24772. * @category Array
  24773. * @param {Array} array The array to inspect.
  24774. * @param {*} value The value to search for.
  24775. * @param {number} [fromIndex=array.length-1] The index to search from.
  24776. * @returns {number} Returns the index of the matched value, else `-1`.
  24777. * @example
  24778. *
  24779. * _.lastIndexOf([1, 2, 1, 2], 2);
  24780. * // => 3
  24781. *
  24782. * // Search from the `fromIndex`.
  24783. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24784. * // => 1
  24785. */
  24786. function lastIndexOf(array, value, fromIndex) {
  24787. var length = array == null ? 0 : array.length;
  24788. if (!length) {
  24789. return -1;
  24790. }
  24791. var index = length;
  24792. if (fromIndex !== undefined) {
  24793. index = toInteger(fromIndex);
  24794. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24795. }
  24796. return value === value
  24797. ? strictLastIndexOf(array, value, index)
  24798. : baseFindIndex(array, baseIsNaN, index, true);
  24799. }
  24800. /**
  24801. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24802. * element from the end is returned.
  24803. *
  24804. * @static
  24805. * @memberOf _
  24806. * @since 4.11.0
  24807. * @category Array
  24808. * @param {Array} array The array to query.
  24809. * @param {number} [n=0] The index of the element to return.
  24810. * @returns {*} Returns the nth element of `array`.
  24811. * @example
  24812. *
  24813. * var array = ['a', 'b', 'c', 'd'];
  24814. *
  24815. * _.nth(array, 1);
  24816. * // => 'b'
  24817. *
  24818. * _.nth(array, -2);
  24819. * // => 'c';
  24820. */
  24821. function nth(array, n) {
  24822. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24823. }
  24824. /**
  24825. * Removes all given values from `array` using
  24826. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24827. * for equality comparisons.
  24828. *
  24829. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24830. * to remove elements from an array by predicate.
  24831. *
  24832. * @static
  24833. * @memberOf _
  24834. * @since 2.0.0
  24835. * @category Array
  24836. * @param {Array} array The array to modify.
  24837. * @param {...*} [values] The values to remove.
  24838. * @returns {Array} Returns `array`.
  24839. * @example
  24840. *
  24841. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24842. *
  24843. * _.pull(array, 'a', 'c');
  24844. * console.log(array);
  24845. * // => ['b', 'b']
  24846. */
  24847. var pull = baseRest(pullAll);
  24848. /**
  24849. * This method is like `_.pull` except that it accepts an array of values to remove.
  24850. *
  24851. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24852. *
  24853. * @static
  24854. * @memberOf _
  24855. * @since 4.0.0
  24856. * @category Array
  24857. * @param {Array} array The array to modify.
  24858. * @param {Array} values The values to remove.
  24859. * @returns {Array} Returns `array`.
  24860. * @example
  24861. *
  24862. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24863. *
  24864. * _.pullAll(array, ['a', 'c']);
  24865. * console.log(array);
  24866. * // => ['b', 'b']
  24867. */
  24868. function pullAll(array, values) {
  24869. return (array && array.length && values && values.length)
  24870. ? basePullAll(array, values)
  24871. : array;
  24872. }
  24873. /**
  24874. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24875. * invoked for each element of `array` and `values` to generate the criterion
  24876. * by which they're compared. The iteratee is invoked with one argument: (value).
  24877. *
  24878. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24879. *
  24880. * @static
  24881. * @memberOf _
  24882. * @since 4.0.0
  24883. * @category Array
  24884. * @param {Array} array The array to modify.
  24885. * @param {Array} values The values to remove.
  24886. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24887. * @returns {Array} Returns `array`.
  24888. * @example
  24889. *
  24890. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  24891. *
  24892. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  24893. * console.log(array);
  24894. * // => [{ 'x': 2 }]
  24895. */
  24896. function pullAllBy(array, values, iteratee) {
  24897. return (array && array.length && values && values.length)
  24898. ? basePullAll(array, values, getIteratee(iteratee, 2))
  24899. : array;
  24900. }
  24901. /**
  24902. * This method is like `_.pullAll` except that it accepts `comparator` which
  24903. * is invoked to compare elements of `array` to `values`. The comparator is
  24904. * invoked with two arguments: (arrVal, othVal).
  24905. *
  24906. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  24907. *
  24908. * @static
  24909. * @memberOf _
  24910. * @since 4.6.0
  24911. * @category Array
  24912. * @param {Array} array The array to modify.
  24913. * @param {Array} values The values to remove.
  24914. * @param {Function} [comparator] The comparator invoked per element.
  24915. * @returns {Array} Returns `array`.
  24916. * @example
  24917. *
  24918. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  24919. *
  24920. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  24921. * console.log(array);
  24922. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  24923. */
  24924. function pullAllWith(array, values, comparator) {
  24925. return (array && array.length && values && values.length)
  24926. ? basePullAll(array, values, undefined, comparator)
  24927. : array;
  24928. }
  24929. /**
  24930. * Removes elements from `array` corresponding to `indexes` and returns an
  24931. * array of removed elements.
  24932. *
  24933. * **Note:** Unlike `_.at`, this method mutates `array`.
  24934. *
  24935. * @static
  24936. * @memberOf _
  24937. * @since 3.0.0
  24938. * @category Array
  24939. * @param {Array} array The array to modify.
  24940. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  24941. * @returns {Array} Returns the new array of removed elements.
  24942. * @example
  24943. *
  24944. * var array = ['a', 'b', 'c', 'd'];
  24945. * var pulled = _.pullAt(array, [1, 3]);
  24946. *
  24947. * console.log(array);
  24948. * // => ['a', 'c']
  24949. *
  24950. * console.log(pulled);
  24951. * // => ['b', 'd']
  24952. */
  24953. var pullAt = flatRest(function(array, indexes) {
  24954. var length = array == null ? 0 : array.length,
  24955. result = baseAt(array, indexes);
  24956. basePullAt(array, arrayMap(indexes, function(index) {
  24957. return isIndex(index, length) ? +index : index;
  24958. }).sort(compareAscending));
  24959. return result;
  24960. });
  24961. /**
  24962. * Removes all elements from `array` that `predicate` returns truthy for
  24963. * and returns an array of the removed elements. The predicate is invoked
  24964. * with three arguments: (value, index, array).
  24965. *
  24966. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  24967. * to pull elements from an array by value.
  24968. *
  24969. * @static
  24970. * @memberOf _
  24971. * @since 2.0.0
  24972. * @category Array
  24973. * @param {Array} array The array to modify.
  24974. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24975. * @returns {Array} Returns the new array of removed elements.
  24976. * @example
  24977. *
  24978. * var array = [1, 2, 3, 4];
  24979. * var evens = _.remove(array, function(n) {
  24980. * return n % 2 == 0;
  24981. * });
  24982. *
  24983. * console.log(array);
  24984. * // => [1, 3]
  24985. *
  24986. * console.log(evens);
  24987. * // => [2, 4]
  24988. */
  24989. function remove(array, predicate) {
  24990. var result = [];
  24991. if (!(array && array.length)) {
  24992. return result;
  24993. }
  24994. var index = -1,
  24995. indexes = [],
  24996. length = array.length;
  24997. predicate = getIteratee(predicate, 3);
  24998. while (++index < length) {
  24999. var value = array[index];
  25000. if (predicate(value, index, array)) {
  25001. result.push(value);
  25002. indexes.push(index);
  25003. }
  25004. }
  25005. basePullAt(array, indexes);
  25006. return result;
  25007. }
  25008. /**
  25009. * Reverses `array` so that the first element becomes the last, the second
  25010. * element becomes the second to last, and so on.
  25011. *
  25012. * **Note:** This method mutates `array` and is based on
  25013. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25014. *
  25015. * @static
  25016. * @memberOf _
  25017. * @since 4.0.0
  25018. * @category Array
  25019. * @param {Array} array The array to modify.
  25020. * @returns {Array} Returns `array`.
  25021. * @example
  25022. *
  25023. * var array = [1, 2, 3];
  25024. *
  25025. * _.reverse(array);
  25026. * // => [3, 2, 1]
  25027. *
  25028. * console.log(array);
  25029. * // => [3, 2, 1]
  25030. */
  25031. function reverse(array) {
  25032. return array == null ? array : nativeReverse.call(array);
  25033. }
  25034. /**
  25035. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25036. *
  25037. * **Note:** This method is used instead of
  25038. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25039. * returned.
  25040. *
  25041. * @static
  25042. * @memberOf _
  25043. * @since 3.0.0
  25044. * @category Array
  25045. * @param {Array} array The array to slice.
  25046. * @param {number} [start=0] The start position.
  25047. * @param {number} [end=array.length] The end position.
  25048. * @returns {Array} Returns the slice of `array`.
  25049. */
  25050. function slice(array, start, end) {
  25051. var length = array == null ? 0 : array.length;
  25052. if (!length) {
  25053. return [];
  25054. }
  25055. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25056. start = 0;
  25057. end = length;
  25058. }
  25059. else {
  25060. start = start == null ? 0 : toInteger(start);
  25061. end = end === undefined ? length : toInteger(end);
  25062. }
  25063. return baseSlice(array, start, end);
  25064. }
  25065. /**
  25066. * Uses a binary search to determine the lowest index at which `value`
  25067. * should be inserted into `array` in order to maintain its sort order.
  25068. *
  25069. * @static
  25070. * @memberOf _
  25071. * @since 0.1.0
  25072. * @category Array
  25073. * @param {Array} array The sorted array to inspect.
  25074. * @param {*} value The value to evaluate.
  25075. * @returns {number} Returns the index at which `value` should be inserted
  25076. * into `array`.
  25077. * @example
  25078. *
  25079. * _.sortedIndex([30, 50], 40);
  25080. * // => 1
  25081. */
  25082. function sortedIndex(array, value) {
  25083. return baseSortedIndex(array, value);
  25084. }
  25085. /**
  25086. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25087. * which is invoked for `value` and each element of `array` to compute their
  25088. * sort ranking. The iteratee is invoked with one argument: (value).
  25089. *
  25090. * @static
  25091. * @memberOf _
  25092. * @since 4.0.0
  25093. * @category Array
  25094. * @param {Array} array The sorted array to inspect.
  25095. * @param {*} value The value to evaluate.
  25096. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25097. * @returns {number} Returns the index at which `value` should be inserted
  25098. * into `array`.
  25099. * @example
  25100. *
  25101. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25102. *
  25103. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25104. * // => 0
  25105. *
  25106. * // The `_.property` iteratee shorthand.
  25107. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25108. * // => 0
  25109. */
  25110. function sortedIndexBy(array, value, iteratee) {
  25111. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25112. }
  25113. /**
  25114. * This method is like `_.indexOf` except that it performs a binary
  25115. * search on a sorted `array`.
  25116. *
  25117. * @static
  25118. * @memberOf _
  25119. * @since 4.0.0
  25120. * @category Array
  25121. * @param {Array} array The array to inspect.
  25122. * @param {*} value The value to search for.
  25123. * @returns {number} Returns the index of the matched value, else `-1`.
  25124. * @example
  25125. *
  25126. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25127. * // => 1
  25128. */
  25129. function sortedIndexOf(array, value) {
  25130. var length = array == null ? 0 : array.length;
  25131. if (length) {
  25132. var index = baseSortedIndex(array, value);
  25133. if (index < length && eq(array[index], value)) {
  25134. return index;
  25135. }
  25136. }
  25137. return -1;
  25138. }
  25139. /**
  25140. * This method is like `_.sortedIndex` except that it returns the highest
  25141. * index at which `value` should be inserted into `array` in order to
  25142. * maintain its sort order.
  25143. *
  25144. * @static
  25145. * @memberOf _
  25146. * @since 3.0.0
  25147. * @category Array
  25148. * @param {Array} array The sorted array to inspect.
  25149. * @param {*} value The value to evaluate.
  25150. * @returns {number} Returns the index at which `value` should be inserted
  25151. * into `array`.
  25152. * @example
  25153. *
  25154. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25155. * // => 4
  25156. */
  25157. function sortedLastIndex(array, value) {
  25158. return baseSortedIndex(array, value, true);
  25159. }
  25160. /**
  25161. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25162. * which is invoked for `value` and each element of `array` to compute their
  25163. * sort ranking. The iteratee is invoked with one argument: (value).
  25164. *
  25165. * @static
  25166. * @memberOf _
  25167. * @since 4.0.0
  25168. * @category Array
  25169. * @param {Array} array The sorted array to inspect.
  25170. * @param {*} value The value to evaluate.
  25171. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25172. * @returns {number} Returns the index at which `value` should be inserted
  25173. * into `array`.
  25174. * @example
  25175. *
  25176. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25177. *
  25178. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25179. * // => 1
  25180. *
  25181. * // The `_.property` iteratee shorthand.
  25182. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25183. * // => 1
  25184. */
  25185. function sortedLastIndexBy(array, value, iteratee) {
  25186. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25187. }
  25188. /**
  25189. * This method is like `_.lastIndexOf` except that it performs a binary
  25190. * search on a sorted `array`.
  25191. *
  25192. * @static
  25193. * @memberOf _
  25194. * @since 4.0.0
  25195. * @category Array
  25196. * @param {Array} array The array to inspect.
  25197. * @param {*} value The value to search for.
  25198. * @returns {number} Returns the index of the matched value, else `-1`.
  25199. * @example
  25200. *
  25201. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25202. * // => 3
  25203. */
  25204. function sortedLastIndexOf(array, value) {
  25205. var length = array == null ? 0 : array.length;
  25206. if (length) {
  25207. var index = baseSortedIndex(array, value, true) - 1;
  25208. if (eq(array[index], value)) {
  25209. return index;
  25210. }
  25211. }
  25212. return -1;
  25213. }
  25214. /**
  25215. * This method is like `_.uniq` except that it's designed and optimized
  25216. * for sorted arrays.
  25217. *
  25218. * @static
  25219. * @memberOf _
  25220. * @since 4.0.0
  25221. * @category Array
  25222. * @param {Array} array The array to inspect.
  25223. * @returns {Array} Returns the new duplicate free array.
  25224. * @example
  25225. *
  25226. * _.sortedUniq([1, 1, 2]);
  25227. * // => [1, 2]
  25228. */
  25229. function sortedUniq(array) {
  25230. return (array && array.length)
  25231. ? baseSortedUniq(array)
  25232. : [];
  25233. }
  25234. /**
  25235. * This method is like `_.uniqBy` except that it's designed and optimized
  25236. * for sorted arrays.
  25237. *
  25238. * @static
  25239. * @memberOf _
  25240. * @since 4.0.0
  25241. * @category Array
  25242. * @param {Array} array The array to inspect.
  25243. * @param {Function} [iteratee] The iteratee invoked per element.
  25244. * @returns {Array} Returns the new duplicate free array.
  25245. * @example
  25246. *
  25247. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25248. * // => [1.1, 2.3]
  25249. */
  25250. function sortedUniqBy(array, iteratee) {
  25251. return (array && array.length)
  25252. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25253. : [];
  25254. }
  25255. /**
  25256. * Gets all but the first element of `array`.
  25257. *
  25258. * @static
  25259. * @memberOf _
  25260. * @since 4.0.0
  25261. * @category Array
  25262. * @param {Array} array The array to query.
  25263. * @returns {Array} Returns the slice of `array`.
  25264. * @example
  25265. *
  25266. * _.tail([1, 2, 3]);
  25267. * // => [2, 3]
  25268. */
  25269. function tail(array) {
  25270. var length = array == null ? 0 : array.length;
  25271. return length ? baseSlice(array, 1, length) : [];
  25272. }
  25273. /**
  25274. * Creates a slice of `array` with `n` elements taken from the beginning.
  25275. *
  25276. * @static
  25277. * @memberOf _
  25278. * @since 0.1.0
  25279. * @category Array
  25280. * @param {Array} array The array to query.
  25281. * @param {number} [n=1] The number of elements to take.
  25282. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25283. * @returns {Array} Returns the slice of `array`.
  25284. * @example
  25285. *
  25286. * _.take([1, 2, 3]);
  25287. * // => [1]
  25288. *
  25289. * _.take([1, 2, 3], 2);
  25290. * // => [1, 2]
  25291. *
  25292. * _.take([1, 2, 3], 5);
  25293. * // => [1, 2, 3]
  25294. *
  25295. * _.take([1, 2, 3], 0);
  25296. * // => []
  25297. */
  25298. function take(array, n, guard) {
  25299. if (!(array && array.length)) {
  25300. return [];
  25301. }
  25302. n = (guard || n === undefined) ? 1 : toInteger(n);
  25303. return baseSlice(array, 0, n < 0 ? 0 : n);
  25304. }
  25305. /**
  25306. * Creates a slice of `array` with `n` elements taken from the end.
  25307. *
  25308. * @static
  25309. * @memberOf _
  25310. * @since 3.0.0
  25311. * @category Array
  25312. * @param {Array} array The array to query.
  25313. * @param {number} [n=1] The number of elements to take.
  25314. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25315. * @returns {Array} Returns the slice of `array`.
  25316. * @example
  25317. *
  25318. * _.takeRight([1, 2, 3]);
  25319. * // => [3]
  25320. *
  25321. * _.takeRight([1, 2, 3], 2);
  25322. * // => [2, 3]
  25323. *
  25324. * _.takeRight([1, 2, 3], 5);
  25325. * // => [1, 2, 3]
  25326. *
  25327. * _.takeRight([1, 2, 3], 0);
  25328. * // => []
  25329. */
  25330. function takeRight(array, n, guard) {
  25331. var length = array == null ? 0 : array.length;
  25332. if (!length) {
  25333. return [];
  25334. }
  25335. n = (guard || n === undefined) ? 1 : toInteger(n);
  25336. n = length - n;
  25337. return baseSlice(array, n < 0 ? 0 : n, length);
  25338. }
  25339. /**
  25340. * Creates a slice of `array` with elements taken from the end. Elements are
  25341. * taken until `predicate` returns falsey. The predicate is invoked with
  25342. * three arguments: (value, index, array).
  25343. *
  25344. * @static
  25345. * @memberOf _
  25346. * @since 3.0.0
  25347. * @category Array
  25348. * @param {Array} array The array to query.
  25349. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25350. * @returns {Array} Returns the slice of `array`.
  25351. * @example
  25352. *
  25353. * var users = [
  25354. * { 'user': 'barney', 'active': true },
  25355. * { 'user': 'fred', 'active': false },
  25356. * { 'user': 'pebbles', 'active': false }
  25357. * ];
  25358. *
  25359. * _.takeRightWhile(users, function(o) { return !o.active; });
  25360. * // => objects for ['fred', 'pebbles']
  25361. *
  25362. * // The `_.matches` iteratee shorthand.
  25363. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25364. * // => objects for ['pebbles']
  25365. *
  25366. * // The `_.matchesProperty` iteratee shorthand.
  25367. * _.takeRightWhile(users, ['active', false]);
  25368. * // => objects for ['fred', 'pebbles']
  25369. *
  25370. * // The `_.property` iteratee shorthand.
  25371. * _.takeRightWhile(users, 'active');
  25372. * // => []
  25373. */
  25374. function takeRightWhile(array, predicate) {
  25375. return (array && array.length)
  25376. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25377. : [];
  25378. }
  25379. /**
  25380. * Creates a slice of `array` with elements taken from the beginning. Elements
  25381. * are taken until `predicate` returns falsey. The predicate is invoked with
  25382. * three arguments: (value, index, array).
  25383. *
  25384. * @static
  25385. * @memberOf _
  25386. * @since 3.0.0
  25387. * @category Array
  25388. * @param {Array} array The array to query.
  25389. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25390. * @returns {Array} Returns the slice of `array`.
  25391. * @example
  25392. *
  25393. * var users = [
  25394. * { 'user': 'barney', 'active': false },
  25395. * { 'user': 'fred', 'active': false },
  25396. * { 'user': 'pebbles', 'active': true }
  25397. * ];
  25398. *
  25399. * _.takeWhile(users, function(o) { return !o.active; });
  25400. * // => objects for ['barney', 'fred']
  25401. *
  25402. * // The `_.matches` iteratee shorthand.
  25403. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25404. * // => objects for ['barney']
  25405. *
  25406. * // The `_.matchesProperty` iteratee shorthand.
  25407. * _.takeWhile(users, ['active', false]);
  25408. * // => objects for ['barney', 'fred']
  25409. *
  25410. * // The `_.property` iteratee shorthand.
  25411. * _.takeWhile(users, 'active');
  25412. * // => []
  25413. */
  25414. function takeWhile(array, predicate) {
  25415. return (array && array.length)
  25416. ? baseWhile(array, getIteratee(predicate, 3))
  25417. : [];
  25418. }
  25419. /**
  25420. * Creates an array of unique values, in order, from all given arrays using
  25421. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25422. * for equality comparisons.
  25423. *
  25424. * @static
  25425. * @memberOf _
  25426. * @since 0.1.0
  25427. * @category Array
  25428. * @param {...Array} [arrays] The arrays to inspect.
  25429. * @returns {Array} Returns the new array of combined values.
  25430. * @example
  25431. *
  25432. * _.union([2], [1, 2]);
  25433. * // => [2, 1]
  25434. */
  25435. var union = baseRest(function(arrays) {
  25436. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25437. });
  25438. /**
  25439. * This method is like `_.union` except that it accepts `iteratee` which is
  25440. * invoked for each element of each `arrays` to generate the criterion by
  25441. * which uniqueness is computed. Result values are chosen from the first
  25442. * array in which the value occurs. The iteratee is invoked with one argument:
  25443. * (value).
  25444. *
  25445. * @static
  25446. * @memberOf _
  25447. * @since 4.0.0
  25448. * @category Array
  25449. * @param {...Array} [arrays] The arrays to inspect.
  25450. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25451. * @returns {Array} Returns the new array of combined values.
  25452. * @example
  25453. *
  25454. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25455. * // => [2.1, 1.2]
  25456. *
  25457. * // The `_.property` iteratee shorthand.
  25458. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25459. * // => [{ 'x': 1 }, { 'x': 2 }]
  25460. */
  25461. var unionBy = baseRest(function(arrays) {
  25462. var iteratee = last(arrays);
  25463. if (isArrayLikeObject(iteratee)) {
  25464. iteratee = undefined;
  25465. }
  25466. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25467. });
  25468. /**
  25469. * This method is like `_.union` except that it accepts `comparator` which
  25470. * is invoked to compare elements of `arrays`. Result values are chosen from
  25471. * the first array in which the value occurs. The comparator is invoked
  25472. * with two arguments: (arrVal, othVal).
  25473. *
  25474. * @static
  25475. * @memberOf _
  25476. * @since 4.0.0
  25477. * @category Array
  25478. * @param {...Array} [arrays] The arrays to inspect.
  25479. * @param {Function} [comparator] The comparator invoked per element.
  25480. * @returns {Array} Returns the new array of combined values.
  25481. * @example
  25482. *
  25483. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25484. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25485. *
  25486. * _.unionWith(objects, others, _.isEqual);
  25487. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25488. */
  25489. var unionWith = baseRest(function(arrays) {
  25490. var comparator = last(arrays);
  25491. comparator = typeof comparator == 'function' ? comparator : undefined;
  25492. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25493. });
  25494. /**
  25495. * Creates a duplicate-free version of an array, using
  25496. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25497. * for equality comparisons, in which only the first occurrence of each element
  25498. * is kept. The order of result values is determined by the order they occur
  25499. * in the array.
  25500. *
  25501. * @static
  25502. * @memberOf _
  25503. * @since 0.1.0
  25504. * @category Array
  25505. * @param {Array} array The array to inspect.
  25506. * @returns {Array} Returns the new duplicate free array.
  25507. * @example
  25508. *
  25509. * _.uniq([2, 1, 2]);
  25510. * // => [2, 1]
  25511. */
  25512. function uniq(array) {
  25513. return (array && array.length) ? baseUniq(array) : [];
  25514. }
  25515. /**
  25516. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25517. * invoked for each element in `array` to generate the criterion by which
  25518. * uniqueness is computed. The order of result values is determined by the
  25519. * order they occur in the array. The iteratee is invoked with one argument:
  25520. * (value).
  25521. *
  25522. * @static
  25523. * @memberOf _
  25524. * @since 4.0.0
  25525. * @category Array
  25526. * @param {Array} array The array to inspect.
  25527. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25528. * @returns {Array} Returns the new duplicate free array.
  25529. * @example
  25530. *
  25531. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25532. * // => [2.1, 1.2]
  25533. *
  25534. * // The `_.property` iteratee shorthand.
  25535. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25536. * // => [{ 'x': 1 }, { 'x': 2 }]
  25537. */
  25538. function uniqBy(array, iteratee) {
  25539. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25540. }
  25541. /**
  25542. * This method is like `_.uniq` except that it accepts `comparator` which
  25543. * is invoked to compare elements of `array`. The order of result values is
  25544. * determined by the order they occur in the array.The comparator is invoked
  25545. * with two arguments: (arrVal, othVal).
  25546. *
  25547. * @static
  25548. * @memberOf _
  25549. * @since 4.0.0
  25550. * @category Array
  25551. * @param {Array} array The array to inspect.
  25552. * @param {Function} [comparator] The comparator invoked per element.
  25553. * @returns {Array} Returns the new duplicate free array.
  25554. * @example
  25555. *
  25556. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25557. *
  25558. * _.uniqWith(objects, _.isEqual);
  25559. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25560. */
  25561. function uniqWith(array, comparator) {
  25562. comparator = typeof comparator == 'function' ? comparator : undefined;
  25563. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25564. }
  25565. /**
  25566. * This method is like `_.zip` except that it accepts an array of grouped
  25567. * elements and creates an array regrouping the elements to their pre-zip
  25568. * configuration.
  25569. *
  25570. * @static
  25571. * @memberOf _
  25572. * @since 1.2.0
  25573. * @category Array
  25574. * @param {Array} array The array of grouped elements to process.
  25575. * @returns {Array} Returns the new array of regrouped elements.
  25576. * @example
  25577. *
  25578. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25579. * // => [['a', 1, true], ['b', 2, false]]
  25580. *
  25581. * _.unzip(zipped);
  25582. * // => [['a', 'b'], [1, 2], [true, false]]
  25583. */
  25584. function unzip(array) {
  25585. if (!(array && array.length)) {
  25586. return [];
  25587. }
  25588. var length = 0;
  25589. array = arrayFilter(array, function(group) {
  25590. if (isArrayLikeObject(group)) {
  25591. length = nativeMax(group.length, length);
  25592. return true;
  25593. }
  25594. });
  25595. return baseTimes(length, function(index) {
  25596. return arrayMap(array, baseProperty(index));
  25597. });
  25598. }
  25599. /**
  25600. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25601. * how regrouped values should be combined. The iteratee is invoked with the
  25602. * elements of each group: (...group).
  25603. *
  25604. * @static
  25605. * @memberOf _
  25606. * @since 3.8.0
  25607. * @category Array
  25608. * @param {Array} array The array of grouped elements to process.
  25609. * @param {Function} [iteratee=_.identity] The function to combine
  25610. * regrouped values.
  25611. * @returns {Array} Returns the new array of regrouped elements.
  25612. * @example
  25613. *
  25614. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25615. * // => [[1, 10, 100], [2, 20, 200]]
  25616. *
  25617. * _.unzipWith(zipped, _.add);
  25618. * // => [3, 30, 300]
  25619. */
  25620. function unzipWith(array, iteratee) {
  25621. if (!(array && array.length)) {
  25622. return [];
  25623. }
  25624. var result = unzip(array);
  25625. if (iteratee == null) {
  25626. return result;
  25627. }
  25628. return arrayMap(result, function(group) {
  25629. return apply(iteratee, undefined, group);
  25630. });
  25631. }
  25632. /**
  25633. * Creates an array excluding all given values using
  25634. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25635. * for equality comparisons.
  25636. *
  25637. * **Note:** Unlike `_.pull`, this method returns a new array.
  25638. *
  25639. * @static
  25640. * @memberOf _
  25641. * @since 0.1.0
  25642. * @category Array
  25643. * @param {Array} array The array to inspect.
  25644. * @param {...*} [values] The values to exclude.
  25645. * @returns {Array} Returns the new array of filtered values.
  25646. * @see _.difference, _.xor
  25647. * @example
  25648. *
  25649. * _.without([2, 1, 2, 3], 1, 2);
  25650. * // => [3]
  25651. */
  25652. var without = baseRest(function(array, values) {
  25653. return isArrayLikeObject(array)
  25654. ? baseDifference(array, values)
  25655. : [];
  25656. });
  25657. /**
  25658. * Creates an array of unique values that is the
  25659. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25660. * of the given arrays. The order of result values is determined by the order
  25661. * they occur in the arrays.
  25662. *
  25663. * @static
  25664. * @memberOf _
  25665. * @since 2.4.0
  25666. * @category Array
  25667. * @param {...Array} [arrays] The arrays to inspect.
  25668. * @returns {Array} Returns the new array of filtered values.
  25669. * @see _.difference, _.without
  25670. * @example
  25671. *
  25672. * _.xor([2, 1], [2, 3]);
  25673. * // => [1, 3]
  25674. */
  25675. var xor = baseRest(function(arrays) {
  25676. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25677. });
  25678. /**
  25679. * This method is like `_.xor` except that it accepts `iteratee` which is
  25680. * invoked for each element of each `arrays` to generate the criterion by
  25681. * which by which they're compared. The order of result values is determined
  25682. * by the order they occur in the arrays. The iteratee is invoked with one
  25683. * argument: (value).
  25684. *
  25685. * @static
  25686. * @memberOf _
  25687. * @since 4.0.0
  25688. * @category Array
  25689. * @param {...Array} [arrays] The arrays to inspect.
  25690. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25691. * @returns {Array} Returns the new array of filtered values.
  25692. * @example
  25693. *
  25694. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25695. * // => [1.2, 3.4]
  25696. *
  25697. * // The `_.property` iteratee shorthand.
  25698. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25699. * // => [{ 'x': 2 }]
  25700. */
  25701. var xorBy = baseRest(function(arrays) {
  25702. var iteratee = last(arrays);
  25703. if (isArrayLikeObject(iteratee)) {
  25704. iteratee = undefined;
  25705. }
  25706. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25707. });
  25708. /**
  25709. * This method is like `_.xor` except that it accepts `comparator` which is
  25710. * invoked to compare elements of `arrays`. The order of result values is
  25711. * determined by the order they occur in the arrays. The comparator is invoked
  25712. * with two arguments: (arrVal, othVal).
  25713. *
  25714. * @static
  25715. * @memberOf _
  25716. * @since 4.0.0
  25717. * @category Array
  25718. * @param {...Array} [arrays] The arrays to inspect.
  25719. * @param {Function} [comparator] The comparator invoked per element.
  25720. * @returns {Array} Returns the new array of filtered values.
  25721. * @example
  25722. *
  25723. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25724. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25725. *
  25726. * _.xorWith(objects, others, _.isEqual);
  25727. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25728. */
  25729. var xorWith = baseRest(function(arrays) {
  25730. var comparator = last(arrays);
  25731. comparator = typeof comparator == 'function' ? comparator : undefined;
  25732. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25733. });
  25734. /**
  25735. * Creates an array of grouped elements, the first of which contains the
  25736. * first elements of the given arrays, the second of which contains the
  25737. * second elements of the given arrays, and so on.
  25738. *
  25739. * @static
  25740. * @memberOf _
  25741. * @since 0.1.0
  25742. * @category Array
  25743. * @param {...Array} [arrays] The arrays to process.
  25744. * @returns {Array} Returns the new array of grouped elements.
  25745. * @example
  25746. *
  25747. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25748. * // => [['a', 1, true], ['b', 2, false]]
  25749. */
  25750. var zip = baseRest(unzip);
  25751. /**
  25752. * This method is like `_.fromPairs` except that it accepts two arrays,
  25753. * one of property identifiers and one of corresponding values.
  25754. *
  25755. * @static
  25756. * @memberOf _
  25757. * @since 0.4.0
  25758. * @category Array
  25759. * @param {Array} [props=[]] The property identifiers.
  25760. * @param {Array} [values=[]] The property values.
  25761. * @returns {Object} Returns the new object.
  25762. * @example
  25763. *
  25764. * _.zipObject(['a', 'b'], [1, 2]);
  25765. * // => { 'a': 1, 'b': 2 }
  25766. */
  25767. function zipObject(props, values) {
  25768. return baseZipObject(props || [], values || [], assignValue);
  25769. }
  25770. /**
  25771. * This method is like `_.zipObject` except that it supports property paths.
  25772. *
  25773. * @static
  25774. * @memberOf _
  25775. * @since 4.1.0
  25776. * @category Array
  25777. * @param {Array} [props=[]] The property identifiers.
  25778. * @param {Array} [values=[]] The property values.
  25779. * @returns {Object} Returns the new object.
  25780. * @example
  25781. *
  25782. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25783. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25784. */
  25785. function zipObjectDeep(props, values) {
  25786. return baseZipObject(props || [], values || [], baseSet);
  25787. }
  25788. /**
  25789. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25790. * how grouped values should be combined. The iteratee is invoked with the
  25791. * elements of each group: (...group).
  25792. *
  25793. * @static
  25794. * @memberOf _
  25795. * @since 3.8.0
  25796. * @category Array
  25797. * @param {...Array} [arrays] The arrays to process.
  25798. * @param {Function} [iteratee=_.identity] The function to combine
  25799. * grouped values.
  25800. * @returns {Array} Returns the new array of grouped elements.
  25801. * @example
  25802. *
  25803. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25804. * return a + b + c;
  25805. * });
  25806. * // => [111, 222]
  25807. */
  25808. var zipWith = baseRest(function(arrays) {
  25809. var length = arrays.length,
  25810. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25811. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25812. return unzipWith(arrays, iteratee);
  25813. });
  25814. /*------------------------------------------------------------------------*/
  25815. /**
  25816. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25817. * chain sequences enabled. The result of such sequences must be unwrapped
  25818. * with `_#value`.
  25819. *
  25820. * @static
  25821. * @memberOf _
  25822. * @since 1.3.0
  25823. * @category Seq
  25824. * @param {*} value The value to wrap.
  25825. * @returns {Object} Returns the new `lodash` wrapper instance.
  25826. * @example
  25827. *
  25828. * var users = [
  25829. * { 'user': 'barney', 'age': 36 },
  25830. * { 'user': 'fred', 'age': 40 },
  25831. * { 'user': 'pebbles', 'age': 1 }
  25832. * ];
  25833. *
  25834. * var youngest = _
  25835. * .chain(users)
  25836. * .sortBy('age')
  25837. * .map(function(o) {
  25838. * return o.user + ' is ' + o.age;
  25839. * })
  25840. * .head()
  25841. * .value();
  25842. * // => 'pebbles is 1'
  25843. */
  25844. function chain(value) {
  25845. var result = lodash(value);
  25846. result.__chain__ = true;
  25847. return result;
  25848. }
  25849. /**
  25850. * This method invokes `interceptor` and returns `value`. The interceptor
  25851. * is invoked with one argument; (value). The purpose of this method is to
  25852. * "tap into" a method chain sequence in order to modify intermediate results.
  25853. *
  25854. * @static
  25855. * @memberOf _
  25856. * @since 0.1.0
  25857. * @category Seq
  25858. * @param {*} value The value to provide to `interceptor`.
  25859. * @param {Function} interceptor The function to invoke.
  25860. * @returns {*} Returns `value`.
  25861. * @example
  25862. *
  25863. * _([1, 2, 3])
  25864. * .tap(function(array) {
  25865. * // Mutate input array.
  25866. * array.pop();
  25867. * })
  25868. * .reverse()
  25869. * .value();
  25870. * // => [2, 1]
  25871. */
  25872. function tap(value, interceptor) {
  25873. interceptor(value);
  25874. return value;
  25875. }
  25876. /**
  25877. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25878. * The purpose of this method is to "pass thru" values replacing intermediate
  25879. * results in a method chain sequence.
  25880. *
  25881. * @static
  25882. * @memberOf _
  25883. * @since 3.0.0
  25884. * @category Seq
  25885. * @param {*} value The value to provide to `interceptor`.
  25886. * @param {Function} interceptor The function to invoke.
  25887. * @returns {*} Returns the result of `interceptor`.
  25888. * @example
  25889. *
  25890. * _(' abc ')
  25891. * .chain()
  25892. * .trim()
  25893. * .thru(function(value) {
  25894. * return [value];
  25895. * })
  25896. * .value();
  25897. * // => ['abc']
  25898. */
  25899. function thru(value, interceptor) {
  25900. return interceptor(value);
  25901. }
  25902. /**
  25903. * This method is the wrapper version of `_.at`.
  25904. *
  25905. * @name at
  25906. * @memberOf _
  25907. * @since 1.0.0
  25908. * @category Seq
  25909. * @param {...(string|string[])} [paths] The property paths to pick.
  25910. * @returns {Object} Returns the new `lodash` wrapper instance.
  25911. * @example
  25912. *
  25913. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25914. *
  25915. * _(object).at(['a[0].b.c', 'a[1]']).value();
  25916. * // => [3, 4]
  25917. */
  25918. var wrapperAt = flatRest(function(paths) {
  25919. var length = paths.length,
  25920. start = length ? paths[0] : 0,
  25921. value = this.__wrapped__,
  25922. interceptor = function(object) { return baseAt(object, paths); };
  25923. if (length > 1 || this.__actions__.length ||
  25924. !(value instanceof LazyWrapper) || !isIndex(start)) {
  25925. return this.thru(interceptor);
  25926. }
  25927. value = value.slice(start, +start + (length ? 1 : 0));
  25928. value.__actions__.push({
  25929. 'func': thru,
  25930. 'args': [interceptor],
  25931. 'thisArg': undefined
  25932. });
  25933. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  25934. if (length && !array.length) {
  25935. array.push(undefined);
  25936. }
  25937. return array;
  25938. });
  25939. });
  25940. /**
  25941. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  25942. *
  25943. * @name chain
  25944. * @memberOf _
  25945. * @since 0.1.0
  25946. * @category Seq
  25947. * @returns {Object} Returns the new `lodash` wrapper instance.
  25948. * @example
  25949. *
  25950. * var users = [
  25951. * { 'user': 'barney', 'age': 36 },
  25952. * { 'user': 'fred', 'age': 40 }
  25953. * ];
  25954. *
  25955. * // A sequence without explicit chaining.
  25956. * _(users).head();
  25957. * // => { 'user': 'barney', 'age': 36 }
  25958. *
  25959. * // A sequence with explicit chaining.
  25960. * _(users)
  25961. * .chain()
  25962. * .head()
  25963. * .pick('user')
  25964. * .value();
  25965. * // => { 'user': 'barney' }
  25966. */
  25967. function wrapperChain() {
  25968. return chain(this);
  25969. }
  25970. /**
  25971. * Executes the chain sequence and returns the wrapped result.
  25972. *
  25973. * @name commit
  25974. * @memberOf _
  25975. * @since 3.2.0
  25976. * @category Seq
  25977. * @returns {Object} Returns the new `lodash` wrapper instance.
  25978. * @example
  25979. *
  25980. * var array = [1, 2];
  25981. * var wrapped = _(array).push(3);
  25982. *
  25983. * console.log(array);
  25984. * // => [1, 2]
  25985. *
  25986. * wrapped = wrapped.commit();
  25987. * console.log(array);
  25988. * // => [1, 2, 3]
  25989. *
  25990. * wrapped.last();
  25991. * // => 3
  25992. *
  25993. * console.log(array);
  25994. * // => [1, 2, 3]
  25995. */
  25996. function wrapperCommit() {
  25997. return new LodashWrapper(this.value(), this.__chain__);
  25998. }
  25999. /**
  26000. * Gets the next value on a wrapped object following the
  26001. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26002. *
  26003. * @name next
  26004. * @memberOf _
  26005. * @since 4.0.0
  26006. * @category Seq
  26007. * @returns {Object} Returns the next iterator value.
  26008. * @example
  26009. *
  26010. * var wrapped = _([1, 2]);
  26011. *
  26012. * wrapped.next();
  26013. * // => { 'done': false, 'value': 1 }
  26014. *
  26015. * wrapped.next();
  26016. * // => { 'done': false, 'value': 2 }
  26017. *
  26018. * wrapped.next();
  26019. * // => { 'done': true, 'value': undefined }
  26020. */
  26021. function wrapperNext() {
  26022. if (this.__values__ === undefined) {
  26023. this.__values__ = toArray(this.value());
  26024. }
  26025. var done = this.__index__ >= this.__values__.length,
  26026. value = done ? undefined : this.__values__[this.__index__++];
  26027. return { 'done': done, 'value': value };
  26028. }
  26029. /**
  26030. * Enables the wrapper to be iterable.
  26031. *
  26032. * @name Symbol.iterator
  26033. * @memberOf _
  26034. * @since 4.0.0
  26035. * @category Seq
  26036. * @returns {Object} Returns the wrapper object.
  26037. * @example
  26038. *
  26039. * var wrapped = _([1, 2]);
  26040. *
  26041. * wrapped[Symbol.iterator]() === wrapped;
  26042. * // => true
  26043. *
  26044. * Array.from(wrapped);
  26045. * // => [1, 2]
  26046. */
  26047. function wrapperToIterator() {
  26048. return this;
  26049. }
  26050. /**
  26051. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26052. *
  26053. * @name plant
  26054. * @memberOf _
  26055. * @since 3.2.0
  26056. * @category Seq
  26057. * @param {*} value The value to plant.
  26058. * @returns {Object} Returns the new `lodash` wrapper instance.
  26059. * @example
  26060. *
  26061. * function square(n) {
  26062. * return n * n;
  26063. * }
  26064. *
  26065. * var wrapped = _([1, 2]).map(square);
  26066. * var other = wrapped.plant([3, 4]);
  26067. *
  26068. * other.value();
  26069. * // => [9, 16]
  26070. *
  26071. * wrapped.value();
  26072. * // => [1, 4]
  26073. */
  26074. function wrapperPlant(value) {
  26075. var result,
  26076. parent = this;
  26077. while (parent instanceof baseLodash) {
  26078. var clone = wrapperClone(parent);
  26079. clone.__index__ = 0;
  26080. clone.__values__ = undefined;
  26081. if (result) {
  26082. previous.__wrapped__ = clone;
  26083. } else {
  26084. result = clone;
  26085. }
  26086. var previous = clone;
  26087. parent = parent.__wrapped__;
  26088. }
  26089. previous.__wrapped__ = value;
  26090. return result;
  26091. }
  26092. /**
  26093. * This method is the wrapper version of `_.reverse`.
  26094. *
  26095. * **Note:** This method mutates the wrapped array.
  26096. *
  26097. * @name reverse
  26098. * @memberOf _
  26099. * @since 0.1.0
  26100. * @category Seq
  26101. * @returns {Object} Returns the new `lodash` wrapper instance.
  26102. * @example
  26103. *
  26104. * var array = [1, 2, 3];
  26105. *
  26106. * _(array).reverse().value()
  26107. * // => [3, 2, 1]
  26108. *
  26109. * console.log(array);
  26110. * // => [3, 2, 1]
  26111. */
  26112. function wrapperReverse() {
  26113. var value = this.__wrapped__;
  26114. if (value instanceof LazyWrapper) {
  26115. var wrapped = value;
  26116. if (this.__actions__.length) {
  26117. wrapped = new LazyWrapper(this);
  26118. }
  26119. wrapped = wrapped.reverse();
  26120. wrapped.__actions__.push({
  26121. 'func': thru,
  26122. 'args': [reverse],
  26123. 'thisArg': undefined
  26124. });
  26125. return new LodashWrapper(wrapped, this.__chain__);
  26126. }
  26127. return this.thru(reverse);
  26128. }
  26129. /**
  26130. * Executes the chain sequence to resolve the unwrapped value.
  26131. *
  26132. * @name value
  26133. * @memberOf _
  26134. * @since 0.1.0
  26135. * @alias toJSON, valueOf
  26136. * @category Seq
  26137. * @returns {*} Returns the resolved unwrapped value.
  26138. * @example
  26139. *
  26140. * _([1, 2, 3]).value();
  26141. * // => [1, 2, 3]
  26142. */
  26143. function wrapperValue() {
  26144. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26145. }
  26146. /*------------------------------------------------------------------------*/
  26147. /**
  26148. * Creates an object composed of keys generated from the results of running
  26149. * each element of `collection` thru `iteratee`. The corresponding value of
  26150. * each key is the number of times the key was returned by `iteratee`. The
  26151. * iteratee is invoked with one argument: (value).
  26152. *
  26153. * @static
  26154. * @memberOf _
  26155. * @since 0.5.0
  26156. * @category Collection
  26157. * @param {Array|Object} collection The collection to iterate over.
  26158. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26159. * @returns {Object} Returns the composed aggregate object.
  26160. * @example
  26161. *
  26162. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26163. * // => { '4': 1, '6': 2 }
  26164. *
  26165. * // The `_.property` iteratee shorthand.
  26166. * _.countBy(['one', 'two', 'three'], 'length');
  26167. * // => { '3': 2, '5': 1 }
  26168. */
  26169. var countBy = createAggregator(function(result, value, key) {
  26170. if (hasOwnProperty.call(result, key)) {
  26171. ++result[key];
  26172. } else {
  26173. baseAssignValue(result, key, 1);
  26174. }
  26175. });
  26176. /**
  26177. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26178. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26179. * invoked with three arguments: (value, index|key, collection).
  26180. *
  26181. * **Note:** This method returns `true` for
  26182. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26183. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26184. * elements of empty collections.
  26185. *
  26186. * @static
  26187. * @memberOf _
  26188. * @since 0.1.0
  26189. * @category Collection
  26190. * @param {Array|Object} collection The collection to iterate over.
  26191. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26192. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26193. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26194. * else `false`.
  26195. * @example
  26196. *
  26197. * _.every([true, 1, null, 'yes'], Boolean);
  26198. * // => false
  26199. *
  26200. * var users = [
  26201. * { 'user': 'barney', 'age': 36, 'active': false },
  26202. * { 'user': 'fred', 'age': 40, 'active': false }
  26203. * ];
  26204. *
  26205. * // The `_.matches` iteratee shorthand.
  26206. * _.every(users, { 'user': 'barney', 'active': false });
  26207. * // => false
  26208. *
  26209. * // The `_.matchesProperty` iteratee shorthand.
  26210. * _.every(users, ['active', false]);
  26211. * // => true
  26212. *
  26213. * // The `_.property` iteratee shorthand.
  26214. * _.every(users, 'active');
  26215. * // => false
  26216. */
  26217. function every(collection, predicate, guard) {
  26218. var func = isArray(collection) ? arrayEvery : baseEvery;
  26219. if (guard && isIterateeCall(collection, predicate, guard)) {
  26220. predicate = undefined;
  26221. }
  26222. return func(collection, getIteratee(predicate, 3));
  26223. }
  26224. /**
  26225. * Iterates over elements of `collection`, returning an array of all elements
  26226. * `predicate` returns truthy for. The predicate is invoked with three
  26227. * arguments: (value, index|key, collection).
  26228. *
  26229. * **Note:** Unlike `_.remove`, this method returns a new array.
  26230. *
  26231. * @static
  26232. * @memberOf _
  26233. * @since 0.1.0
  26234. * @category Collection
  26235. * @param {Array|Object} collection The collection to iterate over.
  26236. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26237. * @returns {Array} Returns the new filtered array.
  26238. * @see _.reject
  26239. * @example
  26240. *
  26241. * var users = [
  26242. * { 'user': 'barney', 'age': 36, 'active': true },
  26243. * { 'user': 'fred', 'age': 40, 'active': false }
  26244. * ];
  26245. *
  26246. * _.filter(users, function(o) { return !o.active; });
  26247. * // => objects for ['fred']
  26248. *
  26249. * // The `_.matches` iteratee shorthand.
  26250. * _.filter(users, { 'age': 36, 'active': true });
  26251. * // => objects for ['barney']
  26252. *
  26253. * // The `_.matchesProperty` iteratee shorthand.
  26254. * _.filter(users, ['active', false]);
  26255. * // => objects for ['fred']
  26256. *
  26257. * // The `_.property` iteratee shorthand.
  26258. * _.filter(users, 'active');
  26259. * // => objects for ['barney']
  26260. */
  26261. function filter(collection, predicate) {
  26262. var func = isArray(collection) ? arrayFilter : baseFilter;
  26263. return func(collection, getIteratee(predicate, 3));
  26264. }
  26265. /**
  26266. * Iterates over elements of `collection`, returning the first element
  26267. * `predicate` returns truthy for. The predicate is invoked with three
  26268. * arguments: (value, index|key, collection).
  26269. *
  26270. * @static
  26271. * @memberOf _
  26272. * @since 0.1.0
  26273. * @category Collection
  26274. * @param {Array|Object} collection The collection to inspect.
  26275. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26276. * @param {number} [fromIndex=0] The index to search from.
  26277. * @returns {*} Returns the matched element, else `undefined`.
  26278. * @example
  26279. *
  26280. * var users = [
  26281. * { 'user': 'barney', 'age': 36, 'active': true },
  26282. * { 'user': 'fred', 'age': 40, 'active': false },
  26283. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26284. * ];
  26285. *
  26286. * _.find(users, function(o) { return o.age < 40; });
  26287. * // => object for 'barney'
  26288. *
  26289. * // The `_.matches` iteratee shorthand.
  26290. * _.find(users, { 'age': 1, 'active': true });
  26291. * // => object for 'pebbles'
  26292. *
  26293. * // The `_.matchesProperty` iteratee shorthand.
  26294. * _.find(users, ['active', false]);
  26295. * // => object for 'fred'
  26296. *
  26297. * // The `_.property` iteratee shorthand.
  26298. * _.find(users, 'active');
  26299. * // => object for 'barney'
  26300. */
  26301. var find = createFind(findIndex);
  26302. /**
  26303. * This method is like `_.find` except that it iterates over elements of
  26304. * `collection` from right to left.
  26305. *
  26306. * @static
  26307. * @memberOf _
  26308. * @since 2.0.0
  26309. * @category Collection
  26310. * @param {Array|Object} collection The collection to inspect.
  26311. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26312. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26313. * @returns {*} Returns the matched element, else `undefined`.
  26314. * @example
  26315. *
  26316. * _.findLast([1, 2, 3, 4], function(n) {
  26317. * return n % 2 == 1;
  26318. * });
  26319. * // => 3
  26320. */
  26321. var findLast = createFind(findLastIndex);
  26322. /**
  26323. * Creates a flattened array of values by running each element in `collection`
  26324. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26325. * with three arguments: (value, index|key, collection).
  26326. *
  26327. * @static
  26328. * @memberOf _
  26329. * @since 4.0.0
  26330. * @category Collection
  26331. * @param {Array|Object} collection The collection to iterate over.
  26332. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26333. * @returns {Array} Returns the new flattened array.
  26334. * @example
  26335. *
  26336. * function duplicate(n) {
  26337. * return [n, n];
  26338. * }
  26339. *
  26340. * _.flatMap([1, 2], duplicate);
  26341. * // => [1, 1, 2, 2]
  26342. */
  26343. function flatMap(collection, iteratee) {
  26344. return baseFlatten(map(collection, iteratee), 1);
  26345. }
  26346. /**
  26347. * This method is like `_.flatMap` except that it recursively flattens the
  26348. * mapped results.
  26349. *
  26350. * @static
  26351. * @memberOf _
  26352. * @since 4.7.0
  26353. * @category Collection
  26354. * @param {Array|Object} collection The collection to iterate over.
  26355. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26356. * @returns {Array} Returns the new flattened array.
  26357. * @example
  26358. *
  26359. * function duplicate(n) {
  26360. * return [[[n, n]]];
  26361. * }
  26362. *
  26363. * _.flatMapDeep([1, 2], duplicate);
  26364. * // => [1, 1, 2, 2]
  26365. */
  26366. function flatMapDeep(collection, iteratee) {
  26367. return baseFlatten(map(collection, iteratee), INFINITY);
  26368. }
  26369. /**
  26370. * This method is like `_.flatMap` except that it recursively flattens the
  26371. * mapped results up to `depth` times.
  26372. *
  26373. * @static
  26374. * @memberOf _
  26375. * @since 4.7.0
  26376. * @category Collection
  26377. * @param {Array|Object} collection The collection to iterate over.
  26378. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26379. * @param {number} [depth=1] The maximum recursion depth.
  26380. * @returns {Array} Returns the new flattened array.
  26381. * @example
  26382. *
  26383. * function duplicate(n) {
  26384. * return [[[n, n]]];
  26385. * }
  26386. *
  26387. * _.flatMapDepth([1, 2], duplicate, 2);
  26388. * // => [[1, 1], [2, 2]]
  26389. */
  26390. function flatMapDepth(collection, iteratee, depth) {
  26391. depth = depth === undefined ? 1 : toInteger(depth);
  26392. return baseFlatten(map(collection, iteratee), depth);
  26393. }
  26394. /**
  26395. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26396. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26397. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26398. *
  26399. * **Note:** As with other "Collections" methods, objects with a "length"
  26400. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26401. * or `_.forOwn` for object iteration.
  26402. *
  26403. * @static
  26404. * @memberOf _
  26405. * @since 0.1.0
  26406. * @alias each
  26407. * @category Collection
  26408. * @param {Array|Object} collection The collection to iterate over.
  26409. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26410. * @returns {Array|Object} Returns `collection`.
  26411. * @see _.forEachRight
  26412. * @example
  26413. *
  26414. * _.forEach([1, 2], function(value) {
  26415. * console.log(value);
  26416. * });
  26417. * // => Logs `1` then `2`.
  26418. *
  26419. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26420. * console.log(key);
  26421. * });
  26422. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26423. */
  26424. function forEach(collection, iteratee) {
  26425. var func = isArray(collection) ? arrayEach : baseEach;
  26426. return func(collection, getIteratee(iteratee, 3));
  26427. }
  26428. /**
  26429. * This method is like `_.forEach` except that it iterates over elements of
  26430. * `collection` from right to left.
  26431. *
  26432. * @static
  26433. * @memberOf _
  26434. * @since 2.0.0
  26435. * @alias eachRight
  26436. * @category Collection
  26437. * @param {Array|Object} collection The collection to iterate over.
  26438. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26439. * @returns {Array|Object} Returns `collection`.
  26440. * @see _.forEach
  26441. * @example
  26442. *
  26443. * _.forEachRight([1, 2], function(value) {
  26444. * console.log(value);
  26445. * });
  26446. * // => Logs `2` then `1`.
  26447. */
  26448. function forEachRight(collection, iteratee) {
  26449. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26450. return func(collection, getIteratee(iteratee, 3));
  26451. }
  26452. /**
  26453. * Creates an object composed of keys generated from the results of running
  26454. * each element of `collection` thru `iteratee`. The order of grouped values
  26455. * is determined by the order they occur in `collection`. The corresponding
  26456. * value of each key is an array of elements responsible for generating the
  26457. * key. The iteratee is invoked with one argument: (value).
  26458. *
  26459. * @static
  26460. * @memberOf _
  26461. * @since 0.1.0
  26462. * @category Collection
  26463. * @param {Array|Object} collection The collection to iterate over.
  26464. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26465. * @returns {Object} Returns the composed aggregate object.
  26466. * @example
  26467. *
  26468. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26469. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26470. *
  26471. * // The `_.property` iteratee shorthand.
  26472. * _.groupBy(['one', 'two', 'three'], 'length');
  26473. * // => { '3': ['one', 'two'], '5': ['three'] }
  26474. */
  26475. var groupBy = createAggregator(function(result, value, key) {
  26476. if (hasOwnProperty.call(result, key)) {
  26477. result[key].push(value);
  26478. } else {
  26479. baseAssignValue(result, key, [value]);
  26480. }
  26481. });
  26482. /**
  26483. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26484. * checked for a substring of `value`, otherwise
  26485. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26486. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26487. * the offset from the end of `collection`.
  26488. *
  26489. * @static
  26490. * @memberOf _
  26491. * @since 0.1.0
  26492. * @category Collection
  26493. * @param {Array|Object|string} collection The collection to inspect.
  26494. * @param {*} value The value to search for.
  26495. * @param {number} [fromIndex=0] The index to search from.
  26496. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26497. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26498. * @example
  26499. *
  26500. * _.includes([1, 2, 3], 1);
  26501. * // => true
  26502. *
  26503. * _.includes([1, 2, 3], 1, 2);
  26504. * // => false
  26505. *
  26506. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26507. * // => true
  26508. *
  26509. * _.includes('abcd', 'bc');
  26510. * // => true
  26511. */
  26512. function includes(collection, value, fromIndex, guard) {
  26513. collection = isArrayLike(collection) ? collection : values(collection);
  26514. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26515. var length = collection.length;
  26516. if (fromIndex < 0) {
  26517. fromIndex = nativeMax(length + fromIndex, 0);
  26518. }
  26519. return isString(collection)
  26520. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26521. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26522. }
  26523. /**
  26524. * Invokes the method at `path` of each element in `collection`, returning
  26525. * an array of the results of each invoked method. Any additional arguments
  26526. * are provided to each invoked method. If `path` is a function, it's invoked
  26527. * for, and `this` bound to, each element in `collection`.
  26528. *
  26529. * @static
  26530. * @memberOf _
  26531. * @since 4.0.0
  26532. * @category Collection
  26533. * @param {Array|Object} collection The collection to iterate over.
  26534. * @param {Array|Function|string} path The path of the method to invoke or
  26535. * the function invoked per iteration.
  26536. * @param {...*} [args] The arguments to invoke each method with.
  26537. * @returns {Array} Returns the array of results.
  26538. * @example
  26539. *
  26540. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26541. * // => [[1, 5, 7], [1, 2, 3]]
  26542. *
  26543. * _.invokeMap([123, 456], String.prototype.split, '');
  26544. * // => [['1', '2', '3'], ['4', '5', '6']]
  26545. */
  26546. var invokeMap = baseRest(function(collection, path, args) {
  26547. var index = -1,
  26548. isFunc = typeof path == 'function',
  26549. result = isArrayLike(collection) ? Array(collection.length) : [];
  26550. baseEach(collection, function(value) {
  26551. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26552. });
  26553. return result;
  26554. });
  26555. /**
  26556. * Creates an object composed of keys generated from the results of running
  26557. * each element of `collection` thru `iteratee`. The corresponding value of
  26558. * each key is the last element responsible for generating the key. The
  26559. * iteratee is invoked with one argument: (value).
  26560. *
  26561. * @static
  26562. * @memberOf _
  26563. * @since 4.0.0
  26564. * @category Collection
  26565. * @param {Array|Object} collection The collection to iterate over.
  26566. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26567. * @returns {Object} Returns the composed aggregate object.
  26568. * @example
  26569. *
  26570. * var array = [
  26571. * { 'dir': 'left', 'code': 97 },
  26572. * { 'dir': 'right', 'code': 100 }
  26573. * ];
  26574. *
  26575. * _.keyBy(array, function(o) {
  26576. * return String.fromCharCode(o.code);
  26577. * });
  26578. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26579. *
  26580. * _.keyBy(array, 'dir');
  26581. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26582. */
  26583. var keyBy = createAggregator(function(result, value, key) {
  26584. baseAssignValue(result, key, value);
  26585. });
  26586. /**
  26587. * Creates an array of values by running each element in `collection` thru
  26588. * `iteratee`. The iteratee is invoked with three arguments:
  26589. * (value, index|key, collection).
  26590. *
  26591. * Many lodash methods are guarded to work as iteratees for methods like
  26592. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26593. *
  26594. * The guarded methods are:
  26595. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26596. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26597. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26598. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26599. *
  26600. * @static
  26601. * @memberOf _
  26602. * @since 0.1.0
  26603. * @category Collection
  26604. * @param {Array|Object} collection The collection to iterate over.
  26605. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26606. * @returns {Array} Returns the new mapped array.
  26607. * @example
  26608. *
  26609. * function square(n) {
  26610. * return n * n;
  26611. * }
  26612. *
  26613. * _.map([4, 8], square);
  26614. * // => [16, 64]
  26615. *
  26616. * _.map({ 'a': 4, 'b': 8 }, square);
  26617. * // => [16, 64] (iteration order is not guaranteed)
  26618. *
  26619. * var users = [
  26620. * { 'user': 'barney' },
  26621. * { 'user': 'fred' }
  26622. * ];
  26623. *
  26624. * // The `_.property` iteratee shorthand.
  26625. * _.map(users, 'user');
  26626. * // => ['barney', 'fred']
  26627. */
  26628. function map(collection, iteratee) {
  26629. var func = isArray(collection) ? arrayMap : baseMap;
  26630. return func(collection, getIteratee(iteratee, 3));
  26631. }
  26632. /**
  26633. * This method is like `_.sortBy` except that it allows specifying the sort
  26634. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26635. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26636. * descending or "asc" for ascending sort order of corresponding values.
  26637. *
  26638. * @static
  26639. * @memberOf _
  26640. * @since 4.0.0
  26641. * @category Collection
  26642. * @param {Array|Object} collection The collection to iterate over.
  26643. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26644. * The iteratees to sort by.
  26645. * @param {string[]} [orders] The sort orders of `iteratees`.
  26646. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26647. * @returns {Array} Returns the new sorted array.
  26648. * @example
  26649. *
  26650. * var users = [
  26651. * { 'user': 'fred', 'age': 48 },
  26652. * { 'user': 'barney', 'age': 34 },
  26653. * { 'user': 'fred', 'age': 40 },
  26654. * { 'user': 'barney', 'age': 36 }
  26655. * ];
  26656. *
  26657. * // Sort by `user` in ascending order and by `age` in descending order.
  26658. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26659. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26660. */
  26661. function orderBy(collection, iteratees, orders, guard) {
  26662. if (collection == null) {
  26663. return [];
  26664. }
  26665. if (!isArray(iteratees)) {
  26666. iteratees = iteratees == null ? [] : [iteratees];
  26667. }
  26668. orders = guard ? undefined : orders;
  26669. if (!isArray(orders)) {
  26670. orders = orders == null ? [] : [orders];
  26671. }
  26672. return baseOrderBy(collection, iteratees, orders);
  26673. }
  26674. /**
  26675. * Creates an array of elements split into two groups, the first of which
  26676. * contains elements `predicate` returns truthy for, the second of which
  26677. * contains elements `predicate` returns falsey for. The predicate is
  26678. * invoked with one argument: (value).
  26679. *
  26680. * @static
  26681. * @memberOf _
  26682. * @since 3.0.0
  26683. * @category Collection
  26684. * @param {Array|Object} collection The collection to iterate over.
  26685. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26686. * @returns {Array} Returns the array of grouped elements.
  26687. * @example
  26688. *
  26689. * var users = [
  26690. * { 'user': 'barney', 'age': 36, 'active': false },
  26691. * { 'user': 'fred', 'age': 40, 'active': true },
  26692. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26693. * ];
  26694. *
  26695. * _.partition(users, function(o) { return o.active; });
  26696. * // => objects for [['fred'], ['barney', 'pebbles']]
  26697. *
  26698. * // The `_.matches` iteratee shorthand.
  26699. * _.partition(users, { 'age': 1, 'active': false });
  26700. * // => objects for [['pebbles'], ['barney', 'fred']]
  26701. *
  26702. * // The `_.matchesProperty` iteratee shorthand.
  26703. * _.partition(users, ['active', false]);
  26704. * // => objects for [['barney', 'pebbles'], ['fred']]
  26705. *
  26706. * // The `_.property` iteratee shorthand.
  26707. * _.partition(users, 'active');
  26708. * // => objects for [['fred'], ['barney', 'pebbles']]
  26709. */
  26710. var partition = createAggregator(function(result, value, key) {
  26711. result[key ? 0 : 1].push(value);
  26712. }, function() { return [[], []]; });
  26713. /**
  26714. * Reduces `collection` to a value which is the accumulated result of running
  26715. * each element in `collection` thru `iteratee`, where each successive
  26716. * invocation is supplied the return value of the previous. If `accumulator`
  26717. * is not given, the first element of `collection` is used as the initial
  26718. * value. The iteratee is invoked with four arguments:
  26719. * (accumulator, value, index|key, collection).
  26720. *
  26721. * Many lodash methods are guarded to work as iteratees for methods like
  26722. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26723. *
  26724. * The guarded methods are:
  26725. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26726. * and `sortBy`
  26727. *
  26728. * @static
  26729. * @memberOf _
  26730. * @since 0.1.0
  26731. * @category Collection
  26732. * @param {Array|Object} collection The collection to iterate over.
  26733. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26734. * @param {*} [accumulator] The initial value.
  26735. * @returns {*} Returns the accumulated value.
  26736. * @see _.reduceRight
  26737. * @example
  26738. *
  26739. * _.reduce([1, 2], function(sum, n) {
  26740. * return sum + n;
  26741. * }, 0);
  26742. * // => 3
  26743. *
  26744. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26745. * (result[value] || (result[value] = [])).push(key);
  26746. * return result;
  26747. * }, {});
  26748. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26749. */
  26750. function reduce(collection, iteratee, accumulator) {
  26751. var func = isArray(collection) ? arrayReduce : baseReduce,
  26752. initAccum = arguments.length < 3;
  26753. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26754. }
  26755. /**
  26756. * This method is like `_.reduce` except that it iterates over elements of
  26757. * `collection` from right to left.
  26758. *
  26759. * @static
  26760. * @memberOf _
  26761. * @since 0.1.0
  26762. * @category Collection
  26763. * @param {Array|Object} collection The collection to iterate over.
  26764. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26765. * @param {*} [accumulator] The initial value.
  26766. * @returns {*} Returns the accumulated value.
  26767. * @see _.reduce
  26768. * @example
  26769. *
  26770. * var array = [[0, 1], [2, 3], [4, 5]];
  26771. *
  26772. * _.reduceRight(array, function(flattened, other) {
  26773. * return flattened.concat(other);
  26774. * }, []);
  26775. * // => [4, 5, 2, 3, 0, 1]
  26776. */
  26777. function reduceRight(collection, iteratee, accumulator) {
  26778. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26779. initAccum = arguments.length < 3;
  26780. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26781. }
  26782. /**
  26783. * The opposite of `_.filter`; this method returns the elements of `collection`
  26784. * that `predicate` does **not** return truthy for.
  26785. *
  26786. * @static
  26787. * @memberOf _
  26788. * @since 0.1.0
  26789. * @category Collection
  26790. * @param {Array|Object} collection The collection to iterate over.
  26791. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26792. * @returns {Array} Returns the new filtered array.
  26793. * @see _.filter
  26794. * @example
  26795. *
  26796. * var users = [
  26797. * { 'user': 'barney', 'age': 36, 'active': false },
  26798. * { 'user': 'fred', 'age': 40, 'active': true }
  26799. * ];
  26800. *
  26801. * _.reject(users, function(o) { return !o.active; });
  26802. * // => objects for ['fred']
  26803. *
  26804. * // The `_.matches` iteratee shorthand.
  26805. * _.reject(users, { 'age': 40, 'active': true });
  26806. * // => objects for ['barney']
  26807. *
  26808. * // The `_.matchesProperty` iteratee shorthand.
  26809. * _.reject(users, ['active', false]);
  26810. * // => objects for ['fred']
  26811. *
  26812. * // The `_.property` iteratee shorthand.
  26813. * _.reject(users, 'active');
  26814. * // => objects for ['barney']
  26815. */
  26816. function reject(collection, predicate) {
  26817. var func = isArray(collection) ? arrayFilter : baseFilter;
  26818. return func(collection, negate(getIteratee(predicate, 3)));
  26819. }
  26820. /**
  26821. * Gets a random element from `collection`.
  26822. *
  26823. * @static
  26824. * @memberOf _
  26825. * @since 2.0.0
  26826. * @category Collection
  26827. * @param {Array|Object} collection The collection to sample.
  26828. * @returns {*} Returns the random element.
  26829. * @example
  26830. *
  26831. * _.sample([1, 2, 3, 4]);
  26832. * // => 2
  26833. */
  26834. function sample(collection) {
  26835. var func = isArray(collection) ? arraySample : baseSample;
  26836. return func(collection);
  26837. }
  26838. /**
  26839. * Gets `n` random elements at unique keys from `collection` up to the
  26840. * size of `collection`.
  26841. *
  26842. * @static
  26843. * @memberOf _
  26844. * @since 4.0.0
  26845. * @category Collection
  26846. * @param {Array|Object} collection The collection to sample.
  26847. * @param {number} [n=1] The number of elements to sample.
  26848. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26849. * @returns {Array} Returns the random elements.
  26850. * @example
  26851. *
  26852. * _.sampleSize([1, 2, 3], 2);
  26853. * // => [3, 1]
  26854. *
  26855. * _.sampleSize([1, 2, 3], 4);
  26856. * // => [2, 3, 1]
  26857. */
  26858. function sampleSize(collection, n, guard) {
  26859. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26860. n = 1;
  26861. } else {
  26862. n = toInteger(n);
  26863. }
  26864. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26865. return func(collection, n);
  26866. }
  26867. /**
  26868. * Creates an array of shuffled values, using a version of the
  26869. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26870. *
  26871. * @static
  26872. * @memberOf _
  26873. * @since 0.1.0
  26874. * @category Collection
  26875. * @param {Array|Object} collection The collection to shuffle.
  26876. * @returns {Array} Returns the new shuffled array.
  26877. * @example
  26878. *
  26879. * _.shuffle([1, 2, 3, 4]);
  26880. * // => [4, 1, 3, 2]
  26881. */
  26882. function shuffle(collection) {
  26883. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26884. return func(collection);
  26885. }
  26886. /**
  26887. * Gets the size of `collection` by returning its length for array-like
  26888. * values or the number of own enumerable string keyed properties for objects.
  26889. *
  26890. * @static
  26891. * @memberOf _
  26892. * @since 0.1.0
  26893. * @category Collection
  26894. * @param {Array|Object|string} collection The collection to inspect.
  26895. * @returns {number} Returns the collection size.
  26896. * @example
  26897. *
  26898. * _.size([1, 2, 3]);
  26899. * // => 3
  26900. *
  26901. * _.size({ 'a': 1, 'b': 2 });
  26902. * // => 2
  26903. *
  26904. * _.size('pebbles');
  26905. * // => 7
  26906. */
  26907. function size(collection) {
  26908. if (collection == null) {
  26909. return 0;
  26910. }
  26911. if (isArrayLike(collection)) {
  26912. return isString(collection) ? stringSize(collection) : collection.length;
  26913. }
  26914. var tag = getTag(collection);
  26915. if (tag == mapTag || tag == setTag) {
  26916. return collection.size;
  26917. }
  26918. return baseKeys(collection).length;
  26919. }
  26920. /**
  26921. * Checks if `predicate` returns truthy for **any** element of `collection`.
  26922. * Iteration is stopped once `predicate` returns truthy. The predicate is
  26923. * invoked with three arguments: (value, index|key, collection).
  26924. *
  26925. * @static
  26926. * @memberOf _
  26927. * @since 0.1.0
  26928. * @category Collection
  26929. * @param {Array|Object} collection The collection to iterate over.
  26930. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26931. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26932. * @returns {boolean} Returns `true` if any element passes the predicate check,
  26933. * else `false`.
  26934. * @example
  26935. *
  26936. * _.some([null, 0, 'yes', false], Boolean);
  26937. * // => true
  26938. *
  26939. * var users = [
  26940. * { 'user': 'barney', 'active': true },
  26941. * { 'user': 'fred', 'active': false }
  26942. * ];
  26943. *
  26944. * // The `_.matches` iteratee shorthand.
  26945. * _.some(users, { 'user': 'barney', 'active': false });
  26946. * // => false
  26947. *
  26948. * // The `_.matchesProperty` iteratee shorthand.
  26949. * _.some(users, ['active', false]);
  26950. * // => true
  26951. *
  26952. * // The `_.property` iteratee shorthand.
  26953. * _.some(users, 'active');
  26954. * // => true
  26955. */
  26956. function some(collection, predicate, guard) {
  26957. var func = isArray(collection) ? arraySome : baseSome;
  26958. if (guard && isIterateeCall(collection, predicate, guard)) {
  26959. predicate = undefined;
  26960. }
  26961. return func(collection, getIteratee(predicate, 3));
  26962. }
  26963. /**
  26964. * Creates an array of elements, sorted in ascending order by the results of
  26965. * running each element in a collection thru each iteratee. This method
  26966. * performs a stable sort, that is, it preserves the original sort order of
  26967. * equal elements. The iteratees are invoked with one argument: (value).
  26968. *
  26969. * @static
  26970. * @memberOf _
  26971. * @since 0.1.0
  26972. * @category Collection
  26973. * @param {Array|Object} collection The collection to iterate over.
  26974. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  26975. * The iteratees to sort by.
  26976. * @returns {Array} Returns the new sorted array.
  26977. * @example
  26978. *
  26979. * var users = [
  26980. * { 'user': 'fred', 'age': 48 },
  26981. * { 'user': 'barney', 'age': 36 },
  26982. * { 'user': 'fred', 'age': 40 },
  26983. * { 'user': 'barney', 'age': 34 }
  26984. * ];
  26985. *
  26986. * _.sortBy(users, [function(o) { return o.user; }]);
  26987. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26988. *
  26989. * _.sortBy(users, ['user', 'age']);
  26990. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  26991. */
  26992. var sortBy = baseRest(function(collection, iteratees) {
  26993. if (collection == null) {
  26994. return [];
  26995. }
  26996. var length = iteratees.length;
  26997. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  26998. iteratees = [];
  26999. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27000. iteratees = [iteratees[0]];
  27001. }
  27002. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27003. });
  27004. /*------------------------------------------------------------------------*/
  27005. /**
  27006. * Gets the timestamp of the number of milliseconds that have elapsed since
  27007. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27008. *
  27009. * @static
  27010. * @memberOf _
  27011. * @since 2.4.0
  27012. * @category Date
  27013. * @returns {number} Returns the timestamp.
  27014. * @example
  27015. *
  27016. * _.defer(function(stamp) {
  27017. * console.log(_.now() - stamp);
  27018. * }, _.now());
  27019. * // => Logs the number of milliseconds it took for the deferred invocation.
  27020. */
  27021. var now = ctxNow || function() {
  27022. return root.Date.now();
  27023. };
  27024. /*------------------------------------------------------------------------*/
  27025. /**
  27026. * The opposite of `_.before`; this method creates a function that invokes
  27027. * `func` once it's called `n` or more times.
  27028. *
  27029. * @static
  27030. * @memberOf _
  27031. * @since 0.1.0
  27032. * @category Function
  27033. * @param {number} n The number of calls before `func` is invoked.
  27034. * @param {Function} func The function to restrict.
  27035. * @returns {Function} Returns the new restricted function.
  27036. * @example
  27037. *
  27038. * var saves = ['profile', 'settings'];
  27039. *
  27040. * var done = _.after(saves.length, function() {
  27041. * console.log('done saving!');
  27042. * });
  27043. *
  27044. * _.forEach(saves, function(type) {
  27045. * asyncSave({ 'type': type, 'complete': done });
  27046. * });
  27047. * // => Logs 'done saving!' after the two async saves have completed.
  27048. */
  27049. function after(n, func) {
  27050. if (typeof func != 'function') {
  27051. throw new TypeError(FUNC_ERROR_TEXT);
  27052. }
  27053. n = toInteger(n);
  27054. return function() {
  27055. if (--n < 1) {
  27056. return func.apply(this, arguments);
  27057. }
  27058. };
  27059. }
  27060. /**
  27061. * Creates a function that invokes `func`, with up to `n` arguments,
  27062. * ignoring any additional arguments.
  27063. *
  27064. * @static
  27065. * @memberOf _
  27066. * @since 3.0.0
  27067. * @category Function
  27068. * @param {Function} func The function to cap arguments for.
  27069. * @param {number} [n=func.length] The arity cap.
  27070. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27071. * @returns {Function} Returns the new capped function.
  27072. * @example
  27073. *
  27074. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27075. * // => [6, 8, 10]
  27076. */
  27077. function ary(func, n, guard) {
  27078. n = guard ? undefined : n;
  27079. n = (func && n == null) ? func.length : n;
  27080. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27081. }
  27082. /**
  27083. * Creates a function that invokes `func`, with the `this` binding and arguments
  27084. * of the created function, while it's called less than `n` times. Subsequent
  27085. * calls to the created function return the result of the last `func` invocation.
  27086. *
  27087. * @static
  27088. * @memberOf _
  27089. * @since 3.0.0
  27090. * @category Function
  27091. * @param {number} n The number of calls at which `func` is no longer invoked.
  27092. * @param {Function} func The function to restrict.
  27093. * @returns {Function} Returns the new restricted function.
  27094. * @example
  27095. *
  27096. * jQuery(element).on('click', _.before(5, addContactToList));
  27097. * // => Allows adding up to 4 contacts to the list.
  27098. */
  27099. function before(n, func) {
  27100. var result;
  27101. if (typeof func != 'function') {
  27102. throw new TypeError(FUNC_ERROR_TEXT);
  27103. }
  27104. n = toInteger(n);
  27105. return function() {
  27106. if (--n > 0) {
  27107. result = func.apply(this, arguments);
  27108. }
  27109. if (n <= 1) {
  27110. func = undefined;
  27111. }
  27112. return result;
  27113. };
  27114. }
  27115. /**
  27116. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27117. * and `partials` prepended to the arguments it receives.
  27118. *
  27119. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27120. * may be used as a placeholder for partially applied arguments.
  27121. *
  27122. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27123. * property of bound functions.
  27124. *
  27125. * @static
  27126. * @memberOf _
  27127. * @since 0.1.0
  27128. * @category Function
  27129. * @param {Function} func The function to bind.
  27130. * @param {*} thisArg The `this` binding of `func`.
  27131. * @param {...*} [partials] The arguments to be partially applied.
  27132. * @returns {Function} Returns the new bound function.
  27133. * @example
  27134. *
  27135. * function greet(greeting, punctuation) {
  27136. * return greeting + ' ' + this.user + punctuation;
  27137. * }
  27138. *
  27139. * var object = { 'user': 'fred' };
  27140. *
  27141. * var bound = _.bind(greet, object, 'hi');
  27142. * bound('!');
  27143. * // => 'hi fred!'
  27144. *
  27145. * // Bound with placeholders.
  27146. * var bound = _.bind(greet, object, _, '!');
  27147. * bound('hi');
  27148. * // => 'hi fred!'
  27149. */
  27150. var bind = baseRest(function(func, thisArg, partials) {
  27151. var bitmask = WRAP_BIND_FLAG;
  27152. if (partials.length) {
  27153. var holders = replaceHolders(partials, getHolder(bind));
  27154. bitmask |= WRAP_PARTIAL_FLAG;
  27155. }
  27156. return createWrap(func, bitmask, thisArg, partials, holders);
  27157. });
  27158. /**
  27159. * Creates a function that invokes the method at `object[key]` with `partials`
  27160. * prepended to the arguments it receives.
  27161. *
  27162. * This method differs from `_.bind` by allowing bound functions to reference
  27163. * methods that may be redefined or don't yet exist. See
  27164. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27165. * for more details.
  27166. *
  27167. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27168. * builds, may be used as a placeholder for partially applied arguments.
  27169. *
  27170. * @static
  27171. * @memberOf _
  27172. * @since 0.10.0
  27173. * @category Function
  27174. * @param {Object} object The object to invoke the method on.
  27175. * @param {string} key The key of the method.
  27176. * @param {...*} [partials] The arguments to be partially applied.
  27177. * @returns {Function} Returns the new bound function.
  27178. * @example
  27179. *
  27180. * var object = {
  27181. * 'user': 'fred',
  27182. * 'greet': function(greeting, punctuation) {
  27183. * return greeting + ' ' + this.user + punctuation;
  27184. * }
  27185. * };
  27186. *
  27187. * var bound = _.bindKey(object, 'greet', 'hi');
  27188. * bound('!');
  27189. * // => 'hi fred!'
  27190. *
  27191. * object.greet = function(greeting, punctuation) {
  27192. * return greeting + 'ya ' + this.user + punctuation;
  27193. * };
  27194. *
  27195. * bound('!');
  27196. * // => 'hiya fred!'
  27197. *
  27198. * // Bound with placeholders.
  27199. * var bound = _.bindKey(object, 'greet', _, '!');
  27200. * bound('hi');
  27201. * // => 'hiya fred!'
  27202. */
  27203. var bindKey = baseRest(function(object, key, partials) {
  27204. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27205. if (partials.length) {
  27206. var holders = replaceHolders(partials, getHolder(bindKey));
  27207. bitmask |= WRAP_PARTIAL_FLAG;
  27208. }
  27209. return createWrap(key, bitmask, object, partials, holders);
  27210. });
  27211. /**
  27212. * Creates a function that accepts arguments of `func` and either invokes
  27213. * `func` returning its result, if at least `arity` number of arguments have
  27214. * been provided, or returns a function that accepts the remaining `func`
  27215. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27216. * is not sufficient.
  27217. *
  27218. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27219. * may be used as a placeholder for provided arguments.
  27220. *
  27221. * **Note:** This method doesn't set the "length" property of curried functions.
  27222. *
  27223. * @static
  27224. * @memberOf _
  27225. * @since 2.0.0
  27226. * @category Function
  27227. * @param {Function} func The function to curry.
  27228. * @param {number} [arity=func.length] The arity of `func`.
  27229. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27230. * @returns {Function} Returns the new curried function.
  27231. * @example
  27232. *
  27233. * var abc = function(a, b, c) {
  27234. * return [a, b, c];
  27235. * };
  27236. *
  27237. * var curried = _.curry(abc);
  27238. *
  27239. * curried(1)(2)(3);
  27240. * // => [1, 2, 3]
  27241. *
  27242. * curried(1, 2)(3);
  27243. * // => [1, 2, 3]
  27244. *
  27245. * curried(1, 2, 3);
  27246. * // => [1, 2, 3]
  27247. *
  27248. * // Curried with placeholders.
  27249. * curried(1)(_, 3)(2);
  27250. * // => [1, 2, 3]
  27251. */
  27252. function curry(func, arity, guard) {
  27253. arity = guard ? undefined : arity;
  27254. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27255. result.placeholder = curry.placeholder;
  27256. return result;
  27257. }
  27258. /**
  27259. * This method is like `_.curry` except that arguments are applied to `func`
  27260. * in the manner of `_.partialRight` instead of `_.partial`.
  27261. *
  27262. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27263. * builds, may be used as a placeholder for provided arguments.
  27264. *
  27265. * **Note:** This method doesn't set the "length" property of curried functions.
  27266. *
  27267. * @static
  27268. * @memberOf _
  27269. * @since 3.0.0
  27270. * @category Function
  27271. * @param {Function} func The function to curry.
  27272. * @param {number} [arity=func.length] The arity of `func`.
  27273. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27274. * @returns {Function} Returns the new curried function.
  27275. * @example
  27276. *
  27277. * var abc = function(a, b, c) {
  27278. * return [a, b, c];
  27279. * };
  27280. *
  27281. * var curried = _.curryRight(abc);
  27282. *
  27283. * curried(3)(2)(1);
  27284. * // => [1, 2, 3]
  27285. *
  27286. * curried(2, 3)(1);
  27287. * // => [1, 2, 3]
  27288. *
  27289. * curried(1, 2, 3);
  27290. * // => [1, 2, 3]
  27291. *
  27292. * // Curried with placeholders.
  27293. * curried(3)(1, _)(2);
  27294. * // => [1, 2, 3]
  27295. */
  27296. function curryRight(func, arity, guard) {
  27297. arity = guard ? undefined : arity;
  27298. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27299. result.placeholder = curryRight.placeholder;
  27300. return result;
  27301. }
  27302. /**
  27303. * Creates a debounced function that delays invoking `func` until after `wait`
  27304. * milliseconds have elapsed since the last time the debounced function was
  27305. * invoked. The debounced function comes with a `cancel` method to cancel
  27306. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27307. * Provide `options` to indicate whether `func` should be invoked on the
  27308. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27309. * with the last arguments provided to the debounced function. Subsequent
  27310. * calls to the debounced function return the result of the last `func`
  27311. * invocation.
  27312. *
  27313. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27314. * invoked on the trailing edge of the timeout only if the debounced function
  27315. * is invoked more than once during the `wait` timeout.
  27316. *
  27317. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27318. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27319. *
  27320. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27321. * for details over the differences between `_.debounce` and `_.throttle`.
  27322. *
  27323. * @static
  27324. * @memberOf _
  27325. * @since 0.1.0
  27326. * @category Function
  27327. * @param {Function} func The function to debounce.
  27328. * @param {number} [wait=0] The number of milliseconds to delay.
  27329. * @param {Object} [options={}] The options object.
  27330. * @param {boolean} [options.leading=false]
  27331. * Specify invoking on the leading edge of the timeout.
  27332. * @param {number} [options.maxWait]
  27333. * The maximum time `func` is allowed to be delayed before it's invoked.
  27334. * @param {boolean} [options.trailing=true]
  27335. * Specify invoking on the trailing edge of the timeout.
  27336. * @returns {Function} Returns the new debounced function.
  27337. * @example
  27338. *
  27339. * // Avoid costly calculations while the window size is in flux.
  27340. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27341. *
  27342. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27343. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27344. * 'leading': true,
  27345. * 'trailing': false
  27346. * }));
  27347. *
  27348. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27349. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27350. * var source = new EventSource('/stream');
  27351. * jQuery(source).on('message', debounced);
  27352. *
  27353. * // Cancel the trailing debounced invocation.
  27354. * jQuery(window).on('popstate', debounced.cancel);
  27355. */
  27356. function debounce(func, wait, options) {
  27357. var lastArgs,
  27358. lastThis,
  27359. maxWait,
  27360. result,
  27361. timerId,
  27362. lastCallTime,
  27363. lastInvokeTime = 0,
  27364. leading = false,
  27365. maxing = false,
  27366. trailing = true;
  27367. if (typeof func != 'function') {
  27368. throw new TypeError(FUNC_ERROR_TEXT);
  27369. }
  27370. wait = toNumber(wait) || 0;
  27371. if (isObject(options)) {
  27372. leading = !!options.leading;
  27373. maxing = 'maxWait' in options;
  27374. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27375. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27376. }
  27377. function invokeFunc(time) {
  27378. var args = lastArgs,
  27379. thisArg = lastThis;
  27380. lastArgs = lastThis = undefined;
  27381. lastInvokeTime = time;
  27382. result = func.apply(thisArg, args);
  27383. return result;
  27384. }
  27385. function leadingEdge(time) {
  27386. // Reset any `maxWait` timer.
  27387. lastInvokeTime = time;
  27388. // Start the timer for the trailing edge.
  27389. timerId = setTimeout(timerExpired, wait);
  27390. // Invoke the leading edge.
  27391. return leading ? invokeFunc(time) : result;
  27392. }
  27393. function remainingWait(time) {
  27394. var timeSinceLastCall = time - lastCallTime,
  27395. timeSinceLastInvoke = time - lastInvokeTime,
  27396. timeWaiting = wait - timeSinceLastCall;
  27397. return maxing
  27398. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27399. : timeWaiting;
  27400. }
  27401. function shouldInvoke(time) {
  27402. var timeSinceLastCall = time - lastCallTime,
  27403. timeSinceLastInvoke = time - lastInvokeTime;
  27404. // Either this is the first call, activity has stopped and we're at the
  27405. // trailing edge, the system time has gone backwards and we're treating
  27406. // it as the trailing edge, or we've hit the `maxWait` limit.
  27407. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27408. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27409. }
  27410. function timerExpired() {
  27411. var time = now();
  27412. if (shouldInvoke(time)) {
  27413. return trailingEdge(time);
  27414. }
  27415. // Restart the timer.
  27416. timerId = setTimeout(timerExpired, remainingWait(time));
  27417. }
  27418. function trailingEdge(time) {
  27419. timerId = undefined;
  27420. // Only invoke if we have `lastArgs` which means `func` has been
  27421. // debounced at least once.
  27422. if (trailing && lastArgs) {
  27423. return invokeFunc(time);
  27424. }
  27425. lastArgs = lastThis = undefined;
  27426. return result;
  27427. }
  27428. function cancel() {
  27429. if (timerId !== undefined) {
  27430. clearTimeout(timerId);
  27431. }
  27432. lastInvokeTime = 0;
  27433. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27434. }
  27435. function flush() {
  27436. return timerId === undefined ? result : trailingEdge(now());
  27437. }
  27438. function debounced() {
  27439. var time = now(),
  27440. isInvoking = shouldInvoke(time);
  27441. lastArgs = arguments;
  27442. lastThis = this;
  27443. lastCallTime = time;
  27444. if (isInvoking) {
  27445. if (timerId === undefined) {
  27446. return leadingEdge(lastCallTime);
  27447. }
  27448. if (maxing) {
  27449. // Handle invocations in a tight loop.
  27450. clearTimeout(timerId);
  27451. timerId = setTimeout(timerExpired, wait);
  27452. return invokeFunc(lastCallTime);
  27453. }
  27454. }
  27455. if (timerId === undefined) {
  27456. timerId = setTimeout(timerExpired, wait);
  27457. }
  27458. return result;
  27459. }
  27460. debounced.cancel = cancel;
  27461. debounced.flush = flush;
  27462. return debounced;
  27463. }
  27464. /**
  27465. * Defers invoking the `func` until the current call stack has cleared. Any
  27466. * additional arguments are provided to `func` when it's invoked.
  27467. *
  27468. * @static
  27469. * @memberOf _
  27470. * @since 0.1.0
  27471. * @category Function
  27472. * @param {Function} func The function to defer.
  27473. * @param {...*} [args] The arguments to invoke `func` with.
  27474. * @returns {number} Returns the timer id.
  27475. * @example
  27476. *
  27477. * _.defer(function(text) {
  27478. * console.log(text);
  27479. * }, 'deferred');
  27480. * // => Logs 'deferred' after one millisecond.
  27481. */
  27482. var defer = baseRest(function(func, args) {
  27483. return baseDelay(func, 1, args);
  27484. });
  27485. /**
  27486. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27487. * provided to `func` when it's invoked.
  27488. *
  27489. * @static
  27490. * @memberOf _
  27491. * @since 0.1.0
  27492. * @category Function
  27493. * @param {Function} func The function to delay.
  27494. * @param {number} wait The number of milliseconds to delay invocation.
  27495. * @param {...*} [args] The arguments to invoke `func` with.
  27496. * @returns {number} Returns the timer id.
  27497. * @example
  27498. *
  27499. * _.delay(function(text) {
  27500. * console.log(text);
  27501. * }, 1000, 'later');
  27502. * // => Logs 'later' after one second.
  27503. */
  27504. var delay = baseRest(function(func, wait, args) {
  27505. return baseDelay(func, toNumber(wait) || 0, args);
  27506. });
  27507. /**
  27508. * Creates a function that invokes `func` with arguments reversed.
  27509. *
  27510. * @static
  27511. * @memberOf _
  27512. * @since 4.0.0
  27513. * @category Function
  27514. * @param {Function} func The function to flip arguments for.
  27515. * @returns {Function} Returns the new flipped function.
  27516. * @example
  27517. *
  27518. * var flipped = _.flip(function() {
  27519. * return _.toArray(arguments);
  27520. * });
  27521. *
  27522. * flipped('a', 'b', 'c', 'd');
  27523. * // => ['d', 'c', 'b', 'a']
  27524. */
  27525. function flip(func) {
  27526. return createWrap(func, WRAP_FLIP_FLAG);
  27527. }
  27528. /**
  27529. * Creates a function that memoizes the result of `func`. If `resolver` is
  27530. * provided, it determines the cache key for storing the result based on the
  27531. * arguments provided to the memoized function. By default, the first argument
  27532. * provided to the memoized function is used as the map cache key. The `func`
  27533. * is invoked with the `this` binding of the memoized function.
  27534. *
  27535. * **Note:** The cache is exposed as the `cache` property on the memoized
  27536. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27537. * constructor with one whose instances implement the
  27538. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27539. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27540. *
  27541. * @static
  27542. * @memberOf _
  27543. * @since 0.1.0
  27544. * @category Function
  27545. * @param {Function} func The function to have its output memoized.
  27546. * @param {Function} [resolver] The function to resolve the cache key.
  27547. * @returns {Function} Returns the new memoized function.
  27548. * @example
  27549. *
  27550. * var object = { 'a': 1, 'b': 2 };
  27551. * var other = { 'c': 3, 'd': 4 };
  27552. *
  27553. * var values = _.memoize(_.values);
  27554. * values(object);
  27555. * // => [1, 2]
  27556. *
  27557. * values(other);
  27558. * // => [3, 4]
  27559. *
  27560. * object.a = 2;
  27561. * values(object);
  27562. * // => [1, 2]
  27563. *
  27564. * // Modify the result cache.
  27565. * values.cache.set(object, ['a', 'b']);
  27566. * values(object);
  27567. * // => ['a', 'b']
  27568. *
  27569. * // Replace `_.memoize.Cache`.
  27570. * _.memoize.Cache = WeakMap;
  27571. */
  27572. function memoize(func, resolver) {
  27573. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27574. throw new TypeError(FUNC_ERROR_TEXT);
  27575. }
  27576. var memoized = function() {
  27577. var args = arguments,
  27578. key = resolver ? resolver.apply(this, args) : args[0],
  27579. cache = memoized.cache;
  27580. if (cache.has(key)) {
  27581. return cache.get(key);
  27582. }
  27583. var result = func.apply(this, args);
  27584. memoized.cache = cache.set(key, result) || cache;
  27585. return result;
  27586. };
  27587. memoized.cache = new (memoize.Cache || MapCache);
  27588. return memoized;
  27589. }
  27590. // Expose `MapCache`.
  27591. memoize.Cache = MapCache;
  27592. /**
  27593. * Creates a function that negates the result of the predicate `func`. The
  27594. * `func` predicate is invoked with the `this` binding and arguments of the
  27595. * created function.
  27596. *
  27597. * @static
  27598. * @memberOf _
  27599. * @since 3.0.0
  27600. * @category Function
  27601. * @param {Function} predicate The predicate to negate.
  27602. * @returns {Function} Returns the new negated function.
  27603. * @example
  27604. *
  27605. * function isEven(n) {
  27606. * return n % 2 == 0;
  27607. * }
  27608. *
  27609. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27610. * // => [1, 3, 5]
  27611. */
  27612. function negate(predicate) {
  27613. if (typeof predicate != 'function') {
  27614. throw new TypeError(FUNC_ERROR_TEXT);
  27615. }
  27616. return function() {
  27617. var args = arguments;
  27618. switch (args.length) {
  27619. case 0: return !predicate.call(this);
  27620. case 1: return !predicate.call(this, args[0]);
  27621. case 2: return !predicate.call(this, args[0], args[1]);
  27622. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27623. }
  27624. return !predicate.apply(this, args);
  27625. };
  27626. }
  27627. /**
  27628. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27629. * to the function return the value of the first invocation. The `func` is
  27630. * invoked with the `this` binding and arguments of the created function.
  27631. *
  27632. * @static
  27633. * @memberOf _
  27634. * @since 0.1.0
  27635. * @category Function
  27636. * @param {Function} func The function to restrict.
  27637. * @returns {Function} Returns the new restricted function.
  27638. * @example
  27639. *
  27640. * var initialize = _.once(createApplication);
  27641. * initialize();
  27642. * initialize();
  27643. * // => `createApplication` is invoked once
  27644. */
  27645. function once(func) {
  27646. return before(2, func);
  27647. }
  27648. /**
  27649. * Creates a function that invokes `func` with its arguments transformed.
  27650. *
  27651. * @static
  27652. * @since 4.0.0
  27653. * @memberOf _
  27654. * @category Function
  27655. * @param {Function} func The function to wrap.
  27656. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27657. * The argument transforms.
  27658. * @returns {Function} Returns the new function.
  27659. * @example
  27660. *
  27661. * function doubled(n) {
  27662. * return n * 2;
  27663. * }
  27664. *
  27665. * function square(n) {
  27666. * return n * n;
  27667. * }
  27668. *
  27669. * var func = _.overArgs(function(x, y) {
  27670. * return [x, y];
  27671. * }, [square, doubled]);
  27672. *
  27673. * func(9, 3);
  27674. * // => [81, 6]
  27675. *
  27676. * func(10, 5);
  27677. * // => [100, 10]
  27678. */
  27679. var overArgs = castRest(function(func, transforms) {
  27680. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27681. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27682. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27683. var funcsLength = transforms.length;
  27684. return baseRest(function(args) {
  27685. var index = -1,
  27686. length = nativeMin(args.length, funcsLength);
  27687. while (++index < length) {
  27688. args[index] = transforms[index].call(this, args[index]);
  27689. }
  27690. return apply(func, this, args);
  27691. });
  27692. });
  27693. /**
  27694. * Creates a function that invokes `func` with `partials` prepended to the
  27695. * arguments it receives. This method is like `_.bind` except it does **not**
  27696. * alter the `this` binding.
  27697. *
  27698. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27699. * builds, may be used as a placeholder for partially applied arguments.
  27700. *
  27701. * **Note:** This method doesn't set the "length" property of partially
  27702. * applied functions.
  27703. *
  27704. * @static
  27705. * @memberOf _
  27706. * @since 0.2.0
  27707. * @category Function
  27708. * @param {Function} func The function to partially apply arguments to.
  27709. * @param {...*} [partials] The arguments to be partially applied.
  27710. * @returns {Function} Returns the new partially applied function.
  27711. * @example
  27712. *
  27713. * function greet(greeting, name) {
  27714. * return greeting + ' ' + name;
  27715. * }
  27716. *
  27717. * var sayHelloTo = _.partial(greet, 'hello');
  27718. * sayHelloTo('fred');
  27719. * // => 'hello fred'
  27720. *
  27721. * // Partially applied with placeholders.
  27722. * var greetFred = _.partial(greet, _, 'fred');
  27723. * greetFred('hi');
  27724. * // => 'hi fred'
  27725. */
  27726. var partial = baseRest(function(func, partials) {
  27727. var holders = replaceHolders(partials, getHolder(partial));
  27728. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27729. });
  27730. /**
  27731. * This method is like `_.partial` except that partially applied arguments
  27732. * are appended to the arguments it receives.
  27733. *
  27734. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27735. * builds, may be used as a placeholder for partially applied arguments.
  27736. *
  27737. * **Note:** This method doesn't set the "length" property of partially
  27738. * applied functions.
  27739. *
  27740. * @static
  27741. * @memberOf _
  27742. * @since 1.0.0
  27743. * @category Function
  27744. * @param {Function} func The function to partially apply arguments to.
  27745. * @param {...*} [partials] The arguments to be partially applied.
  27746. * @returns {Function} Returns the new partially applied function.
  27747. * @example
  27748. *
  27749. * function greet(greeting, name) {
  27750. * return greeting + ' ' + name;
  27751. * }
  27752. *
  27753. * var greetFred = _.partialRight(greet, 'fred');
  27754. * greetFred('hi');
  27755. * // => 'hi fred'
  27756. *
  27757. * // Partially applied with placeholders.
  27758. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27759. * sayHelloTo('fred');
  27760. * // => 'hello fred'
  27761. */
  27762. var partialRight = baseRest(function(func, partials) {
  27763. var holders = replaceHolders(partials, getHolder(partialRight));
  27764. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27765. });
  27766. /**
  27767. * Creates a function that invokes `func` with arguments arranged according
  27768. * to the specified `indexes` where the argument value at the first index is
  27769. * provided as the first argument, the argument value at the second index is
  27770. * provided as the second argument, and so on.
  27771. *
  27772. * @static
  27773. * @memberOf _
  27774. * @since 3.0.0
  27775. * @category Function
  27776. * @param {Function} func The function to rearrange arguments for.
  27777. * @param {...(number|number[])} indexes The arranged argument indexes.
  27778. * @returns {Function} Returns the new function.
  27779. * @example
  27780. *
  27781. * var rearged = _.rearg(function(a, b, c) {
  27782. * return [a, b, c];
  27783. * }, [2, 0, 1]);
  27784. *
  27785. * rearged('b', 'c', 'a')
  27786. * // => ['a', 'b', 'c']
  27787. */
  27788. var rearg = flatRest(function(func, indexes) {
  27789. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27790. });
  27791. /**
  27792. * Creates a function that invokes `func` with the `this` binding of the
  27793. * created function and arguments from `start` and beyond provided as
  27794. * an array.
  27795. *
  27796. * **Note:** This method is based on the
  27797. * [rest parameter](https://mdn.io/rest_parameters).
  27798. *
  27799. * @static
  27800. * @memberOf _
  27801. * @since 4.0.0
  27802. * @category Function
  27803. * @param {Function} func The function to apply a rest parameter to.
  27804. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27805. * @returns {Function} Returns the new function.
  27806. * @example
  27807. *
  27808. * var say = _.rest(function(what, names) {
  27809. * return what + ' ' + _.initial(names).join(', ') +
  27810. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27811. * });
  27812. *
  27813. * say('hello', 'fred', 'barney', 'pebbles');
  27814. * // => 'hello fred, barney, & pebbles'
  27815. */
  27816. function rest(func, start) {
  27817. if (typeof func != 'function') {
  27818. throw new TypeError(FUNC_ERROR_TEXT);
  27819. }
  27820. start = start === undefined ? start : toInteger(start);
  27821. return baseRest(func, start);
  27822. }
  27823. /**
  27824. * Creates a function that invokes `func` with the `this` binding of the
  27825. * create function and an array of arguments much like
  27826. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27827. *
  27828. * **Note:** This method is based on the
  27829. * [spread operator](https://mdn.io/spread_operator).
  27830. *
  27831. * @static
  27832. * @memberOf _
  27833. * @since 3.2.0
  27834. * @category Function
  27835. * @param {Function} func The function to spread arguments over.
  27836. * @param {number} [start=0] The start position of the spread.
  27837. * @returns {Function} Returns the new function.
  27838. * @example
  27839. *
  27840. * var say = _.spread(function(who, what) {
  27841. * return who + ' says ' + what;
  27842. * });
  27843. *
  27844. * say(['fred', 'hello']);
  27845. * // => 'fred says hello'
  27846. *
  27847. * var numbers = Promise.all([
  27848. * Promise.resolve(40),
  27849. * Promise.resolve(36)
  27850. * ]);
  27851. *
  27852. * numbers.then(_.spread(function(x, y) {
  27853. * return x + y;
  27854. * }));
  27855. * // => a Promise of 76
  27856. */
  27857. function spread(func, start) {
  27858. if (typeof func != 'function') {
  27859. throw new TypeError(FUNC_ERROR_TEXT);
  27860. }
  27861. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27862. return baseRest(function(args) {
  27863. var array = args[start],
  27864. otherArgs = castSlice(args, 0, start);
  27865. if (array) {
  27866. arrayPush(otherArgs, array);
  27867. }
  27868. return apply(func, this, otherArgs);
  27869. });
  27870. }
  27871. /**
  27872. * Creates a throttled function that only invokes `func` at most once per
  27873. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27874. * method to cancel delayed `func` invocations and a `flush` method to
  27875. * immediately invoke them. Provide `options` to indicate whether `func`
  27876. * should be invoked on the leading and/or trailing edge of the `wait`
  27877. * timeout. The `func` is invoked with the last arguments provided to the
  27878. * throttled function. Subsequent calls to the throttled function return the
  27879. * result of the last `func` invocation.
  27880. *
  27881. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27882. * invoked on the trailing edge of the timeout only if the throttled function
  27883. * is invoked more than once during the `wait` timeout.
  27884. *
  27885. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27886. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27887. *
  27888. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27889. * for details over the differences between `_.throttle` and `_.debounce`.
  27890. *
  27891. * @static
  27892. * @memberOf _
  27893. * @since 0.1.0
  27894. * @category Function
  27895. * @param {Function} func The function to throttle.
  27896. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  27897. * @param {Object} [options={}] The options object.
  27898. * @param {boolean} [options.leading=true]
  27899. * Specify invoking on the leading edge of the timeout.
  27900. * @param {boolean} [options.trailing=true]
  27901. * Specify invoking on the trailing edge of the timeout.
  27902. * @returns {Function} Returns the new throttled function.
  27903. * @example
  27904. *
  27905. * // Avoid excessively updating the position while scrolling.
  27906. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  27907. *
  27908. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  27909. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  27910. * jQuery(element).on('click', throttled);
  27911. *
  27912. * // Cancel the trailing throttled invocation.
  27913. * jQuery(window).on('popstate', throttled.cancel);
  27914. */
  27915. function throttle(func, wait, options) {
  27916. var leading = true,
  27917. trailing = true;
  27918. if (typeof func != 'function') {
  27919. throw new TypeError(FUNC_ERROR_TEXT);
  27920. }
  27921. if (isObject(options)) {
  27922. leading = 'leading' in options ? !!options.leading : leading;
  27923. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27924. }
  27925. return debounce(func, wait, {
  27926. 'leading': leading,
  27927. 'maxWait': wait,
  27928. 'trailing': trailing
  27929. });
  27930. }
  27931. /**
  27932. * Creates a function that accepts up to one argument, ignoring any
  27933. * additional arguments.
  27934. *
  27935. * @static
  27936. * @memberOf _
  27937. * @since 4.0.0
  27938. * @category Function
  27939. * @param {Function} func The function to cap arguments for.
  27940. * @returns {Function} Returns the new capped function.
  27941. * @example
  27942. *
  27943. * _.map(['6', '8', '10'], _.unary(parseInt));
  27944. * // => [6, 8, 10]
  27945. */
  27946. function unary(func) {
  27947. return ary(func, 1);
  27948. }
  27949. /**
  27950. * Creates a function that provides `value` to `wrapper` as its first
  27951. * argument. Any additional arguments provided to the function are appended
  27952. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  27953. * binding of the created function.
  27954. *
  27955. * @static
  27956. * @memberOf _
  27957. * @since 0.1.0
  27958. * @category Function
  27959. * @param {*} value The value to wrap.
  27960. * @param {Function} [wrapper=identity] The wrapper function.
  27961. * @returns {Function} Returns the new function.
  27962. * @example
  27963. *
  27964. * var p = _.wrap(_.escape, function(func, text) {
  27965. * return '<p>' + func(text) + '</p>';
  27966. * });
  27967. *
  27968. * p('fred, barney, & pebbles');
  27969. * // => '<p>fred, barney, &amp; pebbles</p>'
  27970. */
  27971. function wrap(value, wrapper) {
  27972. return partial(castFunction(wrapper), value);
  27973. }
  27974. /*------------------------------------------------------------------------*/
  27975. /**
  27976. * Casts `value` as an array if it's not one.
  27977. *
  27978. * @static
  27979. * @memberOf _
  27980. * @since 4.4.0
  27981. * @category Lang
  27982. * @param {*} value The value to inspect.
  27983. * @returns {Array} Returns the cast array.
  27984. * @example
  27985. *
  27986. * _.castArray(1);
  27987. * // => [1]
  27988. *
  27989. * _.castArray({ 'a': 1 });
  27990. * // => [{ 'a': 1 }]
  27991. *
  27992. * _.castArray('abc');
  27993. * // => ['abc']
  27994. *
  27995. * _.castArray(null);
  27996. * // => [null]
  27997. *
  27998. * _.castArray(undefined);
  27999. * // => [undefined]
  28000. *
  28001. * _.castArray();
  28002. * // => []
  28003. *
  28004. * var array = [1, 2, 3];
  28005. * console.log(_.castArray(array) === array);
  28006. * // => true
  28007. */
  28008. function castArray() {
  28009. if (!arguments.length) {
  28010. return [];
  28011. }
  28012. var value = arguments[0];
  28013. return isArray(value) ? value : [value];
  28014. }
  28015. /**
  28016. * Creates a shallow clone of `value`.
  28017. *
  28018. * **Note:** This method is loosely based on the
  28019. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28020. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28021. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28022. * arrays. The own enumerable properties of `arguments` objects are cloned
  28023. * as plain objects. An empty object is returned for uncloneable values such
  28024. * as error objects, functions, DOM nodes, and WeakMaps.
  28025. *
  28026. * @static
  28027. * @memberOf _
  28028. * @since 0.1.0
  28029. * @category Lang
  28030. * @param {*} value The value to clone.
  28031. * @returns {*} Returns the cloned value.
  28032. * @see _.cloneDeep
  28033. * @example
  28034. *
  28035. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28036. *
  28037. * var shallow = _.clone(objects);
  28038. * console.log(shallow[0] === objects[0]);
  28039. * // => true
  28040. */
  28041. function clone(value) {
  28042. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28043. }
  28044. /**
  28045. * This method is like `_.clone` except that it accepts `customizer` which
  28046. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28047. * cloning is handled by the method instead. The `customizer` is invoked with
  28048. * up to four arguments; (value [, index|key, object, stack]).
  28049. *
  28050. * @static
  28051. * @memberOf _
  28052. * @since 4.0.0
  28053. * @category Lang
  28054. * @param {*} value The value to clone.
  28055. * @param {Function} [customizer] The function to customize cloning.
  28056. * @returns {*} Returns the cloned value.
  28057. * @see _.cloneDeepWith
  28058. * @example
  28059. *
  28060. * function customizer(value) {
  28061. * if (_.isElement(value)) {
  28062. * return value.cloneNode(false);
  28063. * }
  28064. * }
  28065. *
  28066. * var el = _.cloneWith(document.body, customizer);
  28067. *
  28068. * console.log(el === document.body);
  28069. * // => false
  28070. * console.log(el.nodeName);
  28071. * // => 'BODY'
  28072. * console.log(el.childNodes.length);
  28073. * // => 0
  28074. */
  28075. function cloneWith(value, customizer) {
  28076. customizer = typeof customizer == 'function' ? customizer : undefined;
  28077. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28078. }
  28079. /**
  28080. * This method is like `_.clone` except that it recursively clones `value`.
  28081. *
  28082. * @static
  28083. * @memberOf _
  28084. * @since 1.0.0
  28085. * @category Lang
  28086. * @param {*} value The value to recursively clone.
  28087. * @returns {*} Returns the deep cloned value.
  28088. * @see _.clone
  28089. * @example
  28090. *
  28091. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28092. *
  28093. * var deep = _.cloneDeep(objects);
  28094. * console.log(deep[0] === objects[0]);
  28095. * // => false
  28096. */
  28097. function cloneDeep(value) {
  28098. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28099. }
  28100. /**
  28101. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28102. *
  28103. * @static
  28104. * @memberOf _
  28105. * @since 4.0.0
  28106. * @category Lang
  28107. * @param {*} value The value to recursively clone.
  28108. * @param {Function} [customizer] The function to customize cloning.
  28109. * @returns {*} Returns the deep cloned value.
  28110. * @see _.cloneWith
  28111. * @example
  28112. *
  28113. * function customizer(value) {
  28114. * if (_.isElement(value)) {
  28115. * return value.cloneNode(true);
  28116. * }
  28117. * }
  28118. *
  28119. * var el = _.cloneDeepWith(document.body, customizer);
  28120. *
  28121. * console.log(el === document.body);
  28122. * // => false
  28123. * console.log(el.nodeName);
  28124. * // => 'BODY'
  28125. * console.log(el.childNodes.length);
  28126. * // => 20
  28127. */
  28128. function cloneDeepWith(value, customizer) {
  28129. customizer = typeof customizer == 'function' ? customizer : undefined;
  28130. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28131. }
  28132. /**
  28133. * Checks if `object` conforms to `source` by invoking the predicate
  28134. * properties of `source` with the corresponding property values of `object`.
  28135. *
  28136. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28137. * partially applied.
  28138. *
  28139. * @static
  28140. * @memberOf _
  28141. * @since 4.14.0
  28142. * @category Lang
  28143. * @param {Object} object The object to inspect.
  28144. * @param {Object} source The object of property predicates to conform to.
  28145. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28146. * @example
  28147. *
  28148. * var object = { 'a': 1, 'b': 2 };
  28149. *
  28150. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28151. * // => true
  28152. *
  28153. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28154. * // => false
  28155. */
  28156. function conformsTo(object, source) {
  28157. return source == null || baseConformsTo(object, source, keys(source));
  28158. }
  28159. /**
  28160. * Performs a
  28161. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28162. * comparison between two values to determine if they are equivalent.
  28163. *
  28164. * @static
  28165. * @memberOf _
  28166. * @since 4.0.0
  28167. * @category Lang
  28168. * @param {*} value The value to compare.
  28169. * @param {*} other The other value to compare.
  28170. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28171. * @example
  28172. *
  28173. * var object = { 'a': 1 };
  28174. * var other = { 'a': 1 };
  28175. *
  28176. * _.eq(object, object);
  28177. * // => true
  28178. *
  28179. * _.eq(object, other);
  28180. * // => false
  28181. *
  28182. * _.eq('a', 'a');
  28183. * // => true
  28184. *
  28185. * _.eq('a', Object('a'));
  28186. * // => false
  28187. *
  28188. * _.eq(NaN, NaN);
  28189. * // => true
  28190. */
  28191. function eq(value, other) {
  28192. return value === other || (value !== value && other !== other);
  28193. }
  28194. /**
  28195. * Checks if `value` is greater than `other`.
  28196. *
  28197. * @static
  28198. * @memberOf _
  28199. * @since 3.9.0
  28200. * @category Lang
  28201. * @param {*} value The value to compare.
  28202. * @param {*} other The other value to compare.
  28203. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28204. * else `false`.
  28205. * @see _.lt
  28206. * @example
  28207. *
  28208. * _.gt(3, 1);
  28209. * // => true
  28210. *
  28211. * _.gt(3, 3);
  28212. * // => false
  28213. *
  28214. * _.gt(1, 3);
  28215. * // => false
  28216. */
  28217. var gt = createRelationalOperation(baseGt);
  28218. /**
  28219. * Checks if `value` is greater than or equal to `other`.
  28220. *
  28221. * @static
  28222. * @memberOf _
  28223. * @since 3.9.0
  28224. * @category Lang
  28225. * @param {*} value The value to compare.
  28226. * @param {*} other The other value to compare.
  28227. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28228. * `other`, else `false`.
  28229. * @see _.lte
  28230. * @example
  28231. *
  28232. * _.gte(3, 1);
  28233. * // => true
  28234. *
  28235. * _.gte(3, 3);
  28236. * // => true
  28237. *
  28238. * _.gte(1, 3);
  28239. * // => false
  28240. */
  28241. var gte = createRelationalOperation(function(value, other) {
  28242. return value >= other;
  28243. });
  28244. /**
  28245. * Checks if `value` is likely an `arguments` object.
  28246. *
  28247. * @static
  28248. * @memberOf _
  28249. * @since 0.1.0
  28250. * @category Lang
  28251. * @param {*} value The value to check.
  28252. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28253. * else `false`.
  28254. * @example
  28255. *
  28256. * _.isArguments(function() { return arguments; }());
  28257. * // => true
  28258. *
  28259. * _.isArguments([1, 2, 3]);
  28260. * // => false
  28261. */
  28262. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28263. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28264. !propertyIsEnumerable.call(value, 'callee');
  28265. };
  28266. /**
  28267. * Checks if `value` is classified as an `Array` object.
  28268. *
  28269. * @static
  28270. * @memberOf _
  28271. * @since 0.1.0
  28272. * @category Lang
  28273. * @param {*} value The value to check.
  28274. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28275. * @example
  28276. *
  28277. * _.isArray([1, 2, 3]);
  28278. * // => true
  28279. *
  28280. * _.isArray(document.body.children);
  28281. * // => false
  28282. *
  28283. * _.isArray('abc');
  28284. * // => false
  28285. *
  28286. * _.isArray(_.noop);
  28287. * // => false
  28288. */
  28289. var isArray = Array.isArray;
  28290. /**
  28291. * Checks if `value` is classified as an `ArrayBuffer` object.
  28292. *
  28293. * @static
  28294. * @memberOf _
  28295. * @since 4.3.0
  28296. * @category Lang
  28297. * @param {*} value The value to check.
  28298. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28299. * @example
  28300. *
  28301. * _.isArrayBuffer(new ArrayBuffer(2));
  28302. * // => true
  28303. *
  28304. * _.isArrayBuffer(new Array(2));
  28305. * // => false
  28306. */
  28307. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28308. /**
  28309. * Checks if `value` is array-like. A value is considered array-like if it's
  28310. * not a function and has a `value.length` that's an integer greater than or
  28311. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28312. *
  28313. * @static
  28314. * @memberOf _
  28315. * @since 4.0.0
  28316. * @category Lang
  28317. * @param {*} value The value to check.
  28318. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28319. * @example
  28320. *
  28321. * _.isArrayLike([1, 2, 3]);
  28322. * // => true
  28323. *
  28324. * _.isArrayLike(document.body.children);
  28325. * // => true
  28326. *
  28327. * _.isArrayLike('abc');
  28328. * // => true
  28329. *
  28330. * _.isArrayLike(_.noop);
  28331. * // => false
  28332. */
  28333. function isArrayLike(value) {
  28334. return value != null && isLength(value.length) && !isFunction(value);
  28335. }
  28336. /**
  28337. * This method is like `_.isArrayLike` except that it also checks if `value`
  28338. * is an object.
  28339. *
  28340. * @static
  28341. * @memberOf _
  28342. * @since 4.0.0
  28343. * @category Lang
  28344. * @param {*} value The value to check.
  28345. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28346. * else `false`.
  28347. * @example
  28348. *
  28349. * _.isArrayLikeObject([1, 2, 3]);
  28350. * // => true
  28351. *
  28352. * _.isArrayLikeObject(document.body.children);
  28353. * // => true
  28354. *
  28355. * _.isArrayLikeObject('abc');
  28356. * // => false
  28357. *
  28358. * _.isArrayLikeObject(_.noop);
  28359. * // => false
  28360. */
  28361. function isArrayLikeObject(value) {
  28362. return isObjectLike(value) && isArrayLike(value);
  28363. }
  28364. /**
  28365. * Checks if `value` is classified as a boolean primitive or object.
  28366. *
  28367. * @static
  28368. * @memberOf _
  28369. * @since 0.1.0
  28370. * @category Lang
  28371. * @param {*} value The value to check.
  28372. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28373. * @example
  28374. *
  28375. * _.isBoolean(false);
  28376. * // => true
  28377. *
  28378. * _.isBoolean(null);
  28379. * // => false
  28380. */
  28381. function isBoolean(value) {
  28382. return value === true || value === false ||
  28383. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28384. }
  28385. /**
  28386. * Checks if `value` is a buffer.
  28387. *
  28388. * @static
  28389. * @memberOf _
  28390. * @since 4.3.0
  28391. * @category Lang
  28392. * @param {*} value The value to check.
  28393. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28394. * @example
  28395. *
  28396. * _.isBuffer(new Buffer(2));
  28397. * // => true
  28398. *
  28399. * _.isBuffer(new Uint8Array(2));
  28400. * // => false
  28401. */
  28402. var isBuffer = nativeIsBuffer || stubFalse;
  28403. /**
  28404. * Checks if `value` is classified as a `Date` object.
  28405. *
  28406. * @static
  28407. * @memberOf _
  28408. * @since 0.1.0
  28409. * @category Lang
  28410. * @param {*} value The value to check.
  28411. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28412. * @example
  28413. *
  28414. * _.isDate(new Date);
  28415. * // => true
  28416. *
  28417. * _.isDate('Mon April 23 2012');
  28418. * // => false
  28419. */
  28420. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28421. /**
  28422. * Checks if `value` is likely a DOM element.
  28423. *
  28424. * @static
  28425. * @memberOf _
  28426. * @since 0.1.0
  28427. * @category Lang
  28428. * @param {*} value The value to check.
  28429. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28430. * @example
  28431. *
  28432. * _.isElement(document.body);
  28433. * // => true
  28434. *
  28435. * _.isElement('<body>');
  28436. * // => false
  28437. */
  28438. function isElement(value) {
  28439. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28440. }
  28441. /**
  28442. * Checks if `value` is an empty object, collection, map, or set.
  28443. *
  28444. * Objects are considered empty if they have no own enumerable string keyed
  28445. * properties.
  28446. *
  28447. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28448. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28449. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28450. *
  28451. * @static
  28452. * @memberOf _
  28453. * @since 0.1.0
  28454. * @category Lang
  28455. * @param {*} value The value to check.
  28456. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28457. * @example
  28458. *
  28459. * _.isEmpty(null);
  28460. * // => true
  28461. *
  28462. * _.isEmpty(true);
  28463. * // => true
  28464. *
  28465. * _.isEmpty(1);
  28466. * // => true
  28467. *
  28468. * _.isEmpty([1, 2, 3]);
  28469. * // => false
  28470. *
  28471. * _.isEmpty({ 'a': 1 });
  28472. * // => false
  28473. */
  28474. function isEmpty(value) {
  28475. if (value == null) {
  28476. return true;
  28477. }
  28478. if (isArrayLike(value) &&
  28479. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28480. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28481. return !value.length;
  28482. }
  28483. var tag = getTag(value);
  28484. if (tag == mapTag || tag == setTag) {
  28485. return !value.size;
  28486. }
  28487. if (isPrototype(value)) {
  28488. return !baseKeys(value).length;
  28489. }
  28490. for (var key in value) {
  28491. if (hasOwnProperty.call(value, key)) {
  28492. return false;
  28493. }
  28494. }
  28495. return true;
  28496. }
  28497. /**
  28498. * Performs a deep comparison between two values to determine if they are
  28499. * equivalent.
  28500. *
  28501. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28502. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28503. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28504. * by their own, not inherited, enumerable properties. Functions and DOM
  28505. * nodes are compared by strict equality, i.e. `===`.
  28506. *
  28507. * @static
  28508. * @memberOf _
  28509. * @since 0.1.0
  28510. * @category Lang
  28511. * @param {*} value The value to compare.
  28512. * @param {*} other The other value to compare.
  28513. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28514. * @example
  28515. *
  28516. * var object = { 'a': 1 };
  28517. * var other = { 'a': 1 };
  28518. *
  28519. * _.isEqual(object, other);
  28520. * // => true
  28521. *
  28522. * object === other;
  28523. * // => false
  28524. */
  28525. function isEqual(value, other) {
  28526. return baseIsEqual(value, other);
  28527. }
  28528. /**
  28529. * This method is like `_.isEqual` except that it accepts `customizer` which
  28530. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28531. * are handled by the method instead. The `customizer` is invoked with up to
  28532. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28533. *
  28534. * @static
  28535. * @memberOf _
  28536. * @since 4.0.0
  28537. * @category Lang
  28538. * @param {*} value The value to compare.
  28539. * @param {*} other The other value to compare.
  28540. * @param {Function} [customizer] The function to customize comparisons.
  28541. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28542. * @example
  28543. *
  28544. * function isGreeting(value) {
  28545. * return /^h(?:i|ello)$/.test(value);
  28546. * }
  28547. *
  28548. * function customizer(objValue, othValue) {
  28549. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28550. * return true;
  28551. * }
  28552. * }
  28553. *
  28554. * var array = ['hello', 'goodbye'];
  28555. * var other = ['hi', 'goodbye'];
  28556. *
  28557. * _.isEqualWith(array, other, customizer);
  28558. * // => true
  28559. */
  28560. function isEqualWith(value, other, customizer) {
  28561. customizer = typeof customizer == 'function' ? customizer : undefined;
  28562. var result = customizer ? customizer(value, other) : undefined;
  28563. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28564. }
  28565. /**
  28566. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28567. * `SyntaxError`, `TypeError`, or `URIError` object.
  28568. *
  28569. * @static
  28570. * @memberOf _
  28571. * @since 3.0.0
  28572. * @category Lang
  28573. * @param {*} value The value to check.
  28574. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28575. * @example
  28576. *
  28577. * _.isError(new Error);
  28578. * // => true
  28579. *
  28580. * _.isError(Error);
  28581. * // => false
  28582. */
  28583. function isError(value) {
  28584. if (!isObjectLike(value)) {
  28585. return false;
  28586. }
  28587. var tag = baseGetTag(value);
  28588. return tag == errorTag || tag == domExcTag ||
  28589. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28590. }
  28591. /**
  28592. * Checks if `value` is a finite primitive number.
  28593. *
  28594. * **Note:** This method is based on
  28595. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28596. *
  28597. * @static
  28598. * @memberOf _
  28599. * @since 0.1.0
  28600. * @category Lang
  28601. * @param {*} value The value to check.
  28602. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28603. * @example
  28604. *
  28605. * _.isFinite(3);
  28606. * // => true
  28607. *
  28608. * _.isFinite(Number.MIN_VALUE);
  28609. * // => true
  28610. *
  28611. * _.isFinite(Infinity);
  28612. * // => false
  28613. *
  28614. * _.isFinite('3');
  28615. * // => false
  28616. */
  28617. function isFinite(value) {
  28618. return typeof value == 'number' && nativeIsFinite(value);
  28619. }
  28620. /**
  28621. * Checks if `value` is classified as a `Function` object.
  28622. *
  28623. * @static
  28624. * @memberOf _
  28625. * @since 0.1.0
  28626. * @category Lang
  28627. * @param {*} value The value to check.
  28628. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28629. * @example
  28630. *
  28631. * _.isFunction(_);
  28632. * // => true
  28633. *
  28634. * _.isFunction(/abc/);
  28635. * // => false
  28636. */
  28637. function isFunction(value) {
  28638. if (!isObject(value)) {
  28639. return false;
  28640. }
  28641. // The use of `Object#toString` avoids issues with the `typeof` operator
  28642. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28643. var tag = baseGetTag(value);
  28644. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28645. }
  28646. /**
  28647. * Checks if `value` is an integer.
  28648. *
  28649. * **Note:** This method is based on
  28650. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28651. *
  28652. * @static
  28653. * @memberOf _
  28654. * @since 4.0.0
  28655. * @category Lang
  28656. * @param {*} value The value to check.
  28657. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28658. * @example
  28659. *
  28660. * _.isInteger(3);
  28661. * // => true
  28662. *
  28663. * _.isInteger(Number.MIN_VALUE);
  28664. * // => false
  28665. *
  28666. * _.isInteger(Infinity);
  28667. * // => false
  28668. *
  28669. * _.isInteger('3');
  28670. * // => false
  28671. */
  28672. function isInteger(value) {
  28673. return typeof value == 'number' && value == toInteger(value);
  28674. }
  28675. /**
  28676. * Checks if `value` is a valid array-like length.
  28677. *
  28678. * **Note:** This method is loosely based on
  28679. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28680. *
  28681. * @static
  28682. * @memberOf _
  28683. * @since 4.0.0
  28684. * @category Lang
  28685. * @param {*} value The value to check.
  28686. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28687. * @example
  28688. *
  28689. * _.isLength(3);
  28690. * // => true
  28691. *
  28692. * _.isLength(Number.MIN_VALUE);
  28693. * // => false
  28694. *
  28695. * _.isLength(Infinity);
  28696. * // => false
  28697. *
  28698. * _.isLength('3');
  28699. * // => false
  28700. */
  28701. function isLength(value) {
  28702. return typeof value == 'number' &&
  28703. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28704. }
  28705. /**
  28706. * Checks if `value` is the
  28707. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28708. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28709. *
  28710. * @static
  28711. * @memberOf _
  28712. * @since 0.1.0
  28713. * @category Lang
  28714. * @param {*} value The value to check.
  28715. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28716. * @example
  28717. *
  28718. * _.isObject({});
  28719. * // => true
  28720. *
  28721. * _.isObject([1, 2, 3]);
  28722. * // => true
  28723. *
  28724. * _.isObject(_.noop);
  28725. * // => true
  28726. *
  28727. * _.isObject(null);
  28728. * // => false
  28729. */
  28730. function isObject(value) {
  28731. var type = typeof value;
  28732. return value != null && (type == 'object' || type == 'function');
  28733. }
  28734. /**
  28735. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28736. * and has a `typeof` result of "object".
  28737. *
  28738. * @static
  28739. * @memberOf _
  28740. * @since 4.0.0
  28741. * @category Lang
  28742. * @param {*} value The value to check.
  28743. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28744. * @example
  28745. *
  28746. * _.isObjectLike({});
  28747. * // => true
  28748. *
  28749. * _.isObjectLike([1, 2, 3]);
  28750. * // => true
  28751. *
  28752. * _.isObjectLike(_.noop);
  28753. * // => false
  28754. *
  28755. * _.isObjectLike(null);
  28756. * // => false
  28757. */
  28758. function isObjectLike(value) {
  28759. return value != null && typeof value == 'object';
  28760. }
  28761. /**
  28762. * Checks if `value` is classified as a `Map` object.
  28763. *
  28764. * @static
  28765. * @memberOf _
  28766. * @since 4.3.0
  28767. * @category Lang
  28768. * @param {*} value The value to check.
  28769. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28770. * @example
  28771. *
  28772. * _.isMap(new Map);
  28773. * // => true
  28774. *
  28775. * _.isMap(new WeakMap);
  28776. * // => false
  28777. */
  28778. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28779. /**
  28780. * Performs a partial deep comparison between `object` and `source` to
  28781. * determine if `object` contains equivalent property values.
  28782. *
  28783. * **Note:** This method is equivalent to `_.matches` when `source` is
  28784. * partially applied.
  28785. *
  28786. * Partial comparisons will match empty array and empty object `source`
  28787. * values against any array or object value, respectively. See `_.isEqual`
  28788. * for a list of supported value comparisons.
  28789. *
  28790. * @static
  28791. * @memberOf _
  28792. * @since 3.0.0
  28793. * @category Lang
  28794. * @param {Object} object The object to inspect.
  28795. * @param {Object} source The object of property values to match.
  28796. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28797. * @example
  28798. *
  28799. * var object = { 'a': 1, 'b': 2 };
  28800. *
  28801. * _.isMatch(object, { 'b': 2 });
  28802. * // => true
  28803. *
  28804. * _.isMatch(object, { 'b': 1 });
  28805. * // => false
  28806. */
  28807. function isMatch(object, source) {
  28808. return object === source || baseIsMatch(object, source, getMatchData(source));
  28809. }
  28810. /**
  28811. * This method is like `_.isMatch` except that it accepts `customizer` which
  28812. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28813. * are handled by the method instead. The `customizer` is invoked with five
  28814. * arguments: (objValue, srcValue, index|key, object, source).
  28815. *
  28816. * @static
  28817. * @memberOf _
  28818. * @since 4.0.0
  28819. * @category Lang
  28820. * @param {Object} object The object to inspect.
  28821. * @param {Object} source The object of property values to match.
  28822. * @param {Function} [customizer] The function to customize comparisons.
  28823. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28824. * @example
  28825. *
  28826. * function isGreeting(value) {
  28827. * return /^h(?:i|ello)$/.test(value);
  28828. * }
  28829. *
  28830. * function customizer(objValue, srcValue) {
  28831. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28832. * return true;
  28833. * }
  28834. * }
  28835. *
  28836. * var object = { 'greeting': 'hello' };
  28837. * var source = { 'greeting': 'hi' };
  28838. *
  28839. * _.isMatchWith(object, source, customizer);
  28840. * // => true
  28841. */
  28842. function isMatchWith(object, source, customizer) {
  28843. customizer = typeof customizer == 'function' ? customizer : undefined;
  28844. return baseIsMatch(object, source, getMatchData(source), customizer);
  28845. }
  28846. /**
  28847. * Checks if `value` is `NaN`.
  28848. *
  28849. * **Note:** This method is based on
  28850. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28851. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28852. * `undefined` and other non-number values.
  28853. *
  28854. * @static
  28855. * @memberOf _
  28856. * @since 0.1.0
  28857. * @category Lang
  28858. * @param {*} value The value to check.
  28859. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28860. * @example
  28861. *
  28862. * _.isNaN(NaN);
  28863. * // => true
  28864. *
  28865. * _.isNaN(new Number(NaN));
  28866. * // => true
  28867. *
  28868. * isNaN(undefined);
  28869. * // => true
  28870. *
  28871. * _.isNaN(undefined);
  28872. * // => false
  28873. */
  28874. function isNaN(value) {
  28875. // An `NaN` primitive is the only value that is not equal to itself.
  28876. // Perform the `toStringTag` check first to avoid errors with some
  28877. // ActiveX objects in IE.
  28878. return isNumber(value) && value != +value;
  28879. }
  28880. /**
  28881. * Checks if `value` is a pristine native function.
  28882. *
  28883. * **Note:** This method can't reliably detect native functions in the presence
  28884. * of the core-js package because core-js circumvents this kind of detection.
  28885. * Despite multiple requests, the core-js maintainer has made it clear: any
  28886. * attempt to fix the detection will be obstructed. As a result, we're left
  28887. * with little choice but to throw an error. Unfortunately, this also affects
  28888. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  28889. * which rely on core-js.
  28890. *
  28891. * @static
  28892. * @memberOf _
  28893. * @since 3.0.0
  28894. * @category Lang
  28895. * @param {*} value The value to check.
  28896. * @returns {boolean} Returns `true` if `value` is a native function,
  28897. * else `false`.
  28898. * @example
  28899. *
  28900. * _.isNative(Array.prototype.push);
  28901. * // => true
  28902. *
  28903. * _.isNative(_);
  28904. * // => false
  28905. */
  28906. function isNative(value) {
  28907. if (isMaskable(value)) {
  28908. throw new Error(CORE_ERROR_TEXT);
  28909. }
  28910. return baseIsNative(value);
  28911. }
  28912. /**
  28913. * Checks if `value` is `null`.
  28914. *
  28915. * @static
  28916. * @memberOf _
  28917. * @since 0.1.0
  28918. * @category Lang
  28919. * @param {*} value The value to check.
  28920. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  28921. * @example
  28922. *
  28923. * _.isNull(null);
  28924. * // => true
  28925. *
  28926. * _.isNull(void 0);
  28927. * // => false
  28928. */
  28929. function isNull(value) {
  28930. return value === null;
  28931. }
  28932. /**
  28933. * Checks if `value` is `null` or `undefined`.
  28934. *
  28935. * @static
  28936. * @memberOf _
  28937. * @since 4.0.0
  28938. * @category Lang
  28939. * @param {*} value The value to check.
  28940. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  28941. * @example
  28942. *
  28943. * _.isNil(null);
  28944. * // => true
  28945. *
  28946. * _.isNil(void 0);
  28947. * // => true
  28948. *
  28949. * _.isNil(NaN);
  28950. * // => false
  28951. */
  28952. function isNil(value) {
  28953. return value == null;
  28954. }
  28955. /**
  28956. * Checks if `value` is classified as a `Number` primitive or object.
  28957. *
  28958. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  28959. * classified as numbers, use the `_.isFinite` method.
  28960. *
  28961. * @static
  28962. * @memberOf _
  28963. * @since 0.1.0
  28964. * @category Lang
  28965. * @param {*} value The value to check.
  28966. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  28967. * @example
  28968. *
  28969. * _.isNumber(3);
  28970. * // => true
  28971. *
  28972. * _.isNumber(Number.MIN_VALUE);
  28973. * // => true
  28974. *
  28975. * _.isNumber(Infinity);
  28976. * // => true
  28977. *
  28978. * _.isNumber('3');
  28979. * // => false
  28980. */
  28981. function isNumber(value) {
  28982. return typeof value == 'number' ||
  28983. (isObjectLike(value) && baseGetTag(value) == numberTag);
  28984. }
  28985. /**
  28986. * Checks if `value` is a plain object, that is, an object created by the
  28987. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  28988. *
  28989. * @static
  28990. * @memberOf _
  28991. * @since 0.8.0
  28992. * @category Lang
  28993. * @param {*} value The value to check.
  28994. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  28995. * @example
  28996. *
  28997. * function Foo() {
  28998. * this.a = 1;
  28999. * }
  29000. *
  29001. * _.isPlainObject(new Foo);
  29002. * // => false
  29003. *
  29004. * _.isPlainObject([1, 2, 3]);
  29005. * // => false
  29006. *
  29007. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29008. * // => true
  29009. *
  29010. * _.isPlainObject(Object.create(null));
  29011. * // => true
  29012. */
  29013. function isPlainObject(value) {
  29014. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29015. return false;
  29016. }
  29017. var proto = getPrototype(value);
  29018. if (proto === null) {
  29019. return true;
  29020. }
  29021. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29022. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29023. funcToString.call(Ctor) == objectCtorString;
  29024. }
  29025. /**
  29026. * Checks if `value` is classified as a `RegExp` object.
  29027. *
  29028. * @static
  29029. * @memberOf _
  29030. * @since 0.1.0
  29031. * @category Lang
  29032. * @param {*} value The value to check.
  29033. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29034. * @example
  29035. *
  29036. * _.isRegExp(/abc/);
  29037. * // => true
  29038. *
  29039. * _.isRegExp('/abc/');
  29040. * // => false
  29041. */
  29042. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29043. /**
  29044. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29045. * double precision number which isn't the result of a rounded unsafe integer.
  29046. *
  29047. * **Note:** This method is based on
  29048. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29049. *
  29050. * @static
  29051. * @memberOf _
  29052. * @since 4.0.0
  29053. * @category Lang
  29054. * @param {*} value The value to check.
  29055. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29056. * @example
  29057. *
  29058. * _.isSafeInteger(3);
  29059. * // => true
  29060. *
  29061. * _.isSafeInteger(Number.MIN_VALUE);
  29062. * // => false
  29063. *
  29064. * _.isSafeInteger(Infinity);
  29065. * // => false
  29066. *
  29067. * _.isSafeInteger('3');
  29068. * // => false
  29069. */
  29070. function isSafeInteger(value) {
  29071. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29072. }
  29073. /**
  29074. * Checks if `value` is classified as a `Set` object.
  29075. *
  29076. * @static
  29077. * @memberOf _
  29078. * @since 4.3.0
  29079. * @category Lang
  29080. * @param {*} value The value to check.
  29081. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29082. * @example
  29083. *
  29084. * _.isSet(new Set);
  29085. * // => true
  29086. *
  29087. * _.isSet(new WeakSet);
  29088. * // => false
  29089. */
  29090. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29091. /**
  29092. * Checks if `value` is classified as a `String` primitive or object.
  29093. *
  29094. * @static
  29095. * @since 0.1.0
  29096. * @memberOf _
  29097. * @category Lang
  29098. * @param {*} value The value to check.
  29099. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29100. * @example
  29101. *
  29102. * _.isString('abc');
  29103. * // => true
  29104. *
  29105. * _.isString(1);
  29106. * // => false
  29107. */
  29108. function isString(value) {
  29109. return typeof value == 'string' ||
  29110. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29111. }
  29112. /**
  29113. * Checks if `value` is classified as a `Symbol` primitive or object.
  29114. *
  29115. * @static
  29116. * @memberOf _
  29117. * @since 4.0.0
  29118. * @category Lang
  29119. * @param {*} value The value to check.
  29120. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29121. * @example
  29122. *
  29123. * _.isSymbol(Symbol.iterator);
  29124. * // => true
  29125. *
  29126. * _.isSymbol('abc');
  29127. * // => false
  29128. */
  29129. function isSymbol(value) {
  29130. return typeof value == 'symbol' ||
  29131. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29132. }
  29133. /**
  29134. * Checks if `value` is classified as a typed array.
  29135. *
  29136. * @static
  29137. * @memberOf _
  29138. * @since 3.0.0
  29139. * @category Lang
  29140. * @param {*} value The value to check.
  29141. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29142. * @example
  29143. *
  29144. * _.isTypedArray(new Uint8Array);
  29145. * // => true
  29146. *
  29147. * _.isTypedArray([]);
  29148. * // => false
  29149. */
  29150. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29151. /**
  29152. * Checks if `value` is `undefined`.
  29153. *
  29154. * @static
  29155. * @since 0.1.0
  29156. * @memberOf _
  29157. * @category Lang
  29158. * @param {*} value The value to check.
  29159. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29160. * @example
  29161. *
  29162. * _.isUndefined(void 0);
  29163. * // => true
  29164. *
  29165. * _.isUndefined(null);
  29166. * // => false
  29167. */
  29168. function isUndefined(value) {
  29169. return value === undefined;
  29170. }
  29171. /**
  29172. * Checks if `value` is classified as a `WeakMap` object.
  29173. *
  29174. * @static
  29175. * @memberOf _
  29176. * @since 4.3.0
  29177. * @category Lang
  29178. * @param {*} value The value to check.
  29179. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29180. * @example
  29181. *
  29182. * _.isWeakMap(new WeakMap);
  29183. * // => true
  29184. *
  29185. * _.isWeakMap(new Map);
  29186. * // => false
  29187. */
  29188. function isWeakMap(value) {
  29189. return isObjectLike(value) && getTag(value) == weakMapTag;
  29190. }
  29191. /**
  29192. * Checks if `value` is classified as a `WeakSet` object.
  29193. *
  29194. * @static
  29195. * @memberOf _
  29196. * @since 4.3.0
  29197. * @category Lang
  29198. * @param {*} value The value to check.
  29199. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29200. * @example
  29201. *
  29202. * _.isWeakSet(new WeakSet);
  29203. * // => true
  29204. *
  29205. * _.isWeakSet(new Set);
  29206. * // => false
  29207. */
  29208. function isWeakSet(value) {
  29209. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29210. }
  29211. /**
  29212. * Checks if `value` is less than `other`.
  29213. *
  29214. * @static
  29215. * @memberOf _
  29216. * @since 3.9.0
  29217. * @category Lang
  29218. * @param {*} value The value to compare.
  29219. * @param {*} other The other value to compare.
  29220. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29221. * else `false`.
  29222. * @see _.gt
  29223. * @example
  29224. *
  29225. * _.lt(1, 3);
  29226. * // => true
  29227. *
  29228. * _.lt(3, 3);
  29229. * // => false
  29230. *
  29231. * _.lt(3, 1);
  29232. * // => false
  29233. */
  29234. var lt = createRelationalOperation(baseLt);
  29235. /**
  29236. * Checks if `value` is less than or equal to `other`.
  29237. *
  29238. * @static
  29239. * @memberOf _
  29240. * @since 3.9.0
  29241. * @category Lang
  29242. * @param {*} value The value to compare.
  29243. * @param {*} other The other value to compare.
  29244. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29245. * `other`, else `false`.
  29246. * @see _.gte
  29247. * @example
  29248. *
  29249. * _.lte(1, 3);
  29250. * // => true
  29251. *
  29252. * _.lte(3, 3);
  29253. * // => true
  29254. *
  29255. * _.lte(3, 1);
  29256. * // => false
  29257. */
  29258. var lte = createRelationalOperation(function(value, other) {
  29259. return value <= other;
  29260. });
  29261. /**
  29262. * Converts `value` to an array.
  29263. *
  29264. * @static
  29265. * @since 0.1.0
  29266. * @memberOf _
  29267. * @category Lang
  29268. * @param {*} value The value to convert.
  29269. * @returns {Array} Returns the converted array.
  29270. * @example
  29271. *
  29272. * _.toArray({ 'a': 1, 'b': 2 });
  29273. * // => [1, 2]
  29274. *
  29275. * _.toArray('abc');
  29276. * // => ['a', 'b', 'c']
  29277. *
  29278. * _.toArray(1);
  29279. * // => []
  29280. *
  29281. * _.toArray(null);
  29282. * // => []
  29283. */
  29284. function toArray(value) {
  29285. if (!value) {
  29286. return [];
  29287. }
  29288. if (isArrayLike(value)) {
  29289. return isString(value) ? stringToArray(value) : copyArray(value);
  29290. }
  29291. if (symIterator && value[symIterator]) {
  29292. return iteratorToArray(value[symIterator]());
  29293. }
  29294. var tag = getTag(value),
  29295. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29296. return func(value);
  29297. }
  29298. /**
  29299. * Converts `value` to a finite number.
  29300. *
  29301. * @static
  29302. * @memberOf _
  29303. * @since 4.12.0
  29304. * @category Lang
  29305. * @param {*} value The value to convert.
  29306. * @returns {number} Returns the converted number.
  29307. * @example
  29308. *
  29309. * _.toFinite(3.2);
  29310. * // => 3.2
  29311. *
  29312. * _.toFinite(Number.MIN_VALUE);
  29313. * // => 5e-324
  29314. *
  29315. * _.toFinite(Infinity);
  29316. * // => 1.7976931348623157e+308
  29317. *
  29318. * _.toFinite('3.2');
  29319. * // => 3.2
  29320. */
  29321. function toFinite(value) {
  29322. if (!value) {
  29323. return value === 0 ? value : 0;
  29324. }
  29325. value = toNumber(value);
  29326. if (value === INFINITY || value === -INFINITY) {
  29327. var sign = (value < 0 ? -1 : 1);
  29328. return sign * MAX_INTEGER;
  29329. }
  29330. return value === value ? value : 0;
  29331. }
  29332. /**
  29333. * Converts `value` to an integer.
  29334. *
  29335. * **Note:** This method is loosely based on
  29336. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29337. *
  29338. * @static
  29339. * @memberOf _
  29340. * @since 4.0.0
  29341. * @category Lang
  29342. * @param {*} value The value to convert.
  29343. * @returns {number} Returns the converted integer.
  29344. * @example
  29345. *
  29346. * _.toInteger(3.2);
  29347. * // => 3
  29348. *
  29349. * _.toInteger(Number.MIN_VALUE);
  29350. * // => 0
  29351. *
  29352. * _.toInteger(Infinity);
  29353. * // => 1.7976931348623157e+308
  29354. *
  29355. * _.toInteger('3.2');
  29356. * // => 3
  29357. */
  29358. function toInteger(value) {
  29359. var result = toFinite(value),
  29360. remainder = result % 1;
  29361. return result === result ? (remainder ? result - remainder : result) : 0;
  29362. }
  29363. /**
  29364. * Converts `value` to an integer suitable for use as the length of an
  29365. * array-like object.
  29366. *
  29367. * **Note:** This method is based on
  29368. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29369. *
  29370. * @static
  29371. * @memberOf _
  29372. * @since 4.0.0
  29373. * @category Lang
  29374. * @param {*} value The value to convert.
  29375. * @returns {number} Returns the converted integer.
  29376. * @example
  29377. *
  29378. * _.toLength(3.2);
  29379. * // => 3
  29380. *
  29381. * _.toLength(Number.MIN_VALUE);
  29382. * // => 0
  29383. *
  29384. * _.toLength(Infinity);
  29385. * // => 4294967295
  29386. *
  29387. * _.toLength('3.2');
  29388. * // => 3
  29389. */
  29390. function toLength(value) {
  29391. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29392. }
  29393. /**
  29394. * Converts `value` to a number.
  29395. *
  29396. * @static
  29397. * @memberOf _
  29398. * @since 4.0.0
  29399. * @category Lang
  29400. * @param {*} value The value to process.
  29401. * @returns {number} Returns the number.
  29402. * @example
  29403. *
  29404. * _.toNumber(3.2);
  29405. * // => 3.2
  29406. *
  29407. * _.toNumber(Number.MIN_VALUE);
  29408. * // => 5e-324
  29409. *
  29410. * _.toNumber(Infinity);
  29411. * // => Infinity
  29412. *
  29413. * _.toNumber('3.2');
  29414. * // => 3.2
  29415. */
  29416. function toNumber(value) {
  29417. if (typeof value == 'number') {
  29418. return value;
  29419. }
  29420. if (isSymbol(value)) {
  29421. return NAN;
  29422. }
  29423. if (isObject(value)) {
  29424. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29425. value = isObject(other) ? (other + '') : other;
  29426. }
  29427. if (typeof value != 'string') {
  29428. return value === 0 ? value : +value;
  29429. }
  29430. value = value.replace(reTrim, '');
  29431. var isBinary = reIsBinary.test(value);
  29432. return (isBinary || reIsOctal.test(value))
  29433. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29434. : (reIsBadHex.test(value) ? NAN : +value);
  29435. }
  29436. /**
  29437. * Converts `value` to a plain object flattening inherited enumerable string
  29438. * keyed properties of `value` to own properties of the plain object.
  29439. *
  29440. * @static
  29441. * @memberOf _
  29442. * @since 3.0.0
  29443. * @category Lang
  29444. * @param {*} value The value to convert.
  29445. * @returns {Object} Returns the converted plain object.
  29446. * @example
  29447. *
  29448. * function Foo() {
  29449. * this.b = 2;
  29450. * }
  29451. *
  29452. * Foo.prototype.c = 3;
  29453. *
  29454. * _.assign({ 'a': 1 }, new Foo);
  29455. * // => { 'a': 1, 'b': 2 }
  29456. *
  29457. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29458. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29459. */
  29460. function toPlainObject(value) {
  29461. return copyObject(value, keysIn(value));
  29462. }
  29463. /**
  29464. * Converts `value` to a safe integer. A safe integer can be compared and
  29465. * represented correctly.
  29466. *
  29467. * @static
  29468. * @memberOf _
  29469. * @since 4.0.0
  29470. * @category Lang
  29471. * @param {*} value The value to convert.
  29472. * @returns {number} Returns the converted integer.
  29473. * @example
  29474. *
  29475. * _.toSafeInteger(3.2);
  29476. * // => 3
  29477. *
  29478. * _.toSafeInteger(Number.MIN_VALUE);
  29479. * // => 0
  29480. *
  29481. * _.toSafeInteger(Infinity);
  29482. * // => 9007199254740991
  29483. *
  29484. * _.toSafeInteger('3.2');
  29485. * // => 3
  29486. */
  29487. function toSafeInteger(value) {
  29488. return value
  29489. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29490. : (value === 0 ? value : 0);
  29491. }
  29492. /**
  29493. * Converts `value` to a string. An empty string is returned for `null`
  29494. * and `undefined` values. The sign of `-0` is preserved.
  29495. *
  29496. * @static
  29497. * @memberOf _
  29498. * @since 4.0.0
  29499. * @category Lang
  29500. * @param {*} value The value to convert.
  29501. * @returns {string} Returns the converted string.
  29502. * @example
  29503. *
  29504. * _.toString(null);
  29505. * // => ''
  29506. *
  29507. * _.toString(-0);
  29508. * // => '-0'
  29509. *
  29510. * _.toString([1, 2, 3]);
  29511. * // => '1,2,3'
  29512. */
  29513. function toString(value) {
  29514. return value == null ? '' : baseToString(value);
  29515. }
  29516. /*------------------------------------------------------------------------*/
  29517. /**
  29518. * Assigns own enumerable string keyed properties of source objects to the
  29519. * destination object. Source objects are applied from left to right.
  29520. * Subsequent sources overwrite property assignments of previous sources.
  29521. *
  29522. * **Note:** This method mutates `object` and is loosely based on
  29523. * [`Object.assign`](https://mdn.io/Object/assign).
  29524. *
  29525. * @static
  29526. * @memberOf _
  29527. * @since 0.10.0
  29528. * @category Object
  29529. * @param {Object} object The destination object.
  29530. * @param {...Object} [sources] The source objects.
  29531. * @returns {Object} Returns `object`.
  29532. * @see _.assignIn
  29533. * @example
  29534. *
  29535. * function Foo() {
  29536. * this.a = 1;
  29537. * }
  29538. *
  29539. * function Bar() {
  29540. * this.c = 3;
  29541. * }
  29542. *
  29543. * Foo.prototype.b = 2;
  29544. * Bar.prototype.d = 4;
  29545. *
  29546. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29547. * // => { 'a': 1, 'c': 3 }
  29548. */
  29549. var assign = createAssigner(function(object, source) {
  29550. if (isPrototype(source) || isArrayLike(source)) {
  29551. copyObject(source, keys(source), object);
  29552. return;
  29553. }
  29554. for (var key in source) {
  29555. if (hasOwnProperty.call(source, key)) {
  29556. assignValue(object, key, source[key]);
  29557. }
  29558. }
  29559. });
  29560. /**
  29561. * This method is like `_.assign` except that it iterates over own and
  29562. * inherited source properties.
  29563. *
  29564. * **Note:** This method mutates `object`.
  29565. *
  29566. * @static
  29567. * @memberOf _
  29568. * @since 4.0.0
  29569. * @alias extend
  29570. * @category Object
  29571. * @param {Object} object The destination object.
  29572. * @param {...Object} [sources] The source objects.
  29573. * @returns {Object} Returns `object`.
  29574. * @see _.assign
  29575. * @example
  29576. *
  29577. * function Foo() {
  29578. * this.a = 1;
  29579. * }
  29580. *
  29581. * function Bar() {
  29582. * this.c = 3;
  29583. * }
  29584. *
  29585. * Foo.prototype.b = 2;
  29586. * Bar.prototype.d = 4;
  29587. *
  29588. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29589. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29590. */
  29591. var assignIn = createAssigner(function(object, source) {
  29592. copyObject(source, keysIn(source), object);
  29593. });
  29594. /**
  29595. * This method is like `_.assignIn` except that it accepts `customizer`
  29596. * which is invoked to produce the assigned values. If `customizer` returns
  29597. * `undefined`, assignment is handled by the method instead. The `customizer`
  29598. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29599. *
  29600. * **Note:** This method mutates `object`.
  29601. *
  29602. * @static
  29603. * @memberOf _
  29604. * @since 4.0.0
  29605. * @alias extendWith
  29606. * @category Object
  29607. * @param {Object} object The destination object.
  29608. * @param {...Object} sources The source objects.
  29609. * @param {Function} [customizer] The function to customize assigned values.
  29610. * @returns {Object} Returns `object`.
  29611. * @see _.assignWith
  29612. * @example
  29613. *
  29614. * function customizer(objValue, srcValue) {
  29615. * return _.isUndefined(objValue) ? srcValue : objValue;
  29616. * }
  29617. *
  29618. * var defaults = _.partialRight(_.assignInWith, customizer);
  29619. *
  29620. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29621. * // => { 'a': 1, 'b': 2 }
  29622. */
  29623. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29624. copyObject(source, keysIn(source), object, customizer);
  29625. });
  29626. /**
  29627. * This method is like `_.assign` except that it accepts `customizer`
  29628. * which is invoked to produce the assigned values. If `customizer` returns
  29629. * `undefined`, assignment is handled by the method instead. The `customizer`
  29630. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29631. *
  29632. * **Note:** This method mutates `object`.
  29633. *
  29634. * @static
  29635. * @memberOf _
  29636. * @since 4.0.0
  29637. * @category Object
  29638. * @param {Object} object The destination object.
  29639. * @param {...Object} sources The source objects.
  29640. * @param {Function} [customizer] The function to customize assigned values.
  29641. * @returns {Object} Returns `object`.
  29642. * @see _.assignInWith
  29643. * @example
  29644. *
  29645. * function customizer(objValue, srcValue) {
  29646. * return _.isUndefined(objValue) ? srcValue : objValue;
  29647. * }
  29648. *
  29649. * var defaults = _.partialRight(_.assignWith, customizer);
  29650. *
  29651. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29652. * // => { 'a': 1, 'b': 2 }
  29653. */
  29654. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29655. copyObject(source, keys(source), object, customizer);
  29656. });
  29657. /**
  29658. * Creates an array of values corresponding to `paths` of `object`.
  29659. *
  29660. * @static
  29661. * @memberOf _
  29662. * @since 1.0.0
  29663. * @category Object
  29664. * @param {Object} object The object to iterate over.
  29665. * @param {...(string|string[])} [paths] The property paths to pick.
  29666. * @returns {Array} Returns the picked values.
  29667. * @example
  29668. *
  29669. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29670. *
  29671. * _.at(object, ['a[0].b.c', 'a[1]']);
  29672. * // => [3, 4]
  29673. */
  29674. var at = flatRest(baseAt);
  29675. /**
  29676. * Creates an object that inherits from the `prototype` object. If a
  29677. * `properties` object is given, its own enumerable string keyed properties
  29678. * are assigned to the created object.
  29679. *
  29680. * @static
  29681. * @memberOf _
  29682. * @since 2.3.0
  29683. * @category Object
  29684. * @param {Object} prototype The object to inherit from.
  29685. * @param {Object} [properties] The properties to assign to the object.
  29686. * @returns {Object} Returns the new object.
  29687. * @example
  29688. *
  29689. * function Shape() {
  29690. * this.x = 0;
  29691. * this.y = 0;
  29692. * }
  29693. *
  29694. * function Circle() {
  29695. * Shape.call(this);
  29696. * }
  29697. *
  29698. * Circle.prototype = _.create(Shape.prototype, {
  29699. * 'constructor': Circle
  29700. * });
  29701. *
  29702. * var circle = new Circle;
  29703. * circle instanceof Circle;
  29704. * // => true
  29705. *
  29706. * circle instanceof Shape;
  29707. * // => true
  29708. */
  29709. function create(prototype, properties) {
  29710. var result = baseCreate(prototype);
  29711. return properties == null ? result : baseAssign(result, properties);
  29712. }
  29713. /**
  29714. * Assigns own and inherited enumerable string keyed properties of source
  29715. * objects to the destination object for all destination properties that
  29716. * resolve to `undefined`. Source objects are applied from left to right.
  29717. * Once a property is set, additional values of the same property are ignored.
  29718. *
  29719. * **Note:** This method mutates `object`.
  29720. *
  29721. * @static
  29722. * @since 0.1.0
  29723. * @memberOf _
  29724. * @category Object
  29725. * @param {Object} object The destination object.
  29726. * @param {...Object} [sources] The source objects.
  29727. * @returns {Object} Returns `object`.
  29728. * @see _.defaultsDeep
  29729. * @example
  29730. *
  29731. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29732. * // => { 'a': 1, 'b': 2 }
  29733. */
  29734. var defaults = baseRest(function(object, sources) {
  29735. object = Object(object);
  29736. var index = -1;
  29737. var length = sources.length;
  29738. var guard = length > 2 ? sources[2] : undefined;
  29739. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29740. length = 1;
  29741. }
  29742. while (++index < length) {
  29743. var source = sources[index];
  29744. var props = keysIn(source);
  29745. var propsIndex = -1;
  29746. var propsLength = props.length;
  29747. while (++propsIndex < propsLength) {
  29748. var key = props[propsIndex];
  29749. var value = object[key];
  29750. if (value === undefined ||
  29751. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29752. object[key] = source[key];
  29753. }
  29754. }
  29755. }
  29756. return object;
  29757. });
  29758. /**
  29759. * This method is like `_.defaults` except that it recursively assigns
  29760. * default properties.
  29761. *
  29762. * **Note:** This method mutates `object`.
  29763. *
  29764. * @static
  29765. * @memberOf _
  29766. * @since 3.10.0
  29767. * @category Object
  29768. * @param {Object} object The destination object.
  29769. * @param {...Object} [sources] The source objects.
  29770. * @returns {Object} Returns `object`.
  29771. * @see _.defaults
  29772. * @example
  29773. *
  29774. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29775. * // => { 'a': { 'b': 2, 'c': 3 } }
  29776. */
  29777. var defaultsDeep = baseRest(function(args) {
  29778. args.push(undefined, customDefaultsMerge);
  29779. return apply(mergeWith, undefined, args);
  29780. });
  29781. /**
  29782. * This method is like `_.find` except that it returns the key of the first
  29783. * element `predicate` returns truthy for instead of the element itself.
  29784. *
  29785. * @static
  29786. * @memberOf _
  29787. * @since 1.1.0
  29788. * @category Object
  29789. * @param {Object} object The object to inspect.
  29790. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29791. * @returns {string|undefined} Returns the key of the matched element,
  29792. * else `undefined`.
  29793. * @example
  29794. *
  29795. * var users = {
  29796. * 'barney': { 'age': 36, 'active': true },
  29797. * 'fred': { 'age': 40, 'active': false },
  29798. * 'pebbles': { 'age': 1, 'active': true }
  29799. * };
  29800. *
  29801. * _.findKey(users, function(o) { return o.age < 40; });
  29802. * // => 'barney' (iteration order is not guaranteed)
  29803. *
  29804. * // The `_.matches` iteratee shorthand.
  29805. * _.findKey(users, { 'age': 1, 'active': true });
  29806. * // => 'pebbles'
  29807. *
  29808. * // The `_.matchesProperty` iteratee shorthand.
  29809. * _.findKey(users, ['active', false]);
  29810. * // => 'fred'
  29811. *
  29812. * // The `_.property` iteratee shorthand.
  29813. * _.findKey(users, 'active');
  29814. * // => 'barney'
  29815. */
  29816. function findKey(object, predicate) {
  29817. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29818. }
  29819. /**
  29820. * This method is like `_.findKey` except that it iterates over elements of
  29821. * a collection in the opposite order.
  29822. *
  29823. * @static
  29824. * @memberOf _
  29825. * @since 2.0.0
  29826. * @category Object
  29827. * @param {Object} object The object to inspect.
  29828. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29829. * @returns {string|undefined} Returns the key of the matched element,
  29830. * else `undefined`.
  29831. * @example
  29832. *
  29833. * var users = {
  29834. * 'barney': { 'age': 36, 'active': true },
  29835. * 'fred': { 'age': 40, 'active': false },
  29836. * 'pebbles': { 'age': 1, 'active': true }
  29837. * };
  29838. *
  29839. * _.findLastKey(users, function(o) { return o.age < 40; });
  29840. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29841. *
  29842. * // The `_.matches` iteratee shorthand.
  29843. * _.findLastKey(users, { 'age': 36, 'active': true });
  29844. * // => 'barney'
  29845. *
  29846. * // The `_.matchesProperty` iteratee shorthand.
  29847. * _.findLastKey(users, ['active', false]);
  29848. * // => 'fred'
  29849. *
  29850. * // The `_.property` iteratee shorthand.
  29851. * _.findLastKey(users, 'active');
  29852. * // => 'pebbles'
  29853. */
  29854. function findLastKey(object, predicate) {
  29855. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29856. }
  29857. /**
  29858. * Iterates over own and inherited enumerable string keyed properties of an
  29859. * object and invokes `iteratee` for each property. The iteratee is invoked
  29860. * with three arguments: (value, key, object). Iteratee functions may exit
  29861. * iteration early by explicitly returning `false`.
  29862. *
  29863. * @static
  29864. * @memberOf _
  29865. * @since 0.3.0
  29866. * @category Object
  29867. * @param {Object} object The object to iterate over.
  29868. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29869. * @returns {Object} Returns `object`.
  29870. * @see _.forInRight
  29871. * @example
  29872. *
  29873. * function Foo() {
  29874. * this.a = 1;
  29875. * this.b = 2;
  29876. * }
  29877. *
  29878. * Foo.prototype.c = 3;
  29879. *
  29880. * _.forIn(new Foo, function(value, key) {
  29881. * console.log(key);
  29882. * });
  29883. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29884. */
  29885. function forIn(object, iteratee) {
  29886. return object == null
  29887. ? object
  29888. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  29889. }
  29890. /**
  29891. * This method is like `_.forIn` except that it iterates over properties of
  29892. * `object` in the opposite order.
  29893. *
  29894. * @static
  29895. * @memberOf _
  29896. * @since 2.0.0
  29897. * @category Object
  29898. * @param {Object} object The object to iterate over.
  29899. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29900. * @returns {Object} Returns `object`.
  29901. * @see _.forIn
  29902. * @example
  29903. *
  29904. * function Foo() {
  29905. * this.a = 1;
  29906. * this.b = 2;
  29907. * }
  29908. *
  29909. * Foo.prototype.c = 3;
  29910. *
  29911. * _.forInRight(new Foo, function(value, key) {
  29912. * console.log(key);
  29913. * });
  29914. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  29915. */
  29916. function forInRight(object, iteratee) {
  29917. return object == null
  29918. ? object
  29919. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  29920. }
  29921. /**
  29922. * Iterates over own enumerable string keyed properties of an object and
  29923. * invokes `iteratee` for each property. The iteratee is invoked with three
  29924. * arguments: (value, key, object). Iteratee functions may exit iteration
  29925. * early by explicitly returning `false`.
  29926. *
  29927. * @static
  29928. * @memberOf _
  29929. * @since 0.3.0
  29930. * @category Object
  29931. * @param {Object} object The object to iterate over.
  29932. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29933. * @returns {Object} Returns `object`.
  29934. * @see _.forOwnRight
  29935. * @example
  29936. *
  29937. * function Foo() {
  29938. * this.a = 1;
  29939. * this.b = 2;
  29940. * }
  29941. *
  29942. * Foo.prototype.c = 3;
  29943. *
  29944. * _.forOwn(new Foo, function(value, key) {
  29945. * console.log(key);
  29946. * });
  29947. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  29948. */
  29949. function forOwn(object, iteratee) {
  29950. return object && baseForOwn(object, getIteratee(iteratee, 3));
  29951. }
  29952. /**
  29953. * This method is like `_.forOwn` except that it iterates over properties of
  29954. * `object` in the opposite order.
  29955. *
  29956. * @static
  29957. * @memberOf _
  29958. * @since 2.0.0
  29959. * @category Object
  29960. * @param {Object} object The object to iterate over.
  29961. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29962. * @returns {Object} Returns `object`.
  29963. * @see _.forOwn
  29964. * @example
  29965. *
  29966. * function Foo() {
  29967. * this.a = 1;
  29968. * this.b = 2;
  29969. * }
  29970. *
  29971. * Foo.prototype.c = 3;
  29972. *
  29973. * _.forOwnRight(new Foo, function(value, key) {
  29974. * console.log(key);
  29975. * });
  29976. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  29977. */
  29978. function forOwnRight(object, iteratee) {
  29979. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  29980. }
  29981. /**
  29982. * Creates an array of function property names from own enumerable properties
  29983. * of `object`.
  29984. *
  29985. * @static
  29986. * @since 0.1.0
  29987. * @memberOf _
  29988. * @category Object
  29989. * @param {Object} object The object to inspect.
  29990. * @returns {Array} Returns the function names.
  29991. * @see _.functionsIn
  29992. * @example
  29993. *
  29994. * function Foo() {
  29995. * this.a = _.constant('a');
  29996. * this.b = _.constant('b');
  29997. * }
  29998. *
  29999. * Foo.prototype.c = _.constant('c');
  30000. *
  30001. * _.functions(new Foo);
  30002. * // => ['a', 'b']
  30003. */
  30004. function functions(object) {
  30005. return object == null ? [] : baseFunctions(object, keys(object));
  30006. }
  30007. /**
  30008. * Creates an array of function property names from own and inherited
  30009. * enumerable properties of `object`.
  30010. *
  30011. * @static
  30012. * @memberOf _
  30013. * @since 4.0.0
  30014. * @category Object
  30015. * @param {Object} object The object to inspect.
  30016. * @returns {Array} Returns the function names.
  30017. * @see _.functions
  30018. * @example
  30019. *
  30020. * function Foo() {
  30021. * this.a = _.constant('a');
  30022. * this.b = _.constant('b');
  30023. * }
  30024. *
  30025. * Foo.prototype.c = _.constant('c');
  30026. *
  30027. * _.functionsIn(new Foo);
  30028. * // => ['a', 'b', 'c']
  30029. */
  30030. function functionsIn(object) {
  30031. return object == null ? [] : baseFunctions(object, keysIn(object));
  30032. }
  30033. /**
  30034. * Gets the value at `path` of `object`. If the resolved value is
  30035. * `undefined`, the `defaultValue` is returned in its place.
  30036. *
  30037. * @static
  30038. * @memberOf _
  30039. * @since 3.7.0
  30040. * @category Object
  30041. * @param {Object} object The object to query.
  30042. * @param {Array|string} path The path of the property to get.
  30043. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30044. * @returns {*} Returns the resolved value.
  30045. * @example
  30046. *
  30047. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30048. *
  30049. * _.get(object, 'a[0].b.c');
  30050. * // => 3
  30051. *
  30052. * _.get(object, ['a', '0', 'b', 'c']);
  30053. * // => 3
  30054. *
  30055. * _.get(object, 'a.b.c', 'default');
  30056. * // => 'default'
  30057. */
  30058. function get(object, path, defaultValue) {
  30059. var result = object == null ? undefined : baseGet(object, path);
  30060. return result === undefined ? defaultValue : result;
  30061. }
  30062. /**
  30063. * Checks if `path` is a direct property of `object`.
  30064. *
  30065. * @static
  30066. * @since 0.1.0
  30067. * @memberOf _
  30068. * @category Object
  30069. * @param {Object} object The object to query.
  30070. * @param {Array|string} path The path to check.
  30071. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30072. * @example
  30073. *
  30074. * var object = { 'a': { 'b': 2 } };
  30075. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30076. *
  30077. * _.has(object, 'a');
  30078. * // => true
  30079. *
  30080. * _.has(object, 'a.b');
  30081. * // => true
  30082. *
  30083. * _.has(object, ['a', 'b']);
  30084. * // => true
  30085. *
  30086. * _.has(other, 'a');
  30087. * // => false
  30088. */
  30089. function has(object, path) {
  30090. return object != null && hasPath(object, path, baseHas);
  30091. }
  30092. /**
  30093. * Checks if `path` is a direct or inherited property of `object`.
  30094. *
  30095. * @static
  30096. * @memberOf _
  30097. * @since 4.0.0
  30098. * @category Object
  30099. * @param {Object} object The object to query.
  30100. * @param {Array|string} path The path to check.
  30101. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30102. * @example
  30103. *
  30104. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30105. *
  30106. * _.hasIn(object, 'a');
  30107. * // => true
  30108. *
  30109. * _.hasIn(object, 'a.b');
  30110. * // => true
  30111. *
  30112. * _.hasIn(object, ['a', 'b']);
  30113. * // => true
  30114. *
  30115. * _.hasIn(object, 'b');
  30116. * // => false
  30117. */
  30118. function hasIn(object, path) {
  30119. return object != null && hasPath(object, path, baseHasIn);
  30120. }
  30121. /**
  30122. * Creates an object composed of the inverted keys and values of `object`.
  30123. * If `object` contains duplicate values, subsequent values overwrite
  30124. * property assignments of previous values.
  30125. *
  30126. * @static
  30127. * @memberOf _
  30128. * @since 0.7.0
  30129. * @category Object
  30130. * @param {Object} object The object to invert.
  30131. * @returns {Object} Returns the new inverted object.
  30132. * @example
  30133. *
  30134. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30135. *
  30136. * _.invert(object);
  30137. * // => { '1': 'c', '2': 'b' }
  30138. */
  30139. var invert = createInverter(function(result, value, key) {
  30140. if (value != null &&
  30141. typeof value.toString != 'function') {
  30142. value = nativeObjectToString.call(value);
  30143. }
  30144. result[value] = key;
  30145. }, constant(identity));
  30146. /**
  30147. * This method is like `_.invert` except that the inverted object is generated
  30148. * from the results of running each element of `object` thru `iteratee`. The
  30149. * corresponding inverted value of each inverted key is an array of keys
  30150. * responsible for generating the inverted value. The iteratee is invoked
  30151. * with one argument: (value).
  30152. *
  30153. * @static
  30154. * @memberOf _
  30155. * @since 4.1.0
  30156. * @category Object
  30157. * @param {Object} object The object to invert.
  30158. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30159. * @returns {Object} Returns the new inverted object.
  30160. * @example
  30161. *
  30162. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30163. *
  30164. * _.invertBy(object);
  30165. * // => { '1': ['a', 'c'], '2': ['b'] }
  30166. *
  30167. * _.invertBy(object, function(value) {
  30168. * return 'group' + value;
  30169. * });
  30170. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30171. */
  30172. var invertBy = createInverter(function(result, value, key) {
  30173. if (value != null &&
  30174. typeof value.toString != 'function') {
  30175. value = nativeObjectToString.call(value);
  30176. }
  30177. if (hasOwnProperty.call(result, value)) {
  30178. result[value].push(key);
  30179. } else {
  30180. result[value] = [key];
  30181. }
  30182. }, getIteratee);
  30183. /**
  30184. * Invokes the method at `path` of `object`.
  30185. *
  30186. * @static
  30187. * @memberOf _
  30188. * @since 4.0.0
  30189. * @category Object
  30190. * @param {Object} object The object to query.
  30191. * @param {Array|string} path The path of the method to invoke.
  30192. * @param {...*} [args] The arguments to invoke the method with.
  30193. * @returns {*} Returns the result of the invoked method.
  30194. * @example
  30195. *
  30196. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30197. *
  30198. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30199. * // => [2, 3]
  30200. */
  30201. var invoke = baseRest(baseInvoke);
  30202. /**
  30203. * Creates an array of the own enumerable property names of `object`.
  30204. *
  30205. * **Note:** Non-object values are coerced to objects. See the
  30206. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30207. * for more details.
  30208. *
  30209. * @static
  30210. * @since 0.1.0
  30211. * @memberOf _
  30212. * @category Object
  30213. * @param {Object} object The object to query.
  30214. * @returns {Array} Returns the array of property names.
  30215. * @example
  30216. *
  30217. * function Foo() {
  30218. * this.a = 1;
  30219. * this.b = 2;
  30220. * }
  30221. *
  30222. * Foo.prototype.c = 3;
  30223. *
  30224. * _.keys(new Foo);
  30225. * // => ['a', 'b'] (iteration order is not guaranteed)
  30226. *
  30227. * _.keys('hi');
  30228. * // => ['0', '1']
  30229. */
  30230. function keys(object) {
  30231. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30232. }
  30233. /**
  30234. * Creates an array of the own and inherited enumerable property names of `object`.
  30235. *
  30236. * **Note:** Non-object values are coerced to objects.
  30237. *
  30238. * @static
  30239. * @memberOf _
  30240. * @since 3.0.0
  30241. * @category Object
  30242. * @param {Object} object The object to query.
  30243. * @returns {Array} Returns the array of property names.
  30244. * @example
  30245. *
  30246. * function Foo() {
  30247. * this.a = 1;
  30248. * this.b = 2;
  30249. * }
  30250. *
  30251. * Foo.prototype.c = 3;
  30252. *
  30253. * _.keysIn(new Foo);
  30254. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30255. */
  30256. function keysIn(object) {
  30257. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30258. }
  30259. /**
  30260. * The opposite of `_.mapValues`; this method creates an object with the
  30261. * same values as `object` and keys generated by running each own enumerable
  30262. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30263. * with three arguments: (value, key, object).
  30264. *
  30265. * @static
  30266. * @memberOf _
  30267. * @since 3.8.0
  30268. * @category Object
  30269. * @param {Object} object The object to iterate over.
  30270. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30271. * @returns {Object} Returns the new mapped object.
  30272. * @see _.mapValues
  30273. * @example
  30274. *
  30275. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30276. * return key + value;
  30277. * });
  30278. * // => { 'a1': 1, 'b2': 2 }
  30279. */
  30280. function mapKeys(object, iteratee) {
  30281. var result = {};
  30282. iteratee = getIteratee(iteratee, 3);
  30283. baseForOwn(object, function(value, key, object) {
  30284. baseAssignValue(result, iteratee(value, key, object), value);
  30285. });
  30286. return result;
  30287. }
  30288. /**
  30289. * Creates an object with the same keys as `object` and values generated
  30290. * by running each own enumerable string keyed property of `object` thru
  30291. * `iteratee`. The iteratee is invoked with three arguments:
  30292. * (value, key, object).
  30293. *
  30294. * @static
  30295. * @memberOf _
  30296. * @since 2.4.0
  30297. * @category Object
  30298. * @param {Object} object The object to iterate over.
  30299. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30300. * @returns {Object} Returns the new mapped object.
  30301. * @see _.mapKeys
  30302. * @example
  30303. *
  30304. * var users = {
  30305. * 'fred': { 'user': 'fred', 'age': 40 },
  30306. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30307. * };
  30308. *
  30309. * _.mapValues(users, function(o) { return o.age; });
  30310. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30311. *
  30312. * // The `_.property` iteratee shorthand.
  30313. * _.mapValues(users, 'age');
  30314. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30315. */
  30316. function mapValues(object, iteratee) {
  30317. var result = {};
  30318. iteratee = getIteratee(iteratee, 3);
  30319. baseForOwn(object, function(value, key, object) {
  30320. baseAssignValue(result, key, iteratee(value, key, object));
  30321. });
  30322. return result;
  30323. }
  30324. /**
  30325. * This method is like `_.assign` except that it recursively merges own and
  30326. * inherited enumerable string keyed properties of source objects into the
  30327. * destination object. Source properties that resolve to `undefined` are
  30328. * skipped if a destination value exists. Array and plain object properties
  30329. * are merged recursively. Other objects and value types are overridden by
  30330. * assignment. Source objects are applied from left to right. Subsequent
  30331. * sources overwrite property assignments of previous sources.
  30332. *
  30333. * **Note:** This method mutates `object`.
  30334. *
  30335. * @static
  30336. * @memberOf _
  30337. * @since 0.5.0
  30338. * @category Object
  30339. * @param {Object} object The destination object.
  30340. * @param {...Object} [sources] The source objects.
  30341. * @returns {Object} Returns `object`.
  30342. * @example
  30343. *
  30344. * var object = {
  30345. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30346. * };
  30347. *
  30348. * var other = {
  30349. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30350. * };
  30351. *
  30352. * _.merge(object, other);
  30353. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30354. */
  30355. var merge = createAssigner(function(object, source, srcIndex) {
  30356. baseMerge(object, source, srcIndex);
  30357. });
  30358. /**
  30359. * This method is like `_.merge` except that it accepts `customizer` which
  30360. * is invoked to produce the merged values of the destination and source
  30361. * properties. If `customizer` returns `undefined`, merging is handled by the
  30362. * method instead. The `customizer` is invoked with six arguments:
  30363. * (objValue, srcValue, key, object, source, stack).
  30364. *
  30365. * **Note:** This method mutates `object`.
  30366. *
  30367. * @static
  30368. * @memberOf _
  30369. * @since 4.0.0
  30370. * @category Object
  30371. * @param {Object} object The destination object.
  30372. * @param {...Object} sources The source objects.
  30373. * @param {Function} customizer The function to customize assigned values.
  30374. * @returns {Object} Returns `object`.
  30375. * @example
  30376. *
  30377. * function customizer(objValue, srcValue) {
  30378. * if (_.isArray(objValue)) {
  30379. * return objValue.concat(srcValue);
  30380. * }
  30381. * }
  30382. *
  30383. * var object = { 'a': [1], 'b': [2] };
  30384. * var other = { 'a': [3], 'b': [4] };
  30385. *
  30386. * _.mergeWith(object, other, customizer);
  30387. * // => { 'a': [1, 3], 'b': [2, 4] }
  30388. */
  30389. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30390. baseMerge(object, source, srcIndex, customizer);
  30391. });
  30392. /**
  30393. * The opposite of `_.pick`; this method creates an object composed of the
  30394. * own and inherited enumerable property paths of `object` that are not omitted.
  30395. *
  30396. * **Note:** This method is considerably slower than `_.pick`.
  30397. *
  30398. * @static
  30399. * @since 0.1.0
  30400. * @memberOf _
  30401. * @category Object
  30402. * @param {Object} object The source object.
  30403. * @param {...(string|string[])} [paths] The property paths to omit.
  30404. * @returns {Object} Returns the new object.
  30405. * @example
  30406. *
  30407. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30408. *
  30409. * _.omit(object, ['a', 'c']);
  30410. * // => { 'b': '2' }
  30411. */
  30412. var omit = flatRest(function(object, paths) {
  30413. var result = {};
  30414. if (object == null) {
  30415. return result;
  30416. }
  30417. var isDeep = false;
  30418. paths = arrayMap(paths, function(path) {
  30419. path = castPath(path, object);
  30420. isDeep || (isDeep = path.length > 1);
  30421. return path;
  30422. });
  30423. copyObject(object, getAllKeysIn(object), result);
  30424. if (isDeep) {
  30425. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30426. }
  30427. var length = paths.length;
  30428. while (length--) {
  30429. baseUnset(result, paths[length]);
  30430. }
  30431. return result;
  30432. });
  30433. /**
  30434. * The opposite of `_.pickBy`; this method creates an object composed of
  30435. * the own and inherited enumerable string keyed properties of `object` that
  30436. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30437. * arguments: (value, key).
  30438. *
  30439. * @static
  30440. * @memberOf _
  30441. * @since 4.0.0
  30442. * @category Object
  30443. * @param {Object} object The source object.
  30444. * @param {Function} [predicate=_.identity] The function invoked per property.
  30445. * @returns {Object} Returns the new object.
  30446. * @example
  30447. *
  30448. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30449. *
  30450. * _.omitBy(object, _.isNumber);
  30451. * // => { 'b': '2' }
  30452. */
  30453. function omitBy(object, predicate) {
  30454. return pickBy(object, negate(getIteratee(predicate)));
  30455. }
  30456. /**
  30457. * Creates an object composed of the picked `object` properties.
  30458. *
  30459. * @static
  30460. * @since 0.1.0
  30461. * @memberOf _
  30462. * @category Object
  30463. * @param {Object} object The source object.
  30464. * @param {...(string|string[])} [paths] The property paths to pick.
  30465. * @returns {Object} Returns the new object.
  30466. * @example
  30467. *
  30468. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30469. *
  30470. * _.pick(object, ['a', 'c']);
  30471. * // => { 'a': 1, 'c': 3 }
  30472. */
  30473. var pick = flatRest(function(object, paths) {
  30474. return object == null ? {} : basePick(object, paths);
  30475. });
  30476. /**
  30477. * Creates an object composed of the `object` properties `predicate` returns
  30478. * truthy for. The predicate is invoked with two arguments: (value, key).
  30479. *
  30480. * @static
  30481. * @memberOf _
  30482. * @since 4.0.0
  30483. * @category Object
  30484. * @param {Object} object The source object.
  30485. * @param {Function} [predicate=_.identity] The function invoked per property.
  30486. * @returns {Object} Returns the new object.
  30487. * @example
  30488. *
  30489. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30490. *
  30491. * _.pickBy(object, _.isNumber);
  30492. * // => { 'a': 1, 'c': 3 }
  30493. */
  30494. function pickBy(object, predicate) {
  30495. if (object == null) {
  30496. return {};
  30497. }
  30498. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30499. return [prop];
  30500. });
  30501. predicate = getIteratee(predicate);
  30502. return basePickBy(object, props, function(value, path) {
  30503. return predicate(value, path[0]);
  30504. });
  30505. }
  30506. /**
  30507. * This method is like `_.get` except that if the resolved value is a
  30508. * function it's invoked with the `this` binding of its parent object and
  30509. * its result is returned.
  30510. *
  30511. * @static
  30512. * @since 0.1.0
  30513. * @memberOf _
  30514. * @category Object
  30515. * @param {Object} object The object to query.
  30516. * @param {Array|string} path The path of the property to resolve.
  30517. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30518. * @returns {*} Returns the resolved value.
  30519. * @example
  30520. *
  30521. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30522. *
  30523. * _.result(object, 'a[0].b.c1');
  30524. * // => 3
  30525. *
  30526. * _.result(object, 'a[0].b.c2');
  30527. * // => 4
  30528. *
  30529. * _.result(object, 'a[0].b.c3', 'default');
  30530. * // => 'default'
  30531. *
  30532. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30533. * // => 'default'
  30534. */
  30535. function result(object, path, defaultValue) {
  30536. path = castPath(path, object);
  30537. var index = -1,
  30538. length = path.length;
  30539. // Ensure the loop is entered when path is empty.
  30540. if (!length) {
  30541. length = 1;
  30542. object = undefined;
  30543. }
  30544. while (++index < length) {
  30545. var value = object == null ? undefined : object[toKey(path[index])];
  30546. if (value === undefined) {
  30547. index = length;
  30548. value = defaultValue;
  30549. }
  30550. object = isFunction(value) ? value.call(object) : value;
  30551. }
  30552. return object;
  30553. }
  30554. /**
  30555. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30556. * it's created. Arrays are created for missing index properties while objects
  30557. * are created for all other missing properties. Use `_.setWith` to customize
  30558. * `path` creation.
  30559. *
  30560. * **Note:** This method mutates `object`.
  30561. *
  30562. * @static
  30563. * @memberOf _
  30564. * @since 3.7.0
  30565. * @category Object
  30566. * @param {Object} object The object to modify.
  30567. * @param {Array|string} path The path of the property to set.
  30568. * @param {*} value The value to set.
  30569. * @returns {Object} Returns `object`.
  30570. * @example
  30571. *
  30572. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30573. *
  30574. * _.set(object, 'a[0].b.c', 4);
  30575. * console.log(object.a[0].b.c);
  30576. * // => 4
  30577. *
  30578. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30579. * console.log(object.x[0].y.z);
  30580. * // => 5
  30581. */
  30582. function set(object, path, value) {
  30583. return object == null ? object : baseSet(object, path, value);
  30584. }
  30585. /**
  30586. * This method is like `_.set` except that it accepts `customizer` which is
  30587. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30588. * path creation is handled by the method instead. The `customizer` is invoked
  30589. * with three arguments: (nsValue, key, nsObject).
  30590. *
  30591. * **Note:** This method mutates `object`.
  30592. *
  30593. * @static
  30594. * @memberOf _
  30595. * @since 4.0.0
  30596. * @category Object
  30597. * @param {Object} object The object to modify.
  30598. * @param {Array|string} path The path of the property to set.
  30599. * @param {*} value The value to set.
  30600. * @param {Function} [customizer] The function to customize assigned values.
  30601. * @returns {Object} Returns `object`.
  30602. * @example
  30603. *
  30604. * var object = {};
  30605. *
  30606. * _.setWith(object, '[0][1]', 'a', Object);
  30607. * // => { '0': { '1': 'a' } }
  30608. */
  30609. function setWith(object, path, value, customizer) {
  30610. customizer = typeof customizer == 'function' ? customizer : undefined;
  30611. return object == null ? object : baseSet(object, path, value, customizer);
  30612. }
  30613. /**
  30614. * Creates an array of own enumerable string keyed-value pairs for `object`
  30615. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30616. * entries are returned.
  30617. *
  30618. * @static
  30619. * @memberOf _
  30620. * @since 4.0.0
  30621. * @alias entries
  30622. * @category Object
  30623. * @param {Object} object The object to query.
  30624. * @returns {Array} Returns the key-value pairs.
  30625. * @example
  30626. *
  30627. * function Foo() {
  30628. * this.a = 1;
  30629. * this.b = 2;
  30630. * }
  30631. *
  30632. * Foo.prototype.c = 3;
  30633. *
  30634. * _.toPairs(new Foo);
  30635. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30636. */
  30637. var toPairs = createToPairs(keys);
  30638. /**
  30639. * Creates an array of own and inherited enumerable string keyed-value pairs
  30640. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30641. * or set, its entries are returned.
  30642. *
  30643. * @static
  30644. * @memberOf _
  30645. * @since 4.0.0
  30646. * @alias entriesIn
  30647. * @category Object
  30648. * @param {Object} object The object to query.
  30649. * @returns {Array} Returns the key-value pairs.
  30650. * @example
  30651. *
  30652. * function Foo() {
  30653. * this.a = 1;
  30654. * this.b = 2;
  30655. * }
  30656. *
  30657. * Foo.prototype.c = 3;
  30658. *
  30659. * _.toPairsIn(new Foo);
  30660. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30661. */
  30662. var toPairsIn = createToPairs(keysIn);
  30663. /**
  30664. * An alternative to `_.reduce`; this method transforms `object` to a new
  30665. * `accumulator` object which is the result of running each of its own
  30666. * enumerable string keyed properties thru `iteratee`, with each invocation
  30667. * potentially mutating the `accumulator` object. If `accumulator` is not
  30668. * provided, a new object with the same `[[Prototype]]` will be used. The
  30669. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30670. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30671. *
  30672. * @static
  30673. * @memberOf _
  30674. * @since 1.3.0
  30675. * @category Object
  30676. * @param {Object} object The object to iterate over.
  30677. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30678. * @param {*} [accumulator] The custom accumulator value.
  30679. * @returns {*} Returns the accumulated value.
  30680. * @example
  30681. *
  30682. * _.transform([2, 3, 4], function(result, n) {
  30683. * result.push(n *= n);
  30684. * return n % 2 == 0;
  30685. * }, []);
  30686. * // => [4, 9]
  30687. *
  30688. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30689. * (result[value] || (result[value] = [])).push(key);
  30690. * }, {});
  30691. * // => { '1': ['a', 'c'], '2': ['b'] }
  30692. */
  30693. function transform(object, iteratee, accumulator) {
  30694. var isArr = isArray(object),
  30695. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30696. iteratee = getIteratee(iteratee, 4);
  30697. if (accumulator == null) {
  30698. var Ctor = object && object.constructor;
  30699. if (isArrLike) {
  30700. accumulator = isArr ? new Ctor : [];
  30701. }
  30702. else if (isObject(object)) {
  30703. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30704. }
  30705. else {
  30706. accumulator = {};
  30707. }
  30708. }
  30709. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30710. return iteratee(accumulator, value, index, object);
  30711. });
  30712. return accumulator;
  30713. }
  30714. /**
  30715. * Removes the property at `path` of `object`.
  30716. *
  30717. * **Note:** This method mutates `object`.
  30718. *
  30719. * @static
  30720. * @memberOf _
  30721. * @since 4.0.0
  30722. * @category Object
  30723. * @param {Object} object The object to modify.
  30724. * @param {Array|string} path The path of the property to unset.
  30725. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30726. * @example
  30727. *
  30728. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30729. * _.unset(object, 'a[0].b.c');
  30730. * // => true
  30731. *
  30732. * console.log(object);
  30733. * // => { 'a': [{ 'b': {} }] };
  30734. *
  30735. * _.unset(object, ['a', '0', 'b', 'c']);
  30736. * // => true
  30737. *
  30738. * console.log(object);
  30739. * // => { 'a': [{ 'b': {} }] };
  30740. */
  30741. function unset(object, path) {
  30742. return object == null ? true : baseUnset(object, path);
  30743. }
  30744. /**
  30745. * This method is like `_.set` except that accepts `updater` to produce the
  30746. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30747. * is invoked with one argument: (value).
  30748. *
  30749. * **Note:** This method mutates `object`.
  30750. *
  30751. * @static
  30752. * @memberOf _
  30753. * @since 4.6.0
  30754. * @category Object
  30755. * @param {Object} object The object to modify.
  30756. * @param {Array|string} path The path of the property to set.
  30757. * @param {Function} updater The function to produce the updated value.
  30758. * @returns {Object} Returns `object`.
  30759. * @example
  30760. *
  30761. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30762. *
  30763. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30764. * console.log(object.a[0].b.c);
  30765. * // => 9
  30766. *
  30767. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30768. * console.log(object.x[0].y.z);
  30769. * // => 0
  30770. */
  30771. function update(object, path, updater) {
  30772. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30773. }
  30774. /**
  30775. * This method is like `_.update` except that it accepts `customizer` which is
  30776. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30777. * path creation is handled by the method instead. The `customizer` is invoked
  30778. * with three arguments: (nsValue, key, nsObject).
  30779. *
  30780. * **Note:** This method mutates `object`.
  30781. *
  30782. * @static
  30783. * @memberOf _
  30784. * @since 4.6.0
  30785. * @category Object
  30786. * @param {Object} object The object to modify.
  30787. * @param {Array|string} path The path of the property to set.
  30788. * @param {Function} updater The function to produce the updated value.
  30789. * @param {Function} [customizer] The function to customize assigned values.
  30790. * @returns {Object} Returns `object`.
  30791. * @example
  30792. *
  30793. * var object = {};
  30794. *
  30795. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30796. * // => { '0': { '1': 'a' } }
  30797. */
  30798. function updateWith(object, path, updater, customizer) {
  30799. customizer = typeof customizer == 'function' ? customizer : undefined;
  30800. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30801. }
  30802. /**
  30803. * Creates an array of the own enumerable string keyed property values of `object`.
  30804. *
  30805. * **Note:** Non-object values are coerced to objects.
  30806. *
  30807. * @static
  30808. * @since 0.1.0
  30809. * @memberOf _
  30810. * @category Object
  30811. * @param {Object} object The object to query.
  30812. * @returns {Array} Returns the array of property values.
  30813. * @example
  30814. *
  30815. * function Foo() {
  30816. * this.a = 1;
  30817. * this.b = 2;
  30818. * }
  30819. *
  30820. * Foo.prototype.c = 3;
  30821. *
  30822. * _.values(new Foo);
  30823. * // => [1, 2] (iteration order is not guaranteed)
  30824. *
  30825. * _.values('hi');
  30826. * // => ['h', 'i']
  30827. */
  30828. function values(object) {
  30829. return object == null ? [] : baseValues(object, keys(object));
  30830. }
  30831. /**
  30832. * Creates an array of the own and inherited enumerable string keyed property
  30833. * values of `object`.
  30834. *
  30835. * **Note:** Non-object values are coerced to objects.
  30836. *
  30837. * @static
  30838. * @memberOf _
  30839. * @since 3.0.0
  30840. * @category Object
  30841. * @param {Object} object The object to query.
  30842. * @returns {Array} Returns the array of property values.
  30843. * @example
  30844. *
  30845. * function Foo() {
  30846. * this.a = 1;
  30847. * this.b = 2;
  30848. * }
  30849. *
  30850. * Foo.prototype.c = 3;
  30851. *
  30852. * _.valuesIn(new Foo);
  30853. * // => [1, 2, 3] (iteration order is not guaranteed)
  30854. */
  30855. function valuesIn(object) {
  30856. return object == null ? [] : baseValues(object, keysIn(object));
  30857. }
  30858. /*------------------------------------------------------------------------*/
  30859. /**
  30860. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30861. *
  30862. * @static
  30863. * @memberOf _
  30864. * @since 4.0.0
  30865. * @category Number
  30866. * @param {number} number The number to clamp.
  30867. * @param {number} [lower] The lower bound.
  30868. * @param {number} upper The upper bound.
  30869. * @returns {number} Returns the clamped number.
  30870. * @example
  30871. *
  30872. * _.clamp(-10, -5, 5);
  30873. * // => -5
  30874. *
  30875. * _.clamp(10, -5, 5);
  30876. * // => 5
  30877. */
  30878. function clamp(number, lower, upper) {
  30879. if (upper === undefined) {
  30880. upper = lower;
  30881. lower = undefined;
  30882. }
  30883. if (upper !== undefined) {
  30884. upper = toNumber(upper);
  30885. upper = upper === upper ? upper : 0;
  30886. }
  30887. if (lower !== undefined) {
  30888. lower = toNumber(lower);
  30889. lower = lower === lower ? lower : 0;
  30890. }
  30891. return baseClamp(toNumber(number), lower, upper);
  30892. }
  30893. /**
  30894. * Checks if `n` is between `start` and up to, but not including, `end`. If
  30895. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  30896. * If `start` is greater than `end` the params are swapped to support
  30897. * negative ranges.
  30898. *
  30899. * @static
  30900. * @memberOf _
  30901. * @since 3.3.0
  30902. * @category Number
  30903. * @param {number} number The number to check.
  30904. * @param {number} [start=0] The start of the range.
  30905. * @param {number} end The end of the range.
  30906. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  30907. * @see _.range, _.rangeRight
  30908. * @example
  30909. *
  30910. * _.inRange(3, 2, 4);
  30911. * // => true
  30912. *
  30913. * _.inRange(4, 8);
  30914. * // => true
  30915. *
  30916. * _.inRange(4, 2);
  30917. * // => false
  30918. *
  30919. * _.inRange(2, 2);
  30920. * // => false
  30921. *
  30922. * _.inRange(1.2, 2);
  30923. * // => true
  30924. *
  30925. * _.inRange(5.2, 4);
  30926. * // => false
  30927. *
  30928. * _.inRange(-3, -2, -6);
  30929. * // => true
  30930. */
  30931. function inRange(number, start, end) {
  30932. start = toFinite(start);
  30933. if (end === undefined) {
  30934. end = start;
  30935. start = 0;
  30936. } else {
  30937. end = toFinite(end);
  30938. }
  30939. number = toNumber(number);
  30940. return baseInRange(number, start, end);
  30941. }
  30942. /**
  30943. * Produces a random number between the inclusive `lower` and `upper` bounds.
  30944. * If only one argument is provided a number between `0` and the given number
  30945. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  30946. * floats, a floating-point number is returned instead of an integer.
  30947. *
  30948. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  30949. * floating-point values which can produce unexpected results.
  30950. *
  30951. * @static
  30952. * @memberOf _
  30953. * @since 0.7.0
  30954. * @category Number
  30955. * @param {number} [lower=0] The lower bound.
  30956. * @param {number} [upper=1] The upper bound.
  30957. * @param {boolean} [floating] Specify returning a floating-point number.
  30958. * @returns {number} Returns the random number.
  30959. * @example
  30960. *
  30961. * _.random(0, 5);
  30962. * // => an integer between 0 and 5
  30963. *
  30964. * _.random(5);
  30965. * // => also an integer between 0 and 5
  30966. *
  30967. * _.random(5, true);
  30968. * // => a floating-point number between 0 and 5
  30969. *
  30970. * _.random(1.2, 5.2);
  30971. * // => a floating-point number between 1.2 and 5.2
  30972. */
  30973. function random(lower, upper, floating) {
  30974. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  30975. upper = floating = undefined;
  30976. }
  30977. if (floating === undefined) {
  30978. if (typeof upper == 'boolean') {
  30979. floating = upper;
  30980. upper = undefined;
  30981. }
  30982. else if (typeof lower == 'boolean') {
  30983. floating = lower;
  30984. lower = undefined;
  30985. }
  30986. }
  30987. if (lower === undefined && upper === undefined) {
  30988. lower = 0;
  30989. upper = 1;
  30990. }
  30991. else {
  30992. lower = toFinite(lower);
  30993. if (upper === undefined) {
  30994. upper = lower;
  30995. lower = 0;
  30996. } else {
  30997. upper = toFinite(upper);
  30998. }
  30999. }
  31000. if (lower > upper) {
  31001. var temp = lower;
  31002. lower = upper;
  31003. upper = temp;
  31004. }
  31005. if (floating || lower % 1 || upper % 1) {
  31006. var rand = nativeRandom();
  31007. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31008. }
  31009. return baseRandom(lower, upper);
  31010. }
  31011. /*------------------------------------------------------------------------*/
  31012. /**
  31013. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31014. *
  31015. * @static
  31016. * @memberOf _
  31017. * @since 3.0.0
  31018. * @category String
  31019. * @param {string} [string=''] The string to convert.
  31020. * @returns {string} Returns the camel cased string.
  31021. * @example
  31022. *
  31023. * _.camelCase('Foo Bar');
  31024. * // => 'fooBar'
  31025. *
  31026. * _.camelCase('--foo-bar--');
  31027. * // => 'fooBar'
  31028. *
  31029. * _.camelCase('__FOO_BAR__');
  31030. * // => 'fooBar'
  31031. */
  31032. var camelCase = createCompounder(function(result, word, index) {
  31033. word = word.toLowerCase();
  31034. return result + (index ? capitalize(word) : word);
  31035. });
  31036. /**
  31037. * Converts the first character of `string` to upper case and the remaining
  31038. * to lower case.
  31039. *
  31040. * @static
  31041. * @memberOf _
  31042. * @since 3.0.0
  31043. * @category String
  31044. * @param {string} [string=''] The string to capitalize.
  31045. * @returns {string} Returns the capitalized string.
  31046. * @example
  31047. *
  31048. * _.capitalize('FRED');
  31049. * // => 'Fred'
  31050. */
  31051. function capitalize(string) {
  31052. return upperFirst(toString(string).toLowerCase());
  31053. }
  31054. /**
  31055. * Deburrs `string` by converting
  31056. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31057. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31058. * letters to basic Latin letters and removing
  31059. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31060. *
  31061. * @static
  31062. * @memberOf _
  31063. * @since 3.0.0
  31064. * @category String
  31065. * @param {string} [string=''] The string to deburr.
  31066. * @returns {string} Returns the deburred string.
  31067. * @example
  31068. *
  31069. * _.deburr('déjà vu');
  31070. * // => 'deja vu'
  31071. */
  31072. function deburr(string) {
  31073. string = toString(string);
  31074. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31075. }
  31076. /**
  31077. * Checks if `string` ends with the given target string.
  31078. *
  31079. * @static
  31080. * @memberOf _
  31081. * @since 3.0.0
  31082. * @category String
  31083. * @param {string} [string=''] The string to inspect.
  31084. * @param {string} [target] The string to search for.
  31085. * @param {number} [position=string.length] The position to search up to.
  31086. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31087. * else `false`.
  31088. * @example
  31089. *
  31090. * _.endsWith('abc', 'c');
  31091. * // => true
  31092. *
  31093. * _.endsWith('abc', 'b');
  31094. * // => false
  31095. *
  31096. * _.endsWith('abc', 'b', 2);
  31097. * // => true
  31098. */
  31099. function endsWith(string, target, position) {
  31100. string = toString(string);
  31101. target = baseToString(target);
  31102. var length = string.length;
  31103. position = position === undefined
  31104. ? length
  31105. : baseClamp(toInteger(position), 0, length);
  31106. var end = position;
  31107. position -= target.length;
  31108. return position >= 0 && string.slice(position, end) == target;
  31109. }
  31110. /**
  31111. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31112. * corresponding HTML entities.
  31113. *
  31114. * **Note:** No other characters are escaped. To escape additional
  31115. * characters use a third-party library like [_he_](https://mths.be/he).
  31116. *
  31117. * Though the ">" character is escaped for symmetry, characters like
  31118. * ">" and "/" don't need escaping in HTML and have no special meaning
  31119. * unless they're part of a tag or unquoted attribute value. See
  31120. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31121. * (under "semi-related fun fact") for more details.
  31122. *
  31123. * When working with HTML you should always
  31124. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31125. * XSS vectors.
  31126. *
  31127. * @static
  31128. * @since 0.1.0
  31129. * @memberOf _
  31130. * @category String
  31131. * @param {string} [string=''] The string to escape.
  31132. * @returns {string} Returns the escaped string.
  31133. * @example
  31134. *
  31135. * _.escape('fred, barney, & pebbles');
  31136. * // => 'fred, barney, &amp; pebbles'
  31137. */
  31138. function escape(string) {
  31139. string = toString(string);
  31140. return (string && reHasUnescapedHtml.test(string))
  31141. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31142. : string;
  31143. }
  31144. /**
  31145. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31146. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31147. *
  31148. * @static
  31149. * @memberOf _
  31150. * @since 3.0.0
  31151. * @category String
  31152. * @param {string} [string=''] The string to escape.
  31153. * @returns {string} Returns the escaped string.
  31154. * @example
  31155. *
  31156. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31157. * // => '\[lodash\]\(https://lodash\.com/\)'
  31158. */
  31159. function escapeRegExp(string) {
  31160. string = toString(string);
  31161. return (string && reHasRegExpChar.test(string))
  31162. ? string.replace(reRegExpChar, '\\$&')
  31163. : string;
  31164. }
  31165. /**
  31166. * Converts `string` to
  31167. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31168. *
  31169. * @static
  31170. * @memberOf _
  31171. * @since 3.0.0
  31172. * @category String
  31173. * @param {string} [string=''] The string to convert.
  31174. * @returns {string} Returns the kebab cased string.
  31175. * @example
  31176. *
  31177. * _.kebabCase('Foo Bar');
  31178. * // => 'foo-bar'
  31179. *
  31180. * _.kebabCase('fooBar');
  31181. * // => 'foo-bar'
  31182. *
  31183. * _.kebabCase('__FOO_BAR__');
  31184. * // => 'foo-bar'
  31185. */
  31186. var kebabCase = createCompounder(function(result, word, index) {
  31187. return result + (index ? '-' : '') + word.toLowerCase();
  31188. });
  31189. /**
  31190. * Converts `string`, as space separated words, to lower case.
  31191. *
  31192. * @static
  31193. * @memberOf _
  31194. * @since 4.0.0
  31195. * @category String
  31196. * @param {string} [string=''] The string to convert.
  31197. * @returns {string} Returns the lower cased string.
  31198. * @example
  31199. *
  31200. * _.lowerCase('--Foo-Bar--');
  31201. * // => 'foo bar'
  31202. *
  31203. * _.lowerCase('fooBar');
  31204. * // => 'foo bar'
  31205. *
  31206. * _.lowerCase('__FOO_BAR__');
  31207. * // => 'foo bar'
  31208. */
  31209. var lowerCase = createCompounder(function(result, word, index) {
  31210. return result + (index ? ' ' : '') + word.toLowerCase();
  31211. });
  31212. /**
  31213. * Converts the first character of `string` to lower case.
  31214. *
  31215. * @static
  31216. * @memberOf _
  31217. * @since 4.0.0
  31218. * @category String
  31219. * @param {string} [string=''] The string to convert.
  31220. * @returns {string} Returns the converted string.
  31221. * @example
  31222. *
  31223. * _.lowerFirst('Fred');
  31224. * // => 'fred'
  31225. *
  31226. * _.lowerFirst('FRED');
  31227. * // => 'fRED'
  31228. */
  31229. var lowerFirst = createCaseFirst('toLowerCase');
  31230. /**
  31231. * Pads `string` on the left and right sides if it's shorter than `length`.
  31232. * Padding characters are truncated if they can't be evenly divided by `length`.
  31233. *
  31234. * @static
  31235. * @memberOf _
  31236. * @since 3.0.0
  31237. * @category String
  31238. * @param {string} [string=''] The string to pad.
  31239. * @param {number} [length=0] The padding length.
  31240. * @param {string} [chars=' '] The string used as padding.
  31241. * @returns {string} Returns the padded string.
  31242. * @example
  31243. *
  31244. * _.pad('abc', 8);
  31245. * // => ' abc '
  31246. *
  31247. * _.pad('abc', 8, '_-');
  31248. * // => '_-abc_-_'
  31249. *
  31250. * _.pad('abc', 3);
  31251. * // => 'abc'
  31252. */
  31253. function pad(string, length, chars) {
  31254. string = toString(string);
  31255. length = toInteger(length);
  31256. var strLength = length ? stringSize(string) : 0;
  31257. if (!length || strLength >= length) {
  31258. return string;
  31259. }
  31260. var mid = (length - strLength) / 2;
  31261. return (
  31262. createPadding(nativeFloor(mid), chars) +
  31263. string +
  31264. createPadding(nativeCeil(mid), chars)
  31265. );
  31266. }
  31267. /**
  31268. * Pads `string` on the right side if it's shorter than `length`. Padding
  31269. * characters are truncated if they exceed `length`.
  31270. *
  31271. * @static
  31272. * @memberOf _
  31273. * @since 4.0.0
  31274. * @category String
  31275. * @param {string} [string=''] The string to pad.
  31276. * @param {number} [length=0] The padding length.
  31277. * @param {string} [chars=' '] The string used as padding.
  31278. * @returns {string} Returns the padded string.
  31279. * @example
  31280. *
  31281. * _.padEnd('abc', 6);
  31282. * // => 'abc '
  31283. *
  31284. * _.padEnd('abc', 6, '_-');
  31285. * // => 'abc_-_'
  31286. *
  31287. * _.padEnd('abc', 3);
  31288. * // => 'abc'
  31289. */
  31290. function padEnd(string, length, chars) {
  31291. string = toString(string);
  31292. length = toInteger(length);
  31293. var strLength = length ? stringSize(string) : 0;
  31294. return (length && strLength < length)
  31295. ? (string + createPadding(length - strLength, chars))
  31296. : string;
  31297. }
  31298. /**
  31299. * Pads `string` on the left side if it's shorter than `length`. Padding
  31300. * characters are truncated if they exceed `length`.
  31301. *
  31302. * @static
  31303. * @memberOf _
  31304. * @since 4.0.0
  31305. * @category String
  31306. * @param {string} [string=''] The string to pad.
  31307. * @param {number} [length=0] The padding length.
  31308. * @param {string} [chars=' '] The string used as padding.
  31309. * @returns {string} Returns the padded string.
  31310. * @example
  31311. *
  31312. * _.padStart('abc', 6);
  31313. * // => ' abc'
  31314. *
  31315. * _.padStart('abc', 6, '_-');
  31316. * // => '_-_abc'
  31317. *
  31318. * _.padStart('abc', 3);
  31319. * // => 'abc'
  31320. */
  31321. function padStart(string, length, chars) {
  31322. string = toString(string);
  31323. length = toInteger(length);
  31324. var strLength = length ? stringSize(string) : 0;
  31325. return (length && strLength < length)
  31326. ? (createPadding(length - strLength, chars) + string)
  31327. : string;
  31328. }
  31329. /**
  31330. * Converts `string` to an integer of the specified radix. If `radix` is
  31331. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31332. * hexadecimal, in which case a `radix` of `16` is used.
  31333. *
  31334. * **Note:** This method aligns with the
  31335. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31336. *
  31337. * @static
  31338. * @memberOf _
  31339. * @since 1.1.0
  31340. * @category String
  31341. * @param {string} string The string to convert.
  31342. * @param {number} [radix=10] The radix to interpret `value` by.
  31343. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31344. * @returns {number} Returns the converted integer.
  31345. * @example
  31346. *
  31347. * _.parseInt('08');
  31348. * // => 8
  31349. *
  31350. * _.map(['6', '08', '10'], _.parseInt);
  31351. * // => [6, 8, 10]
  31352. */
  31353. function parseInt(string, radix, guard) {
  31354. if (guard || radix == null) {
  31355. radix = 0;
  31356. } else if (radix) {
  31357. radix = +radix;
  31358. }
  31359. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31360. }
  31361. /**
  31362. * Repeats the given string `n` times.
  31363. *
  31364. * @static
  31365. * @memberOf _
  31366. * @since 3.0.0
  31367. * @category String
  31368. * @param {string} [string=''] The string to repeat.
  31369. * @param {number} [n=1] The number of times to repeat the string.
  31370. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31371. * @returns {string} Returns the repeated string.
  31372. * @example
  31373. *
  31374. * _.repeat('*', 3);
  31375. * // => '***'
  31376. *
  31377. * _.repeat('abc', 2);
  31378. * // => 'abcabc'
  31379. *
  31380. * _.repeat('abc', 0);
  31381. * // => ''
  31382. */
  31383. function repeat(string, n, guard) {
  31384. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31385. n = 1;
  31386. } else {
  31387. n = toInteger(n);
  31388. }
  31389. return baseRepeat(toString(string), n);
  31390. }
  31391. /**
  31392. * Replaces matches for `pattern` in `string` with `replacement`.
  31393. *
  31394. * **Note:** This method is based on
  31395. * [`String#replace`](https://mdn.io/String/replace).
  31396. *
  31397. * @static
  31398. * @memberOf _
  31399. * @since 4.0.0
  31400. * @category String
  31401. * @param {string} [string=''] The string to modify.
  31402. * @param {RegExp|string} pattern The pattern to replace.
  31403. * @param {Function|string} replacement The match replacement.
  31404. * @returns {string} Returns the modified string.
  31405. * @example
  31406. *
  31407. * _.replace('Hi Fred', 'Fred', 'Barney');
  31408. * // => 'Hi Barney'
  31409. */
  31410. function replace() {
  31411. var args = arguments,
  31412. string = toString(args[0]);
  31413. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31414. }
  31415. /**
  31416. * Converts `string` to
  31417. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31418. *
  31419. * @static
  31420. * @memberOf _
  31421. * @since 3.0.0
  31422. * @category String
  31423. * @param {string} [string=''] The string to convert.
  31424. * @returns {string} Returns the snake cased string.
  31425. * @example
  31426. *
  31427. * _.snakeCase('Foo Bar');
  31428. * // => 'foo_bar'
  31429. *
  31430. * _.snakeCase('fooBar');
  31431. * // => 'foo_bar'
  31432. *
  31433. * _.snakeCase('--FOO-BAR--');
  31434. * // => 'foo_bar'
  31435. */
  31436. var snakeCase = createCompounder(function(result, word, index) {
  31437. return result + (index ? '_' : '') + word.toLowerCase();
  31438. });
  31439. /**
  31440. * Splits `string` by `separator`.
  31441. *
  31442. * **Note:** This method is based on
  31443. * [`String#split`](https://mdn.io/String/split).
  31444. *
  31445. * @static
  31446. * @memberOf _
  31447. * @since 4.0.0
  31448. * @category String
  31449. * @param {string} [string=''] The string to split.
  31450. * @param {RegExp|string} separator The separator pattern to split by.
  31451. * @param {number} [limit] The length to truncate results to.
  31452. * @returns {Array} Returns the string segments.
  31453. * @example
  31454. *
  31455. * _.split('a-b-c', '-', 2);
  31456. * // => ['a', 'b']
  31457. */
  31458. function split(string, separator, limit) {
  31459. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31460. separator = limit = undefined;
  31461. }
  31462. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31463. if (!limit) {
  31464. return [];
  31465. }
  31466. string = toString(string);
  31467. if (string && (
  31468. typeof separator == 'string' ||
  31469. (separator != null && !isRegExp(separator))
  31470. )) {
  31471. separator = baseToString(separator);
  31472. if (!separator && hasUnicode(string)) {
  31473. return castSlice(stringToArray(string), 0, limit);
  31474. }
  31475. }
  31476. return string.split(separator, limit);
  31477. }
  31478. /**
  31479. * Converts `string` to
  31480. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31481. *
  31482. * @static
  31483. * @memberOf _
  31484. * @since 3.1.0
  31485. * @category String
  31486. * @param {string} [string=''] The string to convert.
  31487. * @returns {string} Returns the start cased string.
  31488. * @example
  31489. *
  31490. * _.startCase('--foo-bar--');
  31491. * // => 'Foo Bar'
  31492. *
  31493. * _.startCase('fooBar');
  31494. * // => 'Foo Bar'
  31495. *
  31496. * _.startCase('__FOO_BAR__');
  31497. * // => 'FOO BAR'
  31498. */
  31499. var startCase = createCompounder(function(result, word, index) {
  31500. return result + (index ? ' ' : '') + upperFirst(word);
  31501. });
  31502. /**
  31503. * Checks if `string` starts with the given target string.
  31504. *
  31505. * @static
  31506. * @memberOf _
  31507. * @since 3.0.0
  31508. * @category String
  31509. * @param {string} [string=''] The string to inspect.
  31510. * @param {string} [target] The string to search for.
  31511. * @param {number} [position=0] The position to search from.
  31512. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31513. * else `false`.
  31514. * @example
  31515. *
  31516. * _.startsWith('abc', 'a');
  31517. * // => true
  31518. *
  31519. * _.startsWith('abc', 'b');
  31520. * // => false
  31521. *
  31522. * _.startsWith('abc', 'b', 1);
  31523. * // => true
  31524. */
  31525. function startsWith(string, target, position) {
  31526. string = toString(string);
  31527. position = position == null
  31528. ? 0
  31529. : baseClamp(toInteger(position), 0, string.length);
  31530. target = baseToString(target);
  31531. return string.slice(position, position + target.length) == target;
  31532. }
  31533. /**
  31534. * Creates a compiled template function that can interpolate data properties
  31535. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31536. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31537. * properties may be accessed as free variables in the template. If a setting
  31538. * object is given, it takes precedence over `_.templateSettings` values.
  31539. *
  31540. * **Note:** In the development build `_.template` utilizes
  31541. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31542. * for easier debugging.
  31543. *
  31544. * For more information on precompiling templates see
  31545. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31546. *
  31547. * For more information on Chrome extension sandboxes see
  31548. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31549. *
  31550. * @static
  31551. * @since 0.1.0
  31552. * @memberOf _
  31553. * @category String
  31554. * @param {string} [string=''] The template string.
  31555. * @param {Object} [options={}] The options object.
  31556. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31557. * The HTML "escape" delimiter.
  31558. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31559. * The "evaluate" delimiter.
  31560. * @param {Object} [options.imports=_.templateSettings.imports]
  31561. * An object to import into the template as free variables.
  31562. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31563. * The "interpolate" delimiter.
  31564. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31565. * The sourceURL of the compiled template.
  31566. * @param {string} [options.variable='obj']
  31567. * The data object variable name.
  31568. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31569. * @returns {Function} Returns the compiled template function.
  31570. * @example
  31571. *
  31572. * // Use the "interpolate" delimiter to create a compiled template.
  31573. * var compiled = _.template('hello <%= user %>!');
  31574. * compiled({ 'user': 'fred' });
  31575. * // => 'hello fred!'
  31576. *
  31577. * // Use the HTML "escape" delimiter to escape data property values.
  31578. * var compiled = _.template('<b><%- value %></b>');
  31579. * compiled({ 'value': '<script>' });
  31580. * // => '<b>&lt;script&gt;</b>'
  31581. *
  31582. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31583. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31584. * compiled({ 'users': ['fred', 'barney'] });
  31585. * // => '<li>fred</li><li>barney</li>'
  31586. *
  31587. * // Use the internal `print` function in "evaluate" delimiters.
  31588. * var compiled = _.template('<% print("hello " + user); %>!');
  31589. * compiled({ 'user': 'barney' });
  31590. * // => 'hello barney!'
  31591. *
  31592. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31593. * // Disable support by replacing the "interpolate" delimiter.
  31594. * var compiled = _.template('hello ${ user }!');
  31595. * compiled({ 'user': 'pebbles' });
  31596. * // => 'hello pebbles!'
  31597. *
  31598. * // Use backslashes to treat delimiters as plain text.
  31599. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31600. * compiled({ 'value': 'ignored' });
  31601. * // => '<%- value %>'
  31602. *
  31603. * // Use the `imports` option to import `jQuery` as `jq`.
  31604. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31605. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31606. * compiled({ 'users': ['fred', 'barney'] });
  31607. * // => '<li>fred</li><li>barney</li>'
  31608. *
  31609. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31610. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31611. * compiled(data);
  31612. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31613. *
  31614. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31615. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31616. * compiled.source;
  31617. * // => function(data) {
  31618. * // var __t, __p = '';
  31619. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31620. * // return __p;
  31621. * // }
  31622. *
  31623. * // Use custom template delimiters.
  31624. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31625. * var compiled = _.template('hello {{ user }}!');
  31626. * compiled({ 'user': 'mustache' });
  31627. * // => 'hello mustache!'
  31628. *
  31629. * // Use the `source` property to inline compiled templates for meaningful
  31630. * // line numbers in error messages and stack traces.
  31631. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31632. * var JST = {\
  31633. * "main": ' + _.template(mainText).source + '\
  31634. * };\
  31635. * ');
  31636. */
  31637. function template(string, options, guard) {
  31638. // Based on John Resig's `tmpl` implementation
  31639. // (http://ejohn.org/blog/javascript-micro-templating/)
  31640. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31641. var settings = lodash.templateSettings;
  31642. if (guard && isIterateeCall(string, options, guard)) {
  31643. options = undefined;
  31644. }
  31645. string = toString(string);
  31646. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31647. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31648. importsKeys = keys(imports),
  31649. importsValues = baseValues(imports, importsKeys);
  31650. var isEscaping,
  31651. isEvaluating,
  31652. index = 0,
  31653. interpolate = options.interpolate || reNoMatch,
  31654. source = "__p += '";
  31655. // Compile the regexp to match each delimiter.
  31656. var reDelimiters = RegExp(
  31657. (options.escape || reNoMatch).source + '|' +
  31658. interpolate.source + '|' +
  31659. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31660. (options.evaluate || reNoMatch).source + '|$'
  31661. , 'g');
  31662. // Use a sourceURL for easier debugging.
  31663. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31664. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31665. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31666. var sourceURL = '//# sourceURL=' +
  31667. (hasOwnProperty.call(options, 'sourceURL')
  31668. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31669. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31670. ) + '\n';
  31671. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31672. interpolateValue || (interpolateValue = esTemplateValue);
  31673. // Escape characters that can't be included in string literals.
  31674. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31675. // Replace delimiters with snippets.
  31676. if (escapeValue) {
  31677. isEscaping = true;
  31678. source += "' +\n__e(" + escapeValue + ") +\n'";
  31679. }
  31680. if (evaluateValue) {
  31681. isEvaluating = true;
  31682. source += "';\n" + evaluateValue + ";\n__p += '";
  31683. }
  31684. if (interpolateValue) {
  31685. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31686. }
  31687. index = offset + match.length;
  31688. // The JS engine embedded in Adobe products needs `match` returned in
  31689. // order to produce the correct `offset` value.
  31690. return match;
  31691. });
  31692. source += "';\n";
  31693. // If `variable` is not specified wrap a with-statement around the generated
  31694. // code to add the data object to the top of the scope chain.
  31695. // Like with sourceURL, we take care to not check the option's prototype,
  31696. // as this configuration is a code injection vector.
  31697. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31698. if (!variable) {
  31699. source = 'with (obj) {\n' + source + '\n}\n';
  31700. }
  31701. // Cleanup code by stripping empty strings.
  31702. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31703. .replace(reEmptyStringMiddle, '$1')
  31704. .replace(reEmptyStringTrailing, '$1;');
  31705. // Frame code as the function body.
  31706. source = 'function(' + (variable || 'obj') + ') {\n' +
  31707. (variable
  31708. ? ''
  31709. : 'obj || (obj = {});\n'
  31710. ) +
  31711. "var __t, __p = ''" +
  31712. (isEscaping
  31713. ? ', __e = _.escape'
  31714. : ''
  31715. ) +
  31716. (isEvaluating
  31717. ? ', __j = Array.prototype.join;\n' +
  31718. "function print() { __p += __j.call(arguments, '') }\n"
  31719. : ';\n'
  31720. ) +
  31721. source +
  31722. 'return __p\n}';
  31723. var result = attempt(function() {
  31724. return Function(importsKeys, sourceURL + 'return ' + source)
  31725. .apply(undefined, importsValues);
  31726. });
  31727. // Provide the compiled function's source by its `toString` method or
  31728. // the `source` property as a convenience for inlining compiled templates.
  31729. result.source = source;
  31730. if (isError(result)) {
  31731. throw result;
  31732. }
  31733. return result;
  31734. }
  31735. /**
  31736. * Converts `string`, as a whole, to lower case just like
  31737. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31738. *
  31739. * @static
  31740. * @memberOf _
  31741. * @since 4.0.0
  31742. * @category String
  31743. * @param {string} [string=''] The string to convert.
  31744. * @returns {string} Returns the lower cased string.
  31745. * @example
  31746. *
  31747. * _.toLower('--Foo-Bar--');
  31748. * // => '--foo-bar--'
  31749. *
  31750. * _.toLower('fooBar');
  31751. * // => 'foobar'
  31752. *
  31753. * _.toLower('__FOO_BAR__');
  31754. * // => '__foo_bar__'
  31755. */
  31756. function toLower(value) {
  31757. return toString(value).toLowerCase();
  31758. }
  31759. /**
  31760. * Converts `string`, as a whole, to upper case just like
  31761. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31762. *
  31763. * @static
  31764. * @memberOf _
  31765. * @since 4.0.0
  31766. * @category String
  31767. * @param {string} [string=''] The string to convert.
  31768. * @returns {string} Returns the upper cased string.
  31769. * @example
  31770. *
  31771. * _.toUpper('--foo-bar--');
  31772. * // => '--FOO-BAR--'
  31773. *
  31774. * _.toUpper('fooBar');
  31775. * // => 'FOOBAR'
  31776. *
  31777. * _.toUpper('__foo_bar__');
  31778. * // => '__FOO_BAR__'
  31779. */
  31780. function toUpper(value) {
  31781. return toString(value).toUpperCase();
  31782. }
  31783. /**
  31784. * Removes leading and trailing whitespace or specified characters from `string`.
  31785. *
  31786. * @static
  31787. * @memberOf _
  31788. * @since 3.0.0
  31789. * @category String
  31790. * @param {string} [string=''] The string to trim.
  31791. * @param {string} [chars=whitespace] The characters to trim.
  31792. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31793. * @returns {string} Returns the trimmed string.
  31794. * @example
  31795. *
  31796. * _.trim(' abc ');
  31797. * // => 'abc'
  31798. *
  31799. * _.trim('-_-abc-_-', '_-');
  31800. * // => 'abc'
  31801. *
  31802. * _.map([' foo ', ' bar '], _.trim);
  31803. * // => ['foo', 'bar']
  31804. */
  31805. function trim(string, chars, guard) {
  31806. string = toString(string);
  31807. if (string && (guard || chars === undefined)) {
  31808. return string.replace(reTrim, '');
  31809. }
  31810. if (!string || !(chars = baseToString(chars))) {
  31811. return string;
  31812. }
  31813. var strSymbols = stringToArray(string),
  31814. chrSymbols = stringToArray(chars),
  31815. start = charsStartIndex(strSymbols, chrSymbols),
  31816. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31817. return castSlice(strSymbols, start, end).join('');
  31818. }
  31819. /**
  31820. * Removes trailing whitespace or specified characters from `string`.
  31821. *
  31822. * @static
  31823. * @memberOf _
  31824. * @since 4.0.0
  31825. * @category String
  31826. * @param {string} [string=''] The string to trim.
  31827. * @param {string} [chars=whitespace] The characters to trim.
  31828. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31829. * @returns {string} Returns the trimmed string.
  31830. * @example
  31831. *
  31832. * _.trimEnd(' abc ');
  31833. * // => ' abc'
  31834. *
  31835. * _.trimEnd('-_-abc-_-', '_-');
  31836. * // => '-_-abc'
  31837. */
  31838. function trimEnd(string, chars, guard) {
  31839. string = toString(string);
  31840. if (string && (guard || chars === undefined)) {
  31841. return string.replace(reTrimEnd, '');
  31842. }
  31843. if (!string || !(chars = baseToString(chars))) {
  31844. return string;
  31845. }
  31846. var strSymbols = stringToArray(string),
  31847. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31848. return castSlice(strSymbols, 0, end).join('');
  31849. }
  31850. /**
  31851. * Removes leading whitespace or specified characters from `string`.
  31852. *
  31853. * @static
  31854. * @memberOf _
  31855. * @since 4.0.0
  31856. * @category String
  31857. * @param {string} [string=''] The string to trim.
  31858. * @param {string} [chars=whitespace] The characters to trim.
  31859. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31860. * @returns {string} Returns the trimmed string.
  31861. * @example
  31862. *
  31863. * _.trimStart(' abc ');
  31864. * // => 'abc '
  31865. *
  31866. * _.trimStart('-_-abc-_-', '_-');
  31867. * // => 'abc-_-'
  31868. */
  31869. function trimStart(string, chars, guard) {
  31870. string = toString(string);
  31871. if (string && (guard || chars === undefined)) {
  31872. return string.replace(reTrimStart, '');
  31873. }
  31874. if (!string || !(chars = baseToString(chars))) {
  31875. return string;
  31876. }
  31877. var strSymbols = stringToArray(string),
  31878. start = charsStartIndex(strSymbols, stringToArray(chars));
  31879. return castSlice(strSymbols, start).join('');
  31880. }
  31881. /**
  31882. * Truncates `string` if it's longer than the given maximum string length.
  31883. * The last characters of the truncated string are replaced with the omission
  31884. * string which defaults to "...".
  31885. *
  31886. * @static
  31887. * @memberOf _
  31888. * @since 4.0.0
  31889. * @category String
  31890. * @param {string} [string=''] The string to truncate.
  31891. * @param {Object} [options={}] The options object.
  31892. * @param {number} [options.length=30] The maximum string length.
  31893. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  31894. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  31895. * @returns {string} Returns the truncated string.
  31896. * @example
  31897. *
  31898. * _.truncate('hi-diddly-ho there, neighborino');
  31899. * // => 'hi-diddly-ho there, neighbo...'
  31900. *
  31901. * _.truncate('hi-diddly-ho there, neighborino', {
  31902. * 'length': 24,
  31903. * 'separator': ' '
  31904. * });
  31905. * // => 'hi-diddly-ho there,...'
  31906. *
  31907. * _.truncate('hi-diddly-ho there, neighborino', {
  31908. * 'length': 24,
  31909. * 'separator': /,? +/
  31910. * });
  31911. * // => 'hi-diddly-ho there...'
  31912. *
  31913. * _.truncate('hi-diddly-ho there, neighborino', {
  31914. * 'omission': ' [...]'
  31915. * });
  31916. * // => 'hi-diddly-ho there, neig [...]'
  31917. */
  31918. function truncate(string, options) {
  31919. var length = DEFAULT_TRUNC_LENGTH,
  31920. omission = DEFAULT_TRUNC_OMISSION;
  31921. if (isObject(options)) {
  31922. var separator = 'separator' in options ? options.separator : separator;
  31923. length = 'length' in options ? toInteger(options.length) : length;
  31924. omission = 'omission' in options ? baseToString(options.omission) : omission;
  31925. }
  31926. string = toString(string);
  31927. var strLength = string.length;
  31928. if (hasUnicode(string)) {
  31929. var strSymbols = stringToArray(string);
  31930. strLength = strSymbols.length;
  31931. }
  31932. if (length >= strLength) {
  31933. return string;
  31934. }
  31935. var end = length - stringSize(omission);
  31936. if (end < 1) {
  31937. return omission;
  31938. }
  31939. var result = strSymbols
  31940. ? castSlice(strSymbols, 0, end).join('')
  31941. : string.slice(0, end);
  31942. if (separator === undefined) {
  31943. return result + omission;
  31944. }
  31945. if (strSymbols) {
  31946. end += (result.length - end);
  31947. }
  31948. if (isRegExp(separator)) {
  31949. if (string.slice(end).search(separator)) {
  31950. var match,
  31951. substring = result;
  31952. if (!separator.global) {
  31953. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  31954. }
  31955. separator.lastIndex = 0;
  31956. while ((match = separator.exec(substring))) {
  31957. var newEnd = match.index;
  31958. }
  31959. result = result.slice(0, newEnd === undefined ? end : newEnd);
  31960. }
  31961. } else if (string.indexOf(baseToString(separator), end) != end) {
  31962. var index = result.lastIndexOf(separator);
  31963. if (index > -1) {
  31964. result = result.slice(0, index);
  31965. }
  31966. }
  31967. return result + omission;
  31968. }
  31969. /**
  31970. * The inverse of `_.escape`; this method converts the HTML entities
  31971. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  31972. * their corresponding characters.
  31973. *
  31974. * **Note:** No other HTML entities are unescaped. To unescape additional
  31975. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  31976. *
  31977. * @static
  31978. * @memberOf _
  31979. * @since 0.6.0
  31980. * @category String
  31981. * @param {string} [string=''] The string to unescape.
  31982. * @returns {string} Returns the unescaped string.
  31983. * @example
  31984. *
  31985. * _.unescape('fred, barney, &amp; pebbles');
  31986. * // => 'fred, barney, & pebbles'
  31987. */
  31988. function unescape(string) {
  31989. string = toString(string);
  31990. return (string && reHasEscapedHtml.test(string))
  31991. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  31992. : string;
  31993. }
  31994. /**
  31995. * Converts `string`, as space separated words, to upper case.
  31996. *
  31997. * @static
  31998. * @memberOf _
  31999. * @since 4.0.0
  32000. * @category String
  32001. * @param {string} [string=''] The string to convert.
  32002. * @returns {string} Returns the upper cased string.
  32003. * @example
  32004. *
  32005. * _.upperCase('--foo-bar');
  32006. * // => 'FOO BAR'
  32007. *
  32008. * _.upperCase('fooBar');
  32009. * // => 'FOO BAR'
  32010. *
  32011. * _.upperCase('__foo_bar__');
  32012. * // => 'FOO BAR'
  32013. */
  32014. var upperCase = createCompounder(function(result, word, index) {
  32015. return result + (index ? ' ' : '') + word.toUpperCase();
  32016. });
  32017. /**
  32018. * Converts the first character of `string` to upper case.
  32019. *
  32020. * @static
  32021. * @memberOf _
  32022. * @since 4.0.0
  32023. * @category String
  32024. * @param {string} [string=''] The string to convert.
  32025. * @returns {string} Returns the converted string.
  32026. * @example
  32027. *
  32028. * _.upperFirst('fred');
  32029. * // => 'Fred'
  32030. *
  32031. * _.upperFirst('FRED');
  32032. * // => 'FRED'
  32033. */
  32034. var upperFirst = createCaseFirst('toUpperCase');
  32035. /**
  32036. * Splits `string` into an array of its words.
  32037. *
  32038. * @static
  32039. * @memberOf _
  32040. * @since 3.0.0
  32041. * @category String
  32042. * @param {string} [string=''] The string to inspect.
  32043. * @param {RegExp|string} [pattern] The pattern to match words.
  32044. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32045. * @returns {Array} Returns the words of `string`.
  32046. * @example
  32047. *
  32048. * _.words('fred, barney, & pebbles');
  32049. * // => ['fred', 'barney', 'pebbles']
  32050. *
  32051. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32052. * // => ['fred', 'barney', '&', 'pebbles']
  32053. */
  32054. function words(string, pattern, guard) {
  32055. string = toString(string);
  32056. pattern = guard ? undefined : pattern;
  32057. if (pattern === undefined) {
  32058. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32059. }
  32060. return string.match(pattern) || [];
  32061. }
  32062. /*------------------------------------------------------------------------*/
  32063. /**
  32064. * Attempts to invoke `func`, returning either the result or the caught error
  32065. * object. Any additional arguments are provided to `func` when it's invoked.
  32066. *
  32067. * @static
  32068. * @memberOf _
  32069. * @since 3.0.0
  32070. * @category Util
  32071. * @param {Function} func The function to attempt.
  32072. * @param {...*} [args] The arguments to invoke `func` with.
  32073. * @returns {*} Returns the `func` result or error object.
  32074. * @example
  32075. *
  32076. * // Avoid throwing errors for invalid selectors.
  32077. * var elements = _.attempt(function(selector) {
  32078. * return document.querySelectorAll(selector);
  32079. * }, '>_>');
  32080. *
  32081. * if (_.isError(elements)) {
  32082. * elements = [];
  32083. * }
  32084. */
  32085. var attempt = baseRest(function(func, args) {
  32086. try {
  32087. return apply(func, undefined, args);
  32088. } catch (e) {
  32089. return isError(e) ? e : new Error(e);
  32090. }
  32091. });
  32092. /**
  32093. * Binds methods of an object to the object itself, overwriting the existing
  32094. * method.
  32095. *
  32096. * **Note:** This method doesn't set the "length" property of bound functions.
  32097. *
  32098. * @static
  32099. * @since 0.1.0
  32100. * @memberOf _
  32101. * @category Util
  32102. * @param {Object} object The object to bind and assign the bound methods to.
  32103. * @param {...(string|string[])} methodNames The object method names to bind.
  32104. * @returns {Object} Returns `object`.
  32105. * @example
  32106. *
  32107. * var view = {
  32108. * 'label': 'docs',
  32109. * 'click': function() {
  32110. * console.log('clicked ' + this.label);
  32111. * }
  32112. * };
  32113. *
  32114. * _.bindAll(view, ['click']);
  32115. * jQuery(element).on('click', view.click);
  32116. * // => Logs 'clicked docs' when clicked.
  32117. */
  32118. var bindAll = flatRest(function(object, methodNames) {
  32119. arrayEach(methodNames, function(key) {
  32120. key = toKey(key);
  32121. baseAssignValue(object, key, bind(object[key], object));
  32122. });
  32123. return object;
  32124. });
  32125. /**
  32126. * Creates a function that iterates over `pairs` and invokes the corresponding
  32127. * function of the first predicate to return truthy. The predicate-function
  32128. * pairs are invoked with the `this` binding and arguments of the created
  32129. * function.
  32130. *
  32131. * @static
  32132. * @memberOf _
  32133. * @since 4.0.0
  32134. * @category Util
  32135. * @param {Array} pairs The predicate-function pairs.
  32136. * @returns {Function} Returns the new composite function.
  32137. * @example
  32138. *
  32139. * var func = _.cond([
  32140. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32141. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32142. * [_.stubTrue, _.constant('no match')]
  32143. * ]);
  32144. *
  32145. * func({ 'a': 1, 'b': 2 });
  32146. * // => 'matches A'
  32147. *
  32148. * func({ 'a': 0, 'b': 1 });
  32149. * // => 'matches B'
  32150. *
  32151. * func({ 'a': '1', 'b': '2' });
  32152. * // => 'no match'
  32153. */
  32154. function cond(pairs) {
  32155. var length = pairs == null ? 0 : pairs.length,
  32156. toIteratee = getIteratee();
  32157. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32158. if (typeof pair[1] != 'function') {
  32159. throw new TypeError(FUNC_ERROR_TEXT);
  32160. }
  32161. return [toIteratee(pair[0]), pair[1]];
  32162. });
  32163. return baseRest(function(args) {
  32164. var index = -1;
  32165. while (++index < length) {
  32166. var pair = pairs[index];
  32167. if (apply(pair[0], this, args)) {
  32168. return apply(pair[1], this, args);
  32169. }
  32170. }
  32171. });
  32172. }
  32173. /**
  32174. * Creates a function that invokes the predicate properties of `source` with
  32175. * the corresponding property values of a given object, returning `true` if
  32176. * all predicates return truthy, else `false`.
  32177. *
  32178. * **Note:** The created function is equivalent to `_.conformsTo` with
  32179. * `source` partially applied.
  32180. *
  32181. * @static
  32182. * @memberOf _
  32183. * @since 4.0.0
  32184. * @category Util
  32185. * @param {Object} source The object of property predicates to conform to.
  32186. * @returns {Function} Returns the new spec function.
  32187. * @example
  32188. *
  32189. * var objects = [
  32190. * { 'a': 2, 'b': 1 },
  32191. * { 'a': 1, 'b': 2 }
  32192. * ];
  32193. *
  32194. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32195. * // => [{ 'a': 1, 'b': 2 }]
  32196. */
  32197. function conforms(source) {
  32198. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32199. }
  32200. /**
  32201. * Creates a function that returns `value`.
  32202. *
  32203. * @static
  32204. * @memberOf _
  32205. * @since 2.4.0
  32206. * @category Util
  32207. * @param {*} value The value to return from the new function.
  32208. * @returns {Function} Returns the new constant function.
  32209. * @example
  32210. *
  32211. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32212. *
  32213. * console.log(objects);
  32214. * // => [{ 'a': 1 }, { 'a': 1 }]
  32215. *
  32216. * console.log(objects[0] === objects[1]);
  32217. * // => true
  32218. */
  32219. function constant(value) {
  32220. return function() {
  32221. return value;
  32222. };
  32223. }
  32224. /**
  32225. * Checks `value` to determine whether a default value should be returned in
  32226. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32227. * or `undefined`.
  32228. *
  32229. * @static
  32230. * @memberOf _
  32231. * @since 4.14.0
  32232. * @category Util
  32233. * @param {*} value The value to check.
  32234. * @param {*} defaultValue The default value.
  32235. * @returns {*} Returns the resolved value.
  32236. * @example
  32237. *
  32238. * _.defaultTo(1, 10);
  32239. * // => 1
  32240. *
  32241. * _.defaultTo(undefined, 10);
  32242. * // => 10
  32243. */
  32244. function defaultTo(value, defaultValue) {
  32245. return (value == null || value !== value) ? defaultValue : value;
  32246. }
  32247. /**
  32248. * Creates a function that returns the result of invoking the given functions
  32249. * with the `this` binding of the created function, where each successive
  32250. * invocation is supplied the return value of the previous.
  32251. *
  32252. * @static
  32253. * @memberOf _
  32254. * @since 3.0.0
  32255. * @category Util
  32256. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32257. * @returns {Function} Returns the new composite function.
  32258. * @see _.flowRight
  32259. * @example
  32260. *
  32261. * function square(n) {
  32262. * return n * n;
  32263. * }
  32264. *
  32265. * var addSquare = _.flow([_.add, square]);
  32266. * addSquare(1, 2);
  32267. * // => 9
  32268. */
  32269. var flow = createFlow();
  32270. /**
  32271. * This method is like `_.flow` except that it creates a function that
  32272. * invokes the given functions from right to left.
  32273. *
  32274. * @static
  32275. * @since 3.0.0
  32276. * @memberOf _
  32277. * @category Util
  32278. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32279. * @returns {Function} Returns the new composite function.
  32280. * @see _.flow
  32281. * @example
  32282. *
  32283. * function square(n) {
  32284. * return n * n;
  32285. * }
  32286. *
  32287. * var addSquare = _.flowRight([square, _.add]);
  32288. * addSquare(1, 2);
  32289. * // => 9
  32290. */
  32291. var flowRight = createFlow(true);
  32292. /**
  32293. * This method returns the first argument it receives.
  32294. *
  32295. * @static
  32296. * @since 0.1.0
  32297. * @memberOf _
  32298. * @category Util
  32299. * @param {*} value Any value.
  32300. * @returns {*} Returns `value`.
  32301. * @example
  32302. *
  32303. * var object = { 'a': 1 };
  32304. *
  32305. * console.log(_.identity(object) === object);
  32306. * // => true
  32307. */
  32308. function identity(value) {
  32309. return value;
  32310. }
  32311. /**
  32312. * Creates a function that invokes `func` with the arguments of the created
  32313. * function. If `func` is a property name, the created function returns the
  32314. * property value for a given element. If `func` is an array or object, the
  32315. * created function returns `true` for elements that contain the equivalent
  32316. * source properties, otherwise it returns `false`.
  32317. *
  32318. * @static
  32319. * @since 4.0.0
  32320. * @memberOf _
  32321. * @category Util
  32322. * @param {*} [func=_.identity] The value to convert to a callback.
  32323. * @returns {Function} Returns the callback.
  32324. * @example
  32325. *
  32326. * var users = [
  32327. * { 'user': 'barney', 'age': 36, 'active': true },
  32328. * { 'user': 'fred', 'age': 40, 'active': false }
  32329. * ];
  32330. *
  32331. * // The `_.matches` iteratee shorthand.
  32332. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32333. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32334. *
  32335. * // The `_.matchesProperty` iteratee shorthand.
  32336. * _.filter(users, _.iteratee(['user', 'fred']));
  32337. * // => [{ 'user': 'fred', 'age': 40 }]
  32338. *
  32339. * // The `_.property` iteratee shorthand.
  32340. * _.map(users, _.iteratee('user'));
  32341. * // => ['barney', 'fred']
  32342. *
  32343. * // Create custom iteratee shorthands.
  32344. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32345. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32346. * return func.test(string);
  32347. * };
  32348. * });
  32349. *
  32350. * _.filter(['abc', 'def'], /ef/);
  32351. * // => ['def']
  32352. */
  32353. function iteratee(func) {
  32354. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32355. }
  32356. /**
  32357. * Creates a function that performs a partial deep comparison between a given
  32358. * object and `source`, returning `true` if the given object has equivalent
  32359. * property values, else `false`.
  32360. *
  32361. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32362. * partially applied.
  32363. *
  32364. * Partial comparisons will match empty array and empty object `source`
  32365. * values against any array or object value, respectively. See `_.isEqual`
  32366. * for a list of supported value comparisons.
  32367. *
  32368. * @static
  32369. * @memberOf _
  32370. * @since 3.0.0
  32371. * @category Util
  32372. * @param {Object} source The object of property values to match.
  32373. * @returns {Function} Returns the new spec function.
  32374. * @example
  32375. *
  32376. * var objects = [
  32377. * { 'a': 1, 'b': 2, 'c': 3 },
  32378. * { 'a': 4, 'b': 5, 'c': 6 }
  32379. * ];
  32380. *
  32381. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32382. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32383. */
  32384. function matches(source) {
  32385. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32386. }
  32387. /**
  32388. * Creates a function that performs a partial deep comparison between the
  32389. * value at `path` of a given object to `srcValue`, returning `true` if the
  32390. * object value is equivalent, else `false`.
  32391. *
  32392. * **Note:** Partial comparisons will match empty array and empty object
  32393. * `srcValue` values against any array or object value, respectively. See
  32394. * `_.isEqual` for a list of supported value comparisons.
  32395. *
  32396. * @static
  32397. * @memberOf _
  32398. * @since 3.2.0
  32399. * @category Util
  32400. * @param {Array|string} path The path of the property to get.
  32401. * @param {*} srcValue The value to match.
  32402. * @returns {Function} Returns the new spec function.
  32403. * @example
  32404. *
  32405. * var objects = [
  32406. * { 'a': 1, 'b': 2, 'c': 3 },
  32407. * { 'a': 4, 'b': 5, 'c': 6 }
  32408. * ];
  32409. *
  32410. * _.find(objects, _.matchesProperty('a', 4));
  32411. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32412. */
  32413. function matchesProperty(path, srcValue) {
  32414. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32415. }
  32416. /**
  32417. * Creates a function that invokes the method at `path` of a given object.
  32418. * Any additional arguments are provided to the invoked method.
  32419. *
  32420. * @static
  32421. * @memberOf _
  32422. * @since 3.7.0
  32423. * @category Util
  32424. * @param {Array|string} path The path of the method to invoke.
  32425. * @param {...*} [args] The arguments to invoke the method with.
  32426. * @returns {Function} Returns the new invoker function.
  32427. * @example
  32428. *
  32429. * var objects = [
  32430. * { 'a': { 'b': _.constant(2) } },
  32431. * { 'a': { 'b': _.constant(1) } }
  32432. * ];
  32433. *
  32434. * _.map(objects, _.method('a.b'));
  32435. * // => [2, 1]
  32436. *
  32437. * _.map(objects, _.method(['a', 'b']));
  32438. * // => [2, 1]
  32439. */
  32440. var method = baseRest(function(path, args) {
  32441. return function(object) {
  32442. return baseInvoke(object, path, args);
  32443. };
  32444. });
  32445. /**
  32446. * The opposite of `_.method`; this method creates a function that invokes
  32447. * the method at a given path of `object`. Any additional arguments are
  32448. * provided to the invoked method.
  32449. *
  32450. * @static
  32451. * @memberOf _
  32452. * @since 3.7.0
  32453. * @category Util
  32454. * @param {Object} object The object to query.
  32455. * @param {...*} [args] The arguments to invoke the method with.
  32456. * @returns {Function} Returns the new invoker function.
  32457. * @example
  32458. *
  32459. * var array = _.times(3, _.constant),
  32460. * object = { 'a': array, 'b': array, 'c': array };
  32461. *
  32462. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32463. * // => [2, 0]
  32464. *
  32465. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32466. * // => [2, 0]
  32467. */
  32468. var methodOf = baseRest(function(object, args) {
  32469. return function(path) {
  32470. return baseInvoke(object, path, args);
  32471. };
  32472. });
  32473. /**
  32474. * Adds all own enumerable string keyed function properties of a source
  32475. * object to the destination object. If `object` is a function, then methods
  32476. * are added to its prototype as well.
  32477. *
  32478. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32479. * avoid conflicts caused by modifying the original.
  32480. *
  32481. * @static
  32482. * @since 0.1.0
  32483. * @memberOf _
  32484. * @category Util
  32485. * @param {Function|Object} [object=lodash] The destination object.
  32486. * @param {Object} source The object of functions to add.
  32487. * @param {Object} [options={}] The options object.
  32488. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32489. * @returns {Function|Object} Returns `object`.
  32490. * @example
  32491. *
  32492. * function vowels(string) {
  32493. * return _.filter(string, function(v) {
  32494. * return /[aeiou]/i.test(v);
  32495. * });
  32496. * }
  32497. *
  32498. * _.mixin({ 'vowels': vowels });
  32499. * _.vowels('fred');
  32500. * // => ['e']
  32501. *
  32502. * _('fred').vowels().value();
  32503. * // => ['e']
  32504. *
  32505. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32506. * _('fred').vowels();
  32507. * // => ['e']
  32508. */
  32509. function mixin(object, source, options) {
  32510. var props = keys(source),
  32511. methodNames = baseFunctions(source, props);
  32512. if (options == null &&
  32513. !(isObject(source) && (methodNames.length || !props.length))) {
  32514. options = source;
  32515. source = object;
  32516. object = this;
  32517. methodNames = baseFunctions(source, keys(source));
  32518. }
  32519. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32520. isFunc = isFunction(object);
  32521. arrayEach(methodNames, function(methodName) {
  32522. var func = source[methodName];
  32523. object[methodName] = func;
  32524. if (isFunc) {
  32525. object.prototype[methodName] = function() {
  32526. var chainAll = this.__chain__;
  32527. if (chain || chainAll) {
  32528. var result = object(this.__wrapped__),
  32529. actions = result.__actions__ = copyArray(this.__actions__);
  32530. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32531. result.__chain__ = chainAll;
  32532. return result;
  32533. }
  32534. return func.apply(object, arrayPush([this.value()], arguments));
  32535. };
  32536. }
  32537. });
  32538. return object;
  32539. }
  32540. /**
  32541. * Reverts the `_` variable to its previous value and returns a reference to
  32542. * the `lodash` function.
  32543. *
  32544. * @static
  32545. * @since 0.1.0
  32546. * @memberOf _
  32547. * @category Util
  32548. * @returns {Function} Returns the `lodash` function.
  32549. * @example
  32550. *
  32551. * var lodash = _.noConflict();
  32552. */
  32553. function noConflict() {
  32554. if (root._ === this) {
  32555. root._ = oldDash;
  32556. }
  32557. return this;
  32558. }
  32559. /**
  32560. * This method returns `undefined`.
  32561. *
  32562. * @static
  32563. * @memberOf _
  32564. * @since 2.3.0
  32565. * @category Util
  32566. * @example
  32567. *
  32568. * _.times(2, _.noop);
  32569. * // => [undefined, undefined]
  32570. */
  32571. function noop() {
  32572. // No operation performed.
  32573. }
  32574. /**
  32575. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32576. * the nth argument from the end is returned.
  32577. *
  32578. * @static
  32579. * @memberOf _
  32580. * @since 4.0.0
  32581. * @category Util
  32582. * @param {number} [n=0] The index of the argument to return.
  32583. * @returns {Function} Returns the new pass-thru function.
  32584. * @example
  32585. *
  32586. * var func = _.nthArg(1);
  32587. * func('a', 'b', 'c', 'd');
  32588. * // => 'b'
  32589. *
  32590. * var func = _.nthArg(-2);
  32591. * func('a', 'b', 'c', 'd');
  32592. * // => 'c'
  32593. */
  32594. function nthArg(n) {
  32595. n = toInteger(n);
  32596. return baseRest(function(args) {
  32597. return baseNth(args, n);
  32598. });
  32599. }
  32600. /**
  32601. * Creates a function that invokes `iteratees` with the arguments it receives
  32602. * and returns their results.
  32603. *
  32604. * @static
  32605. * @memberOf _
  32606. * @since 4.0.0
  32607. * @category Util
  32608. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32609. * The iteratees to invoke.
  32610. * @returns {Function} Returns the new function.
  32611. * @example
  32612. *
  32613. * var func = _.over([Math.max, Math.min]);
  32614. *
  32615. * func(1, 2, 3, 4);
  32616. * // => [4, 1]
  32617. */
  32618. var over = createOver(arrayMap);
  32619. /**
  32620. * Creates a function that checks if **all** of the `predicates` return
  32621. * truthy when invoked with the arguments it receives.
  32622. *
  32623. * @static
  32624. * @memberOf _
  32625. * @since 4.0.0
  32626. * @category Util
  32627. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32628. * The predicates to check.
  32629. * @returns {Function} Returns the new function.
  32630. * @example
  32631. *
  32632. * var func = _.overEvery([Boolean, isFinite]);
  32633. *
  32634. * func('1');
  32635. * // => true
  32636. *
  32637. * func(null);
  32638. * // => false
  32639. *
  32640. * func(NaN);
  32641. * // => false
  32642. */
  32643. var overEvery = createOver(arrayEvery);
  32644. /**
  32645. * Creates a function that checks if **any** of the `predicates` return
  32646. * truthy when invoked with the arguments it receives.
  32647. *
  32648. * @static
  32649. * @memberOf _
  32650. * @since 4.0.0
  32651. * @category Util
  32652. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32653. * The predicates to check.
  32654. * @returns {Function} Returns the new function.
  32655. * @example
  32656. *
  32657. * var func = _.overSome([Boolean, isFinite]);
  32658. *
  32659. * func('1');
  32660. * // => true
  32661. *
  32662. * func(null);
  32663. * // => true
  32664. *
  32665. * func(NaN);
  32666. * // => false
  32667. */
  32668. var overSome = createOver(arraySome);
  32669. /**
  32670. * Creates a function that returns the value at `path` of a given object.
  32671. *
  32672. * @static
  32673. * @memberOf _
  32674. * @since 2.4.0
  32675. * @category Util
  32676. * @param {Array|string} path The path of the property to get.
  32677. * @returns {Function} Returns the new accessor function.
  32678. * @example
  32679. *
  32680. * var objects = [
  32681. * { 'a': { 'b': 2 } },
  32682. * { 'a': { 'b': 1 } }
  32683. * ];
  32684. *
  32685. * _.map(objects, _.property('a.b'));
  32686. * // => [2, 1]
  32687. *
  32688. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32689. * // => [1, 2]
  32690. */
  32691. function property(path) {
  32692. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32693. }
  32694. /**
  32695. * The opposite of `_.property`; this method creates a function that returns
  32696. * the value at a given path of `object`.
  32697. *
  32698. * @static
  32699. * @memberOf _
  32700. * @since 3.0.0
  32701. * @category Util
  32702. * @param {Object} object The object to query.
  32703. * @returns {Function} Returns the new accessor function.
  32704. * @example
  32705. *
  32706. * var array = [0, 1, 2],
  32707. * object = { 'a': array, 'b': array, 'c': array };
  32708. *
  32709. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32710. * // => [2, 0]
  32711. *
  32712. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32713. * // => [2, 0]
  32714. */
  32715. function propertyOf(object) {
  32716. return function(path) {
  32717. return object == null ? undefined : baseGet(object, path);
  32718. };
  32719. }
  32720. /**
  32721. * Creates an array of numbers (positive and/or negative) progressing from
  32722. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32723. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32724. * it's set to `start` with `start` then set to `0`.
  32725. *
  32726. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32727. * floating-point values which can produce unexpected results.
  32728. *
  32729. * @static
  32730. * @since 0.1.0
  32731. * @memberOf _
  32732. * @category Util
  32733. * @param {number} [start=0] The start of the range.
  32734. * @param {number} end The end of the range.
  32735. * @param {number} [step=1] The value to increment or decrement by.
  32736. * @returns {Array} Returns the range of numbers.
  32737. * @see _.inRange, _.rangeRight
  32738. * @example
  32739. *
  32740. * _.range(4);
  32741. * // => [0, 1, 2, 3]
  32742. *
  32743. * _.range(-4);
  32744. * // => [0, -1, -2, -3]
  32745. *
  32746. * _.range(1, 5);
  32747. * // => [1, 2, 3, 4]
  32748. *
  32749. * _.range(0, 20, 5);
  32750. * // => [0, 5, 10, 15]
  32751. *
  32752. * _.range(0, -4, -1);
  32753. * // => [0, -1, -2, -3]
  32754. *
  32755. * _.range(1, 4, 0);
  32756. * // => [1, 1, 1]
  32757. *
  32758. * _.range(0);
  32759. * // => []
  32760. */
  32761. var range = createRange();
  32762. /**
  32763. * This method is like `_.range` except that it populates values in
  32764. * descending order.
  32765. *
  32766. * @static
  32767. * @memberOf _
  32768. * @since 4.0.0
  32769. * @category Util
  32770. * @param {number} [start=0] The start of the range.
  32771. * @param {number} end The end of the range.
  32772. * @param {number} [step=1] The value to increment or decrement by.
  32773. * @returns {Array} Returns the range of numbers.
  32774. * @see _.inRange, _.range
  32775. * @example
  32776. *
  32777. * _.rangeRight(4);
  32778. * // => [3, 2, 1, 0]
  32779. *
  32780. * _.rangeRight(-4);
  32781. * // => [-3, -2, -1, 0]
  32782. *
  32783. * _.rangeRight(1, 5);
  32784. * // => [4, 3, 2, 1]
  32785. *
  32786. * _.rangeRight(0, 20, 5);
  32787. * // => [15, 10, 5, 0]
  32788. *
  32789. * _.rangeRight(0, -4, -1);
  32790. * // => [-3, -2, -1, 0]
  32791. *
  32792. * _.rangeRight(1, 4, 0);
  32793. * // => [1, 1, 1]
  32794. *
  32795. * _.rangeRight(0);
  32796. * // => []
  32797. */
  32798. var rangeRight = createRange(true);
  32799. /**
  32800. * This method returns a new empty array.
  32801. *
  32802. * @static
  32803. * @memberOf _
  32804. * @since 4.13.0
  32805. * @category Util
  32806. * @returns {Array} Returns the new empty array.
  32807. * @example
  32808. *
  32809. * var arrays = _.times(2, _.stubArray);
  32810. *
  32811. * console.log(arrays);
  32812. * // => [[], []]
  32813. *
  32814. * console.log(arrays[0] === arrays[1]);
  32815. * // => false
  32816. */
  32817. function stubArray() {
  32818. return [];
  32819. }
  32820. /**
  32821. * This method returns `false`.
  32822. *
  32823. * @static
  32824. * @memberOf _
  32825. * @since 4.13.0
  32826. * @category Util
  32827. * @returns {boolean} Returns `false`.
  32828. * @example
  32829. *
  32830. * _.times(2, _.stubFalse);
  32831. * // => [false, false]
  32832. */
  32833. function stubFalse() {
  32834. return false;
  32835. }
  32836. /**
  32837. * This method returns a new empty object.
  32838. *
  32839. * @static
  32840. * @memberOf _
  32841. * @since 4.13.0
  32842. * @category Util
  32843. * @returns {Object} Returns the new empty object.
  32844. * @example
  32845. *
  32846. * var objects = _.times(2, _.stubObject);
  32847. *
  32848. * console.log(objects);
  32849. * // => [{}, {}]
  32850. *
  32851. * console.log(objects[0] === objects[1]);
  32852. * // => false
  32853. */
  32854. function stubObject() {
  32855. return {};
  32856. }
  32857. /**
  32858. * This method returns an empty string.
  32859. *
  32860. * @static
  32861. * @memberOf _
  32862. * @since 4.13.0
  32863. * @category Util
  32864. * @returns {string} Returns the empty string.
  32865. * @example
  32866. *
  32867. * _.times(2, _.stubString);
  32868. * // => ['', '']
  32869. */
  32870. function stubString() {
  32871. return '';
  32872. }
  32873. /**
  32874. * This method returns `true`.
  32875. *
  32876. * @static
  32877. * @memberOf _
  32878. * @since 4.13.0
  32879. * @category Util
  32880. * @returns {boolean} Returns `true`.
  32881. * @example
  32882. *
  32883. * _.times(2, _.stubTrue);
  32884. * // => [true, true]
  32885. */
  32886. function stubTrue() {
  32887. return true;
  32888. }
  32889. /**
  32890. * Invokes the iteratee `n` times, returning an array of the results of
  32891. * each invocation. The iteratee is invoked with one argument; (index).
  32892. *
  32893. * @static
  32894. * @since 0.1.0
  32895. * @memberOf _
  32896. * @category Util
  32897. * @param {number} n The number of times to invoke `iteratee`.
  32898. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32899. * @returns {Array} Returns the array of results.
  32900. * @example
  32901. *
  32902. * _.times(3, String);
  32903. * // => ['0', '1', '2']
  32904. *
  32905. * _.times(4, _.constant(0));
  32906. * // => [0, 0, 0, 0]
  32907. */
  32908. function times(n, iteratee) {
  32909. n = toInteger(n);
  32910. if (n < 1 || n > MAX_SAFE_INTEGER) {
  32911. return [];
  32912. }
  32913. var index = MAX_ARRAY_LENGTH,
  32914. length = nativeMin(n, MAX_ARRAY_LENGTH);
  32915. iteratee = getIteratee(iteratee);
  32916. n -= MAX_ARRAY_LENGTH;
  32917. var result = baseTimes(length, iteratee);
  32918. while (++index < n) {
  32919. iteratee(index);
  32920. }
  32921. return result;
  32922. }
  32923. /**
  32924. * Converts `value` to a property path array.
  32925. *
  32926. * @static
  32927. * @memberOf _
  32928. * @since 4.0.0
  32929. * @category Util
  32930. * @param {*} value The value to convert.
  32931. * @returns {Array} Returns the new property path array.
  32932. * @example
  32933. *
  32934. * _.toPath('a.b.c');
  32935. * // => ['a', 'b', 'c']
  32936. *
  32937. * _.toPath('a[0].b.c');
  32938. * // => ['a', '0', 'b', 'c']
  32939. */
  32940. function toPath(value) {
  32941. if (isArray(value)) {
  32942. return arrayMap(value, toKey);
  32943. }
  32944. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  32945. }
  32946. /**
  32947. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  32948. *
  32949. * @static
  32950. * @since 0.1.0
  32951. * @memberOf _
  32952. * @category Util
  32953. * @param {string} [prefix=''] The value to prefix the ID with.
  32954. * @returns {string} Returns the unique ID.
  32955. * @example
  32956. *
  32957. * _.uniqueId('contact_');
  32958. * // => 'contact_104'
  32959. *
  32960. * _.uniqueId();
  32961. * // => '105'
  32962. */
  32963. function uniqueId(prefix) {
  32964. var id = ++idCounter;
  32965. return toString(prefix) + id;
  32966. }
  32967. /*------------------------------------------------------------------------*/
  32968. /**
  32969. * Adds two numbers.
  32970. *
  32971. * @static
  32972. * @memberOf _
  32973. * @since 3.4.0
  32974. * @category Math
  32975. * @param {number} augend The first number in an addition.
  32976. * @param {number} addend The second number in an addition.
  32977. * @returns {number} Returns the total.
  32978. * @example
  32979. *
  32980. * _.add(6, 4);
  32981. * // => 10
  32982. */
  32983. var add = createMathOperation(function(augend, addend) {
  32984. return augend + addend;
  32985. }, 0);
  32986. /**
  32987. * Computes `number` rounded up to `precision`.
  32988. *
  32989. * @static
  32990. * @memberOf _
  32991. * @since 3.10.0
  32992. * @category Math
  32993. * @param {number} number The number to round up.
  32994. * @param {number} [precision=0] The precision to round up to.
  32995. * @returns {number} Returns the rounded up number.
  32996. * @example
  32997. *
  32998. * _.ceil(4.006);
  32999. * // => 5
  33000. *
  33001. * _.ceil(6.004, 2);
  33002. * // => 6.01
  33003. *
  33004. * _.ceil(6040, -2);
  33005. * // => 6100
  33006. */
  33007. var ceil = createRound('ceil');
  33008. /**
  33009. * Divide two numbers.
  33010. *
  33011. * @static
  33012. * @memberOf _
  33013. * @since 4.7.0
  33014. * @category Math
  33015. * @param {number} dividend The first number in a division.
  33016. * @param {number} divisor The second number in a division.
  33017. * @returns {number} Returns the quotient.
  33018. * @example
  33019. *
  33020. * _.divide(6, 4);
  33021. * // => 1.5
  33022. */
  33023. var divide = createMathOperation(function(dividend, divisor) {
  33024. return dividend / divisor;
  33025. }, 1);
  33026. /**
  33027. * Computes `number` rounded down to `precision`.
  33028. *
  33029. * @static
  33030. * @memberOf _
  33031. * @since 3.10.0
  33032. * @category Math
  33033. * @param {number} number The number to round down.
  33034. * @param {number} [precision=0] The precision to round down to.
  33035. * @returns {number} Returns the rounded down number.
  33036. * @example
  33037. *
  33038. * _.floor(4.006);
  33039. * // => 4
  33040. *
  33041. * _.floor(0.046, 2);
  33042. * // => 0.04
  33043. *
  33044. * _.floor(4060, -2);
  33045. * // => 4000
  33046. */
  33047. var floor = createRound('floor');
  33048. /**
  33049. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33050. * `undefined` is returned.
  33051. *
  33052. * @static
  33053. * @since 0.1.0
  33054. * @memberOf _
  33055. * @category Math
  33056. * @param {Array} array The array to iterate over.
  33057. * @returns {*} Returns the maximum value.
  33058. * @example
  33059. *
  33060. * _.max([4, 2, 8, 6]);
  33061. * // => 8
  33062. *
  33063. * _.max([]);
  33064. * // => undefined
  33065. */
  33066. function max(array) {
  33067. return (array && array.length)
  33068. ? baseExtremum(array, identity, baseGt)
  33069. : undefined;
  33070. }
  33071. /**
  33072. * This method is like `_.max` except that it accepts `iteratee` which is
  33073. * invoked for each element in `array` to generate the criterion by which
  33074. * the value is ranked. The iteratee is invoked with one argument: (value).
  33075. *
  33076. * @static
  33077. * @memberOf _
  33078. * @since 4.0.0
  33079. * @category Math
  33080. * @param {Array} array The array to iterate over.
  33081. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33082. * @returns {*} Returns the maximum value.
  33083. * @example
  33084. *
  33085. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33086. *
  33087. * _.maxBy(objects, function(o) { return o.n; });
  33088. * // => { 'n': 2 }
  33089. *
  33090. * // The `_.property` iteratee shorthand.
  33091. * _.maxBy(objects, 'n');
  33092. * // => { 'n': 2 }
  33093. */
  33094. function maxBy(array, iteratee) {
  33095. return (array && array.length)
  33096. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33097. : undefined;
  33098. }
  33099. /**
  33100. * Computes the mean of the values in `array`.
  33101. *
  33102. * @static
  33103. * @memberOf _
  33104. * @since 4.0.0
  33105. * @category Math
  33106. * @param {Array} array The array to iterate over.
  33107. * @returns {number} Returns the mean.
  33108. * @example
  33109. *
  33110. * _.mean([4, 2, 8, 6]);
  33111. * // => 5
  33112. */
  33113. function mean(array) {
  33114. return baseMean(array, identity);
  33115. }
  33116. /**
  33117. * This method is like `_.mean` except that it accepts `iteratee` which is
  33118. * invoked for each element in `array` to generate the value to be averaged.
  33119. * The iteratee is invoked with one argument: (value).
  33120. *
  33121. * @static
  33122. * @memberOf _
  33123. * @since 4.7.0
  33124. * @category Math
  33125. * @param {Array} array The array to iterate over.
  33126. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33127. * @returns {number} Returns the mean.
  33128. * @example
  33129. *
  33130. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33131. *
  33132. * _.meanBy(objects, function(o) { return o.n; });
  33133. * // => 5
  33134. *
  33135. * // The `_.property` iteratee shorthand.
  33136. * _.meanBy(objects, 'n');
  33137. * // => 5
  33138. */
  33139. function meanBy(array, iteratee) {
  33140. return baseMean(array, getIteratee(iteratee, 2));
  33141. }
  33142. /**
  33143. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33144. * `undefined` is returned.
  33145. *
  33146. * @static
  33147. * @since 0.1.0
  33148. * @memberOf _
  33149. * @category Math
  33150. * @param {Array} array The array to iterate over.
  33151. * @returns {*} Returns the minimum value.
  33152. * @example
  33153. *
  33154. * _.min([4, 2, 8, 6]);
  33155. * // => 2
  33156. *
  33157. * _.min([]);
  33158. * // => undefined
  33159. */
  33160. function min(array) {
  33161. return (array && array.length)
  33162. ? baseExtremum(array, identity, baseLt)
  33163. : undefined;
  33164. }
  33165. /**
  33166. * This method is like `_.min` except that it accepts `iteratee` which is
  33167. * invoked for each element in `array` to generate the criterion by which
  33168. * the value is ranked. The iteratee is invoked with one argument: (value).
  33169. *
  33170. * @static
  33171. * @memberOf _
  33172. * @since 4.0.0
  33173. * @category Math
  33174. * @param {Array} array The array to iterate over.
  33175. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33176. * @returns {*} Returns the minimum value.
  33177. * @example
  33178. *
  33179. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33180. *
  33181. * _.minBy(objects, function(o) { return o.n; });
  33182. * // => { 'n': 1 }
  33183. *
  33184. * // The `_.property` iteratee shorthand.
  33185. * _.minBy(objects, 'n');
  33186. * // => { 'n': 1 }
  33187. */
  33188. function minBy(array, iteratee) {
  33189. return (array && array.length)
  33190. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33191. : undefined;
  33192. }
  33193. /**
  33194. * Multiply two numbers.
  33195. *
  33196. * @static
  33197. * @memberOf _
  33198. * @since 4.7.0
  33199. * @category Math
  33200. * @param {number} multiplier The first number in a multiplication.
  33201. * @param {number} multiplicand The second number in a multiplication.
  33202. * @returns {number} Returns the product.
  33203. * @example
  33204. *
  33205. * _.multiply(6, 4);
  33206. * // => 24
  33207. */
  33208. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33209. return multiplier * multiplicand;
  33210. }, 1);
  33211. /**
  33212. * Computes `number` rounded to `precision`.
  33213. *
  33214. * @static
  33215. * @memberOf _
  33216. * @since 3.10.0
  33217. * @category Math
  33218. * @param {number} number The number to round.
  33219. * @param {number} [precision=0] The precision to round to.
  33220. * @returns {number} Returns the rounded number.
  33221. * @example
  33222. *
  33223. * _.round(4.006);
  33224. * // => 4
  33225. *
  33226. * _.round(4.006, 2);
  33227. * // => 4.01
  33228. *
  33229. * _.round(4060, -2);
  33230. * // => 4100
  33231. */
  33232. var round = createRound('round');
  33233. /**
  33234. * Subtract two numbers.
  33235. *
  33236. * @static
  33237. * @memberOf _
  33238. * @since 4.0.0
  33239. * @category Math
  33240. * @param {number} minuend The first number in a subtraction.
  33241. * @param {number} subtrahend The second number in a subtraction.
  33242. * @returns {number} Returns the difference.
  33243. * @example
  33244. *
  33245. * _.subtract(6, 4);
  33246. * // => 2
  33247. */
  33248. var subtract = createMathOperation(function(minuend, subtrahend) {
  33249. return minuend - subtrahend;
  33250. }, 0);
  33251. /**
  33252. * Computes the sum of the values in `array`.
  33253. *
  33254. * @static
  33255. * @memberOf _
  33256. * @since 3.4.0
  33257. * @category Math
  33258. * @param {Array} array The array to iterate over.
  33259. * @returns {number} Returns the sum.
  33260. * @example
  33261. *
  33262. * _.sum([4, 2, 8, 6]);
  33263. * // => 20
  33264. */
  33265. function sum(array) {
  33266. return (array && array.length)
  33267. ? baseSum(array, identity)
  33268. : 0;
  33269. }
  33270. /**
  33271. * This method is like `_.sum` except that it accepts `iteratee` which is
  33272. * invoked for each element in `array` to generate the value to be summed.
  33273. * The iteratee is invoked with one argument: (value).
  33274. *
  33275. * @static
  33276. * @memberOf _
  33277. * @since 4.0.0
  33278. * @category Math
  33279. * @param {Array} array The array to iterate over.
  33280. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33281. * @returns {number} Returns the sum.
  33282. * @example
  33283. *
  33284. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33285. *
  33286. * _.sumBy(objects, function(o) { return o.n; });
  33287. * // => 20
  33288. *
  33289. * // The `_.property` iteratee shorthand.
  33290. * _.sumBy(objects, 'n');
  33291. * // => 20
  33292. */
  33293. function sumBy(array, iteratee) {
  33294. return (array && array.length)
  33295. ? baseSum(array, getIteratee(iteratee, 2))
  33296. : 0;
  33297. }
  33298. /*------------------------------------------------------------------------*/
  33299. // Add methods that return wrapped values in chain sequences.
  33300. lodash.after = after;
  33301. lodash.ary = ary;
  33302. lodash.assign = assign;
  33303. lodash.assignIn = assignIn;
  33304. lodash.assignInWith = assignInWith;
  33305. lodash.assignWith = assignWith;
  33306. lodash.at = at;
  33307. lodash.before = before;
  33308. lodash.bind = bind;
  33309. lodash.bindAll = bindAll;
  33310. lodash.bindKey = bindKey;
  33311. lodash.castArray = castArray;
  33312. lodash.chain = chain;
  33313. lodash.chunk = chunk;
  33314. lodash.compact = compact;
  33315. lodash.concat = concat;
  33316. lodash.cond = cond;
  33317. lodash.conforms = conforms;
  33318. lodash.constant = constant;
  33319. lodash.countBy = countBy;
  33320. lodash.create = create;
  33321. lodash.curry = curry;
  33322. lodash.curryRight = curryRight;
  33323. lodash.debounce = debounce;
  33324. lodash.defaults = defaults;
  33325. lodash.defaultsDeep = defaultsDeep;
  33326. lodash.defer = defer;
  33327. lodash.delay = delay;
  33328. lodash.difference = difference;
  33329. lodash.differenceBy = differenceBy;
  33330. lodash.differenceWith = differenceWith;
  33331. lodash.drop = drop;
  33332. lodash.dropRight = dropRight;
  33333. lodash.dropRightWhile = dropRightWhile;
  33334. lodash.dropWhile = dropWhile;
  33335. lodash.fill = fill;
  33336. lodash.filter = filter;
  33337. lodash.flatMap = flatMap;
  33338. lodash.flatMapDeep = flatMapDeep;
  33339. lodash.flatMapDepth = flatMapDepth;
  33340. lodash.flatten = flatten;
  33341. lodash.flattenDeep = flattenDeep;
  33342. lodash.flattenDepth = flattenDepth;
  33343. lodash.flip = flip;
  33344. lodash.flow = flow;
  33345. lodash.flowRight = flowRight;
  33346. lodash.fromPairs = fromPairs;
  33347. lodash.functions = functions;
  33348. lodash.functionsIn = functionsIn;
  33349. lodash.groupBy = groupBy;
  33350. lodash.initial = initial;
  33351. lodash.intersection = intersection;
  33352. lodash.intersectionBy = intersectionBy;
  33353. lodash.intersectionWith = intersectionWith;
  33354. lodash.invert = invert;
  33355. lodash.invertBy = invertBy;
  33356. lodash.invokeMap = invokeMap;
  33357. lodash.iteratee = iteratee;
  33358. lodash.keyBy = keyBy;
  33359. lodash.keys = keys;
  33360. lodash.keysIn = keysIn;
  33361. lodash.map = map;
  33362. lodash.mapKeys = mapKeys;
  33363. lodash.mapValues = mapValues;
  33364. lodash.matches = matches;
  33365. lodash.matchesProperty = matchesProperty;
  33366. lodash.memoize = memoize;
  33367. lodash.merge = merge;
  33368. lodash.mergeWith = mergeWith;
  33369. lodash.method = method;
  33370. lodash.methodOf = methodOf;
  33371. lodash.mixin = mixin;
  33372. lodash.negate = negate;
  33373. lodash.nthArg = nthArg;
  33374. lodash.omit = omit;
  33375. lodash.omitBy = omitBy;
  33376. lodash.once = once;
  33377. lodash.orderBy = orderBy;
  33378. lodash.over = over;
  33379. lodash.overArgs = overArgs;
  33380. lodash.overEvery = overEvery;
  33381. lodash.overSome = overSome;
  33382. lodash.partial = partial;
  33383. lodash.partialRight = partialRight;
  33384. lodash.partition = partition;
  33385. lodash.pick = pick;
  33386. lodash.pickBy = pickBy;
  33387. lodash.property = property;
  33388. lodash.propertyOf = propertyOf;
  33389. lodash.pull = pull;
  33390. lodash.pullAll = pullAll;
  33391. lodash.pullAllBy = pullAllBy;
  33392. lodash.pullAllWith = pullAllWith;
  33393. lodash.pullAt = pullAt;
  33394. lodash.range = range;
  33395. lodash.rangeRight = rangeRight;
  33396. lodash.rearg = rearg;
  33397. lodash.reject = reject;
  33398. lodash.remove = remove;
  33399. lodash.rest = rest;
  33400. lodash.reverse = reverse;
  33401. lodash.sampleSize = sampleSize;
  33402. lodash.set = set;
  33403. lodash.setWith = setWith;
  33404. lodash.shuffle = shuffle;
  33405. lodash.slice = slice;
  33406. lodash.sortBy = sortBy;
  33407. lodash.sortedUniq = sortedUniq;
  33408. lodash.sortedUniqBy = sortedUniqBy;
  33409. lodash.split = split;
  33410. lodash.spread = spread;
  33411. lodash.tail = tail;
  33412. lodash.take = take;
  33413. lodash.takeRight = takeRight;
  33414. lodash.takeRightWhile = takeRightWhile;
  33415. lodash.takeWhile = takeWhile;
  33416. lodash.tap = tap;
  33417. lodash.throttle = throttle;
  33418. lodash.thru = thru;
  33419. lodash.toArray = toArray;
  33420. lodash.toPairs = toPairs;
  33421. lodash.toPairsIn = toPairsIn;
  33422. lodash.toPath = toPath;
  33423. lodash.toPlainObject = toPlainObject;
  33424. lodash.transform = transform;
  33425. lodash.unary = unary;
  33426. lodash.union = union;
  33427. lodash.unionBy = unionBy;
  33428. lodash.unionWith = unionWith;
  33429. lodash.uniq = uniq;
  33430. lodash.uniqBy = uniqBy;
  33431. lodash.uniqWith = uniqWith;
  33432. lodash.unset = unset;
  33433. lodash.unzip = unzip;
  33434. lodash.unzipWith = unzipWith;
  33435. lodash.update = update;
  33436. lodash.updateWith = updateWith;
  33437. lodash.values = values;
  33438. lodash.valuesIn = valuesIn;
  33439. lodash.without = without;
  33440. lodash.words = words;
  33441. lodash.wrap = wrap;
  33442. lodash.xor = xor;
  33443. lodash.xorBy = xorBy;
  33444. lodash.xorWith = xorWith;
  33445. lodash.zip = zip;
  33446. lodash.zipObject = zipObject;
  33447. lodash.zipObjectDeep = zipObjectDeep;
  33448. lodash.zipWith = zipWith;
  33449. // Add aliases.
  33450. lodash.entries = toPairs;
  33451. lodash.entriesIn = toPairsIn;
  33452. lodash.extend = assignIn;
  33453. lodash.extendWith = assignInWith;
  33454. // Add methods to `lodash.prototype`.
  33455. mixin(lodash, lodash);
  33456. /*------------------------------------------------------------------------*/
  33457. // Add methods that return unwrapped values in chain sequences.
  33458. lodash.add = add;
  33459. lodash.attempt = attempt;
  33460. lodash.camelCase = camelCase;
  33461. lodash.capitalize = capitalize;
  33462. lodash.ceil = ceil;
  33463. lodash.clamp = clamp;
  33464. lodash.clone = clone;
  33465. lodash.cloneDeep = cloneDeep;
  33466. lodash.cloneDeepWith = cloneDeepWith;
  33467. lodash.cloneWith = cloneWith;
  33468. lodash.conformsTo = conformsTo;
  33469. lodash.deburr = deburr;
  33470. lodash.defaultTo = defaultTo;
  33471. lodash.divide = divide;
  33472. lodash.endsWith = endsWith;
  33473. lodash.eq = eq;
  33474. lodash.escape = escape;
  33475. lodash.escapeRegExp = escapeRegExp;
  33476. lodash.every = every;
  33477. lodash.find = find;
  33478. lodash.findIndex = findIndex;
  33479. lodash.findKey = findKey;
  33480. lodash.findLast = findLast;
  33481. lodash.findLastIndex = findLastIndex;
  33482. lodash.findLastKey = findLastKey;
  33483. lodash.floor = floor;
  33484. lodash.forEach = forEach;
  33485. lodash.forEachRight = forEachRight;
  33486. lodash.forIn = forIn;
  33487. lodash.forInRight = forInRight;
  33488. lodash.forOwn = forOwn;
  33489. lodash.forOwnRight = forOwnRight;
  33490. lodash.get = get;
  33491. lodash.gt = gt;
  33492. lodash.gte = gte;
  33493. lodash.has = has;
  33494. lodash.hasIn = hasIn;
  33495. lodash.head = head;
  33496. lodash.identity = identity;
  33497. lodash.includes = includes;
  33498. lodash.indexOf = indexOf;
  33499. lodash.inRange = inRange;
  33500. lodash.invoke = invoke;
  33501. lodash.isArguments = isArguments;
  33502. lodash.isArray = isArray;
  33503. lodash.isArrayBuffer = isArrayBuffer;
  33504. lodash.isArrayLike = isArrayLike;
  33505. lodash.isArrayLikeObject = isArrayLikeObject;
  33506. lodash.isBoolean = isBoolean;
  33507. lodash.isBuffer = isBuffer;
  33508. lodash.isDate = isDate;
  33509. lodash.isElement = isElement;
  33510. lodash.isEmpty = isEmpty;
  33511. lodash.isEqual = isEqual;
  33512. lodash.isEqualWith = isEqualWith;
  33513. lodash.isError = isError;
  33514. lodash.isFinite = isFinite;
  33515. lodash.isFunction = isFunction;
  33516. lodash.isInteger = isInteger;
  33517. lodash.isLength = isLength;
  33518. lodash.isMap = isMap;
  33519. lodash.isMatch = isMatch;
  33520. lodash.isMatchWith = isMatchWith;
  33521. lodash.isNaN = isNaN;
  33522. lodash.isNative = isNative;
  33523. lodash.isNil = isNil;
  33524. lodash.isNull = isNull;
  33525. lodash.isNumber = isNumber;
  33526. lodash.isObject = isObject;
  33527. lodash.isObjectLike = isObjectLike;
  33528. lodash.isPlainObject = isPlainObject;
  33529. lodash.isRegExp = isRegExp;
  33530. lodash.isSafeInteger = isSafeInteger;
  33531. lodash.isSet = isSet;
  33532. lodash.isString = isString;
  33533. lodash.isSymbol = isSymbol;
  33534. lodash.isTypedArray = isTypedArray;
  33535. lodash.isUndefined = isUndefined;
  33536. lodash.isWeakMap = isWeakMap;
  33537. lodash.isWeakSet = isWeakSet;
  33538. lodash.join = join;
  33539. lodash.kebabCase = kebabCase;
  33540. lodash.last = last;
  33541. lodash.lastIndexOf = lastIndexOf;
  33542. lodash.lowerCase = lowerCase;
  33543. lodash.lowerFirst = lowerFirst;
  33544. lodash.lt = lt;
  33545. lodash.lte = lte;
  33546. lodash.max = max;
  33547. lodash.maxBy = maxBy;
  33548. lodash.mean = mean;
  33549. lodash.meanBy = meanBy;
  33550. lodash.min = min;
  33551. lodash.minBy = minBy;
  33552. lodash.stubArray = stubArray;
  33553. lodash.stubFalse = stubFalse;
  33554. lodash.stubObject = stubObject;
  33555. lodash.stubString = stubString;
  33556. lodash.stubTrue = stubTrue;
  33557. lodash.multiply = multiply;
  33558. lodash.nth = nth;
  33559. lodash.noConflict = noConflict;
  33560. lodash.noop = noop;
  33561. lodash.now = now;
  33562. lodash.pad = pad;
  33563. lodash.padEnd = padEnd;
  33564. lodash.padStart = padStart;
  33565. lodash.parseInt = parseInt;
  33566. lodash.random = random;
  33567. lodash.reduce = reduce;
  33568. lodash.reduceRight = reduceRight;
  33569. lodash.repeat = repeat;
  33570. lodash.replace = replace;
  33571. lodash.result = result;
  33572. lodash.round = round;
  33573. lodash.runInContext = runInContext;
  33574. lodash.sample = sample;
  33575. lodash.size = size;
  33576. lodash.snakeCase = snakeCase;
  33577. lodash.some = some;
  33578. lodash.sortedIndex = sortedIndex;
  33579. lodash.sortedIndexBy = sortedIndexBy;
  33580. lodash.sortedIndexOf = sortedIndexOf;
  33581. lodash.sortedLastIndex = sortedLastIndex;
  33582. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33583. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33584. lodash.startCase = startCase;
  33585. lodash.startsWith = startsWith;
  33586. lodash.subtract = subtract;
  33587. lodash.sum = sum;
  33588. lodash.sumBy = sumBy;
  33589. lodash.template = template;
  33590. lodash.times = times;
  33591. lodash.toFinite = toFinite;
  33592. lodash.toInteger = toInteger;
  33593. lodash.toLength = toLength;
  33594. lodash.toLower = toLower;
  33595. lodash.toNumber = toNumber;
  33596. lodash.toSafeInteger = toSafeInteger;
  33597. lodash.toString = toString;
  33598. lodash.toUpper = toUpper;
  33599. lodash.trim = trim;
  33600. lodash.trimEnd = trimEnd;
  33601. lodash.trimStart = trimStart;
  33602. lodash.truncate = truncate;
  33603. lodash.unescape = unescape;
  33604. lodash.uniqueId = uniqueId;
  33605. lodash.upperCase = upperCase;
  33606. lodash.upperFirst = upperFirst;
  33607. // Add aliases.
  33608. lodash.each = forEach;
  33609. lodash.eachRight = forEachRight;
  33610. lodash.first = head;
  33611. mixin(lodash, (function() {
  33612. var source = {};
  33613. baseForOwn(lodash, function(func, methodName) {
  33614. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33615. source[methodName] = func;
  33616. }
  33617. });
  33618. return source;
  33619. }()), { 'chain': false });
  33620. /*------------------------------------------------------------------------*/
  33621. /**
  33622. * The semantic version number.
  33623. *
  33624. * @static
  33625. * @memberOf _
  33626. * @type {string}
  33627. */
  33628. lodash.VERSION = VERSION;
  33629. // Assign default placeholders.
  33630. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33631. lodash[methodName].placeholder = lodash;
  33632. });
  33633. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33634. arrayEach(['drop', 'take'], function(methodName, index) {
  33635. LazyWrapper.prototype[methodName] = function(n) {
  33636. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33637. var result = (this.__filtered__ && !index)
  33638. ? new LazyWrapper(this)
  33639. : this.clone();
  33640. if (result.__filtered__) {
  33641. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33642. } else {
  33643. result.__views__.push({
  33644. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33645. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33646. });
  33647. }
  33648. return result;
  33649. };
  33650. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33651. return this.reverse()[methodName](n).reverse();
  33652. };
  33653. });
  33654. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33655. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33656. var type = index + 1,
  33657. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33658. LazyWrapper.prototype[methodName] = function(iteratee) {
  33659. var result = this.clone();
  33660. result.__iteratees__.push({
  33661. 'iteratee': getIteratee(iteratee, 3),
  33662. 'type': type
  33663. });
  33664. result.__filtered__ = result.__filtered__ || isFilter;
  33665. return result;
  33666. };
  33667. });
  33668. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33669. arrayEach(['head', 'last'], function(methodName, index) {
  33670. var takeName = 'take' + (index ? 'Right' : '');
  33671. LazyWrapper.prototype[methodName] = function() {
  33672. return this[takeName](1).value()[0];
  33673. };
  33674. });
  33675. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33676. arrayEach(['initial', 'tail'], function(methodName, index) {
  33677. var dropName = 'drop' + (index ? '' : 'Right');
  33678. LazyWrapper.prototype[methodName] = function() {
  33679. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33680. };
  33681. });
  33682. LazyWrapper.prototype.compact = function() {
  33683. return this.filter(identity);
  33684. };
  33685. LazyWrapper.prototype.find = function(predicate) {
  33686. return this.filter(predicate).head();
  33687. };
  33688. LazyWrapper.prototype.findLast = function(predicate) {
  33689. return this.reverse().find(predicate);
  33690. };
  33691. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33692. if (typeof path == 'function') {
  33693. return new LazyWrapper(this);
  33694. }
  33695. return this.map(function(value) {
  33696. return baseInvoke(value, path, args);
  33697. });
  33698. });
  33699. LazyWrapper.prototype.reject = function(predicate) {
  33700. return this.filter(negate(getIteratee(predicate)));
  33701. };
  33702. LazyWrapper.prototype.slice = function(start, end) {
  33703. start = toInteger(start);
  33704. var result = this;
  33705. if (result.__filtered__ && (start > 0 || end < 0)) {
  33706. return new LazyWrapper(result);
  33707. }
  33708. if (start < 0) {
  33709. result = result.takeRight(-start);
  33710. } else if (start) {
  33711. result = result.drop(start);
  33712. }
  33713. if (end !== undefined) {
  33714. end = toInteger(end);
  33715. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33716. }
  33717. return result;
  33718. };
  33719. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33720. return this.reverse().takeWhile(predicate).reverse();
  33721. };
  33722. LazyWrapper.prototype.toArray = function() {
  33723. return this.take(MAX_ARRAY_LENGTH);
  33724. };
  33725. // Add `LazyWrapper` methods to `lodash.prototype`.
  33726. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33727. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33728. isTaker = /^(?:head|last)$/.test(methodName),
  33729. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33730. retUnwrapped = isTaker || /^find/.test(methodName);
  33731. if (!lodashFunc) {
  33732. return;
  33733. }
  33734. lodash.prototype[methodName] = function() {
  33735. var value = this.__wrapped__,
  33736. args = isTaker ? [1] : arguments,
  33737. isLazy = value instanceof LazyWrapper,
  33738. iteratee = args[0],
  33739. useLazy = isLazy || isArray(value);
  33740. var interceptor = function(value) {
  33741. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33742. return (isTaker && chainAll) ? result[0] : result;
  33743. };
  33744. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33745. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33746. isLazy = useLazy = false;
  33747. }
  33748. var chainAll = this.__chain__,
  33749. isHybrid = !!this.__actions__.length,
  33750. isUnwrapped = retUnwrapped && !chainAll,
  33751. onlyLazy = isLazy && !isHybrid;
  33752. if (!retUnwrapped && useLazy) {
  33753. value = onlyLazy ? value : new LazyWrapper(this);
  33754. var result = func.apply(value, args);
  33755. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33756. return new LodashWrapper(result, chainAll);
  33757. }
  33758. if (isUnwrapped && onlyLazy) {
  33759. return func.apply(this, args);
  33760. }
  33761. result = this.thru(interceptor);
  33762. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33763. };
  33764. });
  33765. // Add `Array` methods to `lodash.prototype`.
  33766. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33767. var func = arrayProto[methodName],
  33768. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33769. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33770. lodash.prototype[methodName] = function() {
  33771. var args = arguments;
  33772. if (retUnwrapped && !this.__chain__) {
  33773. var value = this.value();
  33774. return func.apply(isArray(value) ? value : [], args);
  33775. }
  33776. return this[chainName](function(value) {
  33777. return func.apply(isArray(value) ? value : [], args);
  33778. });
  33779. };
  33780. });
  33781. // Map minified method names to their real names.
  33782. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33783. var lodashFunc = lodash[methodName];
  33784. if (lodashFunc) {
  33785. var key = lodashFunc.name + '';
  33786. if (!hasOwnProperty.call(realNames, key)) {
  33787. realNames[key] = [];
  33788. }
  33789. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33790. }
  33791. });
  33792. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33793. 'name': 'wrapper',
  33794. 'func': undefined
  33795. }];
  33796. // Add methods to `LazyWrapper`.
  33797. LazyWrapper.prototype.clone = lazyClone;
  33798. LazyWrapper.prototype.reverse = lazyReverse;
  33799. LazyWrapper.prototype.value = lazyValue;
  33800. // Add chain sequence methods to the `lodash` wrapper.
  33801. lodash.prototype.at = wrapperAt;
  33802. lodash.prototype.chain = wrapperChain;
  33803. lodash.prototype.commit = wrapperCommit;
  33804. lodash.prototype.next = wrapperNext;
  33805. lodash.prototype.plant = wrapperPlant;
  33806. lodash.prototype.reverse = wrapperReverse;
  33807. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33808. // Add lazy aliases.
  33809. lodash.prototype.first = lodash.prototype.head;
  33810. if (symIterator) {
  33811. lodash.prototype[symIterator] = wrapperToIterator;
  33812. }
  33813. return lodash;
  33814. });
  33815. /*--------------------------------------------------------------------------*/
  33816. // Export lodash.
  33817. var _ = runInContext();
  33818. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33819. if (true) {
  33820. // Expose Lodash on the global object to prevent errors when Lodash is
  33821. // loaded by a script tag in the presence of an AMD loader.
  33822. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33823. // Use `_.noConflict` to remove Lodash from the global object.
  33824. root._ = _;
  33825. // Define as an anonymous module so, through path mapping, it can be
  33826. // referenced as the "underscore" module.
  33827. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33828. return _;
  33829. }).call(exports, __webpack_require__, exports, module),
  33830. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33831. }
  33832. // Check for `exports` after `define` in case a build optimizer adds it.
  33833. else {}
  33834. }.call(this));
  33835. /* 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)))
  33836. /***/ }),
  33837. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33838. /*!***************************************************!*\
  33839. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33840. \***************************************************/
  33841. /*! exports provided: default */
  33842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33843. "use strict";
  33844. __webpack_require__.r(__webpack_exports__);
  33845. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33846. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33847. * @version 1.16.1
  33848. * @license
  33849. * Copyright (c) 2016 Federico Zivolo and contributors
  33850. *
  33851. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33852. * of this software and associated documentation files (the "Software"), to deal
  33853. * in the Software without restriction, including without limitation the rights
  33854. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33855. * copies of the Software, and to permit persons to whom the Software is
  33856. * furnished to do so, subject to the following conditions:
  33857. *
  33858. * The above copyright notice and this permission notice shall be included in all
  33859. * copies or substantial portions of the Software.
  33860. *
  33861. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33862. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33863. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33864. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33865. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33866. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33867. * SOFTWARE.
  33868. */
  33869. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33870. var timeoutDuration = function () {
  33871. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33872. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33873. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33874. return 1;
  33875. }
  33876. }
  33877. return 0;
  33878. }();
  33879. function microtaskDebounce(fn) {
  33880. var called = false;
  33881. return function () {
  33882. if (called) {
  33883. return;
  33884. }
  33885. called = true;
  33886. window.Promise.resolve().then(function () {
  33887. called = false;
  33888. fn();
  33889. });
  33890. };
  33891. }
  33892. function taskDebounce(fn) {
  33893. var scheduled = false;
  33894. return function () {
  33895. if (!scheduled) {
  33896. scheduled = true;
  33897. setTimeout(function () {
  33898. scheduled = false;
  33899. fn();
  33900. }, timeoutDuration);
  33901. }
  33902. };
  33903. }
  33904. var supportsMicroTasks = isBrowser && window.Promise;
  33905. /**
  33906. * Create a debounced version of a method, that's asynchronously deferred
  33907. * but called in the minimum time possible.
  33908. *
  33909. * @method
  33910. * @memberof Popper.Utils
  33911. * @argument {Function} fn
  33912. * @returns {Function}
  33913. */
  33914. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  33915. /**
  33916. * Check if the given variable is a function
  33917. * @method
  33918. * @memberof Popper.Utils
  33919. * @argument {Any} functionToCheck - variable to check
  33920. * @returns {Boolean} answer to: is a function?
  33921. */
  33922. function isFunction(functionToCheck) {
  33923. var getType = {};
  33924. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  33925. }
  33926. /**
  33927. * Get CSS computed property of the given element
  33928. * @method
  33929. * @memberof Popper.Utils
  33930. * @argument {Eement} element
  33931. * @argument {String} property
  33932. */
  33933. function getStyleComputedProperty(element, property) {
  33934. if (element.nodeType !== 1) {
  33935. return [];
  33936. }
  33937. // NOTE: 1 DOM access here
  33938. var window = element.ownerDocument.defaultView;
  33939. var css = window.getComputedStyle(element, null);
  33940. return property ? css[property] : css;
  33941. }
  33942. /**
  33943. * Returns the parentNode or the host of the element
  33944. * @method
  33945. * @memberof Popper.Utils
  33946. * @argument {Element} element
  33947. * @returns {Element} parent
  33948. */
  33949. function getParentNode(element) {
  33950. if (element.nodeName === 'HTML') {
  33951. return element;
  33952. }
  33953. return element.parentNode || element.host;
  33954. }
  33955. /**
  33956. * Returns the scrolling parent of the given element
  33957. * @method
  33958. * @memberof Popper.Utils
  33959. * @argument {Element} element
  33960. * @returns {Element} scroll parent
  33961. */
  33962. function getScrollParent(element) {
  33963. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  33964. if (!element) {
  33965. return document.body;
  33966. }
  33967. switch (element.nodeName) {
  33968. case 'HTML':
  33969. case 'BODY':
  33970. return element.ownerDocument.body;
  33971. case '#document':
  33972. return element.body;
  33973. }
  33974. // Firefox want us to check `-x` and `-y` variations as well
  33975. var _getStyleComputedProp = getStyleComputedProperty(element),
  33976. overflow = _getStyleComputedProp.overflow,
  33977. overflowX = _getStyleComputedProp.overflowX,
  33978. overflowY = _getStyleComputedProp.overflowY;
  33979. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  33980. return element;
  33981. }
  33982. return getScrollParent(getParentNode(element));
  33983. }
  33984. /**
  33985. * Returns the reference node of the reference object, or the reference object itself.
  33986. * @method
  33987. * @memberof Popper.Utils
  33988. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  33989. * @returns {Element} parent
  33990. */
  33991. function getReferenceNode(reference) {
  33992. return reference && reference.referenceNode ? reference.referenceNode : reference;
  33993. }
  33994. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  33995. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  33996. /**
  33997. * Determines if the browser is Internet Explorer
  33998. * @method
  33999. * @memberof Popper.Utils
  34000. * @param {Number} version to check
  34001. * @returns {Boolean} isIE
  34002. */
  34003. function isIE(version) {
  34004. if (version === 11) {
  34005. return isIE11;
  34006. }
  34007. if (version === 10) {
  34008. return isIE10;
  34009. }
  34010. return isIE11 || isIE10;
  34011. }
  34012. /**
  34013. * Returns the offset parent of the given element
  34014. * @method
  34015. * @memberof Popper.Utils
  34016. * @argument {Element} element
  34017. * @returns {Element} offset parent
  34018. */
  34019. function getOffsetParent(element) {
  34020. if (!element) {
  34021. return document.documentElement;
  34022. }
  34023. var noOffsetParent = isIE(10) ? document.body : null;
  34024. // NOTE: 1 DOM access here
  34025. var offsetParent = element.offsetParent || null;
  34026. // Skip hidden elements which don't have an offsetParent
  34027. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34028. offsetParent = (element = element.nextElementSibling).offsetParent;
  34029. }
  34030. var nodeName = offsetParent && offsetParent.nodeName;
  34031. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34032. return element ? element.ownerDocument.documentElement : document.documentElement;
  34033. }
  34034. // .offsetParent will return the closest TH, TD or TABLE in case
  34035. // no offsetParent is present, I hate this job...
  34036. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34037. return getOffsetParent(offsetParent);
  34038. }
  34039. return offsetParent;
  34040. }
  34041. function isOffsetContainer(element) {
  34042. var nodeName = element.nodeName;
  34043. if (nodeName === 'BODY') {
  34044. return false;
  34045. }
  34046. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34047. }
  34048. /**
  34049. * Finds the root node (document, shadowDOM root) of the given element
  34050. * @method
  34051. * @memberof Popper.Utils
  34052. * @argument {Element} node
  34053. * @returns {Element} root node
  34054. */
  34055. function getRoot(node) {
  34056. if (node.parentNode !== null) {
  34057. return getRoot(node.parentNode);
  34058. }
  34059. return node;
  34060. }
  34061. /**
  34062. * Finds the offset parent common to the two provided nodes
  34063. * @method
  34064. * @memberof Popper.Utils
  34065. * @argument {Element} element1
  34066. * @argument {Element} element2
  34067. * @returns {Element} common offset parent
  34068. */
  34069. function findCommonOffsetParent(element1, element2) {
  34070. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34071. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34072. return document.documentElement;
  34073. }
  34074. // Here we make sure to give as "start" the element that comes first in the DOM
  34075. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34076. var start = order ? element1 : element2;
  34077. var end = order ? element2 : element1;
  34078. // Get common ancestor container
  34079. var range = document.createRange();
  34080. range.setStart(start, 0);
  34081. range.setEnd(end, 0);
  34082. var commonAncestorContainer = range.commonAncestorContainer;
  34083. // Both nodes are inside #document
  34084. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34085. if (isOffsetContainer(commonAncestorContainer)) {
  34086. return commonAncestorContainer;
  34087. }
  34088. return getOffsetParent(commonAncestorContainer);
  34089. }
  34090. // one of the nodes is inside shadowDOM, find which one
  34091. var element1root = getRoot(element1);
  34092. if (element1root.host) {
  34093. return findCommonOffsetParent(element1root.host, element2);
  34094. } else {
  34095. return findCommonOffsetParent(element1, getRoot(element2).host);
  34096. }
  34097. }
  34098. /**
  34099. * Gets the scroll value of the given element in the given side (top and left)
  34100. * @method
  34101. * @memberof Popper.Utils
  34102. * @argument {Element} element
  34103. * @argument {String} side `top` or `left`
  34104. * @returns {number} amount of scrolled pixels
  34105. */
  34106. function getScroll(element) {
  34107. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34108. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34109. var nodeName = element.nodeName;
  34110. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34111. var html = element.ownerDocument.documentElement;
  34112. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34113. return scrollingElement[upperSide];
  34114. }
  34115. return element[upperSide];
  34116. }
  34117. /*
  34118. * Sum or subtract the element scroll values (left and top) from a given rect object
  34119. * @method
  34120. * @memberof Popper.Utils
  34121. * @param {Object} rect - Rect object you want to change
  34122. * @param {HTMLElement} element - The element from the function reads the scroll values
  34123. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34124. * @return {Object} rect - The modifier rect object
  34125. */
  34126. function includeScroll(rect, element) {
  34127. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34128. var scrollTop = getScroll(element, 'top');
  34129. var scrollLeft = getScroll(element, 'left');
  34130. var modifier = subtract ? -1 : 1;
  34131. rect.top += scrollTop * modifier;
  34132. rect.bottom += scrollTop * modifier;
  34133. rect.left += scrollLeft * modifier;
  34134. rect.right += scrollLeft * modifier;
  34135. return rect;
  34136. }
  34137. /*
  34138. * Helper to detect borders of a given element
  34139. * @method
  34140. * @memberof Popper.Utils
  34141. * @param {CSSStyleDeclaration} styles
  34142. * Result of `getStyleComputedProperty` on the given element
  34143. * @param {String} axis - `x` or `y`
  34144. * @return {number} borders - The borders size of the given axis
  34145. */
  34146. function getBordersSize(styles, axis) {
  34147. var sideA = axis === 'x' ? 'Left' : 'Top';
  34148. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34149. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34150. }
  34151. function getSize(axis, body, html, computedStyle) {
  34152. 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);
  34153. }
  34154. function getWindowSizes(document) {
  34155. var body = document.body;
  34156. var html = document.documentElement;
  34157. var computedStyle = isIE(10) && getComputedStyle(html);
  34158. return {
  34159. height: getSize('Height', body, html, computedStyle),
  34160. width: getSize('Width', body, html, computedStyle)
  34161. };
  34162. }
  34163. var classCallCheck = function (instance, Constructor) {
  34164. if (!(instance instanceof Constructor)) {
  34165. throw new TypeError("Cannot call a class as a function");
  34166. }
  34167. };
  34168. var createClass = function () {
  34169. function defineProperties(target, props) {
  34170. for (var i = 0; i < props.length; i++) {
  34171. var descriptor = props[i];
  34172. descriptor.enumerable = descriptor.enumerable || false;
  34173. descriptor.configurable = true;
  34174. if ("value" in descriptor) descriptor.writable = true;
  34175. Object.defineProperty(target, descriptor.key, descriptor);
  34176. }
  34177. }
  34178. return function (Constructor, protoProps, staticProps) {
  34179. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34180. if (staticProps) defineProperties(Constructor, staticProps);
  34181. return Constructor;
  34182. };
  34183. }();
  34184. var defineProperty = function (obj, key, value) {
  34185. if (key in obj) {
  34186. Object.defineProperty(obj, key, {
  34187. value: value,
  34188. enumerable: true,
  34189. configurable: true,
  34190. writable: true
  34191. });
  34192. } else {
  34193. obj[key] = value;
  34194. }
  34195. return obj;
  34196. };
  34197. var _extends = Object.assign || function (target) {
  34198. for (var i = 1; i < arguments.length; i++) {
  34199. var source = arguments[i];
  34200. for (var key in source) {
  34201. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34202. target[key] = source[key];
  34203. }
  34204. }
  34205. }
  34206. return target;
  34207. };
  34208. /**
  34209. * Given element offsets, generate an output similar to getBoundingClientRect
  34210. * @method
  34211. * @memberof Popper.Utils
  34212. * @argument {Object} offsets
  34213. * @returns {Object} ClientRect like output
  34214. */
  34215. function getClientRect(offsets) {
  34216. return _extends({}, offsets, {
  34217. right: offsets.left + offsets.width,
  34218. bottom: offsets.top + offsets.height
  34219. });
  34220. }
  34221. /**
  34222. * Get bounding client rect of given element
  34223. * @method
  34224. * @memberof Popper.Utils
  34225. * @param {HTMLElement} element
  34226. * @return {Object} client rect
  34227. */
  34228. function getBoundingClientRect(element) {
  34229. var rect = {};
  34230. // IE10 10 FIX: Please, don't ask, the element isn't
  34231. // considered in DOM in some circumstances...
  34232. // This isn't reproducible in IE10 compatibility mode of IE11
  34233. try {
  34234. if (isIE(10)) {
  34235. rect = element.getBoundingClientRect();
  34236. var scrollTop = getScroll(element, 'top');
  34237. var scrollLeft = getScroll(element, 'left');
  34238. rect.top += scrollTop;
  34239. rect.left += scrollLeft;
  34240. rect.bottom += scrollTop;
  34241. rect.right += scrollLeft;
  34242. } else {
  34243. rect = element.getBoundingClientRect();
  34244. }
  34245. } catch (e) {}
  34246. var result = {
  34247. left: rect.left,
  34248. top: rect.top,
  34249. width: rect.right - rect.left,
  34250. height: rect.bottom - rect.top
  34251. };
  34252. // subtract scrollbar size from sizes
  34253. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34254. var width = sizes.width || element.clientWidth || result.width;
  34255. var height = sizes.height || element.clientHeight || result.height;
  34256. var horizScrollbar = element.offsetWidth - width;
  34257. var vertScrollbar = element.offsetHeight - height;
  34258. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34259. // we make this check conditional for performance reasons
  34260. if (horizScrollbar || vertScrollbar) {
  34261. var styles = getStyleComputedProperty(element);
  34262. horizScrollbar -= getBordersSize(styles, 'x');
  34263. vertScrollbar -= getBordersSize(styles, 'y');
  34264. result.width -= horizScrollbar;
  34265. result.height -= vertScrollbar;
  34266. }
  34267. return getClientRect(result);
  34268. }
  34269. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34270. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34271. var isIE10 = isIE(10);
  34272. var isHTML = parent.nodeName === 'HTML';
  34273. var childrenRect = getBoundingClientRect(children);
  34274. var parentRect = getBoundingClientRect(parent);
  34275. var scrollParent = getScrollParent(children);
  34276. var styles = getStyleComputedProperty(parent);
  34277. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34278. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34279. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34280. if (fixedPosition && isHTML) {
  34281. parentRect.top = Math.max(parentRect.top, 0);
  34282. parentRect.left = Math.max(parentRect.left, 0);
  34283. }
  34284. var offsets = getClientRect({
  34285. top: childrenRect.top - parentRect.top - borderTopWidth,
  34286. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34287. width: childrenRect.width,
  34288. height: childrenRect.height
  34289. });
  34290. offsets.marginTop = 0;
  34291. offsets.marginLeft = 0;
  34292. // Subtract margins of documentElement in case it's being used as parent
  34293. // we do this only on HTML because it's the only element that behaves
  34294. // differently when margins are applied to it. The margins are included in
  34295. // the box of the documentElement, in the other cases not.
  34296. if (!isIE10 && isHTML) {
  34297. var marginTop = parseFloat(styles.marginTop);
  34298. var marginLeft = parseFloat(styles.marginLeft);
  34299. offsets.top -= borderTopWidth - marginTop;
  34300. offsets.bottom -= borderTopWidth - marginTop;
  34301. offsets.left -= borderLeftWidth - marginLeft;
  34302. offsets.right -= borderLeftWidth - marginLeft;
  34303. // Attach marginTop and marginLeft because in some circumstances we may need them
  34304. offsets.marginTop = marginTop;
  34305. offsets.marginLeft = marginLeft;
  34306. }
  34307. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34308. offsets = includeScroll(offsets, parent);
  34309. }
  34310. return offsets;
  34311. }
  34312. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34313. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34314. var html = element.ownerDocument.documentElement;
  34315. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34316. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34317. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34318. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34319. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34320. var offset = {
  34321. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34322. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34323. width: width,
  34324. height: height
  34325. };
  34326. return getClientRect(offset);
  34327. }
  34328. /**
  34329. * Check if the given element is fixed or is inside a fixed parent
  34330. * @method
  34331. * @memberof Popper.Utils
  34332. * @argument {Element} element
  34333. * @argument {Element} customContainer
  34334. * @returns {Boolean} answer to "isFixed?"
  34335. */
  34336. function isFixed(element) {
  34337. var nodeName = element.nodeName;
  34338. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34339. return false;
  34340. }
  34341. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34342. return true;
  34343. }
  34344. var parentNode = getParentNode(element);
  34345. if (!parentNode) {
  34346. return false;
  34347. }
  34348. return isFixed(parentNode);
  34349. }
  34350. /**
  34351. * Finds the first parent of an element that has a transformed property defined
  34352. * @method
  34353. * @memberof Popper.Utils
  34354. * @argument {Element} element
  34355. * @returns {Element} first transformed parent or documentElement
  34356. */
  34357. function getFixedPositionOffsetParent(element) {
  34358. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34359. if (!element || !element.parentElement || isIE()) {
  34360. return document.documentElement;
  34361. }
  34362. var el = element.parentElement;
  34363. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34364. el = el.parentElement;
  34365. }
  34366. return el || document.documentElement;
  34367. }
  34368. /**
  34369. * Computed the boundaries limits and return them
  34370. * @method
  34371. * @memberof Popper.Utils
  34372. * @param {HTMLElement} popper
  34373. * @param {HTMLElement} reference
  34374. * @param {number} padding
  34375. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34376. * @param {Boolean} fixedPosition - Is in fixed position mode
  34377. * @returns {Object} Coordinates of the boundaries
  34378. */
  34379. function getBoundaries(popper, reference, padding, boundariesElement) {
  34380. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34381. // NOTE: 1 DOM access here
  34382. var boundaries = { top: 0, left: 0 };
  34383. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34384. // Handle viewport case
  34385. if (boundariesElement === 'viewport') {
  34386. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34387. } else {
  34388. // Handle other cases based on DOM element used as boundaries
  34389. var boundariesNode = void 0;
  34390. if (boundariesElement === 'scrollParent') {
  34391. boundariesNode = getScrollParent(getParentNode(reference));
  34392. if (boundariesNode.nodeName === 'BODY') {
  34393. boundariesNode = popper.ownerDocument.documentElement;
  34394. }
  34395. } else if (boundariesElement === 'window') {
  34396. boundariesNode = popper.ownerDocument.documentElement;
  34397. } else {
  34398. boundariesNode = boundariesElement;
  34399. }
  34400. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34401. // In case of HTML, we need a different computation
  34402. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34403. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34404. height = _getWindowSizes.height,
  34405. width = _getWindowSizes.width;
  34406. boundaries.top += offsets.top - offsets.marginTop;
  34407. boundaries.bottom = height + offsets.top;
  34408. boundaries.left += offsets.left - offsets.marginLeft;
  34409. boundaries.right = width + offsets.left;
  34410. } else {
  34411. // for all the other DOM elements, this one is good
  34412. boundaries = offsets;
  34413. }
  34414. }
  34415. // Add paddings
  34416. padding = padding || 0;
  34417. var isPaddingNumber = typeof padding === 'number';
  34418. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34419. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34420. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34421. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34422. return boundaries;
  34423. }
  34424. function getArea(_ref) {
  34425. var width = _ref.width,
  34426. height = _ref.height;
  34427. return width * height;
  34428. }
  34429. /**
  34430. * Utility used to transform the `auto` placement to the placement with more
  34431. * available space.
  34432. * @method
  34433. * @memberof Popper.Utils
  34434. * @argument {Object} data - The data object generated by update method
  34435. * @argument {Object} options - Modifiers configuration and options
  34436. * @returns {Object} The data object, properly modified
  34437. */
  34438. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34439. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34440. if (placement.indexOf('auto') === -1) {
  34441. return placement;
  34442. }
  34443. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34444. var rects = {
  34445. top: {
  34446. width: boundaries.width,
  34447. height: refRect.top - boundaries.top
  34448. },
  34449. right: {
  34450. width: boundaries.right - refRect.right,
  34451. height: boundaries.height
  34452. },
  34453. bottom: {
  34454. width: boundaries.width,
  34455. height: boundaries.bottom - refRect.bottom
  34456. },
  34457. left: {
  34458. width: refRect.left - boundaries.left,
  34459. height: boundaries.height
  34460. }
  34461. };
  34462. var sortedAreas = Object.keys(rects).map(function (key) {
  34463. return _extends({
  34464. key: key
  34465. }, rects[key], {
  34466. area: getArea(rects[key])
  34467. });
  34468. }).sort(function (a, b) {
  34469. return b.area - a.area;
  34470. });
  34471. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34472. var width = _ref2.width,
  34473. height = _ref2.height;
  34474. return width >= popper.clientWidth && height >= popper.clientHeight;
  34475. });
  34476. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34477. var variation = placement.split('-')[1];
  34478. return computedPlacement + (variation ? '-' + variation : '');
  34479. }
  34480. /**
  34481. * Get offsets to the reference element
  34482. * @method
  34483. * @memberof Popper.Utils
  34484. * @param {Object} state
  34485. * @param {Element} popper - the popper element
  34486. * @param {Element} reference - the reference element (the popper will be relative to this)
  34487. * @param {Element} fixedPosition - is in fixed position mode
  34488. * @returns {Object} An object containing the offsets which will be applied to the popper
  34489. */
  34490. function getReferenceOffsets(state, popper, reference) {
  34491. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34492. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34493. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34494. }
  34495. /**
  34496. * Get the outer sizes of the given element (offset size + margins)
  34497. * @method
  34498. * @memberof Popper.Utils
  34499. * @argument {Element} element
  34500. * @returns {Object} object containing width and height properties
  34501. */
  34502. function getOuterSizes(element) {
  34503. var window = element.ownerDocument.defaultView;
  34504. var styles = window.getComputedStyle(element);
  34505. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34506. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34507. var result = {
  34508. width: element.offsetWidth + y,
  34509. height: element.offsetHeight + x
  34510. };
  34511. return result;
  34512. }
  34513. /**
  34514. * Get the opposite placement of the given one
  34515. * @method
  34516. * @memberof Popper.Utils
  34517. * @argument {String} placement
  34518. * @returns {String} flipped placement
  34519. */
  34520. function getOppositePlacement(placement) {
  34521. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34522. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34523. return hash[matched];
  34524. });
  34525. }
  34526. /**
  34527. * Get offsets to the popper
  34528. * @method
  34529. * @memberof Popper.Utils
  34530. * @param {Object} position - CSS position the Popper will get applied
  34531. * @param {HTMLElement} popper - the popper element
  34532. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34533. * @param {String} placement - one of the valid placement options
  34534. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34535. */
  34536. function getPopperOffsets(popper, referenceOffsets, placement) {
  34537. placement = placement.split('-')[0];
  34538. // Get popper node sizes
  34539. var popperRect = getOuterSizes(popper);
  34540. // Add position, width and height to our offsets object
  34541. var popperOffsets = {
  34542. width: popperRect.width,
  34543. height: popperRect.height
  34544. };
  34545. // depending by the popper placement we have to compute its offsets slightly differently
  34546. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34547. var mainSide = isHoriz ? 'top' : 'left';
  34548. var secondarySide = isHoriz ? 'left' : 'top';
  34549. var measurement = isHoriz ? 'height' : 'width';
  34550. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34551. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34552. if (placement === secondarySide) {
  34553. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34554. } else {
  34555. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34556. }
  34557. return popperOffsets;
  34558. }
  34559. /**
  34560. * Mimics the `find` method of Array
  34561. * @method
  34562. * @memberof Popper.Utils
  34563. * @argument {Array} arr
  34564. * @argument prop
  34565. * @argument value
  34566. * @returns index or -1
  34567. */
  34568. function find(arr, check) {
  34569. // use native find if supported
  34570. if (Array.prototype.find) {
  34571. return arr.find(check);
  34572. }
  34573. // use `filter` to obtain the same behavior of `find`
  34574. return arr.filter(check)[0];
  34575. }
  34576. /**
  34577. * Return the index of the matching object
  34578. * @method
  34579. * @memberof Popper.Utils
  34580. * @argument {Array} arr
  34581. * @argument prop
  34582. * @argument value
  34583. * @returns index or -1
  34584. */
  34585. function findIndex(arr, prop, value) {
  34586. // use native findIndex if supported
  34587. if (Array.prototype.findIndex) {
  34588. return arr.findIndex(function (cur) {
  34589. return cur[prop] === value;
  34590. });
  34591. }
  34592. // use `find` + `indexOf` if `findIndex` isn't supported
  34593. var match = find(arr, function (obj) {
  34594. return obj[prop] === value;
  34595. });
  34596. return arr.indexOf(match);
  34597. }
  34598. /**
  34599. * Loop trough the list of modifiers and run them in order,
  34600. * each of them will then edit the data object.
  34601. * @method
  34602. * @memberof Popper.Utils
  34603. * @param {dataObject} data
  34604. * @param {Array} modifiers
  34605. * @param {String} ends - Optional modifier name used as stopper
  34606. * @returns {dataObject}
  34607. */
  34608. function runModifiers(modifiers, data, ends) {
  34609. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34610. modifiersToRun.forEach(function (modifier) {
  34611. if (modifier['function']) {
  34612. // eslint-disable-line dot-notation
  34613. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34614. }
  34615. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34616. if (modifier.enabled && isFunction(fn)) {
  34617. // Add properties to offsets to make them a complete clientRect object
  34618. // we do this before each modifier to make sure the previous one doesn't
  34619. // mess with these values
  34620. data.offsets.popper = getClientRect(data.offsets.popper);
  34621. data.offsets.reference = getClientRect(data.offsets.reference);
  34622. data = fn(data, modifier);
  34623. }
  34624. });
  34625. return data;
  34626. }
  34627. /**
  34628. * Updates the position of the popper, computing the new offsets and applying
  34629. * the new style.<br />
  34630. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34631. * @method
  34632. * @memberof Popper
  34633. */
  34634. function update() {
  34635. // if popper is destroyed, don't perform any further update
  34636. if (this.state.isDestroyed) {
  34637. return;
  34638. }
  34639. var data = {
  34640. instance: this,
  34641. styles: {},
  34642. arrowStyles: {},
  34643. attributes: {},
  34644. flipped: false,
  34645. offsets: {}
  34646. };
  34647. // compute reference element offsets
  34648. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34649. // compute auto placement, store placement inside the data object,
  34650. // modifiers will be able to edit `placement` if needed
  34651. // and refer to originalPlacement to know the original value
  34652. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34653. // store the computed placement inside `originalPlacement`
  34654. data.originalPlacement = data.placement;
  34655. data.positionFixed = this.options.positionFixed;
  34656. // compute the popper offsets
  34657. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34658. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34659. // run the modifiers
  34660. data = runModifiers(this.modifiers, data);
  34661. // the first `update` will call `onCreate` callback
  34662. // the other ones will call `onUpdate` callback
  34663. if (!this.state.isCreated) {
  34664. this.state.isCreated = true;
  34665. this.options.onCreate(data);
  34666. } else {
  34667. this.options.onUpdate(data);
  34668. }
  34669. }
  34670. /**
  34671. * Helper used to know if the given modifier is enabled.
  34672. * @method
  34673. * @memberof Popper.Utils
  34674. * @returns {Boolean}
  34675. */
  34676. function isModifierEnabled(modifiers, modifierName) {
  34677. return modifiers.some(function (_ref) {
  34678. var name = _ref.name,
  34679. enabled = _ref.enabled;
  34680. return enabled && name === modifierName;
  34681. });
  34682. }
  34683. /**
  34684. * Get the prefixed supported property name
  34685. * @method
  34686. * @memberof Popper.Utils
  34687. * @argument {String} property (camelCase)
  34688. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34689. */
  34690. function getSupportedPropertyName(property) {
  34691. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34692. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34693. for (var i = 0; i < prefixes.length; i++) {
  34694. var prefix = prefixes[i];
  34695. var toCheck = prefix ? '' + prefix + upperProp : property;
  34696. if (typeof document.body.style[toCheck] !== 'undefined') {
  34697. return toCheck;
  34698. }
  34699. }
  34700. return null;
  34701. }
  34702. /**
  34703. * Destroys the popper.
  34704. * @method
  34705. * @memberof Popper
  34706. */
  34707. function destroy() {
  34708. this.state.isDestroyed = true;
  34709. // touch DOM only if `applyStyle` modifier is enabled
  34710. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34711. this.popper.removeAttribute('x-placement');
  34712. this.popper.style.position = '';
  34713. this.popper.style.top = '';
  34714. this.popper.style.left = '';
  34715. this.popper.style.right = '';
  34716. this.popper.style.bottom = '';
  34717. this.popper.style.willChange = '';
  34718. this.popper.style[getSupportedPropertyName('transform')] = '';
  34719. }
  34720. this.disableEventListeners();
  34721. // remove the popper if user explicitly asked for the deletion on destroy
  34722. // do not use `remove` because IE11 doesn't support it
  34723. if (this.options.removeOnDestroy) {
  34724. this.popper.parentNode.removeChild(this.popper);
  34725. }
  34726. return this;
  34727. }
  34728. /**
  34729. * Get the window associated with the element
  34730. * @argument {Element} element
  34731. * @returns {Window}
  34732. */
  34733. function getWindow(element) {
  34734. var ownerDocument = element.ownerDocument;
  34735. return ownerDocument ? ownerDocument.defaultView : window;
  34736. }
  34737. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34738. var isBody = scrollParent.nodeName === 'BODY';
  34739. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34740. target.addEventListener(event, callback, { passive: true });
  34741. if (!isBody) {
  34742. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34743. }
  34744. scrollParents.push(target);
  34745. }
  34746. /**
  34747. * Setup needed event listeners used to update the popper position
  34748. * @method
  34749. * @memberof Popper.Utils
  34750. * @private
  34751. */
  34752. function setupEventListeners(reference, options, state, updateBound) {
  34753. // Resize event listener on window
  34754. state.updateBound = updateBound;
  34755. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34756. // Scroll event listener on scroll parents
  34757. var scrollElement = getScrollParent(reference);
  34758. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34759. state.scrollElement = scrollElement;
  34760. state.eventsEnabled = true;
  34761. return state;
  34762. }
  34763. /**
  34764. * It will add resize/scroll events and start recalculating
  34765. * position of the popper element when they are triggered.
  34766. * @method
  34767. * @memberof Popper
  34768. */
  34769. function enableEventListeners() {
  34770. if (!this.state.eventsEnabled) {
  34771. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34772. }
  34773. }
  34774. /**
  34775. * Remove event listeners used to update the popper position
  34776. * @method
  34777. * @memberof Popper.Utils
  34778. * @private
  34779. */
  34780. function removeEventListeners(reference, state) {
  34781. // Remove resize event listener on window
  34782. getWindow(reference).removeEventListener('resize', state.updateBound);
  34783. // Remove scroll event listener on scroll parents
  34784. state.scrollParents.forEach(function (target) {
  34785. target.removeEventListener('scroll', state.updateBound);
  34786. });
  34787. // Reset state
  34788. state.updateBound = null;
  34789. state.scrollParents = [];
  34790. state.scrollElement = null;
  34791. state.eventsEnabled = false;
  34792. return state;
  34793. }
  34794. /**
  34795. * It will remove resize/scroll events and won't recalculate popper position
  34796. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34797. * unless you call `update` method manually.
  34798. * @method
  34799. * @memberof Popper
  34800. */
  34801. function disableEventListeners() {
  34802. if (this.state.eventsEnabled) {
  34803. cancelAnimationFrame(this.scheduleUpdate);
  34804. this.state = removeEventListeners(this.reference, this.state);
  34805. }
  34806. }
  34807. /**
  34808. * Tells if a given input is a number
  34809. * @method
  34810. * @memberof Popper.Utils
  34811. * @param {*} input to check
  34812. * @return {Boolean}
  34813. */
  34814. function isNumeric(n) {
  34815. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34816. }
  34817. /**
  34818. * Set the style to the given popper
  34819. * @method
  34820. * @memberof Popper.Utils
  34821. * @argument {Element} element - Element to apply the style to
  34822. * @argument {Object} styles
  34823. * Object with a list of properties and values which will be applied to the element
  34824. */
  34825. function setStyles(element, styles) {
  34826. Object.keys(styles).forEach(function (prop) {
  34827. var unit = '';
  34828. // add unit if the value is numeric and is one of the following
  34829. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34830. unit = 'px';
  34831. }
  34832. element.style[prop] = styles[prop] + unit;
  34833. });
  34834. }
  34835. /**
  34836. * Set the attributes to the given popper
  34837. * @method
  34838. * @memberof Popper.Utils
  34839. * @argument {Element} element - Element to apply the attributes to
  34840. * @argument {Object} styles
  34841. * Object with a list of properties and values which will be applied to the element
  34842. */
  34843. function setAttributes(element, attributes) {
  34844. Object.keys(attributes).forEach(function (prop) {
  34845. var value = attributes[prop];
  34846. if (value !== false) {
  34847. element.setAttribute(prop, attributes[prop]);
  34848. } else {
  34849. element.removeAttribute(prop);
  34850. }
  34851. });
  34852. }
  34853. /**
  34854. * @function
  34855. * @memberof Modifiers
  34856. * @argument {Object} data - The data object generated by `update` method
  34857. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34858. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34859. * @argument {Object} options - Modifiers configuration and options
  34860. * @returns {Object} The same data object
  34861. */
  34862. function applyStyle(data) {
  34863. // any property present in `data.styles` will be applied to the popper,
  34864. // in this way we can make the 3rd party modifiers add custom styles to it
  34865. // Be aware, modifiers could override the properties defined in the previous
  34866. // lines of this modifier!
  34867. setStyles(data.instance.popper, data.styles);
  34868. // any property present in `data.attributes` will be applied to the popper,
  34869. // they will be set as HTML attributes of the element
  34870. setAttributes(data.instance.popper, data.attributes);
  34871. // if arrowElement is defined and arrowStyles has some properties
  34872. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34873. setStyles(data.arrowElement, data.arrowStyles);
  34874. }
  34875. return data;
  34876. }
  34877. /**
  34878. * Set the x-placement attribute before everything else because it could be used
  34879. * to add margins to the popper margins needs to be calculated to get the
  34880. * correct popper offsets.
  34881. * @method
  34882. * @memberof Popper.modifiers
  34883. * @param {HTMLElement} reference - The reference element used to position the popper
  34884. * @param {HTMLElement} popper - The HTML element used as popper
  34885. * @param {Object} options - Popper.js options
  34886. */
  34887. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  34888. // compute reference element offsets
  34889. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  34890. // compute auto placement, store placement inside the data object,
  34891. // modifiers will be able to edit `placement` if needed
  34892. // and refer to originalPlacement to know the original value
  34893. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  34894. popper.setAttribute('x-placement', placement);
  34895. // Apply `position` to popper before anything else because
  34896. // without the position applied we can't guarantee correct computations
  34897. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  34898. return options;
  34899. }
  34900. /**
  34901. * @function
  34902. * @memberof Popper.Utils
  34903. * @argument {Object} data - The data object generated by `update` method
  34904. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  34905. * @returns {Object} The popper's position offsets rounded
  34906. *
  34907. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  34908. * good as it can be within reason.
  34909. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  34910. *
  34911. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  34912. * as well on High DPI screens).
  34913. *
  34914. * Firefox prefers no rounding for positioning and does not have blurriness on
  34915. * high DPI screens.
  34916. *
  34917. * Only horizontal placement and left/right values need to be considered.
  34918. */
  34919. function getRoundedOffsets(data, shouldRound) {
  34920. var _data$offsets = data.offsets,
  34921. popper = _data$offsets.popper,
  34922. reference = _data$offsets.reference;
  34923. var round = Math.round,
  34924. floor = Math.floor;
  34925. var noRound = function noRound(v) {
  34926. return v;
  34927. };
  34928. var referenceWidth = round(reference.width);
  34929. var popperWidth = round(popper.width);
  34930. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  34931. var isVariation = data.placement.indexOf('-') !== -1;
  34932. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  34933. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  34934. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  34935. var verticalToInteger = !shouldRound ? noRound : round;
  34936. return {
  34937. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  34938. top: verticalToInteger(popper.top),
  34939. bottom: verticalToInteger(popper.bottom),
  34940. right: horizontalToInteger(popper.right)
  34941. };
  34942. }
  34943. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  34944. /**
  34945. * @function
  34946. * @memberof Modifiers
  34947. * @argument {Object} data - The data object generated by `update` method
  34948. * @argument {Object} options - Modifiers configuration and options
  34949. * @returns {Object} The data object, properly modified
  34950. */
  34951. function computeStyle(data, options) {
  34952. var x = options.x,
  34953. y = options.y;
  34954. var popper = data.offsets.popper;
  34955. // Remove this legacy support in Popper.js v2
  34956. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  34957. return modifier.name === 'applyStyle';
  34958. }).gpuAcceleration;
  34959. if (legacyGpuAccelerationOption !== undefined) {
  34960. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  34961. }
  34962. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  34963. var offsetParent = getOffsetParent(data.instance.popper);
  34964. var offsetParentRect = getBoundingClientRect(offsetParent);
  34965. // Styles
  34966. var styles = {
  34967. position: popper.position
  34968. };
  34969. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  34970. var sideA = x === 'bottom' ? 'top' : 'bottom';
  34971. var sideB = y === 'right' ? 'left' : 'right';
  34972. // if gpuAcceleration is set to `true` and transform is supported,
  34973. // we use `translate3d` to apply the position to the popper we
  34974. // automatically use the supported prefixed version if needed
  34975. var prefixedProperty = getSupportedPropertyName('transform');
  34976. // now, let's make a step back and look at this code closely (wtf?)
  34977. // If the content of the popper grows once it's been positioned, it
  34978. // may happen that the popper gets misplaced because of the new content
  34979. // overflowing its reference element
  34980. // To avoid this problem, we provide two options (x and y), which allow
  34981. // the consumer to define the offset origin.
  34982. // If we position a popper on top of a reference element, we can set
  34983. // `x` to `top` to make the popper grow towards its top instead of
  34984. // its bottom.
  34985. var left = void 0,
  34986. top = void 0;
  34987. if (sideA === 'bottom') {
  34988. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  34989. // and not the bottom of the html element
  34990. if (offsetParent.nodeName === 'HTML') {
  34991. top = -offsetParent.clientHeight + offsets.bottom;
  34992. } else {
  34993. top = -offsetParentRect.height + offsets.bottom;
  34994. }
  34995. } else {
  34996. top = offsets.top;
  34997. }
  34998. if (sideB === 'right') {
  34999. if (offsetParent.nodeName === 'HTML') {
  35000. left = -offsetParent.clientWidth + offsets.right;
  35001. } else {
  35002. left = -offsetParentRect.width + offsets.right;
  35003. }
  35004. } else {
  35005. left = offsets.left;
  35006. }
  35007. if (gpuAcceleration && prefixedProperty) {
  35008. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35009. styles[sideA] = 0;
  35010. styles[sideB] = 0;
  35011. styles.willChange = 'transform';
  35012. } else {
  35013. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35014. var invertTop = sideA === 'bottom' ? -1 : 1;
  35015. var invertLeft = sideB === 'right' ? -1 : 1;
  35016. styles[sideA] = top * invertTop;
  35017. styles[sideB] = left * invertLeft;
  35018. styles.willChange = sideA + ', ' + sideB;
  35019. }
  35020. // Attributes
  35021. var attributes = {
  35022. 'x-placement': data.placement
  35023. };
  35024. // Update `data` attributes, styles and arrowStyles
  35025. data.attributes = _extends({}, attributes, data.attributes);
  35026. data.styles = _extends({}, styles, data.styles);
  35027. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35028. return data;
  35029. }
  35030. /**
  35031. * Helper used to know if the given modifier depends from another one.<br />
  35032. * It checks if the needed modifier is listed and enabled.
  35033. * @method
  35034. * @memberof Popper.Utils
  35035. * @param {Array} modifiers - list of modifiers
  35036. * @param {String} requestingName - name of requesting modifier
  35037. * @param {String} requestedName - name of requested modifier
  35038. * @returns {Boolean}
  35039. */
  35040. function isModifierRequired(modifiers, requestingName, requestedName) {
  35041. var requesting = find(modifiers, function (_ref) {
  35042. var name = _ref.name;
  35043. return name === requestingName;
  35044. });
  35045. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35046. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35047. });
  35048. if (!isRequired) {
  35049. var _requesting = '`' + requestingName + '`';
  35050. var requested = '`' + requestedName + '`';
  35051. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35052. }
  35053. return isRequired;
  35054. }
  35055. /**
  35056. * @function
  35057. * @memberof Modifiers
  35058. * @argument {Object} data - The data object generated by update method
  35059. * @argument {Object} options - Modifiers configuration and options
  35060. * @returns {Object} The data object, properly modified
  35061. */
  35062. function arrow(data, options) {
  35063. var _data$offsets$arrow;
  35064. // arrow depends on keepTogether in order to work
  35065. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35066. return data;
  35067. }
  35068. var arrowElement = options.element;
  35069. // if arrowElement is a string, suppose it's a CSS selector
  35070. if (typeof arrowElement === 'string') {
  35071. arrowElement = data.instance.popper.querySelector(arrowElement);
  35072. // if arrowElement is not found, don't run the modifier
  35073. if (!arrowElement) {
  35074. return data;
  35075. }
  35076. } else {
  35077. // if the arrowElement isn't a query selector we must check that the
  35078. // provided DOM node is child of its popper node
  35079. if (!data.instance.popper.contains(arrowElement)) {
  35080. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35081. return data;
  35082. }
  35083. }
  35084. var placement = data.placement.split('-')[0];
  35085. var _data$offsets = data.offsets,
  35086. popper = _data$offsets.popper,
  35087. reference = _data$offsets.reference;
  35088. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35089. var len = isVertical ? 'height' : 'width';
  35090. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35091. var side = sideCapitalized.toLowerCase();
  35092. var altSide = isVertical ? 'left' : 'top';
  35093. var opSide = isVertical ? 'bottom' : 'right';
  35094. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35095. //
  35096. // extends keepTogether behavior making sure the popper and its
  35097. // reference have enough pixels in conjunction
  35098. //
  35099. // top/left side
  35100. if (reference[opSide] - arrowElementSize < popper[side]) {
  35101. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35102. }
  35103. // bottom/right side
  35104. if (reference[side] + arrowElementSize > popper[opSide]) {
  35105. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35106. }
  35107. data.offsets.popper = getClientRect(data.offsets.popper);
  35108. // compute center of the popper
  35109. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35110. // Compute the sideValue using the updated popper offsets
  35111. // take popper margin in account because we don't have this info available
  35112. var css = getStyleComputedProperty(data.instance.popper);
  35113. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35114. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35115. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35116. // prevent arrowElement from being placed not contiguously to its popper
  35117. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35118. data.arrowElement = arrowElement;
  35119. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35120. return data;
  35121. }
  35122. /**
  35123. * Get the opposite placement variation of the given one
  35124. * @method
  35125. * @memberof Popper.Utils
  35126. * @argument {String} placement variation
  35127. * @returns {String} flipped placement variation
  35128. */
  35129. function getOppositeVariation(variation) {
  35130. if (variation === 'end') {
  35131. return 'start';
  35132. } else if (variation === 'start') {
  35133. return 'end';
  35134. }
  35135. return variation;
  35136. }
  35137. /**
  35138. * List of accepted placements to use as values of the `placement` option.<br />
  35139. * Valid placements are:
  35140. * - `auto`
  35141. * - `top`
  35142. * - `right`
  35143. * - `bottom`
  35144. * - `left`
  35145. *
  35146. * Each placement can have a variation from this list:
  35147. * - `-start`
  35148. * - `-end`
  35149. *
  35150. * Variations are interpreted easily if you think of them as the left to right
  35151. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35152. * is right.<br />
  35153. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35154. *
  35155. * Some valid examples are:
  35156. * - `top-end` (on top of reference, right aligned)
  35157. * - `right-start` (on right of reference, top aligned)
  35158. * - `bottom` (on bottom, centered)
  35159. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35160. *
  35161. * @static
  35162. * @type {Array}
  35163. * @enum {String}
  35164. * @readonly
  35165. * @method placements
  35166. * @memberof Popper
  35167. */
  35168. 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'];
  35169. // Get rid of `auto` `auto-start` and `auto-end`
  35170. var validPlacements = placements.slice(3);
  35171. /**
  35172. * Given an initial placement, returns all the subsequent placements
  35173. * clockwise (or counter-clockwise).
  35174. *
  35175. * @method
  35176. * @memberof Popper.Utils
  35177. * @argument {String} placement - A valid placement (it accepts variations)
  35178. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35179. * @returns {Array} placements including their variations
  35180. */
  35181. function clockwise(placement) {
  35182. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35183. var index = validPlacements.indexOf(placement);
  35184. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35185. return counter ? arr.reverse() : arr;
  35186. }
  35187. var BEHAVIORS = {
  35188. FLIP: 'flip',
  35189. CLOCKWISE: 'clockwise',
  35190. COUNTERCLOCKWISE: 'counterclockwise'
  35191. };
  35192. /**
  35193. * @function
  35194. * @memberof Modifiers
  35195. * @argument {Object} data - The data object generated by update method
  35196. * @argument {Object} options - Modifiers configuration and options
  35197. * @returns {Object} The data object, properly modified
  35198. */
  35199. function flip(data, options) {
  35200. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35201. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35202. return data;
  35203. }
  35204. if (data.flipped && data.placement === data.originalPlacement) {
  35205. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35206. return data;
  35207. }
  35208. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35209. var placement = data.placement.split('-')[0];
  35210. var placementOpposite = getOppositePlacement(placement);
  35211. var variation = data.placement.split('-')[1] || '';
  35212. var flipOrder = [];
  35213. switch (options.behavior) {
  35214. case BEHAVIORS.FLIP:
  35215. flipOrder = [placement, placementOpposite];
  35216. break;
  35217. case BEHAVIORS.CLOCKWISE:
  35218. flipOrder = clockwise(placement);
  35219. break;
  35220. case BEHAVIORS.COUNTERCLOCKWISE:
  35221. flipOrder = clockwise(placement, true);
  35222. break;
  35223. default:
  35224. flipOrder = options.behavior;
  35225. }
  35226. flipOrder.forEach(function (step, index) {
  35227. if (placement !== step || flipOrder.length === index + 1) {
  35228. return data;
  35229. }
  35230. placement = data.placement.split('-')[0];
  35231. placementOpposite = getOppositePlacement(placement);
  35232. var popperOffsets = data.offsets.popper;
  35233. var refOffsets = data.offsets.reference;
  35234. // using floor because the reference offsets may contain decimals we are not going to consider here
  35235. var floor = Math.floor;
  35236. 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);
  35237. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35238. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35239. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35240. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35241. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35242. // flip the variation if required
  35243. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35244. // flips variation if reference element overflows boundaries
  35245. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35246. // flips variation if popper content overflows boundaries
  35247. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35248. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35249. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35250. // this boolean to detect any flip loop
  35251. data.flipped = true;
  35252. if (overlapsRef || overflowsBoundaries) {
  35253. placement = flipOrder[index + 1];
  35254. }
  35255. if (flippedVariation) {
  35256. variation = getOppositeVariation(variation);
  35257. }
  35258. data.placement = placement + (variation ? '-' + variation : '');
  35259. // this object contains `position`, we want to preserve it along with
  35260. // any additional property we may add in the future
  35261. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35262. data = runModifiers(data.instance.modifiers, data, 'flip');
  35263. }
  35264. });
  35265. return data;
  35266. }
  35267. /**
  35268. * @function
  35269. * @memberof Modifiers
  35270. * @argument {Object} data - The data object generated by update method
  35271. * @argument {Object} options - Modifiers configuration and options
  35272. * @returns {Object} The data object, properly modified
  35273. */
  35274. function keepTogether(data) {
  35275. var _data$offsets = data.offsets,
  35276. popper = _data$offsets.popper,
  35277. reference = _data$offsets.reference;
  35278. var placement = data.placement.split('-')[0];
  35279. var floor = Math.floor;
  35280. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35281. var side = isVertical ? 'right' : 'bottom';
  35282. var opSide = isVertical ? 'left' : 'top';
  35283. var measurement = isVertical ? 'width' : 'height';
  35284. if (popper[side] < floor(reference[opSide])) {
  35285. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35286. }
  35287. if (popper[opSide] > floor(reference[side])) {
  35288. data.offsets.popper[opSide] = floor(reference[side]);
  35289. }
  35290. return data;
  35291. }
  35292. /**
  35293. * Converts a string containing value + unit into a px value number
  35294. * @function
  35295. * @memberof {modifiers~offset}
  35296. * @private
  35297. * @argument {String} str - Value + unit string
  35298. * @argument {String} measurement - `height` or `width`
  35299. * @argument {Object} popperOffsets
  35300. * @argument {Object} referenceOffsets
  35301. * @returns {Number|String}
  35302. * Value in pixels, or original string if no values were extracted
  35303. */
  35304. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35305. // separate value from unit
  35306. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35307. var value = +split[1];
  35308. var unit = split[2];
  35309. // If it's not a number it's an operator, I guess
  35310. if (!value) {
  35311. return str;
  35312. }
  35313. if (unit.indexOf('%') === 0) {
  35314. var element = void 0;
  35315. switch (unit) {
  35316. case '%p':
  35317. element = popperOffsets;
  35318. break;
  35319. case '%':
  35320. case '%r':
  35321. default:
  35322. element = referenceOffsets;
  35323. }
  35324. var rect = getClientRect(element);
  35325. return rect[measurement] / 100 * value;
  35326. } else if (unit === 'vh' || unit === 'vw') {
  35327. // if is a vh or vw, we calculate the size based on the viewport
  35328. var size = void 0;
  35329. if (unit === 'vh') {
  35330. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35331. } else {
  35332. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35333. }
  35334. return size / 100 * value;
  35335. } else {
  35336. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35337. // if is an implicit unit, it's px, and we return just the value
  35338. return value;
  35339. }
  35340. }
  35341. /**
  35342. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35343. * @function
  35344. * @memberof {modifiers~offset}
  35345. * @private
  35346. * @argument {String} offset
  35347. * @argument {Object} popperOffsets
  35348. * @argument {Object} referenceOffsets
  35349. * @argument {String} basePlacement
  35350. * @returns {Array} a two cells array with x and y offsets in numbers
  35351. */
  35352. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35353. var offsets = [0, 0];
  35354. // Use height if placement is left or right and index is 0 otherwise use width
  35355. // in this way the first offset will use an axis and the second one
  35356. // will use the other one
  35357. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35358. // Split the offset string to obtain a list of values and operands
  35359. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35360. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35361. return frag.trim();
  35362. });
  35363. // Detect if the offset string contains a pair of values or a single one
  35364. // they could be separated by comma or space
  35365. var divider = fragments.indexOf(find(fragments, function (frag) {
  35366. return frag.search(/,|\s/) !== -1;
  35367. }));
  35368. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35369. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35370. }
  35371. // If divider is found, we divide the list of values and operands to divide
  35372. // them by ofset X and Y.
  35373. var splitRegex = /\s*,\s*|\s+/;
  35374. 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];
  35375. // Convert the values with units to absolute pixels to allow our computations
  35376. ops = ops.map(function (op, index) {
  35377. // Most of the units rely on the orientation of the popper
  35378. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35379. var mergeWithPrevious = false;
  35380. return op
  35381. // This aggregates any `+` or `-` sign that aren't considered operators
  35382. // e.g.: 10 + +5 => [10, +, +5]
  35383. .reduce(function (a, b) {
  35384. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35385. a[a.length - 1] = b;
  35386. mergeWithPrevious = true;
  35387. return a;
  35388. } else if (mergeWithPrevious) {
  35389. a[a.length - 1] += b;
  35390. mergeWithPrevious = false;
  35391. return a;
  35392. } else {
  35393. return a.concat(b);
  35394. }
  35395. }, [])
  35396. // Here we convert the string values into number values (in px)
  35397. .map(function (str) {
  35398. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35399. });
  35400. });
  35401. // Loop trough the offsets arrays and execute the operations
  35402. ops.forEach(function (op, index) {
  35403. op.forEach(function (frag, index2) {
  35404. if (isNumeric(frag)) {
  35405. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35406. }
  35407. });
  35408. });
  35409. return offsets;
  35410. }
  35411. /**
  35412. * @function
  35413. * @memberof Modifiers
  35414. * @argument {Object} data - The data object generated by update method
  35415. * @argument {Object} options - Modifiers configuration and options
  35416. * @argument {Number|String} options.offset=0
  35417. * The offset value as described in the modifier description
  35418. * @returns {Object} The data object, properly modified
  35419. */
  35420. function offset(data, _ref) {
  35421. var offset = _ref.offset;
  35422. var placement = data.placement,
  35423. _data$offsets = data.offsets,
  35424. popper = _data$offsets.popper,
  35425. reference = _data$offsets.reference;
  35426. var basePlacement = placement.split('-')[0];
  35427. var offsets = void 0;
  35428. if (isNumeric(+offset)) {
  35429. offsets = [+offset, 0];
  35430. } else {
  35431. offsets = parseOffset(offset, popper, reference, basePlacement);
  35432. }
  35433. if (basePlacement === 'left') {
  35434. popper.top += offsets[0];
  35435. popper.left -= offsets[1];
  35436. } else if (basePlacement === 'right') {
  35437. popper.top += offsets[0];
  35438. popper.left += offsets[1];
  35439. } else if (basePlacement === 'top') {
  35440. popper.left += offsets[0];
  35441. popper.top -= offsets[1];
  35442. } else if (basePlacement === 'bottom') {
  35443. popper.left += offsets[0];
  35444. popper.top += offsets[1];
  35445. }
  35446. data.popper = popper;
  35447. return data;
  35448. }
  35449. /**
  35450. * @function
  35451. * @memberof Modifiers
  35452. * @argument {Object} data - The data object generated by `update` method
  35453. * @argument {Object} options - Modifiers configuration and options
  35454. * @returns {Object} The data object, properly modified
  35455. */
  35456. function preventOverflow(data, options) {
  35457. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35458. // If offsetParent is the reference element, we really want to
  35459. // go one step up and use the next offsetParent as reference to
  35460. // avoid to make this modifier completely useless and look like broken
  35461. if (data.instance.reference === boundariesElement) {
  35462. boundariesElement = getOffsetParent(boundariesElement);
  35463. }
  35464. // NOTE: DOM access here
  35465. // resets the popper's position so that the document size can be calculated excluding
  35466. // the size of the popper element itself
  35467. var transformProp = getSupportedPropertyName('transform');
  35468. var popperStyles = data.instance.popper.style; // assignment to help minification
  35469. var top = popperStyles.top,
  35470. left = popperStyles.left,
  35471. transform = popperStyles[transformProp];
  35472. popperStyles.top = '';
  35473. popperStyles.left = '';
  35474. popperStyles[transformProp] = '';
  35475. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35476. // NOTE: DOM access here
  35477. // restores the original style properties after the offsets have been computed
  35478. popperStyles.top = top;
  35479. popperStyles.left = left;
  35480. popperStyles[transformProp] = transform;
  35481. options.boundaries = boundaries;
  35482. var order = options.priority;
  35483. var popper = data.offsets.popper;
  35484. var check = {
  35485. primary: function primary(placement) {
  35486. var value = popper[placement];
  35487. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35488. value = Math.max(popper[placement], boundaries[placement]);
  35489. }
  35490. return defineProperty({}, placement, value);
  35491. },
  35492. secondary: function secondary(placement) {
  35493. var mainSide = placement === 'right' ? 'left' : 'top';
  35494. var value = popper[mainSide];
  35495. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35496. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35497. }
  35498. return defineProperty({}, mainSide, value);
  35499. }
  35500. };
  35501. order.forEach(function (placement) {
  35502. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35503. popper = _extends({}, popper, check[side](placement));
  35504. });
  35505. data.offsets.popper = popper;
  35506. return data;
  35507. }
  35508. /**
  35509. * @function
  35510. * @memberof Modifiers
  35511. * @argument {Object} data - The data object generated by `update` method
  35512. * @argument {Object} options - Modifiers configuration and options
  35513. * @returns {Object} The data object, properly modified
  35514. */
  35515. function shift(data) {
  35516. var placement = data.placement;
  35517. var basePlacement = placement.split('-')[0];
  35518. var shiftvariation = placement.split('-')[1];
  35519. // if shift shiftvariation is specified, run the modifier
  35520. if (shiftvariation) {
  35521. var _data$offsets = data.offsets,
  35522. reference = _data$offsets.reference,
  35523. popper = _data$offsets.popper;
  35524. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35525. var side = isVertical ? 'left' : 'top';
  35526. var measurement = isVertical ? 'width' : 'height';
  35527. var shiftOffsets = {
  35528. start: defineProperty({}, side, reference[side]),
  35529. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35530. };
  35531. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35532. }
  35533. return data;
  35534. }
  35535. /**
  35536. * @function
  35537. * @memberof Modifiers
  35538. * @argument {Object} data - The data object generated by update method
  35539. * @argument {Object} options - Modifiers configuration and options
  35540. * @returns {Object} The data object, properly modified
  35541. */
  35542. function hide(data) {
  35543. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35544. return data;
  35545. }
  35546. var refRect = data.offsets.reference;
  35547. var bound = find(data.instance.modifiers, function (modifier) {
  35548. return modifier.name === 'preventOverflow';
  35549. }).boundaries;
  35550. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35551. // Avoid unnecessary DOM access if visibility hasn't changed
  35552. if (data.hide === true) {
  35553. return data;
  35554. }
  35555. data.hide = true;
  35556. data.attributes['x-out-of-boundaries'] = '';
  35557. } else {
  35558. // Avoid unnecessary DOM access if visibility hasn't changed
  35559. if (data.hide === false) {
  35560. return data;
  35561. }
  35562. data.hide = false;
  35563. data.attributes['x-out-of-boundaries'] = false;
  35564. }
  35565. return data;
  35566. }
  35567. /**
  35568. * @function
  35569. * @memberof Modifiers
  35570. * @argument {Object} data - The data object generated by `update` method
  35571. * @argument {Object} options - Modifiers configuration and options
  35572. * @returns {Object} The data object, properly modified
  35573. */
  35574. function inner(data) {
  35575. var placement = data.placement;
  35576. var basePlacement = placement.split('-')[0];
  35577. var _data$offsets = data.offsets,
  35578. popper = _data$offsets.popper,
  35579. reference = _data$offsets.reference;
  35580. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35581. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35582. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35583. data.placement = getOppositePlacement(placement);
  35584. data.offsets.popper = getClientRect(popper);
  35585. return data;
  35586. }
  35587. /**
  35588. * Modifier function, each modifier can have a function of this type assigned
  35589. * to its `fn` property.<br />
  35590. * These functions will be called on each update, this means that you must
  35591. * make sure they are performant enough to avoid performance bottlenecks.
  35592. *
  35593. * @function ModifierFn
  35594. * @argument {dataObject} data - The data object generated by `update` method
  35595. * @argument {Object} options - Modifiers configuration and options
  35596. * @returns {dataObject} The data object, properly modified
  35597. */
  35598. /**
  35599. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35600. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35601. * needed by the library.
  35602. *
  35603. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35604. * All the other properties are configurations that could be tweaked.
  35605. * @namespace modifiers
  35606. */
  35607. var modifiers = {
  35608. /**
  35609. * Modifier used to shift the popper on the start or end of its reference
  35610. * element.<br />
  35611. * It will read the variation of the `placement` property.<br />
  35612. * It can be one either `-end` or `-start`.
  35613. * @memberof modifiers
  35614. * @inner
  35615. */
  35616. shift: {
  35617. /** @prop {number} order=100 - Index used to define the order of execution */
  35618. order: 100,
  35619. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35620. enabled: true,
  35621. /** @prop {ModifierFn} */
  35622. fn: shift
  35623. },
  35624. /**
  35625. * The `offset` modifier can shift your popper on both its axis.
  35626. *
  35627. * It accepts the following units:
  35628. * - `px` or unit-less, interpreted as pixels
  35629. * - `%` or `%r`, percentage relative to the length of the reference element
  35630. * - `%p`, percentage relative to the length of the popper element
  35631. * - `vw`, CSS viewport width unit
  35632. * - `vh`, CSS viewport height unit
  35633. *
  35634. * For length is intended the main axis relative to the placement of the popper.<br />
  35635. * This means that if the placement is `top` or `bottom`, the length will be the
  35636. * `width`. In case of `left` or `right`, it will be the `height`.
  35637. *
  35638. * You can provide a single value (as `Number` or `String`), or a pair of values
  35639. * as `String` divided by a comma or one (or more) white spaces.<br />
  35640. * The latter is a deprecated method because it leads to confusion and will be
  35641. * removed in v2.<br />
  35642. * Additionally, it accepts additions and subtractions between different units.
  35643. * Note that multiplications and divisions aren't supported.
  35644. *
  35645. * Valid examples are:
  35646. * ```
  35647. * 10
  35648. * '10%'
  35649. * '10, 10'
  35650. * '10%, 10'
  35651. * '10 + 10%'
  35652. * '10 - 5vh + 3%'
  35653. * '-10px + 5vh, 5px - 6%'
  35654. * ```
  35655. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35656. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35657. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35658. *
  35659. * @memberof modifiers
  35660. * @inner
  35661. */
  35662. offset: {
  35663. /** @prop {number} order=200 - Index used to define the order of execution */
  35664. order: 200,
  35665. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35666. enabled: true,
  35667. /** @prop {ModifierFn} */
  35668. fn: offset,
  35669. /** @prop {Number|String} offset=0
  35670. * The offset value as described in the modifier description
  35671. */
  35672. offset: 0
  35673. },
  35674. /**
  35675. * Modifier used to prevent the popper from being positioned outside the boundary.
  35676. *
  35677. * A scenario exists where the reference itself is not within the boundaries.<br />
  35678. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35679. * In this case we need to decide whether the popper should either:
  35680. *
  35681. * - detach from the reference and remain "trapped" in the boundaries, or
  35682. * - if it should ignore the boundary and "escape with its reference"
  35683. *
  35684. * When `escapeWithReference` is set to`true` and reference is completely
  35685. * outside its boundaries, the popper will overflow (or completely leave)
  35686. * the boundaries in order to remain attached to the edge of the reference.
  35687. *
  35688. * @memberof modifiers
  35689. * @inner
  35690. */
  35691. preventOverflow: {
  35692. /** @prop {number} order=300 - Index used to define the order of execution */
  35693. order: 300,
  35694. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35695. enabled: true,
  35696. /** @prop {ModifierFn} */
  35697. fn: preventOverflow,
  35698. /**
  35699. * @prop {Array} [priority=['left','right','top','bottom']]
  35700. * Popper will try to prevent overflow following these priorities by default,
  35701. * then, it could overflow on the left and on top of the `boundariesElement`
  35702. */
  35703. priority: ['left', 'right', 'top', 'bottom'],
  35704. /**
  35705. * @prop {number} padding=5
  35706. * Amount of pixel used to define a minimum distance between the boundaries
  35707. * and the popper. This makes sure the popper always has a little padding
  35708. * between the edges of its container
  35709. */
  35710. padding: 5,
  35711. /**
  35712. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35713. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35714. * `viewport` or any DOM element.
  35715. */
  35716. boundariesElement: 'scrollParent'
  35717. },
  35718. /**
  35719. * Modifier used to make sure the reference and its popper stay near each other
  35720. * without leaving any gap between the two. Especially useful when the arrow is
  35721. * enabled and you want to ensure that it points to its reference element.
  35722. * It cares only about the first axis. You can still have poppers with margin
  35723. * between the popper and its reference element.
  35724. * @memberof modifiers
  35725. * @inner
  35726. */
  35727. keepTogether: {
  35728. /** @prop {number} order=400 - Index used to define the order of execution */
  35729. order: 400,
  35730. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35731. enabled: true,
  35732. /** @prop {ModifierFn} */
  35733. fn: keepTogether
  35734. },
  35735. /**
  35736. * This modifier is used to move the `arrowElement` of the popper to make
  35737. * sure it is positioned between the reference element and its popper element.
  35738. * It will read the outer size of the `arrowElement` node to detect how many
  35739. * pixels of conjunction are needed.
  35740. *
  35741. * It has no effect if no `arrowElement` is provided.
  35742. * @memberof modifiers
  35743. * @inner
  35744. */
  35745. arrow: {
  35746. /** @prop {number} order=500 - Index used to define the order of execution */
  35747. order: 500,
  35748. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35749. enabled: true,
  35750. /** @prop {ModifierFn} */
  35751. fn: arrow,
  35752. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35753. element: '[x-arrow]'
  35754. },
  35755. /**
  35756. * Modifier used to flip the popper's placement when it starts to overlap its
  35757. * reference element.
  35758. *
  35759. * Requires the `preventOverflow` modifier before it in order to work.
  35760. *
  35761. * **NOTE:** this modifier will interrupt the current update cycle and will
  35762. * restart it if it detects the need to flip the placement.
  35763. * @memberof modifiers
  35764. * @inner
  35765. */
  35766. flip: {
  35767. /** @prop {number} order=600 - Index used to define the order of execution */
  35768. order: 600,
  35769. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35770. enabled: true,
  35771. /** @prop {ModifierFn} */
  35772. fn: flip,
  35773. /**
  35774. * @prop {String|Array} behavior='flip'
  35775. * The behavior used to change the popper's placement. It can be one of
  35776. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35777. * placements (with optional variations)
  35778. */
  35779. behavior: 'flip',
  35780. /**
  35781. * @prop {number} padding=5
  35782. * The popper will flip if it hits the edges of the `boundariesElement`
  35783. */
  35784. padding: 5,
  35785. /**
  35786. * @prop {String|HTMLElement} boundariesElement='viewport'
  35787. * The element which will define the boundaries of the popper position.
  35788. * The popper will never be placed outside of the defined boundaries
  35789. * (except if `keepTogether` is enabled)
  35790. */
  35791. boundariesElement: 'viewport',
  35792. /**
  35793. * @prop {Boolean} flipVariations=false
  35794. * The popper will switch placement variation between `-start` and `-end` when
  35795. * the reference element overlaps its boundaries.
  35796. *
  35797. * The original placement should have a set variation.
  35798. */
  35799. flipVariations: false,
  35800. /**
  35801. * @prop {Boolean} flipVariationsByContent=false
  35802. * The popper will switch placement variation between `-start` and `-end` when
  35803. * the popper element overlaps its reference boundaries.
  35804. *
  35805. * The original placement should have a set variation.
  35806. */
  35807. flipVariationsByContent: false
  35808. },
  35809. /**
  35810. * Modifier used to make the popper flow toward the inner of the reference element.
  35811. * By default, when this modifier is disabled, the popper will be placed outside
  35812. * the reference element.
  35813. * @memberof modifiers
  35814. * @inner
  35815. */
  35816. inner: {
  35817. /** @prop {number} order=700 - Index used to define the order of execution */
  35818. order: 700,
  35819. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35820. enabled: false,
  35821. /** @prop {ModifierFn} */
  35822. fn: inner
  35823. },
  35824. /**
  35825. * Modifier used to hide the popper when its reference element is outside of the
  35826. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35827. * be used to hide with a CSS selector the popper when its reference is
  35828. * out of boundaries.
  35829. *
  35830. * Requires the `preventOverflow` modifier before it in order to work.
  35831. * @memberof modifiers
  35832. * @inner
  35833. */
  35834. hide: {
  35835. /** @prop {number} order=800 - Index used to define the order of execution */
  35836. order: 800,
  35837. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35838. enabled: true,
  35839. /** @prop {ModifierFn} */
  35840. fn: hide
  35841. },
  35842. /**
  35843. * Computes the style that will be applied to the popper element to gets
  35844. * properly positioned.
  35845. *
  35846. * Note that this modifier will not touch the DOM, it just prepares the styles
  35847. * so that `applyStyle` modifier can apply it. This separation is useful
  35848. * in case you need to replace `applyStyle` with a custom implementation.
  35849. *
  35850. * This modifier has `850` as `order` value to maintain backward compatibility
  35851. * with previous versions of Popper.js. Expect the modifiers ordering method
  35852. * to change in future major versions of the library.
  35853. *
  35854. * @memberof modifiers
  35855. * @inner
  35856. */
  35857. computeStyle: {
  35858. /** @prop {number} order=850 - Index used to define the order of execution */
  35859. order: 850,
  35860. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35861. enabled: true,
  35862. /** @prop {ModifierFn} */
  35863. fn: computeStyle,
  35864. /**
  35865. * @prop {Boolean} gpuAcceleration=true
  35866. * If true, it uses the CSS 3D transformation to position the popper.
  35867. * Otherwise, it will use the `top` and `left` properties
  35868. */
  35869. gpuAcceleration: true,
  35870. /**
  35871. * @prop {string} [x='bottom']
  35872. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35873. * Change this if your popper should grow in a direction different from `bottom`
  35874. */
  35875. x: 'bottom',
  35876. /**
  35877. * @prop {string} [x='left']
  35878. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35879. * Change this if your popper should grow in a direction different from `right`
  35880. */
  35881. y: 'right'
  35882. },
  35883. /**
  35884. * Applies the computed styles to the popper element.
  35885. *
  35886. * All the DOM manipulations are limited to this modifier. This is useful in case
  35887. * you want to integrate Popper.js inside a framework or view library and you
  35888. * want to delegate all the DOM manipulations to it.
  35889. *
  35890. * Note that if you disable this modifier, you must make sure the popper element
  35891. * has its position set to `absolute` before Popper.js can do its work!
  35892. *
  35893. * Just disable this modifier and define your own to achieve the desired effect.
  35894. *
  35895. * @memberof modifiers
  35896. * @inner
  35897. */
  35898. applyStyle: {
  35899. /** @prop {number} order=900 - Index used to define the order of execution */
  35900. order: 900,
  35901. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35902. enabled: true,
  35903. /** @prop {ModifierFn} */
  35904. fn: applyStyle,
  35905. /** @prop {Function} */
  35906. onLoad: applyStyleOnLoad,
  35907. /**
  35908. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  35909. * @prop {Boolean} gpuAcceleration=true
  35910. * If true, it uses the CSS 3D transformation to position the popper.
  35911. * Otherwise, it will use the `top` and `left` properties
  35912. */
  35913. gpuAcceleration: undefined
  35914. }
  35915. };
  35916. /**
  35917. * The `dataObject` is an object containing all the information used by Popper.js.
  35918. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  35919. * @name dataObject
  35920. * @property {Object} data.instance The Popper.js instance
  35921. * @property {String} data.placement Placement applied to popper
  35922. * @property {String} data.originalPlacement Placement originally defined on init
  35923. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  35924. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  35925. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  35926. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35927. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35928. * @property {Object} data.boundaries Offsets of the popper boundaries
  35929. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  35930. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  35931. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  35932. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  35933. */
  35934. /**
  35935. * Default options provided to Popper.js constructor.<br />
  35936. * These can be overridden using the `options` argument of Popper.js.<br />
  35937. * To override an option, simply pass an object with the same
  35938. * structure of the `options` object, as the 3rd argument. For example:
  35939. * ```
  35940. * new Popper(ref, pop, {
  35941. * modifiers: {
  35942. * preventOverflow: { enabled: false }
  35943. * }
  35944. * })
  35945. * ```
  35946. * @type {Object}
  35947. * @static
  35948. * @memberof Popper
  35949. */
  35950. var Defaults = {
  35951. /**
  35952. * Popper's placement.
  35953. * @prop {Popper.placements} placement='bottom'
  35954. */
  35955. placement: 'bottom',
  35956. /**
  35957. * Set this to true if you want popper to position it self in 'fixed' mode
  35958. * @prop {Boolean} positionFixed=false
  35959. */
  35960. positionFixed: false,
  35961. /**
  35962. * Whether events (resize, scroll) are initially enabled.
  35963. * @prop {Boolean} eventsEnabled=true
  35964. */
  35965. eventsEnabled: true,
  35966. /**
  35967. * Set to true if you want to automatically remove the popper when
  35968. * you call the `destroy` method.
  35969. * @prop {Boolean} removeOnDestroy=false
  35970. */
  35971. removeOnDestroy: false,
  35972. /**
  35973. * Callback called when the popper is created.<br />
  35974. * By default, it is set to no-op.<br />
  35975. * Access Popper.js instance with `data.instance`.
  35976. * @prop {onCreate}
  35977. */
  35978. onCreate: function onCreate() {},
  35979. /**
  35980. * Callback called when the popper is updated. This callback is not called
  35981. * on the initialization/creation of the popper, but only on subsequent
  35982. * updates.<br />
  35983. * By default, it is set to no-op.<br />
  35984. * Access Popper.js instance with `data.instance`.
  35985. * @prop {onUpdate}
  35986. */
  35987. onUpdate: function onUpdate() {},
  35988. /**
  35989. * List of modifiers used to modify the offsets before they are applied to the popper.
  35990. * They provide most of the functionalities of Popper.js.
  35991. * @prop {modifiers}
  35992. */
  35993. modifiers: modifiers
  35994. };
  35995. /**
  35996. * @callback onCreate
  35997. * @param {dataObject} data
  35998. */
  35999. /**
  36000. * @callback onUpdate
  36001. * @param {dataObject} data
  36002. */
  36003. // Utils
  36004. // Methods
  36005. var Popper = function () {
  36006. /**
  36007. * Creates a new Popper.js instance.
  36008. * @class Popper
  36009. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36010. * @param {Element} popper - The HTML / XML element used as the popper
  36011. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36012. * @return {Object} instance - The generated Popper.js instance
  36013. */
  36014. function Popper(reference, popper) {
  36015. var _this = this;
  36016. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36017. classCallCheck(this, Popper);
  36018. this.scheduleUpdate = function () {
  36019. return requestAnimationFrame(_this.update);
  36020. };
  36021. // make update() debounced, so that it only runs at most once-per-tick
  36022. this.update = debounce(this.update.bind(this));
  36023. // with {} we create a new object with the options inside it
  36024. this.options = _extends({}, Popper.Defaults, options);
  36025. // init state
  36026. this.state = {
  36027. isDestroyed: false,
  36028. isCreated: false,
  36029. scrollParents: []
  36030. };
  36031. // get reference and popper elements (allow jQuery wrappers)
  36032. this.reference = reference && reference.jquery ? reference[0] : reference;
  36033. this.popper = popper && popper.jquery ? popper[0] : popper;
  36034. // Deep merge modifiers options
  36035. this.options.modifiers = {};
  36036. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36037. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36038. });
  36039. // Refactoring modifiers' list (Object => Array)
  36040. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36041. return _extends({
  36042. name: name
  36043. }, _this.options.modifiers[name]);
  36044. })
  36045. // sort the modifiers by order
  36046. .sort(function (a, b) {
  36047. return a.order - b.order;
  36048. });
  36049. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36050. // such code is executed in the same order of its modifier
  36051. // they could add new properties to their options configuration
  36052. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36053. this.modifiers.forEach(function (modifierOptions) {
  36054. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36055. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36056. }
  36057. });
  36058. // fire the first update to position the popper in the right place
  36059. this.update();
  36060. var eventsEnabled = this.options.eventsEnabled;
  36061. if (eventsEnabled) {
  36062. // setup event listeners, they will take care of update the position in specific situations
  36063. this.enableEventListeners();
  36064. }
  36065. this.state.eventsEnabled = eventsEnabled;
  36066. }
  36067. // We can't use class properties because they don't get listed in the
  36068. // class prototype and break stuff like Sinon stubs
  36069. createClass(Popper, [{
  36070. key: 'update',
  36071. value: function update$$1() {
  36072. return update.call(this);
  36073. }
  36074. }, {
  36075. key: 'destroy',
  36076. value: function destroy$$1() {
  36077. return destroy.call(this);
  36078. }
  36079. }, {
  36080. key: 'enableEventListeners',
  36081. value: function enableEventListeners$$1() {
  36082. return enableEventListeners.call(this);
  36083. }
  36084. }, {
  36085. key: 'disableEventListeners',
  36086. value: function disableEventListeners$$1() {
  36087. return disableEventListeners.call(this);
  36088. }
  36089. /**
  36090. * Schedules an update. It will run on the next UI update available.
  36091. * @method scheduleUpdate
  36092. * @memberof Popper
  36093. */
  36094. /**
  36095. * Collection of utilities useful when writing custom modifiers.
  36096. * Starting from version 1.7, this method is available only if you
  36097. * include `popper-utils.js` before `popper.js`.
  36098. *
  36099. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36100. * and will be removed in v2! Use the PopperUtils module directly instead.
  36101. * Due to the high instability of the methods contained in Utils, we can't
  36102. * guarantee them to follow semver. Use them at your own risk!
  36103. * @static
  36104. * @private
  36105. * @type {Object}
  36106. * @deprecated since version 1.8
  36107. * @member Utils
  36108. * @memberof Popper
  36109. */
  36110. }]);
  36111. return Popper;
  36112. }();
  36113. /**
  36114. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36115. * and lets you use it as replacement of a real DOM node.<br />
  36116. * You can use this method to position a popper relatively to a set of coordinates
  36117. * in case you don't have a DOM node to use as reference.
  36118. *
  36119. * ```
  36120. * new Popper(referenceObject, popperNode);
  36121. * ```
  36122. *
  36123. * NB: This feature isn't supported in Internet Explorer 10.
  36124. * @name referenceObject
  36125. * @property {Function} data.getBoundingClientRect
  36126. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36127. * @property {number} data.clientWidth
  36128. * An ES6 getter that will return the width of the virtual reference element.
  36129. * @property {number} data.clientHeight
  36130. * An ES6 getter that will return the height of the virtual reference element.
  36131. */
  36132. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36133. Popper.placements = placements;
  36134. Popper.Defaults = Defaults;
  36135. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36136. //# sourceMappingURL=popper.js.map
  36137. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36138. /***/ }),
  36139. /***/ "./node_modules/process/browser.js":
  36140. /*!*****************************************!*\
  36141. !*** ./node_modules/process/browser.js ***!
  36142. \*****************************************/
  36143. /*! no static exports found */
  36144. /***/ (function(module, exports) {
  36145. // shim for using process in browser
  36146. var process = module.exports = {};
  36147. // cached from whatever global is present so that test runners that stub it
  36148. // don't break things. But we need to wrap it in a try catch in case it is
  36149. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36150. // function because try/catches deoptimize in certain engines.
  36151. var cachedSetTimeout;
  36152. var cachedClearTimeout;
  36153. function defaultSetTimout() {
  36154. throw new Error('setTimeout has not been defined');
  36155. }
  36156. function defaultClearTimeout () {
  36157. throw new Error('clearTimeout has not been defined');
  36158. }
  36159. (function () {
  36160. try {
  36161. if (typeof setTimeout === 'function') {
  36162. cachedSetTimeout = setTimeout;
  36163. } else {
  36164. cachedSetTimeout = defaultSetTimout;
  36165. }
  36166. } catch (e) {
  36167. cachedSetTimeout = defaultSetTimout;
  36168. }
  36169. try {
  36170. if (typeof clearTimeout === 'function') {
  36171. cachedClearTimeout = clearTimeout;
  36172. } else {
  36173. cachedClearTimeout = defaultClearTimeout;
  36174. }
  36175. } catch (e) {
  36176. cachedClearTimeout = defaultClearTimeout;
  36177. }
  36178. } ())
  36179. function runTimeout(fun) {
  36180. if (cachedSetTimeout === setTimeout) {
  36181. //normal enviroments in sane situations
  36182. return setTimeout(fun, 0);
  36183. }
  36184. // if setTimeout wasn't available but was latter defined
  36185. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36186. cachedSetTimeout = setTimeout;
  36187. return setTimeout(fun, 0);
  36188. }
  36189. try {
  36190. // when when somebody has screwed with setTimeout but no I.E. maddness
  36191. return cachedSetTimeout(fun, 0);
  36192. } catch(e){
  36193. try {
  36194. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36195. return cachedSetTimeout.call(null, fun, 0);
  36196. } catch(e){
  36197. // 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
  36198. return cachedSetTimeout.call(this, fun, 0);
  36199. }
  36200. }
  36201. }
  36202. function runClearTimeout(marker) {
  36203. if (cachedClearTimeout === clearTimeout) {
  36204. //normal enviroments in sane situations
  36205. return clearTimeout(marker);
  36206. }
  36207. // if clearTimeout wasn't available but was latter defined
  36208. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36209. cachedClearTimeout = clearTimeout;
  36210. return clearTimeout(marker);
  36211. }
  36212. try {
  36213. // when when somebody has screwed with setTimeout but no I.E. maddness
  36214. return cachedClearTimeout(marker);
  36215. } catch (e){
  36216. try {
  36217. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36218. return cachedClearTimeout.call(null, marker);
  36219. } catch (e){
  36220. // 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.
  36221. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36222. return cachedClearTimeout.call(this, marker);
  36223. }
  36224. }
  36225. }
  36226. var queue = [];
  36227. var draining = false;
  36228. var currentQueue;
  36229. var queueIndex = -1;
  36230. function cleanUpNextTick() {
  36231. if (!draining || !currentQueue) {
  36232. return;
  36233. }
  36234. draining = false;
  36235. if (currentQueue.length) {
  36236. queue = currentQueue.concat(queue);
  36237. } else {
  36238. queueIndex = -1;
  36239. }
  36240. if (queue.length) {
  36241. drainQueue();
  36242. }
  36243. }
  36244. function drainQueue() {
  36245. if (draining) {
  36246. return;
  36247. }
  36248. var timeout = runTimeout(cleanUpNextTick);
  36249. draining = true;
  36250. var len = queue.length;
  36251. while(len) {
  36252. currentQueue = queue;
  36253. queue = [];
  36254. while (++queueIndex < len) {
  36255. if (currentQueue) {
  36256. currentQueue[queueIndex].run();
  36257. }
  36258. }
  36259. queueIndex = -1;
  36260. len = queue.length;
  36261. }
  36262. currentQueue = null;
  36263. draining = false;
  36264. runClearTimeout(timeout);
  36265. }
  36266. process.nextTick = function (fun) {
  36267. var args = new Array(arguments.length - 1);
  36268. if (arguments.length > 1) {
  36269. for (var i = 1; i < arguments.length; i++) {
  36270. args[i - 1] = arguments[i];
  36271. }
  36272. }
  36273. queue.push(new Item(fun, args));
  36274. if (queue.length === 1 && !draining) {
  36275. runTimeout(drainQueue);
  36276. }
  36277. };
  36278. // v8 likes predictible objects
  36279. function Item(fun, array) {
  36280. this.fun = fun;
  36281. this.array = array;
  36282. }
  36283. Item.prototype.run = function () {
  36284. this.fun.apply(null, this.array);
  36285. };
  36286. process.title = 'browser';
  36287. process.browser = true;
  36288. process.env = {};
  36289. process.argv = [];
  36290. process.version = ''; // empty string to avoid regexp issues
  36291. process.versions = {};
  36292. function noop() {}
  36293. process.on = noop;
  36294. process.addListener = noop;
  36295. process.once = noop;
  36296. process.off = noop;
  36297. process.removeListener = noop;
  36298. process.removeAllListeners = noop;
  36299. process.emit = noop;
  36300. process.prependListener = noop;
  36301. process.prependOnceListener = noop;
  36302. process.listeners = function (name) { return [] }
  36303. process.binding = function (name) {
  36304. throw new Error('process.binding is not supported');
  36305. };
  36306. process.cwd = function () { return '/' };
  36307. process.chdir = function (dir) {
  36308. throw new Error('process.chdir is not supported');
  36309. };
  36310. process.umask = function() { return 0; };
  36311. /***/ }),
  36312. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36313. /*!***************************************************!*\
  36314. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36315. \***************************************************/
  36316. /*! no static exports found */
  36317. /***/ (function(module, exports, __webpack_require__) {
  36318. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36319. * Pusher JavaScript Library v5.0.3
  36320. * https://pusher.com/
  36321. *
  36322. * Copyright 2017, Pusher
  36323. * Released under the MIT licence.
  36324. */
  36325. (function webpackUniversalModuleDefinition(root, factory) {
  36326. if(true)
  36327. module.exports = factory();
  36328. else {}
  36329. })(window, function() {
  36330. return /******/ (function(modules) { // webpackBootstrap
  36331. /******/ // The module cache
  36332. /******/ var installedModules = {};
  36333. /******/
  36334. /******/ // The require function
  36335. /******/ function __webpack_require__(moduleId) {
  36336. /******/
  36337. /******/ // Check if module is in cache
  36338. /******/ if(installedModules[moduleId]) {
  36339. /******/ return installedModules[moduleId].exports;
  36340. /******/ }
  36341. /******/ // Create a new module (and put it into the cache)
  36342. /******/ var module = installedModules[moduleId] = {
  36343. /******/ i: moduleId,
  36344. /******/ l: false,
  36345. /******/ exports: {}
  36346. /******/ };
  36347. /******/
  36348. /******/ // Execute the module function
  36349. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36350. /******/
  36351. /******/ // Flag the module as loaded
  36352. /******/ module.l = true;
  36353. /******/
  36354. /******/ // Return the exports of the module
  36355. /******/ return module.exports;
  36356. /******/ }
  36357. /******/
  36358. /******/
  36359. /******/ // expose the modules object (__webpack_modules__)
  36360. /******/ __webpack_require__.m = modules;
  36361. /******/
  36362. /******/ // expose the module cache
  36363. /******/ __webpack_require__.c = installedModules;
  36364. /******/
  36365. /******/ // define getter function for harmony exports
  36366. /******/ __webpack_require__.d = function(exports, name, getter) {
  36367. /******/ if(!__webpack_require__.o(exports, name)) {
  36368. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36369. /******/ }
  36370. /******/ };
  36371. /******/
  36372. /******/ // define __esModule on exports
  36373. /******/ __webpack_require__.r = function(exports) {
  36374. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36375. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36376. /******/ }
  36377. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36378. /******/ };
  36379. /******/
  36380. /******/ // create a fake namespace object
  36381. /******/ // mode & 1: value is a module id, require it
  36382. /******/ // mode & 2: merge all properties of value into the ns
  36383. /******/ // mode & 4: return value when already ns object
  36384. /******/ // mode & 8|1: behave like require
  36385. /******/ __webpack_require__.t = function(value, mode) {
  36386. /******/ if(mode & 1) value = __webpack_require__(value);
  36387. /******/ if(mode & 8) return value;
  36388. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36389. /******/ var ns = Object.create(null);
  36390. /******/ __webpack_require__.r(ns);
  36391. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36392. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36393. /******/ return ns;
  36394. /******/ };
  36395. /******/
  36396. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36397. /******/ __webpack_require__.n = function(module) {
  36398. /******/ var getter = module && module.__esModule ?
  36399. /******/ function getDefault() { return module['default']; } :
  36400. /******/ function getModuleExports() { return module; };
  36401. /******/ __webpack_require__.d(getter, 'a', getter);
  36402. /******/ return getter;
  36403. /******/ };
  36404. /******/
  36405. /******/ // Object.prototype.hasOwnProperty.call
  36406. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36407. /******/
  36408. /******/ // __webpack_public_path__
  36409. /******/ __webpack_require__.p = "";
  36410. /******/
  36411. /******/
  36412. /******/ // Load entry module and return exports
  36413. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36414. /******/ })
  36415. /************************************************************************/
  36416. /******/ ([
  36417. /* 0 */
  36418. /***/ (function(module, exports, __webpack_require__) {
  36419. (function(nacl) {
  36420. 'use strict';
  36421. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36422. // Public domain.
  36423. //
  36424. // Implementation derived from TweetNaCl version 20140427.
  36425. // See for details: http://tweetnacl.cr.yp.to/
  36426. var gf = function(init) {
  36427. var i, r = new Float64Array(16);
  36428. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36429. return r;
  36430. };
  36431. // Pluggable, initialized in high-level API below.
  36432. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36433. var _0 = new Uint8Array(16);
  36434. var _9 = new Uint8Array(32); _9[0] = 9;
  36435. var gf0 = gf(),
  36436. gf1 = gf([1]),
  36437. _121665 = gf([0xdb41, 1]),
  36438. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36439. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36440. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36441. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36442. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36443. function ts64(x, i, h, l) {
  36444. x[i] = (h >> 24) & 0xff;
  36445. x[i+1] = (h >> 16) & 0xff;
  36446. x[i+2] = (h >> 8) & 0xff;
  36447. x[i+3] = h & 0xff;
  36448. x[i+4] = (l >> 24) & 0xff;
  36449. x[i+5] = (l >> 16) & 0xff;
  36450. x[i+6] = (l >> 8) & 0xff;
  36451. x[i+7] = l & 0xff;
  36452. }
  36453. function vn(x, xi, y, yi, n) {
  36454. var i,d = 0;
  36455. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36456. return (1 & ((d - 1) >>> 8)) - 1;
  36457. }
  36458. function crypto_verify_16(x, xi, y, yi) {
  36459. return vn(x,xi,y,yi,16);
  36460. }
  36461. function crypto_verify_32(x, xi, y, yi) {
  36462. return vn(x,xi,y,yi,32);
  36463. }
  36464. function core_salsa20(o, p, k, c) {
  36465. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36466. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36467. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36468. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36469. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36470. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36471. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36472. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36473. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36474. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36475. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36476. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36477. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36478. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36479. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36480. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36481. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36482. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36483. x15 = j15, u;
  36484. for (var i = 0; i < 20; i += 2) {
  36485. u = x0 + x12 | 0;
  36486. x4 ^= u<<7 | u>>>(32-7);
  36487. u = x4 + x0 | 0;
  36488. x8 ^= u<<9 | u>>>(32-9);
  36489. u = x8 + x4 | 0;
  36490. x12 ^= u<<13 | u>>>(32-13);
  36491. u = x12 + x8 | 0;
  36492. x0 ^= u<<18 | u>>>(32-18);
  36493. u = x5 + x1 | 0;
  36494. x9 ^= u<<7 | u>>>(32-7);
  36495. u = x9 + x5 | 0;
  36496. x13 ^= u<<9 | u>>>(32-9);
  36497. u = x13 + x9 | 0;
  36498. x1 ^= u<<13 | u>>>(32-13);
  36499. u = x1 + x13 | 0;
  36500. x5 ^= u<<18 | u>>>(32-18);
  36501. u = x10 + x6 | 0;
  36502. x14 ^= u<<7 | u>>>(32-7);
  36503. u = x14 + x10 | 0;
  36504. x2 ^= u<<9 | u>>>(32-9);
  36505. u = x2 + x14 | 0;
  36506. x6 ^= u<<13 | u>>>(32-13);
  36507. u = x6 + x2 | 0;
  36508. x10 ^= u<<18 | u>>>(32-18);
  36509. u = x15 + x11 | 0;
  36510. x3 ^= u<<7 | u>>>(32-7);
  36511. u = x3 + x15 | 0;
  36512. x7 ^= u<<9 | u>>>(32-9);
  36513. u = x7 + x3 | 0;
  36514. x11 ^= u<<13 | u>>>(32-13);
  36515. u = x11 + x7 | 0;
  36516. x15 ^= u<<18 | u>>>(32-18);
  36517. u = x0 + x3 | 0;
  36518. x1 ^= u<<7 | u>>>(32-7);
  36519. u = x1 + x0 | 0;
  36520. x2 ^= u<<9 | u>>>(32-9);
  36521. u = x2 + x1 | 0;
  36522. x3 ^= u<<13 | u>>>(32-13);
  36523. u = x3 + x2 | 0;
  36524. x0 ^= u<<18 | u>>>(32-18);
  36525. u = x5 + x4 | 0;
  36526. x6 ^= u<<7 | u>>>(32-7);
  36527. u = x6 + x5 | 0;
  36528. x7 ^= u<<9 | u>>>(32-9);
  36529. u = x7 + x6 | 0;
  36530. x4 ^= u<<13 | u>>>(32-13);
  36531. u = x4 + x7 | 0;
  36532. x5 ^= u<<18 | u>>>(32-18);
  36533. u = x10 + x9 | 0;
  36534. x11 ^= u<<7 | u>>>(32-7);
  36535. u = x11 + x10 | 0;
  36536. x8 ^= u<<9 | u>>>(32-9);
  36537. u = x8 + x11 | 0;
  36538. x9 ^= u<<13 | u>>>(32-13);
  36539. u = x9 + x8 | 0;
  36540. x10 ^= u<<18 | u>>>(32-18);
  36541. u = x15 + x14 | 0;
  36542. x12 ^= u<<7 | u>>>(32-7);
  36543. u = x12 + x15 | 0;
  36544. x13 ^= u<<9 | u>>>(32-9);
  36545. u = x13 + x12 | 0;
  36546. x14 ^= u<<13 | u>>>(32-13);
  36547. u = x14 + x13 | 0;
  36548. x15 ^= u<<18 | u>>>(32-18);
  36549. }
  36550. x0 = x0 + j0 | 0;
  36551. x1 = x1 + j1 | 0;
  36552. x2 = x2 + j2 | 0;
  36553. x3 = x3 + j3 | 0;
  36554. x4 = x4 + j4 | 0;
  36555. x5 = x5 + j5 | 0;
  36556. x6 = x6 + j6 | 0;
  36557. x7 = x7 + j7 | 0;
  36558. x8 = x8 + j8 | 0;
  36559. x9 = x9 + j9 | 0;
  36560. x10 = x10 + j10 | 0;
  36561. x11 = x11 + j11 | 0;
  36562. x12 = x12 + j12 | 0;
  36563. x13 = x13 + j13 | 0;
  36564. x14 = x14 + j14 | 0;
  36565. x15 = x15 + j15 | 0;
  36566. o[ 0] = x0 >>> 0 & 0xff;
  36567. o[ 1] = x0 >>> 8 & 0xff;
  36568. o[ 2] = x0 >>> 16 & 0xff;
  36569. o[ 3] = x0 >>> 24 & 0xff;
  36570. o[ 4] = x1 >>> 0 & 0xff;
  36571. o[ 5] = x1 >>> 8 & 0xff;
  36572. o[ 6] = x1 >>> 16 & 0xff;
  36573. o[ 7] = x1 >>> 24 & 0xff;
  36574. o[ 8] = x2 >>> 0 & 0xff;
  36575. o[ 9] = x2 >>> 8 & 0xff;
  36576. o[10] = x2 >>> 16 & 0xff;
  36577. o[11] = x2 >>> 24 & 0xff;
  36578. o[12] = x3 >>> 0 & 0xff;
  36579. o[13] = x3 >>> 8 & 0xff;
  36580. o[14] = x3 >>> 16 & 0xff;
  36581. o[15] = x3 >>> 24 & 0xff;
  36582. o[16] = x4 >>> 0 & 0xff;
  36583. o[17] = x4 >>> 8 & 0xff;
  36584. o[18] = x4 >>> 16 & 0xff;
  36585. o[19] = x4 >>> 24 & 0xff;
  36586. o[20] = x5 >>> 0 & 0xff;
  36587. o[21] = x5 >>> 8 & 0xff;
  36588. o[22] = x5 >>> 16 & 0xff;
  36589. o[23] = x5 >>> 24 & 0xff;
  36590. o[24] = x6 >>> 0 & 0xff;
  36591. o[25] = x6 >>> 8 & 0xff;
  36592. o[26] = x6 >>> 16 & 0xff;
  36593. o[27] = x6 >>> 24 & 0xff;
  36594. o[28] = x7 >>> 0 & 0xff;
  36595. o[29] = x7 >>> 8 & 0xff;
  36596. o[30] = x7 >>> 16 & 0xff;
  36597. o[31] = x7 >>> 24 & 0xff;
  36598. o[32] = x8 >>> 0 & 0xff;
  36599. o[33] = x8 >>> 8 & 0xff;
  36600. o[34] = x8 >>> 16 & 0xff;
  36601. o[35] = x8 >>> 24 & 0xff;
  36602. o[36] = x9 >>> 0 & 0xff;
  36603. o[37] = x9 >>> 8 & 0xff;
  36604. o[38] = x9 >>> 16 & 0xff;
  36605. o[39] = x9 >>> 24 & 0xff;
  36606. o[40] = x10 >>> 0 & 0xff;
  36607. o[41] = x10 >>> 8 & 0xff;
  36608. o[42] = x10 >>> 16 & 0xff;
  36609. o[43] = x10 >>> 24 & 0xff;
  36610. o[44] = x11 >>> 0 & 0xff;
  36611. o[45] = x11 >>> 8 & 0xff;
  36612. o[46] = x11 >>> 16 & 0xff;
  36613. o[47] = x11 >>> 24 & 0xff;
  36614. o[48] = x12 >>> 0 & 0xff;
  36615. o[49] = x12 >>> 8 & 0xff;
  36616. o[50] = x12 >>> 16 & 0xff;
  36617. o[51] = x12 >>> 24 & 0xff;
  36618. o[52] = x13 >>> 0 & 0xff;
  36619. o[53] = x13 >>> 8 & 0xff;
  36620. o[54] = x13 >>> 16 & 0xff;
  36621. o[55] = x13 >>> 24 & 0xff;
  36622. o[56] = x14 >>> 0 & 0xff;
  36623. o[57] = x14 >>> 8 & 0xff;
  36624. o[58] = x14 >>> 16 & 0xff;
  36625. o[59] = x14 >>> 24 & 0xff;
  36626. o[60] = x15 >>> 0 & 0xff;
  36627. o[61] = x15 >>> 8 & 0xff;
  36628. o[62] = x15 >>> 16 & 0xff;
  36629. o[63] = x15 >>> 24 & 0xff;
  36630. }
  36631. function core_hsalsa20(o,p,k,c) {
  36632. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36633. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36634. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36635. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36636. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36637. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36638. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36639. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36640. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36641. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36642. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36643. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36644. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36645. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36646. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36647. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36648. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36649. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36650. x15 = j15, u;
  36651. for (var i = 0; i < 20; i += 2) {
  36652. u = x0 + x12 | 0;
  36653. x4 ^= u<<7 | u>>>(32-7);
  36654. u = x4 + x0 | 0;
  36655. x8 ^= u<<9 | u>>>(32-9);
  36656. u = x8 + x4 | 0;
  36657. x12 ^= u<<13 | u>>>(32-13);
  36658. u = x12 + x8 | 0;
  36659. x0 ^= u<<18 | u>>>(32-18);
  36660. u = x5 + x1 | 0;
  36661. x9 ^= u<<7 | u>>>(32-7);
  36662. u = x9 + x5 | 0;
  36663. x13 ^= u<<9 | u>>>(32-9);
  36664. u = x13 + x9 | 0;
  36665. x1 ^= u<<13 | u>>>(32-13);
  36666. u = x1 + x13 | 0;
  36667. x5 ^= u<<18 | u>>>(32-18);
  36668. u = x10 + x6 | 0;
  36669. x14 ^= u<<7 | u>>>(32-7);
  36670. u = x14 + x10 | 0;
  36671. x2 ^= u<<9 | u>>>(32-9);
  36672. u = x2 + x14 | 0;
  36673. x6 ^= u<<13 | u>>>(32-13);
  36674. u = x6 + x2 | 0;
  36675. x10 ^= u<<18 | u>>>(32-18);
  36676. u = x15 + x11 | 0;
  36677. x3 ^= u<<7 | u>>>(32-7);
  36678. u = x3 + x15 | 0;
  36679. x7 ^= u<<9 | u>>>(32-9);
  36680. u = x7 + x3 | 0;
  36681. x11 ^= u<<13 | u>>>(32-13);
  36682. u = x11 + x7 | 0;
  36683. x15 ^= u<<18 | u>>>(32-18);
  36684. u = x0 + x3 | 0;
  36685. x1 ^= u<<7 | u>>>(32-7);
  36686. u = x1 + x0 | 0;
  36687. x2 ^= u<<9 | u>>>(32-9);
  36688. u = x2 + x1 | 0;
  36689. x3 ^= u<<13 | u>>>(32-13);
  36690. u = x3 + x2 | 0;
  36691. x0 ^= u<<18 | u>>>(32-18);
  36692. u = x5 + x4 | 0;
  36693. x6 ^= u<<7 | u>>>(32-7);
  36694. u = x6 + x5 | 0;
  36695. x7 ^= u<<9 | u>>>(32-9);
  36696. u = x7 + x6 | 0;
  36697. x4 ^= u<<13 | u>>>(32-13);
  36698. u = x4 + x7 | 0;
  36699. x5 ^= u<<18 | u>>>(32-18);
  36700. u = x10 + x9 | 0;
  36701. x11 ^= u<<7 | u>>>(32-7);
  36702. u = x11 + x10 | 0;
  36703. x8 ^= u<<9 | u>>>(32-9);
  36704. u = x8 + x11 | 0;
  36705. x9 ^= u<<13 | u>>>(32-13);
  36706. u = x9 + x8 | 0;
  36707. x10 ^= u<<18 | u>>>(32-18);
  36708. u = x15 + x14 | 0;
  36709. x12 ^= u<<7 | u>>>(32-7);
  36710. u = x12 + x15 | 0;
  36711. x13 ^= u<<9 | u>>>(32-9);
  36712. u = x13 + x12 | 0;
  36713. x14 ^= u<<13 | u>>>(32-13);
  36714. u = x14 + x13 | 0;
  36715. x15 ^= u<<18 | u>>>(32-18);
  36716. }
  36717. o[ 0] = x0 >>> 0 & 0xff;
  36718. o[ 1] = x0 >>> 8 & 0xff;
  36719. o[ 2] = x0 >>> 16 & 0xff;
  36720. o[ 3] = x0 >>> 24 & 0xff;
  36721. o[ 4] = x5 >>> 0 & 0xff;
  36722. o[ 5] = x5 >>> 8 & 0xff;
  36723. o[ 6] = x5 >>> 16 & 0xff;
  36724. o[ 7] = x5 >>> 24 & 0xff;
  36725. o[ 8] = x10 >>> 0 & 0xff;
  36726. o[ 9] = x10 >>> 8 & 0xff;
  36727. o[10] = x10 >>> 16 & 0xff;
  36728. o[11] = x10 >>> 24 & 0xff;
  36729. o[12] = x15 >>> 0 & 0xff;
  36730. o[13] = x15 >>> 8 & 0xff;
  36731. o[14] = x15 >>> 16 & 0xff;
  36732. o[15] = x15 >>> 24 & 0xff;
  36733. o[16] = x6 >>> 0 & 0xff;
  36734. o[17] = x6 >>> 8 & 0xff;
  36735. o[18] = x6 >>> 16 & 0xff;
  36736. o[19] = x6 >>> 24 & 0xff;
  36737. o[20] = x7 >>> 0 & 0xff;
  36738. o[21] = x7 >>> 8 & 0xff;
  36739. o[22] = x7 >>> 16 & 0xff;
  36740. o[23] = x7 >>> 24 & 0xff;
  36741. o[24] = x8 >>> 0 & 0xff;
  36742. o[25] = x8 >>> 8 & 0xff;
  36743. o[26] = x8 >>> 16 & 0xff;
  36744. o[27] = x8 >>> 24 & 0xff;
  36745. o[28] = x9 >>> 0 & 0xff;
  36746. o[29] = x9 >>> 8 & 0xff;
  36747. o[30] = x9 >>> 16 & 0xff;
  36748. o[31] = x9 >>> 24 & 0xff;
  36749. }
  36750. function crypto_core_salsa20(out,inp,k,c) {
  36751. core_salsa20(out,inp,k,c);
  36752. }
  36753. function crypto_core_hsalsa20(out,inp,k,c) {
  36754. core_hsalsa20(out,inp,k,c);
  36755. }
  36756. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36757. // "expand 32-byte k"
  36758. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36759. var z = new Uint8Array(16), x = new Uint8Array(64);
  36760. var u, i;
  36761. for (i = 0; i < 16; i++) z[i] = 0;
  36762. for (i = 0; i < 8; i++) z[i] = n[i];
  36763. while (b >= 64) {
  36764. crypto_core_salsa20(x,z,k,sigma);
  36765. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36766. u = 1;
  36767. for (i = 8; i < 16; i++) {
  36768. u = u + (z[i] & 0xff) | 0;
  36769. z[i] = u & 0xff;
  36770. u >>>= 8;
  36771. }
  36772. b -= 64;
  36773. cpos += 64;
  36774. mpos += 64;
  36775. }
  36776. if (b > 0) {
  36777. crypto_core_salsa20(x,z,k,sigma);
  36778. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36779. }
  36780. return 0;
  36781. }
  36782. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36783. var z = new Uint8Array(16), x = new Uint8Array(64);
  36784. var u, i;
  36785. for (i = 0; i < 16; i++) z[i] = 0;
  36786. for (i = 0; i < 8; i++) z[i] = n[i];
  36787. while (b >= 64) {
  36788. crypto_core_salsa20(x,z,k,sigma);
  36789. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36790. u = 1;
  36791. for (i = 8; i < 16; i++) {
  36792. u = u + (z[i] & 0xff) | 0;
  36793. z[i] = u & 0xff;
  36794. u >>>= 8;
  36795. }
  36796. b -= 64;
  36797. cpos += 64;
  36798. }
  36799. if (b > 0) {
  36800. crypto_core_salsa20(x,z,k,sigma);
  36801. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36802. }
  36803. return 0;
  36804. }
  36805. function crypto_stream(c,cpos,d,n,k) {
  36806. var s = new Uint8Array(32);
  36807. crypto_core_hsalsa20(s,n,k,sigma);
  36808. var sn = new Uint8Array(8);
  36809. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36810. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36811. }
  36812. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36813. var s = new Uint8Array(32);
  36814. crypto_core_hsalsa20(s,n,k,sigma);
  36815. var sn = new Uint8Array(8);
  36816. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36817. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36818. }
  36819. /*
  36820. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36821. * https://github.com/floodyberry/poly1305-donna
  36822. */
  36823. var poly1305 = function(key) {
  36824. this.buffer = new Uint8Array(16);
  36825. this.r = new Uint16Array(10);
  36826. this.h = new Uint16Array(10);
  36827. this.pad = new Uint16Array(8);
  36828. this.leftover = 0;
  36829. this.fin = 0;
  36830. var t0, t1, t2, t3, t4, t5, t6, t7;
  36831. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36832. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36833. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36834. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36835. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36836. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36837. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36838. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36839. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36840. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36841. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36842. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36843. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36844. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36845. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36846. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36847. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36848. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36849. };
  36850. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36851. var hibit = this.fin ? 0 : (1 << 11);
  36852. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36853. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36854. var h0 = this.h[0],
  36855. h1 = this.h[1],
  36856. h2 = this.h[2],
  36857. h3 = this.h[3],
  36858. h4 = this.h[4],
  36859. h5 = this.h[5],
  36860. h6 = this.h[6],
  36861. h7 = this.h[7],
  36862. h8 = this.h[8],
  36863. h9 = this.h[9];
  36864. var r0 = this.r[0],
  36865. r1 = this.r[1],
  36866. r2 = this.r[2],
  36867. r3 = this.r[3],
  36868. r4 = this.r[4],
  36869. r5 = this.r[5],
  36870. r6 = this.r[6],
  36871. r7 = this.r[7],
  36872. r8 = this.r[8],
  36873. r9 = this.r[9];
  36874. while (bytes >= 16) {
  36875. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36876. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36877. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36878. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36879. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36880. h5 += ((t4 >>> 1)) & 0x1fff;
  36881. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36882. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36883. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36884. h9 += ((t7 >>> 5)) | hibit;
  36885. c = 0;
  36886. d0 = c;
  36887. d0 += h0 * r0;
  36888. d0 += h1 * (5 * r9);
  36889. d0 += h2 * (5 * r8);
  36890. d0 += h3 * (5 * r7);
  36891. d0 += h4 * (5 * r6);
  36892. c = (d0 >>> 13); d0 &= 0x1fff;
  36893. d0 += h5 * (5 * r5);
  36894. d0 += h6 * (5 * r4);
  36895. d0 += h7 * (5 * r3);
  36896. d0 += h8 * (5 * r2);
  36897. d0 += h9 * (5 * r1);
  36898. c += (d0 >>> 13); d0 &= 0x1fff;
  36899. d1 = c;
  36900. d1 += h0 * r1;
  36901. d1 += h1 * r0;
  36902. d1 += h2 * (5 * r9);
  36903. d1 += h3 * (5 * r8);
  36904. d1 += h4 * (5 * r7);
  36905. c = (d1 >>> 13); d1 &= 0x1fff;
  36906. d1 += h5 * (5 * r6);
  36907. d1 += h6 * (5 * r5);
  36908. d1 += h7 * (5 * r4);
  36909. d1 += h8 * (5 * r3);
  36910. d1 += h9 * (5 * r2);
  36911. c += (d1 >>> 13); d1 &= 0x1fff;
  36912. d2 = c;
  36913. d2 += h0 * r2;
  36914. d2 += h1 * r1;
  36915. d2 += h2 * r0;
  36916. d2 += h3 * (5 * r9);
  36917. d2 += h4 * (5 * r8);
  36918. c = (d2 >>> 13); d2 &= 0x1fff;
  36919. d2 += h5 * (5 * r7);
  36920. d2 += h6 * (5 * r6);
  36921. d2 += h7 * (5 * r5);
  36922. d2 += h8 * (5 * r4);
  36923. d2 += h9 * (5 * r3);
  36924. c += (d2 >>> 13); d2 &= 0x1fff;
  36925. d3 = c;
  36926. d3 += h0 * r3;
  36927. d3 += h1 * r2;
  36928. d3 += h2 * r1;
  36929. d3 += h3 * r0;
  36930. d3 += h4 * (5 * r9);
  36931. c = (d3 >>> 13); d3 &= 0x1fff;
  36932. d3 += h5 * (5 * r8);
  36933. d3 += h6 * (5 * r7);
  36934. d3 += h7 * (5 * r6);
  36935. d3 += h8 * (5 * r5);
  36936. d3 += h9 * (5 * r4);
  36937. c += (d3 >>> 13); d3 &= 0x1fff;
  36938. d4 = c;
  36939. d4 += h0 * r4;
  36940. d4 += h1 * r3;
  36941. d4 += h2 * r2;
  36942. d4 += h3 * r1;
  36943. d4 += h4 * r0;
  36944. c = (d4 >>> 13); d4 &= 0x1fff;
  36945. d4 += h5 * (5 * r9);
  36946. d4 += h6 * (5 * r8);
  36947. d4 += h7 * (5 * r7);
  36948. d4 += h8 * (5 * r6);
  36949. d4 += h9 * (5 * r5);
  36950. c += (d4 >>> 13); d4 &= 0x1fff;
  36951. d5 = c;
  36952. d5 += h0 * r5;
  36953. d5 += h1 * r4;
  36954. d5 += h2 * r3;
  36955. d5 += h3 * r2;
  36956. d5 += h4 * r1;
  36957. c = (d5 >>> 13); d5 &= 0x1fff;
  36958. d5 += h5 * r0;
  36959. d5 += h6 * (5 * r9);
  36960. d5 += h7 * (5 * r8);
  36961. d5 += h8 * (5 * r7);
  36962. d5 += h9 * (5 * r6);
  36963. c += (d5 >>> 13); d5 &= 0x1fff;
  36964. d6 = c;
  36965. d6 += h0 * r6;
  36966. d6 += h1 * r5;
  36967. d6 += h2 * r4;
  36968. d6 += h3 * r3;
  36969. d6 += h4 * r2;
  36970. c = (d6 >>> 13); d6 &= 0x1fff;
  36971. d6 += h5 * r1;
  36972. d6 += h6 * r0;
  36973. d6 += h7 * (5 * r9);
  36974. d6 += h8 * (5 * r8);
  36975. d6 += h9 * (5 * r7);
  36976. c += (d6 >>> 13); d6 &= 0x1fff;
  36977. d7 = c;
  36978. d7 += h0 * r7;
  36979. d7 += h1 * r6;
  36980. d7 += h2 * r5;
  36981. d7 += h3 * r4;
  36982. d7 += h4 * r3;
  36983. c = (d7 >>> 13); d7 &= 0x1fff;
  36984. d7 += h5 * r2;
  36985. d7 += h6 * r1;
  36986. d7 += h7 * r0;
  36987. d7 += h8 * (5 * r9);
  36988. d7 += h9 * (5 * r8);
  36989. c += (d7 >>> 13); d7 &= 0x1fff;
  36990. d8 = c;
  36991. d8 += h0 * r8;
  36992. d8 += h1 * r7;
  36993. d8 += h2 * r6;
  36994. d8 += h3 * r5;
  36995. d8 += h4 * r4;
  36996. c = (d8 >>> 13); d8 &= 0x1fff;
  36997. d8 += h5 * r3;
  36998. d8 += h6 * r2;
  36999. d8 += h7 * r1;
  37000. d8 += h8 * r0;
  37001. d8 += h9 * (5 * r9);
  37002. c += (d8 >>> 13); d8 &= 0x1fff;
  37003. d9 = c;
  37004. d9 += h0 * r9;
  37005. d9 += h1 * r8;
  37006. d9 += h2 * r7;
  37007. d9 += h3 * r6;
  37008. d9 += h4 * r5;
  37009. c = (d9 >>> 13); d9 &= 0x1fff;
  37010. d9 += h5 * r4;
  37011. d9 += h6 * r3;
  37012. d9 += h7 * r2;
  37013. d9 += h8 * r1;
  37014. d9 += h9 * r0;
  37015. c += (d9 >>> 13); d9 &= 0x1fff;
  37016. c = (((c << 2) + c)) | 0;
  37017. c = (c + d0) | 0;
  37018. d0 = c & 0x1fff;
  37019. c = (c >>> 13);
  37020. d1 += c;
  37021. h0 = d0;
  37022. h1 = d1;
  37023. h2 = d2;
  37024. h3 = d3;
  37025. h4 = d4;
  37026. h5 = d5;
  37027. h6 = d6;
  37028. h7 = d7;
  37029. h8 = d8;
  37030. h9 = d9;
  37031. mpos += 16;
  37032. bytes -= 16;
  37033. }
  37034. this.h[0] = h0;
  37035. this.h[1] = h1;
  37036. this.h[2] = h2;
  37037. this.h[3] = h3;
  37038. this.h[4] = h4;
  37039. this.h[5] = h5;
  37040. this.h[6] = h6;
  37041. this.h[7] = h7;
  37042. this.h[8] = h8;
  37043. this.h[9] = h9;
  37044. };
  37045. poly1305.prototype.finish = function(mac, macpos) {
  37046. var g = new Uint16Array(10);
  37047. var c, mask, f, i;
  37048. if (this.leftover) {
  37049. i = this.leftover;
  37050. this.buffer[i++] = 1;
  37051. for (; i < 16; i++) this.buffer[i] = 0;
  37052. this.fin = 1;
  37053. this.blocks(this.buffer, 0, 16);
  37054. }
  37055. c = this.h[1] >>> 13;
  37056. this.h[1] &= 0x1fff;
  37057. for (i = 2; i < 10; i++) {
  37058. this.h[i] += c;
  37059. c = this.h[i] >>> 13;
  37060. this.h[i] &= 0x1fff;
  37061. }
  37062. this.h[0] += (c * 5);
  37063. c = this.h[0] >>> 13;
  37064. this.h[0] &= 0x1fff;
  37065. this.h[1] += c;
  37066. c = this.h[1] >>> 13;
  37067. this.h[1] &= 0x1fff;
  37068. this.h[2] += c;
  37069. g[0] = this.h[0] + 5;
  37070. c = g[0] >>> 13;
  37071. g[0] &= 0x1fff;
  37072. for (i = 1; i < 10; i++) {
  37073. g[i] = this.h[i] + c;
  37074. c = g[i] >>> 13;
  37075. g[i] &= 0x1fff;
  37076. }
  37077. g[9] -= (1 << 13);
  37078. mask = (c ^ 1) - 1;
  37079. for (i = 0; i < 10; i++) g[i] &= mask;
  37080. mask = ~mask;
  37081. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37082. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37083. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37084. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37085. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37086. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37087. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37088. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37089. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37090. f = this.h[0] + this.pad[0];
  37091. this.h[0] = f & 0xffff;
  37092. for (i = 1; i < 8; i++) {
  37093. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37094. this.h[i] = f & 0xffff;
  37095. }
  37096. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37097. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37098. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37099. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37100. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37101. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37102. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37103. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37104. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37105. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37106. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37107. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37108. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37109. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37110. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37111. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37112. };
  37113. poly1305.prototype.update = function(m, mpos, bytes) {
  37114. var i, want;
  37115. if (this.leftover) {
  37116. want = (16 - this.leftover);
  37117. if (want > bytes)
  37118. want = bytes;
  37119. for (i = 0; i < want; i++)
  37120. this.buffer[this.leftover + i] = m[mpos+i];
  37121. bytes -= want;
  37122. mpos += want;
  37123. this.leftover += want;
  37124. if (this.leftover < 16)
  37125. return;
  37126. this.blocks(this.buffer, 0, 16);
  37127. this.leftover = 0;
  37128. }
  37129. if (bytes >= 16) {
  37130. want = bytes - (bytes % 16);
  37131. this.blocks(m, mpos, want);
  37132. mpos += want;
  37133. bytes -= want;
  37134. }
  37135. if (bytes) {
  37136. for (i = 0; i < bytes; i++)
  37137. this.buffer[this.leftover + i] = m[mpos+i];
  37138. this.leftover += bytes;
  37139. }
  37140. };
  37141. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37142. var s = new poly1305(k);
  37143. s.update(m, mpos, n);
  37144. s.finish(out, outpos);
  37145. return 0;
  37146. }
  37147. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37148. var x = new Uint8Array(16);
  37149. crypto_onetimeauth(x,0,m,mpos,n,k);
  37150. return crypto_verify_16(h,hpos,x,0);
  37151. }
  37152. function crypto_secretbox(c,m,d,n,k) {
  37153. var i;
  37154. if (d < 32) return -1;
  37155. crypto_stream_xor(c,0,m,0,d,n,k);
  37156. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37157. for (i = 0; i < 16; i++) c[i] = 0;
  37158. return 0;
  37159. }
  37160. function crypto_secretbox_open(m,c,d,n,k) {
  37161. var i;
  37162. var x = new Uint8Array(32);
  37163. if (d < 32) return -1;
  37164. crypto_stream(x,0,32,n,k);
  37165. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37166. crypto_stream_xor(m,0,c,0,d,n,k);
  37167. for (i = 0; i < 32; i++) m[i] = 0;
  37168. return 0;
  37169. }
  37170. function set25519(r, a) {
  37171. var i;
  37172. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37173. }
  37174. function car25519(o) {
  37175. var i, v, c = 1;
  37176. for (i = 0; i < 16; i++) {
  37177. v = o[i] + c + 65535;
  37178. c = Math.floor(v / 65536);
  37179. o[i] = v - c * 65536;
  37180. }
  37181. o[0] += c-1 + 37 * (c-1);
  37182. }
  37183. function sel25519(p, q, b) {
  37184. var t, c = ~(b-1);
  37185. for (var i = 0; i < 16; i++) {
  37186. t = c & (p[i] ^ q[i]);
  37187. p[i] ^= t;
  37188. q[i] ^= t;
  37189. }
  37190. }
  37191. function pack25519(o, n) {
  37192. var i, j, b;
  37193. var m = gf(), t = gf();
  37194. for (i = 0; i < 16; i++) t[i] = n[i];
  37195. car25519(t);
  37196. car25519(t);
  37197. car25519(t);
  37198. for (j = 0; j < 2; j++) {
  37199. m[0] = t[0] - 0xffed;
  37200. for (i = 1; i < 15; i++) {
  37201. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37202. m[i-1] &= 0xffff;
  37203. }
  37204. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37205. b = (m[15]>>16) & 1;
  37206. m[14] &= 0xffff;
  37207. sel25519(t, m, 1-b);
  37208. }
  37209. for (i = 0; i < 16; i++) {
  37210. o[2*i] = t[i] & 0xff;
  37211. o[2*i+1] = t[i]>>8;
  37212. }
  37213. }
  37214. function neq25519(a, b) {
  37215. var c = new Uint8Array(32), d = new Uint8Array(32);
  37216. pack25519(c, a);
  37217. pack25519(d, b);
  37218. return crypto_verify_32(c, 0, d, 0);
  37219. }
  37220. function par25519(a) {
  37221. var d = new Uint8Array(32);
  37222. pack25519(d, a);
  37223. return d[0] & 1;
  37224. }
  37225. function unpack25519(o, n) {
  37226. var i;
  37227. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37228. o[15] &= 0x7fff;
  37229. }
  37230. function A(o, a, b) {
  37231. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37232. }
  37233. function Z(o, a, b) {
  37234. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37235. }
  37236. function M(o, a, b) {
  37237. var v, c,
  37238. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37239. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37240. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37241. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37242. b0 = b[0],
  37243. b1 = b[1],
  37244. b2 = b[2],
  37245. b3 = b[3],
  37246. b4 = b[4],
  37247. b5 = b[5],
  37248. b6 = b[6],
  37249. b7 = b[7],
  37250. b8 = b[8],
  37251. b9 = b[9],
  37252. b10 = b[10],
  37253. b11 = b[11],
  37254. b12 = b[12],
  37255. b13 = b[13],
  37256. b14 = b[14],
  37257. b15 = b[15];
  37258. v = a[0];
  37259. t0 += v * b0;
  37260. t1 += v * b1;
  37261. t2 += v * b2;
  37262. t3 += v * b3;
  37263. t4 += v * b4;
  37264. t5 += v * b5;
  37265. t6 += v * b6;
  37266. t7 += v * b7;
  37267. t8 += v * b8;
  37268. t9 += v * b9;
  37269. t10 += v * b10;
  37270. t11 += v * b11;
  37271. t12 += v * b12;
  37272. t13 += v * b13;
  37273. t14 += v * b14;
  37274. t15 += v * b15;
  37275. v = a[1];
  37276. t1 += v * b0;
  37277. t2 += v * b1;
  37278. t3 += v * b2;
  37279. t4 += v * b3;
  37280. t5 += v * b4;
  37281. t6 += v * b5;
  37282. t7 += v * b6;
  37283. t8 += v * b7;
  37284. t9 += v * b8;
  37285. t10 += v * b9;
  37286. t11 += v * b10;
  37287. t12 += v * b11;
  37288. t13 += v * b12;
  37289. t14 += v * b13;
  37290. t15 += v * b14;
  37291. t16 += v * b15;
  37292. v = a[2];
  37293. t2 += v * b0;
  37294. t3 += v * b1;
  37295. t4 += v * b2;
  37296. t5 += v * b3;
  37297. t6 += v * b4;
  37298. t7 += v * b5;
  37299. t8 += v * b6;
  37300. t9 += v * b7;
  37301. t10 += v * b8;
  37302. t11 += v * b9;
  37303. t12 += v * b10;
  37304. t13 += v * b11;
  37305. t14 += v * b12;
  37306. t15 += v * b13;
  37307. t16 += v * b14;
  37308. t17 += v * b15;
  37309. v = a[3];
  37310. t3 += v * b0;
  37311. t4 += v * b1;
  37312. t5 += v * b2;
  37313. t6 += v * b3;
  37314. t7 += v * b4;
  37315. t8 += v * b5;
  37316. t9 += v * b6;
  37317. t10 += v * b7;
  37318. t11 += v * b8;
  37319. t12 += v * b9;
  37320. t13 += v * b10;
  37321. t14 += v * b11;
  37322. t15 += v * b12;
  37323. t16 += v * b13;
  37324. t17 += v * b14;
  37325. t18 += v * b15;
  37326. v = a[4];
  37327. t4 += v * b0;
  37328. t5 += v * b1;
  37329. t6 += v * b2;
  37330. t7 += v * b3;
  37331. t8 += v * b4;
  37332. t9 += v * b5;
  37333. t10 += v * b6;
  37334. t11 += v * b7;
  37335. t12 += v * b8;
  37336. t13 += v * b9;
  37337. t14 += v * b10;
  37338. t15 += v * b11;
  37339. t16 += v * b12;
  37340. t17 += v * b13;
  37341. t18 += v * b14;
  37342. t19 += v * b15;
  37343. v = a[5];
  37344. t5 += v * b0;
  37345. t6 += v * b1;
  37346. t7 += v * b2;
  37347. t8 += v * b3;
  37348. t9 += v * b4;
  37349. t10 += v * b5;
  37350. t11 += v * b6;
  37351. t12 += v * b7;
  37352. t13 += v * b8;
  37353. t14 += v * b9;
  37354. t15 += v * b10;
  37355. t16 += v * b11;
  37356. t17 += v * b12;
  37357. t18 += v * b13;
  37358. t19 += v * b14;
  37359. t20 += v * b15;
  37360. v = a[6];
  37361. t6 += v * b0;
  37362. t7 += v * b1;
  37363. t8 += v * b2;
  37364. t9 += v * b3;
  37365. t10 += v * b4;
  37366. t11 += v * b5;
  37367. t12 += v * b6;
  37368. t13 += v * b7;
  37369. t14 += v * b8;
  37370. t15 += v * b9;
  37371. t16 += v * b10;
  37372. t17 += v * b11;
  37373. t18 += v * b12;
  37374. t19 += v * b13;
  37375. t20 += v * b14;
  37376. t21 += v * b15;
  37377. v = a[7];
  37378. t7 += v * b0;
  37379. t8 += v * b1;
  37380. t9 += v * b2;
  37381. t10 += v * b3;
  37382. t11 += v * b4;
  37383. t12 += v * b5;
  37384. t13 += v * b6;
  37385. t14 += v * b7;
  37386. t15 += v * b8;
  37387. t16 += v * b9;
  37388. t17 += v * b10;
  37389. t18 += v * b11;
  37390. t19 += v * b12;
  37391. t20 += v * b13;
  37392. t21 += v * b14;
  37393. t22 += v * b15;
  37394. v = a[8];
  37395. t8 += v * b0;
  37396. t9 += v * b1;
  37397. t10 += v * b2;
  37398. t11 += v * b3;
  37399. t12 += v * b4;
  37400. t13 += v * b5;
  37401. t14 += v * b6;
  37402. t15 += v * b7;
  37403. t16 += v * b8;
  37404. t17 += v * b9;
  37405. t18 += v * b10;
  37406. t19 += v * b11;
  37407. t20 += v * b12;
  37408. t21 += v * b13;
  37409. t22 += v * b14;
  37410. t23 += v * b15;
  37411. v = a[9];
  37412. t9 += v * b0;
  37413. t10 += v * b1;
  37414. t11 += v * b2;
  37415. t12 += v * b3;
  37416. t13 += v * b4;
  37417. t14 += v * b5;
  37418. t15 += v * b6;
  37419. t16 += v * b7;
  37420. t17 += v * b8;
  37421. t18 += v * b9;
  37422. t19 += v * b10;
  37423. t20 += v * b11;
  37424. t21 += v * b12;
  37425. t22 += v * b13;
  37426. t23 += v * b14;
  37427. t24 += v * b15;
  37428. v = a[10];
  37429. t10 += v * b0;
  37430. t11 += v * b1;
  37431. t12 += v * b2;
  37432. t13 += v * b3;
  37433. t14 += v * b4;
  37434. t15 += v * b5;
  37435. t16 += v * b6;
  37436. t17 += v * b7;
  37437. t18 += v * b8;
  37438. t19 += v * b9;
  37439. t20 += v * b10;
  37440. t21 += v * b11;
  37441. t22 += v * b12;
  37442. t23 += v * b13;
  37443. t24 += v * b14;
  37444. t25 += v * b15;
  37445. v = a[11];
  37446. t11 += v * b0;
  37447. t12 += v * b1;
  37448. t13 += v * b2;
  37449. t14 += v * b3;
  37450. t15 += v * b4;
  37451. t16 += v * b5;
  37452. t17 += v * b6;
  37453. t18 += v * b7;
  37454. t19 += v * b8;
  37455. t20 += v * b9;
  37456. t21 += v * b10;
  37457. t22 += v * b11;
  37458. t23 += v * b12;
  37459. t24 += v * b13;
  37460. t25 += v * b14;
  37461. t26 += v * b15;
  37462. v = a[12];
  37463. t12 += v * b0;
  37464. t13 += v * b1;
  37465. t14 += v * b2;
  37466. t15 += v * b3;
  37467. t16 += v * b4;
  37468. t17 += v * b5;
  37469. t18 += v * b6;
  37470. t19 += v * b7;
  37471. t20 += v * b8;
  37472. t21 += v * b9;
  37473. t22 += v * b10;
  37474. t23 += v * b11;
  37475. t24 += v * b12;
  37476. t25 += v * b13;
  37477. t26 += v * b14;
  37478. t27 += v * b15;
  37479. v = a[13];
  37480. t13 += v * b0;
  37481. t14 += v * b1;
  37482. t15 += v * b2;
  37483. t16 += v * b3;
  37484. t17 += v * b4;
  37485. t18 += v * b5;
  37486. t19 += v * b6;
  37487. t20 += v * b7;
  37488. t21 += v * b8;
  37489. t22 += v * b9;
  37490. t23 += v * b10;
  37491. t24 += v * b11;
  37492. t25 += v * b12;
  37493. t26 += v * b13;
  37494. t27 += v * b14;
  37495. t28 += v * b15;
  37496. v = a[14];
  37497. t14 += v * b0;
  37498. t15 += v * b1;
  37499. t16 += v * b2;
  37500. t17 += v * b3;
  37501. t18 += v * b4;
  37502. t19 += v * b5;
  37503. t20 += v * b6;
  37504. t21 += v * b7;
  37505. t22 += v * b8;
  37506. t23 += v * b9;
  37507. t24 += v * b10;
  37508. t25 += v * b11;
  37509. t26 += v * b12;
  37510. t27 += v * b13;
  37511. t28 += v * b14;
  37512. t29 += v * b15;
  37513. v = a[15];
  37514. t15 += v * b0;
  37515. t16 += v * b1;
  37516. t17 += v * b2;
  37517. t18 += v * b3;
  37518. t19 += v * b4;
  37519. t20 += v * b5;
  37520. t21 += v * b6;
  37521. t22 += v * b7;
  37522. t23 += v * b8;
  37523. t24 += v * b9;
  37524. t25 += v * b10;
  37525. t26 += v * b11;
  37526. t27 += v * b12;
  37527. t28 += v * b13;
  37528. t29 += v * b14;
  37529. t30 += v * b15;
  37530. t0 += 38 * t16;
  37531. t1 += 38 * t17;
  37532. t2 += 38 * t18;
  37533. t3 += 38 * t19;
  37534. t4 += 38 * t20;
  37535. t5 += 38 * t21;
  37536. t6 += 38 * t22;
  37537. t7 += 38 * t23;
  37538. t8 += 38 * t24;
  37539. t9 += 38 * t25;
  37540. t10 += 38 * t26;
  37541. t11 += 38 * t27;
  37542. t12 += 38 * t28;
  37543. t13 += 38 * t29;
  37544. t14 += 38 * t30;
  37545. // t15 left as is
  37546. // first car
  37547. c = 1;
  37548. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37549. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37550. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37551. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37552. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37553. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37554. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37555. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37556. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37557. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37558. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37559. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37560. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37561. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37562. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37563. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37564. t0 += c-1 + 37 * (c-1);
  37565. // second car
  37566. c = 1;
  37567. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37568. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37569. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37570. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37571. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37572. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37573. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37574. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37575. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37576. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37577. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37578. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37579. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37580. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37581. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37582. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37583. t0 += c-1 + 37 * (c-1);
  37584. o[ 0] = t0;
  37585. o[ 1] = t1;
  37586. o[ 2] = t2;
  37587. o[ 3] = t3;
  37588. o[ 4] = t4;
  37589. o[ 5] = t5;
  37590. o[ 6] = t6;
  37591. o[ 7] = t7;
  37592. o[ 8] = t8;
  37593. o[ 9] = t9;
  37594. o[10] = t10;
  37595. o[11] = t11;
  37596. o[12] = t12;
  37597. o[13] = t13;
  37598. o[14] = t14;
  37599. o[15] = t15;
  37600. }
  37601. function S(o, a) {
  37602. M(o, a, a);
  37603. }
  37604. function inv25519(o, i) {
  37605. var c = gf();
  37606. var a;
  37607. for (a = 0; a < 16; a++) c[a] = i[a];
  37608. for (a = 253; a >= 0; a--) {
  37609. S(c, c);
  37610. if(a !== 2 && a !== 4) M(c, c, i);
  37611. }
  37612. for (a = 0; a < 16; a++) o[a] = c[a];
  37613. }
  37614. function pow2523(o, i) {
  37615. var c = gf();
  37616. var a;
  37617. for (a = 0; a < 16; a++) c[a] = i[a];
  37618. for (a = 250; a >= 0; a--) {
  37619. S(c, c);
  37620. if(a !== 1) M(c, c, i);
  37621. }
  37622. for (a = 0; a < 16; a++) o[a] = c[a];
  37623. }
  37624. function crypto_scalarmult(q, n, p) {
  37625. var z = new Uint8Array(32);
  37626. var x = new Float64Array(80), r, i;
  37627. var a = gf(), b = gf(), c = gf(),
  37628. d = gf(), e = gf(), f = gf();
  37629. for (i = 0; i < 31; i++) z[i] = n[i];
  37630. z[31]=(n[31]&127)|64;
  37631. z[0]&=248;
  37632. unpack25519(x,p);
  37633. for (i = 0; i < 16; i++) {
  37634. b[i]=x[i];
  37635. d[i]=a[i]=c[i]=0;
  37636. }
  37637. a[0]=d[0]=1;
  37638. for (i=254; i>=0; --i) {
  37639. r=(z[i>>>3]>>>(i&7))&1;
  37640. sel25519(a,b,r);
  37641. sel25519(c,d,r);
  37642. A(e,a,c);
  37643. Z(a,a,c);
  37644. A(c,b,d);
  37645. Z(b,b,d);
  37646. S(d,e);
  37647. S(f,a);
  37648. M(a,c,a);
  37649. M(c,b,e);
  37650. A(e,a,c);
  37651. Z(a,a,c);
  37652. S(b,a);
  37653. Z(c,d,f);
  37654. M(a,c,_121665);
  37655. A(a,a,d);
  37656. M(c,c,a);
  37657. M(a,d,f);
  37658. M(d,b,x);
  37659. S(b,e);
  37660. sel25519(a,b,r);
  37661. sel25519(c,d,r);
  37662. }
  37663. for (i = 0; i < 16; i++) {
  37664. x[i+16]=a[i];
  37665. x[i+32]=c[i];
  37666. x[i+48]=b[i];
  37667. x[i+64]=d[i];
  37668. }
  37669. var x32 = x.subarray(32);
  37670. var x16 = x.subarray(16);
  37671. inv25519(x32,x32);
  37672. M(x16,x16,x32);
  37673. pack25519(q,x16);
  37674. return 0;
  37675. }
  37676. function crypto_scalarmult_base(q, n) {
  37677. return crypto_scalarmult(q, n, _9);
  37678. }
  37679. function crypto_box_keypair(y, x) {
  37680. randombytes(x, 32);
  37681. return crypto_scalarmult_base(y, x);
  37682. }
  37683. function crypto_box_beforenm(k, y, x) {
  37684. var s = new Uint8Array(32);
  37685. crypto_scalarmult(s, x, y);
  37686. return crypto_core_hsalsa20(k, _0, s, sigma);
  37687. }
  37688. var crypto_box_afternm = crypto_secretbox;
  37689. var crypto_box_open_afternm = crypto_secretbox_open;
  37690. function crypto_box(c, m, d, n, y, x) {
  37691. var k = new Uint8Array(32);
  37692. crypto_box_beforenm(k, y, x);
  37693. return crypto_box_afternm(c, m, d, n, k);
  37694. }
  37695. function crypto_box_open(m, c, d, n, y, x) {
  37696. var k = new Uint8Array(32);
  37697. crypto_box_beforenm(k, y, x);
  37698. return crypto_box_open_afternm(m, c, d, n, k);
  37699. }
  37700. var K = [
  37701. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37702. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37703. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37704. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37705. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37706. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37707. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37708. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37709. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37710. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37711. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37712. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37713. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37714. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37715. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37716. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37717. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37718. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37719. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37720. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37721. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37722. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37723. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37724. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37725. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37726. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37727. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37728. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37729. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37730. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37731. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37732. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37733. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37734. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37735. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37736. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37737. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37738. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37739. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37740. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37741. ];
  37742. function crypto_hashblocks_hl(hh, hl, m, n) {
  37743. var wh = new Int32Array(16), wl = new Int32Array(16),
  37744. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37745. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37746. th, tl, i, j, h, l, a, b, c, d;
  37747. var ah0 = hh[0],
  37748. ah1 = hh[1],
  37749. ah2 = hh[2],
  37750. ah3 = hh[3],
  37751. ah4 = hh[4],
  37752. ah5 = hh[5],
  37753. ah6 = hh[6],
  37754. ah7 = hh[7],
  37755. al0 = hl[0],
  37756. al1 = hl[1],
  37757. al2 = hl[2],
  37758. al3 = hl[3],
  37759. al4 = hl[4],
  37760. al5 = hl[5],
  37761. al6 = hl[6],
  37762. al7 = hl[7];
  37763. var pos = 0;
  37764. while (n >= 128) {
  37765. for (i = 0; i < 16; i++) {
  37766. j = 8 * i + pos;
  37767. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37768. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37769. }
  37770. for (i = 0; i < 80; i++) {
  37771. bh0 = ah0;
  37772. bh1 = ah1;
  37773. bh2 = ah2;
  37774. bh3 = ah3;
  37775. bh4 = ah4;
  37776. bh5 = ah5;
  37777. bh6 = ah6;
  37778. bh7 = ah7;
  37779. bl0 = al0;
  37780. bl1 = al1;
  37781. bl2 = al2;
  37782. bl3 = al3;
  37783. bl4 = al4;
  37784. bl5 = al5;
  37785. bl6 = al6;
  37786. bl7 = al7;
  37787. // add
  37788. h = ah7;
  37789. l = al7;
  37790. a = l & 0xffff; b = l >>> 16;
  37791. c = h & 0xffff; d = h >>> 16;
  37792. // Sigma1
  37793. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37794. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37795. a += l & 0xffff; b += l >>> 16;
  37796. c += h & 0xffff; d += h >>> 16;
  37797. // Ch
  37798. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37799. l = (al4 & al5) ^ (~al4 & al6);
  37800. a += l & 0xffff; b += l >>> 16;
  37801. c += h & 0xffff; d += h >>> 16;
  37802. // K
  37803. h = K[i*2];
  37804. l = K[i*2+1];
  37805. a += l & 0xffff; b += l >>> 16;
  37806. c += h & 0xffff; d += h >>> 16;
  37807. // w
  37808. h = wh[i%16];
  37809. l = wl[i%16];
  37810. a += l & 0xffff; b += l >>> 16;
  37811. c += h & 0xffff; d += h >>> 16;
  37812. b += a >>> 16;
  37813. c += b >>> 16;
  37814. d += c >>> 16;
  37815. th = c & 0xffff | d << 16;
  37816. tl = a & 0xffff | b << 16;
  37817. // add
  37818. h = th;
  37819. l = tl;
  37820. a = l & 0xffff; b = l >>> 16;
  37821. c = h & 0xffff; d = h >>> 16;
  37822. // Sigma0
  37823. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37824. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37825. a += l & 0xffff; b += l >>> 16;
  37826. c += h & 0xffff; d += h >>> 16;
  37827. // Maj
  37828. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37829. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37830. a += l & 0xffff; b += l >>> 16;
  37831. c += h & 0xffff; d += h >>> 16;
  37832. b += a >>> 16;
  37833. c += b >>> 16;
  37834. d += c >>> 16;
  37835. bh7 = (c & 0xffff) | (d << 16);
  37836. bl7 = (a & 0xffff) | (b << 16);
  37837. // add
  37838. h = bh3;
  37839. l = bl3;
  37840. a = l & 0xffff; b = l >>> 16;
  37841. c = h & 0xffff; d = h >>> 16;
  37842. h = th;
  37843. l = tl;
  37844. a += l & 0xffff; b += l >>> 16;
  37845. c += h & 0xffff; d += h >>> 16;
  37846. b += a >>> 16;
  37847. c += b >>> 16;
  37848. d += c >>> 16;
  37849. bh3 = (c & 0xffff) | (d << 16);
  37850. bl3 = (a & 0xffff) | (b << 16);
  37851. ah1 = bh0;
  37852. ah2 = bh1;
  37853. ah3 = bh2;
  37854. ah4 = bh3;
  37855. ah5 = bh4;
  37856. ah6 = bh5;
  37857. ah7 = bh6;
  37858. ah0 = bh7;
  37859. al1 = bl0;
  37860. al2 = bl1;
  37861. al3 = bl2;
  37862. al4 = bl3;
  37863. al5 = bl4;
  37864. al6 = bl5;
  37865. al7 = bl6;
  37866. al0 = bl7;
  37867. if (i%16 === 15) {
  37868. for (j = 0; j < 16; j++) {
  37869. // add
  37870. h = wh[j];
  37871. l = wl[j];
  37872. a = l & 0xffff; b = l >>> 16;
  37873. c = h & 0xffff; d = h >>> 16;
  37874. h = wh[(j+9)%16];
  37875. l = wl[(j+9)%16];
  37876. a += l & 0xffff; b += l >>> 16;
  37877. c += h & 0xffff; d += h >>> 16;
  37878. // sigma0
  37879. th = wh[(j+1)%16];
  37880. tl = wl[(j+1)%16];
  37881. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37882. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37883. a += l & 0xffff; b += l >>> 16;
  37884. c += h & 0xffff; d += h >>> 16;
  37885. // sigma1
  37886. th = wh[(j+14)%16];
  37887. tl = wl[(j+14)%16];
  37888. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  37889. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  37890. a += l & 0xffff; b += l >>> 16;
  37891. c += h & 0xffff; d += h >>> 16;
  37892. b += a >>> 16;
  37893. c += b >>> 16;
  37894. d += c >>> 16;
  37895. wh[j] = (c & 0xffff) | (d << 16);
  37896. wl[j] = (a & 0xffff) | (b << 16);
  37897. }
  37898. }
  37899. }
  37900. // add
  37901. h = ah0;
  37902. l = al0;
  37903. a = l & 0xffff; b = l >>> 16;
  37904. c = h & 0xffff; d = h >>> 16;
  37905. h = hh[0];
  37906. l = hl[0];
  37907. a += l & 0xffff; b += l >>> 16;
  37908. c += h & 0xffff; d += h >>> 16;
  37909. b += a >>> 16;
  37910. c += b >>> 16;
  37911. d += c >>> 16;
  37912. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  37913. hl[0] = al0 = (a & 0xffff) | (b << 16);
  37914. h = ah1;
  37915. l = al1;
  37916. a = l & 0xffff; b = l >>> 16;
  37917. c = h & 0xffff; d = h >>> 16;
  37918. h = hh[1];
  37919. l = hl[1];
  37920. a += l & 0xffff; b += l >>> 16;
  37921. c += h & 0xffff; d += h >>> 16;
  37922. b += a >>> 16;
  37923. c += b >>> 16;
  37924. d += c >>> 16;
  37925. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  37926. hl[1] = al1 = (a & 0xffff) | (b << 16);
  37927. h = ah2;
  37928. l = al2;
  37929. a = l & 0xffff; b = l >>> 16;
  37930. c = h & 0xffff; d = h >>> 16;
  37931. h = hh[2];
  37932. l = hl[2];
  37933. a += l & 0xffff; b += l >>> 16;
  37934. c += h & 0xffff; d += h >>> 16;
  37935. b += a >>> 16;
  37936. c += b >>> 16;
  37937. d += c >>> 16;
  37938. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  37939. hl[2] = al2 = (a & 0xffff) | (b << 16);
  37940. h = ah3;
  37941. l = al3;
  37942. a = l & 0xffff; b = l >>> 16;
  37943. c = h & 0xffff; d = h >>> 16;
  37944. h = hh[3];
  37945. l = hl[3];
  37946. a += l & 0xffff; b += l >>> 16;
  37947. c += h & 0xffff; d += h >>> 16;
  37948. b += a >>> 16;
  37949. c += b >>> 16;
  37950. d += c >>> 16;
  37951. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  37952. hl[3] = al3 = (a & 0xffff) | (b << 16);
  37953. h = ah4;
  37954. l = al4;
  37955. a = l & 0xffff; b = l >>> 16;
  37956. c = h & 0xffff; d = h >>> 16;
  37957. h = hh[4];
  37958. l = hl[4];
  37959. a += l & 0xffff; b += l >>> 16;
  37960. c += h & 0xffff; d += h >>> 16;
  37961. b += a >>> 16;
  37962. c += b >>> 16;
  37963. d += c >>> 16;
  37964. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  37965. hl[4] = al4 = (a & 0xffff) | (b << 16);
  37966. h = ah5;
  37967. l = al5;
  37968. a = l & 0xffff; b = l >>> 16;
  37969. c = h & 0xffff; d = h >>> 16;
  37970. h = hh[5];
  37971. l = hl[5];
  37972. a += l & 0xffff; b += l >>> 16;
  37973. c += h & 0xffff; d += h >>> 16;
  37974. b += a >>> 16;
  37975. c += b >>> 16;
  37976. d += c >>> 16;
  37977. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  37978. hl[5] = al5 = (a & 0xffff) | (b << 16);
  37979. h = ah6;
  37980. l = al6;
  37981. a = l & 0xffff; b = l >>> 16;
  37982. c = h & 0xffff; d = h >>> 16;
  37983. h = hh[6];
  37984. l = hl[6];
  37985. a += l & 0xffff; b += l >>> 16;
  37986. c += h & 0xffff; d += h >>> 16;
  37987. b += a >>> 16;
  37988. c += b >>> 16;
  37989. d += c >>> 16;
  37990. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  37991. hl[6] = al6 = (a & 0xffff) | (b << 16);
  37992. h = ah7;
  37993. l = al7;
  37994. a = l & 0xffff; b = l >>> 16;
  37995. c = h & 0xffff; d = h >>> 16;
  37996. h = hh[7];
  37997. l = hl[7];
  37998. a += l & 0xffff; b += l >>> 16;
  37999. c += h & 0xffff; d += h >>> 16;
  38000. b += a >>> 16;
  38001. c += b >>> 16;
  38002. d += c >>> 16;
  38003. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38004. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38005. pos += 128;
  38006. n -= 128;
  38007. }
  38008. return n;
  38009. }
  38010. function crypto_hash(out, m, n) {
  38011. var hh = new Int32Array(8),
  38012. hl = new Int32Array(8),
  38013. x = new Uint8Array(256),
  38014. i, b = n;
  38015. hh[0] = 0x6a09e667;
  38016. hh[1] = 0xbb67ae85;
  38017. hh[2] = 0x3c6ef372;
  38018. hh[3] = 0xa54ff53a;
  38019. hh[4] = 0x510e527f;
  38020. hh[5] = 0x9b05688c;
  38021. hh[6] = 0x1f83d9ab;
  38022. hh[7] = 0x5be0cd19;
  38023. hl[0] = 0xf3bcc908;
  38024. hl[1] = 0x84caa73b;
  38025. hl[2] = 0xfe94f82b;
  38026. hl[3] = 0x5f1d36f1;
  38027. hl[4] = 0xade682d1;
  38028. hl[5] = 0x2b3e6c1f;
  38029. hl[6] = 0xfb41bd6b;
  38030. hl[7] = 0x137e2179;
  38031. crypto_hashblocks_hl(hh, hl, m, n);
  38032. n %= 128;
  38033. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38034. x[n] = 128;
  38035. n = 256-128*(n<112?1:0);
  38036. x[n-9] = 0;
  38037. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38038. crypto_hashblocks_hl(hh, hl, x, n);
  38039. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38040. return 0;
  38041. }
  38042. function add(p, q) {
  38043. var a = gf(), b = gf(), c = gf(),
  38044. d = gf(), e = gf(), f = gf(),
  38045. g = gf(), h = gf(), t = gf();
  38046. Z(a, p[1], p[0]);
  38047. Z(t, q[1], q[0]);
  38048. M(a, a, t);
  38049. A(b, p[0], p[1]);
  38050. A(t, q[0], q[1]);
  38051. M(b, b, t);
  38052. M(c, p[3], q[3]);
  38053. M(c, c, D2);
  38054. M(d, p[2], q[2]);
  38055. A(d, d, d);
  38056. Z(e, b, a);
  38057. Z(f, d, c);
  38058. A(g, d, c);
  38059. A(h, b, a);
  38060. M(p[0], e, f);
  38061. M(p[1], h, g);
  38062. M(p[2], g, f);
  38063. M(p[3], e, h);
  38064. }
  38065. function cswap(p, q, b) {
  38066. var i;
  38067. for (i = 0; i < 4; i++) {
  38068. sel25519(p[i], q[i], b);
  38069. }
  38070. }
  38071. function pack(r, p) {
  38072. var tx = gf(), ty = gf(), zi = gf();
  38073. inv25519(zi, p[2]);
  38074. M(tx, p[0], zi);
  38075. M(ty, p[1], zi);
  38076. pack25519(r, ty);
  38077. r[31] ^= par25519(tx) << 7;
  38078. }
  38079. function scalarmult(p, q, s) {
  38080. var b, i;
  38081. set25519(p[0], gf0);
  38082. set25519(p[1], gf1);
  38083. set25519(p[2], gf1);
  38084. set25519(p[3], gf0);
  38085. for (i = 255; i >= 0; --i) {
  38086. b = (s[(i/8)|0] >> (i&7)) & 1;
  38087. cswap(p, q, b);
  38088. add(q, p);
  38089. add(p, p);
  38090. cswap(p, q, b);
  38091. }
  38092. }
  38093. function scalarbase(p, s) {
  38094. var q = [gf(), gf(), gf(), gf()];
  38095. set25519(q[0], X);
  38096. set25519(q[1], Y);
  38097. set25519(q[2], gf1);
  38098. M(q[3], X, Y);
  38099. scalarmult(p, q, s);
  38100. }
  38101. function crypto_sign_keypair(pk, sk, seeded) {
  38102. var d = new Uint8Array(64);
  38103. var p = [gf(), gf(), gf(), gf()];
  38104. var i;
  38105. if (!seeded) randombytes(sk, 32);
  38106. crypto_hash(d, sk, 32);
  38107. d[0] &= 248;
  38108. d[31] &= 127;
  38109. d[31] |= 64;
  38110. scalarbase(p, d);
  38111. pack(pk, p);
  38112. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38113. return 0;
  38114. }
  38115. 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]);
  38116. function modL(r, x) {
  38117. var carry, i, j, k;
  38118. for (i = 63; i >= 32; --i) {
  38119. carry = 0;
  38120. for (j = i - 32, k = i - 12; j < k; ++j) {
  38121. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38122. carry = (x[j] + 128) >> 8;
  38123. x[j] -= carry * 256;
  38124. }
  38125. x[j] += carry;
  38126. x[i] = 0;
  38127. }
  38128. carry = 0;
  38129. for (j = 0; j < 32; j++) {
  38130. x[j] += carry - (x[31] >> 4) * L[j];
  38131. carry = x[j] >> 8;
  38132. x[j] &= 255;
  38133. }
  38134. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38135. for (i = 0; i < 32; i++) {
  38136. x[i+1] += x[i] >> 8;
  38137. r[i] = x[i] & 255;
  38138. }
  38139. }
  38140. function reduce(r) {
  38141. var x = new Float64Array(64), i;
  38142. for (i = 0; i < 64; i++) x[i] = r[i];
  38143. for (i = 0; i < 64; i++) r[i] = 0;
  38144. modL(r, x);
  38145. }
  38146. // Note: difference from C - smlen returned, not passed as argument.
  38147. function crypto_sign(sm, m, n, sk) {
  38148. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38149. var i, j, x = new Float64Array(64);
  38150. var p = [gf(), gf(), gf(), gf()];
  38151. crypto_hash(d, sk, 32);
  38152. d[0] &= 248;
  38153. d[31] &= 127;
  38154. d[31] |= 64;
  38155. var smlen = n + 64;
  38156. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38157. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38158. crypto_hash(r, sm.subarray(32), n+32);
  38159. reduce(r);
  38160. scalarbase(p, r);
  38161. pack(sm, p);
  38162. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38163. crypto_hash(h, sm, n + 64);
  38164. reduce(h);
  38165. for (i = 0; i < 64; i++) x[i] = 0;
  38166. for (i = 0; i < 32; i++) x[i] = r[i];
  38167. for (i = 0; i < 32; i++) {
  38168. for (j = 0; j < 32; j++) {
  38169. x[i+j] += h[i] * d[j];
  38170. }
  38171. }
  38172. modL(sm.subarray(32), x);
  38173. return smlen;
  38174. }
  38175. function unpackneg(r, p) {
  38176. var t = gf(), chk = gf(), num = gf(),
  38177. den = gf(), den2 = gf(), den4 = gf(),
  38178. den6 = gf();
  38179. set25519(r[2], gf1);
  38180. unpack25519(r[1], p);
  38181. S(num, r[1]);
  38182. M(den, num, D);
  38183. Z(num, num, r[2]);
  38184. A(den, r[2], den);
  38185. S(den2, den);
  38186. S(den4, den2);
  38187. M(den6, den4, den2);
  38188. M(t, den6, num);
  38189. M(t, t, den);
  38190. pow2523(t, t);
  38191. M(t, t, num);
  38192. M(t, t, den);
  38193. M(t, t, den);
  38194. M(r[0], t, den);
  38195. S(chk, r[0]);
  38196. M(chk, chk, den);
  38197. if (neq25519(chk, num)) M(r[0], r[0], I);
  38198. S(chk, r[0]);
  38199. M(chk, chk, den);
  38200. if (neq25519(chk, num)) return -1;
  38201. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38202. M(r[3], r[0], r[1]);
  38203. return 0;
  38204. }
  38205. function crypto_sign_open(m, sm, n, pk) {
  38206. var i, mlen;
  38207. var t = new Uint8Array(32), h = new Uint8Array(64);
  38208. var p = [gf(), gf(), gf(), gf()],
  38209. q = [gf(), gf(), gf(), gf()];
  38210. mlen = -1;
  38211. if (n < 64) return -1;
  38212. if (unpackneg(q, pk)) return -1;
  38213. for (i = 0; i < n; i++) m[i] = sm[i];
  38214. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38215. crypto_hash(h, m, n);
  38216. reduce(h);
  38217. scalarmult(p, q, h);
  38218. scalarbase(q, sm.subarray(32));
  38219. add(p, q);
  38220. pack(t, p);
  38221. n -= 64;
  38222. if (crypto_verify_32(sm, 0, t, 0)) {
  38223. for (i = 0; i < n; i++) m[i] = 0;
  38224. return -1;
  38225. }
  38226. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38227. mlen = n;
  38228. return mlen;
  38229. }
  38230. var crypto_secretbox_KEYBYTES = 32,
  38231. crypto_secretbox_NONCEBYTES = 24,
  38232. crypto_secretbox_ZEROBYTES = 32,
  38233. crypto_secretbox_BOXZEROBYTES = 16,
  38234. crypto_scalarmult_BYTES = 32,
  38235. crypto_scalarmult_SCALARBYTES = 32,
  38236. crypto_box_PUBLICKEYBYTES = 32,
  38237. crypto_box_SECRETKEYBYTES = 32,
  38238. crypto_box_BEFORENMBYTES = 32,
  38239. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38240. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38241. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38242. crypto_sign_BYTES = 64,
  38243. crypto_sign_PUBLICKEYBYTES = 32,
  38244. crypto_sign_SECRETKEYBYTES = 64,
  38245. crypto_sign_SEEDBYTES = 32,
  38246. crypto_hash_BYTES = 64;
  38247. nacl.lowlevel = {
  38248. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38249. crypto_stream_xor: crypto_stream_xor,
  38250. crypto_stream: crypto_stream,
  38251. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38252. crypto_stream_salsa20: crypto_stream_salsa20,
  38253. crypto_onetimeauth: crypto_onetimeauth,
  38254. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38255. crypto_verify_16: crypto_verify_16,
  38256. crypto_verify_32: crypto_verify_32,
  38257. crypto_secretbox: crypto_secretbox,
  38258. crypto_secretbox_open: crypto_secretbox_open,
  38259. crypto_scalarmult: crypto_scalarmult,
  38260. crypto_scalarmult_base: crypto_scalarmult_base,
  38261. crypto_box_beforenm: crypto_box_beforenm,
  38262. crypto_box_afternm: crypto_box_afternm,
  38263. crypto_box: crypto_box,
  38264. crypto_box_open: crypto_box_open,
  38265. crypto_box_keypair: crypto_box_keypair,
  38266. crypto_hash: crypto_hash,
  38267. crypto_sign: crypto_sign,
  38268. crypto_sign_keypair: crypto_sign_keypair,
  38269. crypto_sign_open: crypto_sign_open,
  38270. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38271. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38272. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38273. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38274. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38275. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38276. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38277. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38278. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38279. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38280. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38281. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38282. crypto_sign_BYTES: crypto_sign_BYTES,
  38283. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38284. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38285. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38286. crypto_hash_BYTES: crypto_hash_BYTES
  38287. };
  38288. /* High-level API */
  38289. function checkLengths(k, n) {
  38290. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38291. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38292. }
  38293. function checkBoxLengths(pk, sk) {
  38294. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38295. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38296. }
  38297. function checkArrayTypes() {
  38298. for (var i = 0; i < arguments.length; i++) {
  38299. if (!(arguments[i] instanceof Uint8Array))
  38300. throw new TypeError('unexpected type, use Uint8Array');
  38301. }
  38302. }
  38303. function cleanup(arr) {
  38304. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38305. }
  38306. nacl.randomBytes = function(n) {
  38307. var b = new Uint8Array(n);
  38308. randombytes(b, n);
  38309. return b;
  38310. };
  38311. nacl.secretbox = function(msg, nonce, key) {
  38312. checkArrayTypes(msg, nonce, key);
  38313. checkLengths(key, nonce);
  38314. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38315. var c = new Uint8Array(m.length);
  38316. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38317. crypto_secretbox(c, m, m.length, nonce, key);
  38318. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38319. };
  38320. nacl.secretbox.open = function(box, nonce, key) {
  38321. checkArrayTypes(box, nonce, key);
  38322. checkLengths(key, nonce);
  38323. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38324. var m = new Uint8Array(c.length);
  38325. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38326. if (c.length < 32) return null;
  38327. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38328. return m.subarray(crypto_secretbox_ZEROBYTES);
  38329. };
  38330. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38331. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38332. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38333. nacl.scalarMult = function(n, p) {
  38334. checkArrayTypes(n, p);
  38335. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38336. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38337. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38338. crypto_scalarmult(q, n, p);
  38339. return q;
  38340. };
  38341. nacl.scalarMult.base = function(n) {
  38342. checkArrayTypes(n);
  38343. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38344. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38345. crypto_scalarmult_base(q, n);
  38346. return q;
  38347. };
  38348. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38349. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38350. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38351. var k = nacl.box.before(publicKey, secretKey);
  38352. return nacl.secretbox(msg, nonce, k);
  38353. };
  38354. nacl.box.before = function(publicKey, secretKey) {
  38355. checkArrayTypes(publicKey, secretKey);
  38356. checkBoxLengths(publicKey, secretKey);
  38357. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38358. crypto_box_beforenm(k, publicKey, secretKey);
  38359. return k;
  38360. };
  38361. nacl.box.after = nacl.secretbox;
  38362. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38363. var k = nacl.box.before(publicKey, secretKey);
  38364. return nacl.secretbox.open(msg, nonce, k);
  38365. };
  38366. nacl.box.open.after = nacl.secretbox.open;
  38367. nacl.box.keyPair = function() {
  38368. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38369. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38370. crypto_box_keypair(pk, sk);
  38371. return {publicKey: pk, secretKey: sk};
  38372. };
  38373. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38374. checkArrayTypes(secretKey);
  38375. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38376. throw new Error('bad secret key size');
  38377. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38378. crypto_scalarmult_base(pk, secretKey);
  38379. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38380. };
  38381. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38382. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38383. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38384. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38385. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38386. nacl.sign = function(msg, secretKey) {
  38387. checkArrayTypes(msg, secretKey);
  38388. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38389. throw new Error('bad secret key size');
  38390. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38391. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38392. return signedMsg;
  38393. };
  38394. nacl.sign.open = function(signedMsg, publicKey) {
  38395. checkArrayTypes(signedMsg, publicKey);
  38396. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38397. throw new Error('bad public key size');
  38398. var tmp = new Uint8Array(signedMsg.length);
  38399. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38400. if (mlen < 0) return null;
  38401. var m = new Uint8Array(mlen);
  38402. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38403. return m;
  38404. };
  38405. nacl.sign.detached = function(msg, secretKey) {
  38406. var signedMsg = nacl.sign(msg, secretKey);
  38407. var sig = new Uint8Array(crypto_sign_BYTES);
  38408. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38409. return sig;
  38410. };
  38411. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38412. checkArrayTypes(msg, sig, publicKey);
  38413. if (sig.length !== crypto_sign_BYTES)
  38414. throw new Error('bad signature size');
  38415. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38416. throw new Error('bad public key size');
  38417. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38418. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38419. var i;
  38420. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38421. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38422. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38423. };
  38424. nacl.sign.keyPair = function() {
  38425. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38426. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38427. crypto_sign_keypair(pk, sk);
  38428. return {publicKey: pk, secretKey: sk};
  38429. };
  38430. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38431. checkArrayTypes(secretKey);
  38432. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38433. throw new Error('bad secret key size');
  38434. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38435. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38436. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38437. };
  38438. nacl.sign.keyPair.fromSeed = function(seed) {
  38439. checkArrayTypes(seed);
  38440. if (seed.length !== crypto_sign_SEEDBYTES)
  38441. throw new Error('bad seed size');
  38442. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38443. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38444. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38445. crypto_sign_keypair(pk, sk, true);
  38446. return {publicKey: pk, secretKey: sk};
  38447. };
  38448. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38449. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38450. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38451. nacl.sign.signatureLength = crypto_sign_BYTES;
  38452. nacl.hash = function(msg) {
  38453. checkArrayTypes(msg);
  38454. var h = new Uint8Array(crypto_hash_BYTES);
  38455. crypto_hash(h, msg, msg.length);
  38456. return h;
  38457. };
  38458. nacl.hash.hashLength = crypto_hash_BYTES;
  38459. nacl.verify = function(x, y) {
  38460. checkArrayTypes(x, y);
  38461. // Zero length arguments are considered not equal.
  38462. if (x.length === 0 || y.length === 0) return false;
  38463. if (x.length !== y.length) return false;
  38464. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38465. };
  38466. nacl.setPRNG = function(fn) {
  38467. randombytes = fn;
  38468. };
  38469. (function() {
  38470. // Initialize PRNG if environment provides CSPRNG.
  38471. // If not, methods calling randombytes will throw.
  38472. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38473. if (crypto && crypto.getRandomValues) {
  38474. // Browsers.
  38475. var QUOTA = 65536;
  38476. nacl.setPRNG(function(x, n) {
  38477. var i, v = new Uint8Array(n);
  38478. for (i = 0; i < n; i += QUOTA) {
  38479. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38480. }
  38481. for (i = 0; i < n; i++) x[i] = v[i];
  38482. cleanup(v);
  38483. });
  38484. } else if (true) {
  38485. // Node.js.
  38486. crypto = __webpack_require__(3);
  38487. if (crypto && crypto.randomBytes) {
  38488. nacl.setPRNG(function(x, n) {
  38489. var i, v = crypto.randomBytes(n);
  38490. for (i = 0; i < n; i++) x[i] = v[i];
  38491. cleanup(v);
  38492. });
  38493. }
  38494. }
  38495. })();
  38496. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38497. /***/ }),
  38498. /* 1 */
  38499. /***/ (function(module, exports, __webpack_require__) {
  38500. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38501. // Public domain.
  38502. (function(root, f) {
  38503. 'use strict';
  38504. if ( true && module.exports) module.exports = f();
  38505. else if (root.nacl) root.nacl.util = f();
  38506. else {
  38507. root.nacl = {};
  38508. root.nacl.util = f();
  38509. }
  38510. }(this, function() {
  38511. 'use strict';
  38512. var util = {};
  38513. function validateBase64(s) {
  38514. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38515. throw new TypeError('invalid encoding');
  38516. }
  38517. }
  38518. util.decodeUTF8 = function(s) {
  38519. if (typeof s !== 'string') throw new TypeError('expected string');
  38520. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38521. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38522. return b;
  38523. };
  38524. util.encodeUTF8 = function(arr) {
  38525. var i, s = [];
  38526. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38527. return decodeURIComponent(escape(s.join('')));
  38528. };
  38529. if (typeof atob === 'undefined') {
  38530. // Node.js
  38531. if (typeof Buffer.from !== 'undefined') {
  38532. // Node v6 and later
  38533. util.encodeBase64 = function (arr) { // v6 and later
  38534. return Buffer.from(arr).toString('base64');
  38535. };
  38536. util.decodeBase64 = function (s) {
  38537. validateBase64(s);
  38538. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38539. };
  38540. } else {
  38541. // Node earlier than v6
  38542. util.encodeBase64 = function (arr) { // v6 and later
  38543. return (new Buffer(arr)).toString('base64');
  38544. };
  38545. util.decodeBase64 = function(s) {
  38546. validateBase64(s);
  38547. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38548. };
  38549. }
  38550. } else {
  38551. // Browsers
  38552. util.encodeBase64 = function(arr) {
  38553. var i, s = [], len = arr.length;
  38554. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38555. return btoa(s.join(''));
  38556. };
  38557. util.decodeBase64 = function(s) {
  38558. validateBase64(s);
  38559. var i, d = atob(s), b = new Uint8Array(d.length);
  38560. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38561. return b;
  38562. };
  38563. }
  38564. return util;
  38565. }));
  38566. /***/ }),
  38567. /* 2 */
  38568. /***/ (function(module, exports, __webpack_require__) {
  38569. // required so we don't have to do require('pusher').default etc.
  38570. module.exports = __webpack_require__(4).default;
  38571. /***/ }),
  38572. /* 3 */
  38573. /***/ (function(module, exports) {
  38574. /* (ignored) */
  38575. /***/ }),
  38576. /* 4 */
  38577. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38578. "use strict";
  38579. __webpack_require__.r(__webpack_exports__);
  38580. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38581. var ScriptReceiverFactory = (function () {
  38582. function ScriptReceiverFactory(prefix, name) {
  38583. this.lastId = 0;
  38584. this.prefix = prefix;
  38585. this.name = name;
  38586. }
  38587. ScriptReceiverFactory.prototype.create = function (callback) {
  38588. this.lastId++;
  38589. var number = this.lastId;
  38590. var id = this.prefix + number;
  38591. var name = this.name + "[" + number + "]";
  38592. var called = false;
  38593. var callbackWrapper = function () {
  38594. if (!called) {
  38595. callback.apply(null, arguments);
  38596. called = true;
  38597. }
  38598. };
  38599. this[number] = callbackWrapper;
  38600. return { number: number, id: id, name: name, callback: callbackWrapper };
  38601. };
  38602. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38603. delete this[receiver.number];
  38604. };
  38605. return ScriptReceiverFactory;
  38606. }());
  38607. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38608. // CONCATENATED MODULE: ./src/core/defaults.ts
  38609. var Defaults = {
  38610. VERSION: "5.0.3",
  38611. PROTOCOL: 7,
  38612. host: 'ws.pusherapp.com',
  38613. ws_port: 80,
  38614. wss_port: 443,
  38615. ws_path: '',
  38616. sockjs_host: 'sockjs.pusher.com',
  38617. sockjs_http_port: 80,
  38618. sockjs_https_port: 443,
  38619. sockjs_path: '/pusher',
  38620. stats_host: 'stats.pusher.com',
  38621. channel_auth_endpoint: '/pusher/auth',
  38622. channel_auth_transport: 'ajax',
  38623. activity_timeout: 120000,
  38624. pong_timeout: 30000,
  38625. unavailable_timeout: 10000,
  38626. cdn_http: "http://js.pusher.com",
  38627. cdn_https: "https://js.pusher.com",
  38628. dependency_suffix: ""
  38629. };
  38630. /* harmony default export */ var defaults = (Defaults);
  38631. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38632. var dependency_loader_DependencyLoader = (function () {
  38633. function DependencyLoader(options) {
  38634. this.options = options;
  38635. this.receivers = options.receivers || ScriptReceivers;
  38636. this.loading = {};
  38637. }
  38638. DependencyLoader.prototype.load = function (name, options, callback) {
  38639. var self = this;
  38640. if (self.loading[name] && self.loading[name].length > 0) {
  38641. self.loading[name].push(callback);
  38642. }
  38643. else {
  38644. self.loading[name] = [callback];
  38645. var request = runtime.createScriptRequest(self.getPath(name, options));
  38646. var receiver = self.receivers.create(function (error) {
  38647. self.receivers.remove(receiver);
  38648. if (self.loading[name]) {
  38649. var callbacks = self.loading[name];
  38650. delete self.loading[name];
  38651. var successCallback = function (wasSuccessful) {
  38652. if (!wasSuccessful) {
  38653. request.cleanup();
  38654. }
  38655. };
  38656. for (var i = 0; i < callbacks.length; i++) {
  38657. callbacks[i](error, successCallback);
  38658. }
  38659. }
  38660. });
  38661. request.send(receiver);
  38662. }
  38663. };
  38664. DependencyLoader.prototype.getRoot = function (options) {
  38665. var cdn;
  38666. var protocol = runtime.getDocument().location.protocol;
  38667. if ((options && options.useTLS) || protocol === "https:") {
  38668. cdn = this.options.cdn_https;
  38669. }
  38670. else {
  38671. cdn = this.options.cdn_http;
  38672. }
  38673. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38674. };
  38675. DependencyLoader.prototype.getPath = function (name, options) {
  38676. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38677. };
  38678. ;
  38679. return DependencyLoader;
  38680. }());
  38681. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38682. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38683. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38684. var Dependencies = new dependency_loader({
  38685. cdn_http: defaults.cdn_http,
  38686. cdn_https: defaults.cdn_https,
  38687. version: defaults.VERSION,
  38688. suffix: defaults.dependency_suffix,
  38689. receivers: DependenciesReceivers
  38690. });
  38691. // CONCATENATED MODULE: ./src/core/base64.ts
  38692. function encode(s) {
  38693. return btoa(utob(s));
  38694. }
  38695. var fromCharCode = String.fromCharCode;
  38696. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38697. var b64tab = {};
  38698. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38699. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38700. }
  38701. var cb_utob = function (c) {
  38702. var cc = c.charCodeAt(0);
  38703. return cc < 0x80
  38704. ? c
  38705. : cc < 0x800
  38706. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38707. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38708. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38709. fromCharCode(0x80 | (cc & 0x3f));
  38710. };
  38711. var utob = function (u) {
  38712. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38713. };
  38714. var cb_encode = function (ccc) {
  38715. var padlen = [0, 2, 1][ccc.length % 3];
  38716. var ord = (ccc.charCodeAt(0) << 16) |
  38717. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38718. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38719. var chars = [
  38720. b64chars.charAt(ord >>> 18),
  38721. b64chars.charAt((ord >>> 12) & 63),
  38722. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38723. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38724. ];
  38725. return chars.join('');
  38726. };
  38727. var btoa = window.btoa ||
  38728. function (b) {
  38729. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38730. };
  38731. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38732. var Timer = (function () {
  38733. function Timer(set, clear, delay, callback) {
  38734. var _this = this;
  38735. this.clear = clear;
  38736. this.timer = set(function () {
  38737. if (_this.timer) {
  38738. _this.timer = callback(_this.timer);
  38739. }
  38740. }, delay);
  38741. }
  38742. Timer.prototype.isRunning = function () {
  38743. return this.timer !== null;
  38744. };
  38745. Timer.prototype.ensureAborted = function () {
  38746. if (this.timer) {
  38747. this.clear(this.timer);
  38748. this.timer = null;
  38749. }
  38750. };
  38751. return Timer;
  38752. }());
  38753. /* harmony default export */ var abstract_timer = (Timer);
  38754. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38755. var __extends = (undefined && undefined.__extends) || (function () {
  38756. var extendStatics = function (d, b) {
  38757. extendStatics = Object.setPrototypeOf ||
  38758. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38759. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38760. return extendStatics(d, b);
  38761. };
  38762. return function (d, b) {
  38763. extendStatics(d, b);
  38764. function __() { this.constructor = d; }
  38765. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38766. };
  38767. })();
  38768. function timers_clearTimeout(timer) {
  38769. window.clearTimeout(timer);
  38770. }
  38771. function timers_clearInterval(timer) {
  38772. window.clearInterval(timer);
  38773. }
  38774. var OneOffTimer = (function (_super) {
  38775. __extends(OneOffTimer, _super);
  38776. function OneOffTimer(delay, callback) {
  38777. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38778. callback();
  38779. return null;
  38780. }) || this;
  38781. }
  38782. return OneOffTimer;
  38783. }(abstract_timer));
  38784. var PeriodicTimer = (function (_super) {
  38785. __extends(PeriodicTimer, _super);
  38786. function PeriodicTimer(delay, callback) {
  38787. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38788. callback();
  38789. return timer;
  38790. }) || this;
  38791. }
  38792. return PeriodicTimer;
  38793. }(abstract_timer));
  38794. // CONCATENATED MODULE: ./src/core/util.ts
  38795. var Util = {
  38796. now: function () {
  38797. if (Date.now) {
  38798. return Date.now();
  38799. }
  38800. else {
  38801. return new Date().valueOf();
  38802. }
  38803. },
  38804. defer: function (callback) {
  38805. return new OneOffTimer(0, callback);
  38806. },
  38807. method: function (name) {
  38808. var args = [];
  38809. for (var _i = 1; _i < arguments.length; _i++) {
  38810. args[_i - 1] = arguments[_i];
  38811. }
  38812. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38813. return function (object) {
  38814. return object[name].apply(object, boundArguments.concat(arguments));
  38815. };
  38816. }
  38817. };
  38818. /* harmony default export */ var util = (Util);
  38819. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38820. function extend(target) {
  38821. var sources = [];
  38822. for (var _i = 1; _i < arguments.length; _i++) {
  38823. sources[_i - 1] = arguments[_i];
  38824. }
  38825. for (var i = 0; i < sources.length; i++) {
  38826. var extensions = sources[i];
  38827. for (var property in extensions) {
  38828. if (extensions[property] && extensions[property].constructor &&
  38829. extensions[property].constructor === Object) {
  38830. target[property] = extend(target[property] || {}, extensions[property]);
  38831. }
  38832. else {
  38833. target[property] = extensions[property];
  38834. }
  38835. }
  38836. }
  38837. return target;
  38838. }
  38839. function stringify() {
  38840. var m = ["Pusher"];
  38841. for (var i = 0; i < arguments.length; i++) {
  38842. if (typeof arguments[i] === "string") {
  38843. m.push(arguments[i]);
  38844. }
  38845. else {
  38846. m.push(safeJSONStringify(arguments[i]));
  38847. }
  38848. }
  38849. return m.join(" : ");
  38850. }
  38851. function arrayIndexOf(array, item) {
  38852. var nativeIndexOf = Array.prototype.indexOf;
  38853. if (array === null) {
  38854. return -1;
  38855. }
  38856. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38857. return array.indexOf(item);
  38858. }
  38859. for (var i = 0, l = array.length; i < l; i++) {
  38860. if (array[i] === item) {
  38861. return i;
  38862. }
  38863. }
  38864. return -1;
  38865. }
  38866. function objectApply(object, f) {
  38867. for (var key in object) {
  38868. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38869. f(object[key], key, object);
  38870. }
  38871. }
  38872. }
  38873. function keys(object) {
  38874. var keys = [];
  38875. objectApply(object, function (_, key) {
  38876. keys.push(key);
  38877. });
  38878. return keys;
  38879. }
  38880. function values(object) {
  38881. var values = [];
  38882. objectApply(object, function (value) {
  38883. values.push(value);
  38884. });
  38885. return values;
  38886. }
  38887. function apply(array, f, context) {
  38888. for (var i = 0; i < array.length; i++) {
  38889. f.call(context || window, array[i], i, array);
  38890. }
  38891. }
  38892. function map(array, f) {
  38893. var result = [];
  38894. for (var i = 0; i < array.length; i++) {
  38895. result.push(f(array[i], i, array, result));
  38896. }
  38897. return result;
  38898. }
  38899. function mapObject(object, f) {
  38900. var result = {};
  38901. objectApply(object, function (value, key) {
  38902. result[key] = f(value);
  38903. });
  38904. return result;
  38905. }
  38906. function filter(array, test) {
  38907. test = test || function (value) { return !!value; };
  38908. var result = [];
  38909. for (var i = 0; i < array.length; i++) {
  38910. if (test(array[i], i, array, result)) {
  38911. result.push(array[i]);
  38912. }
  38913. }
  38914. return result;
  38915. }
  38916. function filterObject(object, test) {
  38917. var result = {};
  38918. objectApply(object, function (value, key) {
  38919. if ((test && test(value, key, object, result)) || Boolean(value)) {
  38920. result[key] = value;
  38921. }
  38922. });
  38923. return result;
  38924. }
  38925. function flatten(object) {
  38926. var result = [];
  38927. objectApply(object, function (value, key) {
  38928. result.push([key, value]);
  38929. });
  38930. return result;
  38931. }
  38932. function any(array, test) {
  38933. for (var i = 0; i < array.length; i++) {
  38934. if (test(array[i], i, array)) {
  38935. return true;
  38936. }
  38937. }
  38938. return false;
  38939. }
  38940. function collections_all(array, test) {
  38941. for (var i = 0; i < array.length; i++) {
  38942. if (!test(array[i], i, array)) {
  38943. return false;
  38944. }
  38945. }
  38946. return true;
  38947. }
  38948. function encodeParamsObject(data) {
  38949. return mapObject(data, function (value) {
  38950. if (typeof value === "object") {
  38951. value = safeJSONStringify(value);
  38952. }
  38953. return encodeURIComponent(encode(value.toString()));
  38954. });
  38955. }
  38956. function buildQueryString(data) {
  38957. var params = filterObject(data, function (value) {
  38958. return value !== undefined;
  38959. });
  38960. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  38961. return query;
  38962. }
  38963. function decycleObject(object) {
  38964. var objects = [], paths = [];
  38965. return (function derez(value, path) {
  38966. var i, name, nu;
  38967. switch (typeof value) {
  38968. case 'object':
  38969. if (!value) {
  38970. return null;
  38971. }
  38972. for (i = 0; i < objects.length; i += 1) {
  38973. if (objects[i] === value) {
  38974. return { $ref: paths[i] };
  38975. }
  38976. }
  38977. objects.push(value);
  38978. paths.push(path);
  38979. if (Object.prototype.toString.apply(value) === '[object Array]') {
  38980. nu = [];
  38981. for (i = 0; i < value.length; i += 1) {
  38982. nu[i] = derez(value[i], path + '[' + i + ']');
  38983. }
  38984. }
  38985. else {
  38986. nu = {};
  38987. for (name in value) {
  38988. if (Object.prototype.hasOwnProperty.call(value, name)) {
  38989. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  38990. }
  38991. }
  38992. }
  38993. return nu;
  38994. case 'number':
  38995. case 'string':
  38996. case 'boolean':
  38997. return value;
  38998. }
  38999. }(object, '$'));
  39000. }
  39001. function safeJSONStringify(source) {
  39002. try {
  39003. return JSON.stringify(source);
  39004. }
  39005. catch (e) {
  39006. return JSON.stringify(decycleObject(source));
  39007. }
  39008. }
  39009. // CONCATENATED MODULE: ./src/core/logger.ts
  39010. var logger_Logger = (function () {
  39011. function Logger() {
  39012. this.globalLog = function (message) {
  39013. if (window.console && window.console.log) {
  39014. window.console.log(message);
  39015. }
  39016. };
  39017. }
  39018. Logger.prototype.debug = function () {
  39019. var args = [];
  39020. for (var _i = 0; _i < arguments.length; _i++) {
  39021. args[_i] = arguments[_i];
  39022. }
  39023. this.log(this.globalLog, args);
  39024. };
  39025. Logger.prototype.warn = function () {
  39026. var args = [];
  39027. for (var _i = 0; _i < arguments.length; _i++) {
  39028. args[_i] = arguments[_i];
  39029. }
  39030. this.log(this.globalLogWarn, args);
  39031. };
  39032. Logger.prototype.error = function () {
  39033. var args = [];
  39034. for (var _i = 0; _i < arguments.length; _i++) {
  39035. args[_i] = arguments[_i];
  39036. }
  39037. this.log(this.globalLogError, args);
  39038. };
  39039. Logger.prototype.globalLogWarn = function (message) {
  39040. if (window.console && window.console.warn) {
  39041. window.console.warn(message);
  39042. }
  39043. else {
  39044. this.globalLog(message);
  39045. }
  39046. };
  39047. Logger.prototype.globalLogError = function (message) {
  39048. if (window.console && window.console.error) {
  39049. window.console.error(message);
  39050. }
  39051. else {
  39052. this.globalLogWarn(message);
  39053. }
  39054. };
  39055. Logger.prototype.log = function (defaultLoggingFunction) {
  39056. var args = [];
  39057. for (var _i = 1; _i < arguments.length; _i++) {
  39058. args[_i - 1] = arguments[_i];
  39059. }
  39060. var message = stringify.apply(this, arguments);
  39061. if (core_pusher.log) {
  39062. core_pusher.log(message);
  39063. }
  39064. else if (core_pusher.logToConsole) {
  39065. var log = defaultLoggingFunction.bind(this);
  39066. log(message);
  39067. }
  39068. };
  39069. return Logger;
  39070. }());
  39071. /* harmony default export */ var logger = (new logger_Logger());
  39072. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39073. var urlStore = {
  39074. baseUrl: "https://pusher.com",
  39075. urls: {
  39076. authenticationEndpoint: {
  39077. path: "/docs/authenticating_users",
  39078. },
  39079. javascriptQuickStart: {
  39080. path: "/docs/javascript_quick_start"
  39081. },
  39082. triggeringClientEvents: {
  39083. path: "/docs/client_api_guide/client_events#trigger-events"
  39084. }
  39085. }
  39086. };
  39087. var buildLogSuffix = function (key) {
  39088. var urlPrefix = "See:";
  39089. var urlObj = urlStore.urls[key];
  39090. if (!urlObj)
  39091. return "";
  39092. var url;
  39093. if (urlObj.fullUrl) {
  39094. url = urlObj.fullUrl;
  39095. }
  39096. else if (urlObj.path) {
  39097. url = urlStore.baseUrl + urlObj.path;
  39098. }
  39099. if (!url)
  39100. return "";
  39101. return urlPrefix + " " + url;
  39102. };
  39103. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39104. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39105. var ajax = function (context, socketId, callback) {
  39106. var self = this, xhr;
  39107. xhr = runtime.createXHR();
  39108. xhr.open("POST", self.options.authEndpoint, true);
  39109. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39110. for (var headerName in this.authOptions.headers) {
  39111. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39112. }
  39113. xhr.onreadystatechange = function () {
  39114. if (xhr.readyState === 4) {
  39115. if (xhr.status === 200) {
  39116. var data, parsed = false;
  39117. try {
  39118. data = JSON.parse(xhr.responseText);
  39119. parsed = true;
  39120. }
  39121. catch (e) {
  39122. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39123. }
  39124. if (parsed) {
  39125. callback(false, data);
  39126. }
  39127. }
  39128. else {
  39129. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39130. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39131. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39132. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39133. callback(true, xhr.status);
  39134. }
  39135. }
  39136. };
  39137. xhr.send(this.composeQuery(socketId));
  39138. return xhr;
  39139. };
  39140. /* harmony default export */ var xhr_auth = (ajax);
  39141. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39142. var jsonp = function (context, socketId, callback) {
  39143. if (this.authOptions.headers !== undefined) {
  39144. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39145. }
  39146. var callbackName = context.nextAuthCallbackID.toString();
  39147. context.nextAuthCallbackID++;
  39148. var document = context.getDocument();
  39149. var script = document.createElement("script");
  39150. context.auth_callbacks[callbackName] = function (data) {
  39151. callback(false, data);
  39152. };
  39153. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39154. script.src = this.options.authEndpoint +
  39155. '?callback=' +
  39156. encodeURIComponent(callback_name) +
  39157. '&' +
  39158. this.composeQuery(socketId);
  39159. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39160. head.insertBefore(script, head.firstChild);
  39161. };
  39162. /* harmony default export */ var jsonp_auth = (jsonp);
  39163. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39164. var ScriptRequest = (function () {
  39165. function ScriptRequest(src) {
  39166. this.src = src;
  39167. }
  39168. ScriptRequest.prototype.send = function (receiver) {
  39169. var self = this;
  39170. var errorString = "Error loading " + self.src;
  39171. self.script = document.createElement("script");
  39172. self.script.id = receiver.id;
  39173. self.script.src = self.src;
  39174. self.script.type = "text/javascript";
  39175. self.script.charset = "UTF-8";
  39176. if (self.script.addEventListener) {
  39177. self.script.onerror = function () {
  39178. receiver.callback(errorString);
  39179. };
  39180. self.script.onload = function () {
  39181. receiver.callback(null);
  39182. };
  39183. }
  39184. else {
  39185. self.script.onreadystatechange = function () {
  39186. if (self.script.readyState === 'loaded' ||
  39187. self.script.readyState === 'complete') {
  39188. receiver.callback(null);
  39189. }
  39190. };
  39191. }
  39192. if (self.script.async === undefined && document.attachEvent &&
  39193. /opera/i.test(navigator.userAgent)) {
  39194. self.errorScript = document.createElement("script");
  39195. self.errorScript.id = receiver.id + "_error";
  39196. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39197. self.script.async = self.errorScript.async = false;
  39198. }
  39199. else {
  39200. self.script.async = true;
  39201. }
  39202. var head = document.getElementsByTagName('head')[0];
  39203. head.insertBefore(self.script, head.firstChild);
  39204. if (self.errorScript) {
  39205. head.insertBefore(self.errorScript, self.script.nextSibling);
  39206. }
  39207. };
  39208. ScriptRequest.prototype.cleanup = function () {
  39209. if (this.script) {
  39210. this.script.onload = this.script.onerror = null;
  39211. this.script.onreadystatechange = null;
  39212. }
  39213. if (this.script && this.script.parentNode) {
  39214. this.script.parentNode.removeChild(this.script);
  39215. }
  39216. if (this.errorScript && this.errorScript.parentNode) {
  39217. this.errorScript.parentNode.removeChild(this.errorScript);
  39218. }
  39219. this.script = null;
  39220. this.errorScript = null;
  39221. };
  39222. return ScriptRequest;
  39223. }());
  39224. /* harmony default export */ var script_request = (ScriptRequest);
  39225. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39226. var jsonp_request_JSONPRequest = (function () {
  39227. function JSONPRequest(url, data) {
  39228. this.url = url;
  39229. this.data = data;
  39230. }
  39231. JSONPRequest.prototype.send = function (receiver) {
  39232. if (this.request) {
  39233. return;
  39234. }
  39235. var query = buildQueryString(this.data);
  39236. var url = this.url + "/" + receiver.number + "?" + query;
  39237. this.request = runtime.createScriptRequest(url);
  39238. this.request.send(receiver);
  39239. };
  39240. JSONPRequest.prototype.cleanup = function () {
  39241. if (this.request) {
  39242. this.request.cleanup();
  39243. }
  39244. };
  39245. return JSONPRequest;
  39246. }());
  39247. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39248. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39249. var getAgent = function (sender, useTLS) {
  39250. return function (data, callback) {
  39251. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39252. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39253. var request = runtime.createJSONPRequest(url, data);
  39254. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39255. ScriptReceivers.remove(receiver);
  39256. request.cleanup();
  39257. if (result && result.host) {
  39258. sender.host = result.host;
  39259. }
  39260. if (callback) {
  39261. callback(error, result);
  39262. }
  39263. });
  39264. request.send(receiver);
  39265. };
  39266. };
  39267. var jsonp_timeline_jsonp = {
  39268. name: 'jsonp',
  39269. getAgent: getAgent
  39270. };
  39271. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39272. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39273. function getGenericURL(baseScheme, params, path) {
  39274. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39275. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39276. return scheme + "://" + host + path;
  39277. }
  39278. function getGenericPath(key, queryString) {
  39279. var path = "/app/" + key;
  39280. var query = "?protocol=" + defaults.PROTOCOL +
  39281. "&client=js" +
  39282. "&version=" + defaults.VERSION +
  39283. (queryString ? ("&" + queryString) : "");
  39284. return path + query;
  39285. }
  39286. var ws = {
  39287. getInitial: function (key, params) {
  39288. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39289. return getGenericURL("ws", params, path);
  39290. }
  39291. };
  39292. var http = {
  39293. getInitial: function (key, params) {
  39294. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39295. return getGenericURL("http", params, path);
  39296. }
  39297. };
  39298. var sockjs = {
  39299. getInitial: function (key, params) {
  39300. return getGenericURL("http", params, params.httpPath || "/pusher");
  39301. },
  39302. getPath: function (key, params) {
  39303. return getGenericPath(key);
  39304. }
  39305. };
  39306. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39307. var callback_registry_CallbackRegistry = (function () {
  39308. function CallbackRegistry() {
  39309. this._callbacks = {};
  39310. }
  39311. CallbackRegistry.prototype.get = function (name) {
  39312. return this._callbacks[prefix(name)];
  39313. };
  39314. CallbackRegistry.prototype.add = function (name, callback, context) {
  39315. var prefixedEventName = prefix(name);
  39316. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39317. this._callbacks[prefixedEventName].push({
  39318. fn: callback,
  39319. context: context
  39320. });
  39321. };
  39322. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39323. if (!name && !callback && !context) {
  39324. this._callbacks = {};
  39325. return;
  39326. }
  39327. var names = name ? [prefix(name)] : keys(this._callbacks);
  39328. if (callback || context) {
  39329. this.removeCallback(names, callback, context);
  39330. }
  39331. else {
  39332. this.removeAllCallbacks(names);
  39333. }
  39334. };
  39335. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39336. apply(names, function (name) {
  39337. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39338. return (callback && callback !== binding.fn) ||
  39339. (context && context !== binding.context);
  39340. });
  39341. if (this._callbacks[name].length === 0) {
  39342. delete this._callbacks[name];
  39343. }
  39344. }, this);
  39345. };
  39346. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39347. apply(names, function (name) {
  39348. delete this._callbacks[name];
  39349. }, this);
  39350. };
  39351. return CallbackRegistry;
  39352. }());
  39353. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39354. function prefix(name) {
  39355. return "_" + name;
  39356. }
  39357. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39358. var dispatcher_Dispatcher = (function () {
  39359. function Dispatcher(failThrough) {
  39360. this.callbacks = new callback_registry();
  39361. this.global_callbacks = [];
  39362. this.failThrough = failThrough;
  39363. }
  39364. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39365. this.callbacks.add(eventName, callback, context);
  39366. return this;
  39367. };
  39368. Dispatcher.prototype.bind_global = function (callback) {
  39369. this.global_callbacks.push(callback);
  39370. return this;
  39371. };
  39372. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39373. this.callbacks.remove(eventName, callback, context);
  39374. return this;
  39375. };
  39376. Dispatcher.prototype.unbind_global = function (callback) {
  39377. if (!callback) {
  39378. this.global_callbacks = [];
  39379. return this;
  39380. }
  39381. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39382. return this;
  39383. };
  39384. Dispatcher.prototype.unbind_all = function () {
  39385. this.unbind();
  39386. this.unbind_global();
  39387. return this;
  39388. };
  39389. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39390. for (var i = 0; i < this.global_callbacks.length; i++) {
  39391. this.global_callbacks[i](eventName, data);
  39392. }
  39393. var callbacks = this.callbacks.get(eventName);
  39394. var args = [];
  39395. if (metadata) {
  39396. args.push(data, metadata);
  39397. }
  39398. else if (data) {
  39399. args.push(data);
  39400. }
  39401. if (callbacks && callbacks.length > 0) {
  39402. for (var i = 0; i < callbacks.length; i++) {
  39403. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39404. }
  39405. }
  39406. else if (this.failThrough) {
  39407. this.failThrough(eventName, data);
  39408. }
  39409. return this;
  39410. };
  39411. return Dispatcher;
  39412. }());
  39413. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39414. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39415. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39416. var extendStatics = function (d, b) {
  39417. extendStatics = Object.setPrototypeOf ||
  39418. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39419. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39420. return extendStatics(d, b);
  39421. };
  39422. return function (d, b) {
  39423. extendStatics(d, b);
  39424. function __() { this.constructor = d; }
  39425. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39426. };
  39427. })();
  39428. var transport_connection_TransportConnection = (function (_super) {
  39429. transport_connection_extends(TransportConnection, _super);
  39430. function TransportConnection(hooks, name, priority, key, options) {
  39431. var _this = _super.call(this) || this;
  39432. _this.initialize = runtime.transportConnectionInitializer;
  39433. _this.hooks = hooks;
  39434. _this.name = name;
  39435. _this.priority = priority;
  39436. _this.key = key;
  39437. _this.options = options;
  39438. _this.state = "new";
  39439. _this.timeline = options.timeline;
  39440. _this.activityTimeout = options.activityTimeout;
  39441. _this.id = _this.timeline.generateUniqueID();
  39442. return _this;
  39443. }
  39444. TransportConnection.prototype.handlesActivityChecks = function () {
  39445. return Boolean(this.hooks.handlesActivityChecks);
  39446. };
  39447. TransportConnection.prototype.supportsPing = function () {
  39448. return Boolean(this.hooks.supportsPing);
  39449. };
  39450. TransportConnection.prototype.connect = function () {
  39451. var _this = this;
  39452. if (this.socket || this.state !== "initialized") {
  39453. return false;
  39454. }
  39455. var url = this.hooks.urls.getInitial(this.key, this.options);
  39456. try {
  39457. this.socket = this.hooks.getSocket(url, this.options);
  39458. }
  39459. catch (e) {
  39460. util.defer(function () {
  39461. _this.onError(e);
  39462. _this.changeState("closed");
  39463. });
  39464. return false;
  39465. }
  39466. this.bindListeners();
  39467. logger.debug("Connecting", { transport: this.name, url: url });
  39468. this.changeState("connecting");
  39469. return true;
  39470. };
  39471. TransportConnection.prototype.close = function () {
  39472. if (this.socket) {
  39473. this.socket.close();
  39474. return true;
  39475. }
  39476. else {
  39477. return false;
  39478. }
  39479. };
  39480. TransportConnection.prototype.send = function (data) {
  39481. var _this = this;
  39482. if (this.state === "open") {
  39483. util.defer(function () {
  39484. if (_this.socket) {
  39485. _this.socket.send(data);
  39486. }
  39487. });
  39488. return true;
  39489. }
  39490. else {
  39491. return false;
  39492. }
  39493. };
  39494. TransportConnection.prototype.ping = function () {
  39495. if (this.state === "open" && this.supportsPing()) {
  39496. this.socket.ping();
  39497. }
  39498. };
  39499. TransportConnection.prototype.onOpen = function () {
  39500. if (this.hooks.beforeOpen) {
  39501. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39502. }
  39503. this.changeState("open");
  39504. this.socket.onopen = undefined;
  39505. };
  39506. TransportConnection.prototype.onError = function (error) {
  39507. this.emit("error", { type: 'WebSocketError', error: error });
  39508. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39509. };
  39510. TransportConnection.prototype.onClose = function (closeEvent) {
  39511. if (closeEvent) {
  39512. this.changeState("closed", {
  39513. code: closeEvent.code,
  39514. reason: closeEvent.reason,
  39515. wasClean: closeEvent.wasClean
  39516. });
  39517. }
  39518. else {
  39519. this.changeState("closed");
  39520. }
  39521. this.unbindListeners();
  39522. this.socket = undefined;
  39523. };
  39524. TransportConnection.prototype.onMessage = function (message) {
  39525. this.emit("message", message);
  39526. };
  39527. TransportConnection.prototype.onActivity = function () {
  39528. this.emit("activity");
  39529. };
  39530. TransportConnection.prototype.bindListeners = function () {
  39531. var _this = this;
  39532. this.socket.onopen = function () {
  39533. _this.onOpen();
  39534. };
  39535. this.socket.onerror = function (error) {
  39536. _this.onError(error);
  39537. };
  39538. this.socket.onclose = function (closeEvent) {
  39539. _this.onClose(closeEvent);
  39540. };
  39541. this.socket.onmessage = function (message) {
  39542. _this.onMessage(message);
  39543. };
  39544. if (this.supportsPing()) {
  39545. this.socket.onactivity = function () { _this.onActivity(); };
  39546. }
  39547. };
  39548. TransportConnection.prototype.unbindListeners = function () {
  39549. if (this.socket) {
  39550. this.socket.onopen = undefined;
  39551. this.socket.onerror = undefined;
  39552. this.socket.onclose = undefined;
  39553. this.socket.onmessage = undefined;
  39554. if (this.supportsPing()) {
  39555. this.socket.onactivity = undefined;
  39556. }
  39557. }
  39558. };
  39559. TransportConnection.prototype.changeState = function (state, params) {
  39560. this.state = state;
  39561. this.timeline.info(this.buildTimelineMessage({
  39562. state: state,
  39563. params: params
  39564. }));
  39565. this.emit(state, params);
  39566. };
  39567. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39568. return extend({ cid: this.id }, message);
  39569. };
  39570. return TransportConnection;
  39571. }(dispatcher));
  39572. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39573. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39574. var transport_Transport = (function () {
  39575. function Transport(hooks) {
  39576. this.hooks = hooks;
  39577. }
  39578. Transport.prototype.isSupported = function (environment) {
  39579. return this.hooks.isSupported(environment);
  39580. };
  39581. Transport.prototype.createConnection = function (name, priority, key, options) {
  39582. return new transport_connection(this.hooks, name, priority, key, options);
  39583. };
  39584. return Transport;
  39585. }());
  39586. /* harmony default export */ var transports_transport = (transport_Transport);
  39587. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39588. var WSTransport = new transports_transport({
  39589. urls: ws,
  39590. handlesActivityChecks: false,
  39591. supportsPing: false,
  39592. isInitialized: function () {
  39593. return Boolean(runtime.getWebSocketAPI());
  39594. },
  39595. isSupported: function () {
  39596. return Boolean(runtime.getWebSocketAPI());
  39597. },
  39598. getSocket: function (url) {
  39599. return runtime.createWebSocket(url);
  39600. }
  39601. });
  39602. var httpConfiguration = {
  39603. urls: http,
  39604. handlesActivityChecks: false,
  39605. supportsPing: true,
  39606. isInitialized: function () {
  39607. return true;
  39608. }
  39609. };
  39610. var streamingConfiguration = extend({ getSocket: function (url) {
  39611. return runtime.HTTPFactory.createStreamingSocket(url);
  39612. }
  39613. }, httpConfiguration);
  39614. var pollingConfiguration = extend({ getSocket: function (url) {
  39615. return runtime.HTTPFactory.createPollingSocket(url);
  39616. }
  39617. }, httpConfiguration);
  39618. var xhrConfiguration = {
  39619. isSupported: function () {
  39620. return runtime.isXHRSupported();
  39621. }
  39622. };
  39623. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39624. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39625. var Transports = {
  39626. ws: WSTransport,
  39627. xhr_streaming: XHRStreamingTransport,
  39628. xhr_polling: XHRPollingTransport
  39629. };
  39630. /* harmony default export */ var transports = (Transports);
  39631. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39632. var SockJSTransport = new transports_transport({
  39633. file: "sockjs",
  39634. urls: sockjs,
  39635. handlesActivityChecks: true,
  39636. supportsPing: false,
  39637. isSupported: function () {
  39638. return true;
  39639. },
  39640. isInitialized: function () {
  39641. return window.SockJS !== undefined;
  39642. },
  39643. getSocket: function (url, options) {
  39644. return new window.SockJS(url, null, {
  39645. js_path: Dependencies.getPath("sockjs", {
  39646. useTLS: options.useTLS
  39647. }),
  39648. ignore_null_origin: options.ignoreNullOrigin
  39649. });
  39650. },
  39651. beforeOpen: function (socket, path) {
  39652. socket.send(JSON.stringify({
  39653. path: path
  39654. }));
  39655. }
  39656. });
  39657. var xdrConfiguration = {
  39658. isSupported: function (environment) {
  39659. var yes = runtime.isXDRSupported(environment.useTLS);
  39660. return yes;
  39661. }
  39662. };
  39663. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39664. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39665. transports.xdr_streaming = XDRStreamingTransport;
  39666. transports.xdr_polling = XDRPollingTransport;
  39667. transports.sockjs = SockJSTransport;
  39668. /* harmony default export */ var transports_transports = (transports);
  39669. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39670. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39671. var extendStatics = function (d, b) {
  39672. extendStatics = Object.setPrototypeOf ||
  39673. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39674. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39675. return extendStatics(d, b);
  39676. };
  39677. return function (d, b) {
  39678. extendStatics(d, b);
  39679. function __() { this.constructor = d; }
  39680. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39681. };
  39682. })();
  39683. var NetInfo = (function (_super) {
  39684. net_info_extends(NetInfo, _super);
  39685. function NetInfo() {
  39686. var _this = _super.call(this) || this;
  39687. var self = _this;
  39688. if (window.addEventListener !== undefined) {
  39689. window.addEventListener("online", function () {
  39690. self.emit('online');
  39691. }, false);
  39692. window.addEventListener("offline", function () {
  39693. self.emit('offline');
  39694. }, false);
  39695. }
  39696. return _this;
  39697. }
  39698. NetInfo.prototype.isOnline = function () {
  39699. if (window.navigator.onLine === undefined) {
  39700. return true;
  39701. }
  39702. else {
  39703. return window.navigator.onLine;
  39704. }
  39705. };
  39706. return NetInfo;
  39707. }(dispatcher));
  39708. var net_info_Network = new NetInfo();
  39709. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39710. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39711. function AssistantToTheTransportManager(manager, transport, options) {
  39712. this.manager = manager;
  39713. this.transport = transport;
  39714. this.minPingDelay = options.minPingDelay;
  39715. this.maxPingDelay = options.maxPingDelay;
  39716. this.pingDelay = undefined;
  39717. }
  39718. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39719. var _this = this;
  39720. options = extend({}, options, {
  39721. activityTimeout: this.pingDelay
  39722. });
  39723. var connection = this.transport.createConnection(name, priority, key, options);
  39724. var openTimestamp = null;
  39725. var onOpen = function () {
  39726. connection.unbind("open", onOpen);
  39727. connection.bind("closed", onClosed);
  39728. openTimestamp = util.now();
  39729. };
  39730. var onClosed = function (closeEvent) {
  39731. connection.unbind("closed", onClosed);
  39732. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39733. _this.manager.reportDeath();
  39734. }
  39735. else if (!closeEvent.wasClean && openTimestamp) {
  39736. var lifespan = util.now() - openTimestamp;
  39737. if (lifespan < 2 * _this.maxPingDelay) {
  39738. _this.manager.reportDeath();
  39739. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39740. }
  39741. }
  39742. };
  39743. connection.bind("open", onOpen);
  39744. return connection;
  39745. };
  39746. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39747. return this.manager.isAlive() && this.transport.isSupported(environment);
  39748. };
  39749. return AssistantToTheTransportManager;
  39750. }());
  39751. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39752. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39753. var Protocol = {
  39754. decodeMessage: function (messageEvent) {
  39755. try {
  39756. var messageData = JSON.parse(messageEvent.data);
  39757. var pusherEventData = messageData.data;
  39758. if (typeof pusherEventData === 'string') {
  39759. try {
  39760. pusherEventData = JSON.parse(messageData.data);
  39761. }
  39762. catch (e) { }
  39763. }
  39764. var pusherEvent = {
  39765. event: messageData.event,
  39766. channel: messageData.channel,
  39767. data: pusherEventData,
  39768. };
  39769. if (messageData.user_id) {
  39770. pusherEvent.user_id = messageData.user_id;
  39771. }
  39772. return pusherEvent;
  39773. }
  39774. catch (e) {
  39775. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39776. }
  39777. },
  39778. encodeMessage: function (event) {
  39779. return JSON.stringify(event);
  39780. },
  39781. processHandshake: function (messageEvent) {
  39782. var message = Protocol.decodeMessage(messageEvent);
  39783. if (message.event === "pusher:connection_established") {
  39784. if (!message.data.activity_timeout) {
  39785. throw "No activity timeout specified in handshake";
  39786. }
  39787. return {
  39788. action: "connected",
  39789. id: message.data.socket_id,
  39790. activityTimeout: message.data.activity_timeout * 1000
  39791. };
  39792. }
  39793. else if (message.event === "pusher:error") {
  39794. return {
  39795. action: this.getCloseAction(message.data),
  39796. error: this.getCloseError(message.data)
  39797. };
  39798. }
  39799. else {
  39800. throw "Invalid handshake";
  39801. }
  39802. },
  39803. getCloseAction: function (closeEvent) {
  39804. if (closeEvent.code < 4000) {
  39805. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39806. return "backoff";
  39807. }
  39808. else {
  39809. return null;
  39810. }
  39811. }
  39812. else if (closeEvent.code === 4000) {
  39813. return "tls_only";
  39814. }
  39815. else if (closeEvent.code < 4100) {
  39816. return "refused";
  39817. }
  39818. else if (closeEvent.code < 4200) {
  39819. return "backoff";
  39820. }
  39821. else if (closeEvent.code < 4300) {
  39822. return "retry";
  39823. }
  39824. else {
  39825. return "refused";
  39826. }
  39827. },
  39828. getCloseError: function (closeEvent) {
  39829. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39830. return {
  39831. type: 'PusherError',
  39832. data: {
  39833. code: closeEvent.code,
  39834. message: closeEvent.reason || closeEvent.message
  39835. }
  39836. };
  39837. }
  39838. else {
  39839. return null;
  39840. }
  39841. }
  39842. };
  39843. /* harmony default export */ var protocol_protocol = (Protocol);
  39844. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39845. var connection_extends = (undefined && undefined.__extends) || (function () {
  39846. var extendStatics = function (d, b) {
  39847. extendStatics = Object.setPrototypeOf ||
  39848. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39849. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39850. return extendStatics(d, b);
  39851. };
  39852. return function (d, b) {
  39853. extendStatics(d, b);
  39854. function __() { this.constructor = d; }
  39855. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39856. };
  39857. })();
  39858. var connection_Connection = (function (_super) {
  39859. connection_extends(Connection, _super);
  39860. function Connection(id, transport) {
  39861. var _this = _super.call(this) || this;
  39862. _this.id = id;
  39863. _this.transport = transport;
  39864. _this.activityTimeout = transport.activityTimeout;
  39865. _this.bindListeners();
  39866. return _this;
  39867. }
  39868. Connection.prototype.handlesActivityChecks = function () {
  39869. return this.transport.handlesActivityChecks();
  39870. };
  39871. Connection.prototype.send = function (data) {
  39872. return this.transport.send(data);
  39873. };
  39874. Connection.prototype.send_event = function (name, data, channel) {
  39875. var event = { event: name, data: data };
  39876. if (channel) {
  39877. event.channel = channel;
  39878. }
  39879. logger.debug('Event sent', event);
  39880. return this.send(protocol_protocol.encodeMessage(event));
  39881. };
  39882. Connection.prototype.ping = function () {
  39883. if (this.transport.supportsPing()) {
  39884. this.transport.ping();
  39885. }
  39886. else {
  39887. this.send_event('pusher:ping', {});
  39888. }
  39889. };
  39890. Connection.prototype.close = function () {
  39891. this.transport.close();
  39892. };
  39893. Connection.prototype.bindListeners = function () {
  39894. var _this = this;
  39895. var listeners = {
  39896. message: function (messageEvent) {
  39897. var pusherEvent;
  39898. try {
  39899. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  39900. }
  39901. catch (e) {
  39902. _this.emit('error', {
  39903. type: 'MessageParseError',
  39904. error: e,
  39905. data: messageEvent.data
  39906. });
  39907. }
  39908. if (pusherEvent !== undefined) {
  39909. logger.debug('Event recd', pusherEvent);
  39910. switch (pusherEvent.event) {
  39911. case 'pusher:error':
  39912. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  39913. break;
  39914. case 'pusher:ping':
  39915. _this.emit("ping");
  39916. break;
  39917. case 'pusher:pong':
  39918. _this.emit("pong");
  39919. break;
  39920. }
  39921. _this.emit('message', pusherEvent);
  39922. }
  39923. },
  39924. activity: function () {
  39925. _this.emit("activity");
  39926. },
  39927. error: function (error) {
  39928. _this.emit("error", { type: "WebSocketError", error: error });
  39929. },
  39930. closed: function (closeEvent) {
  39931. unbindListeners();
  39932. if (closeEvent && closeEvent.code) {
  39933. _this.handleCloseEvent(closeEvent);
  39934. }
  39935. _this.transport = null;
  39936. _this.emit("closed");
  39937. }
  39938. };
  39939. var unbindListeners = function () {
  39940. objectApply(listeners, function (listener, event) {
  39941. _this.transport.unbind(event, listener);
  39942. });
  39943. };
  39944. objectApply(listeners, function (listener, event) {
  39945. _this.transport.bind(event, listener);
  39946. });
  39947. };
  39948. Connection.prototype.handleCloseEvent = function (closeEvent) {
  39949. var action = protocol_protocol.getCloseAction(closeEvent);
  39950. var error = protocol_protocol.getCloseError(closeEvent);
  39951. if (error) {
  39952. this.emit('error', error);
  39953. }
  39954. if (action) {
  39955. this.emit(action, { action: action, error: error });
  39956. }
  39957. };
  39958. return Connection;
  39959. }(dispatcher));
  39960. /* harmony default export */ var connection_connection = (connection_Connection);
  39961. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  39962. var handshake_Handshake = (function () {
  39963. function Handshake(transport, callback) {
  39964. this.transport = transport;
  39965. this.callback = callback;
  39966. this.bindListeners();
  39967. }
  39968. Handshake.prototype.close = function () {
  39969. this.unbindListeners();
  39970. this.transport.close();
  39971. };
  39972. Handshake.prototype.bindListeners = function () {
  39973. var _this = this;
  39974. this.onMessage = function (m) {
  39975. _this.unbindListeners();
  39976. var result;
  39977. try {
  39978. result = protocol_protocol.processHandshake(m);
  39979. }
  39980. catch (e) {
  39981. _this.finish("error", { error: e });
  39982. _this.transport.close();
  39983. return;
  39984. }
  39985. if (result.action === "connected") {
  39986. _this.finish("connected", {
  39987. connection: new connection_connection(result.id, _this.transport),
  39988. activityTimeout: result.activityTimeout
  39989. });
  39990. }
  39991. else {
  39992. _this.finish(result.action, { error: result.error });
  39993. _this.transport.close();
  39994. }
  39995. };
  39996. this.onClosed = function (closeEvent) {
  39997. _this.unbindListeners();
  39998. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  39999. var error = protocol_protocol.getCloseError(closeEvent);
  40000. _this.finish(action, { error: error });
  40001. };
  40002. this.transport.bind("message", this.onMessage);
  40003. this.transport.bind("closed", this.onClosed);
  40004. };
  40005. Handshake.prototype.unbindListeners = function () {
  40006. this.transport.unbind("message", this.onMessage);
  40007. this.transport.unbind("closed", this.onClosed);
  40008. };
  40009. Handshake.prototype.finish = function (action, params) {
  40010. this.callback(extend({ transport: this.transport, action: action }, params));
  40011. };
  40012. return Handshake;
  40013. }());
  40014. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40015. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40016. var pusher_authorizer_PusherAuthorizer = (function () {
  40017. function PusherAuthorizer(channel, options) {
  40018. this.channel = channel;
  40019. var authTransport = options.authTransport;
  40020. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40021. throw "'" + authTransport + "' is not a recognized auth transport";
  40022. }
  40023. this.type = authTransport;
  40024. this.options = options;
  40025. this.authOptions = (options || {}).auth || {};
  40026. }
  40027. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40028. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40029. '&channel_name=' + encodeURIComponent(this.channel.name);
  40030. for (var i in this.authOptions.params) {
  40031. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40032. }
  40033. return query;
  40034. };
  40035. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40036. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40037. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40038. };
  40039. return PusherAuthorizer;
  40040. }());
  40041. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40042. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40043. var timeline_sender_TimelineSender = (function () {
  40044. function TimelineSender(timeline, options) {
  40045. this.timeline = timeline;
  40046. this.options = options || {};
  40047. }
  40048. TimelineSender.prototype.send = function (useTLS, callback) {
  40049. if (this.timeline.isEmpty()) {
  40050. return;
  40051. }
  40052. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40053. };
  40054. return TimelineSender;
  40055. }());
  40056. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40057. // CONCATENATED MODULE: ./src/core/errors.ts
  40058. var errors_extends = (undefined && undefined.__extends) || (function () {
  40059. var extendStatics = function (d, b) {
  40060. extendStatics = Object.setPrototypeOf ||
  40061. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40062. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40063. return extendStatics(d, b);
  40064. };
  40065. return function (d, b) {
  40066. extendStatics(d, b);
  40067. function __() { this.constructor = d; }
  40068. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40069. };
  40070. })();
  40071. var BadEventName = (function (_super) {
  40072. errors_extends(BadEventName, _super);
  40073. function BadEventName(msg) {
  40074. var _newTarget = this.constructor;
  40075. var _this = _super.call(this, msg) || this;
  40076. Object.setPrototypeOf(_this, _newTarget.prototype);
  40077. return _this;
  40078. }
  40079. return BadEventName;
  40080. }(Error));
  40081. var RequestTimedOut = (function (_super) {
  40082. errors_extends(RequestTimedOut, _super);
  40083. function RequestTimedOut(msg) {
  40084. var _newTarget = this.constructor;
  40085. var _this = _super.call(this, msg) || this;
  40086. Object.setPrototypeOf(_this, _newTarget.prototype);
  40087. return _this;
  40088. }
  40089. return RequestTimedOut;
  40090. }(Error));
  40091. var TransportPriorityTooLow = (function (_super) {
  40092. errors_extends(TransportPriorityTooLow, _super);
  40093. function TransportPriorityTooLow(msg) {
  40094. var _newTarget = this.constructor;
  40095. var _this = _super.call(this, msg) || this;
  40096. Object.setPrototypeOf(_this, _newTarget.prototype);
  40097. return _this;
  40098. }
  40099. return TransportPriorityTooLow;
  40100. }(Error));
  40101. var TransportClosed = (function (_super) {
  40102. errors_extends(TransportClosed, _super);
  40103. function TransportClosed(msg) {
  40104. var _newTarget = this.constructor;
  40105. var _this = _super.call(this, msg) || this;
  40106. Object.setPrototypeOf(_this, _newTarget.prototype);
  40107. return _this;
  40108. }
  40109. return TransportClosed;
  40110. }(Error));
  40111. var UnsupportedFeature = (function (_super) {
  40112. errors_extends(UnsupportedFeature, _super);
  40113. function UnsupportedFeature(msg) {
  40114. var _newTarget = this.constructor;
  40115. var _this = _super.call(this, msg) || this;
  40116. Object.setPrototypeOf(_this, _newTarget.prototype);
  40117. return _this;
  40118. }
  40119. return UnsupportedFeature;
  40120. }(Error));
  40121. var UnsupportedTransport = (function (_super) {
  40122. errors_extends(UnsupportedTransport, _super);
  40123. function UnsupportedTransport(msg) {
  40124. var _newTarget = this.constructor;
  40125. var _this = _super.call(this, msg) || this;
  40126. Object.setPrototypeOf(_this, _newTarget.prototype);
  40127. return _this;
  40128. }
  40129. return UnsupportedTransport;
  40130. }(Error));
  40131. var UnsupportedStrategy = (function (_super) {
  40132. errors_extends(UnsupportedStrategy, _super);
  40133. function UnsupportedStrategy(msg) {
  40134. var _newTarget = this.constructor;
  40135. var _this = _super.call(this, msg) || this;
  40136. Object.setPrototypeOf(_this, _newTarget.prototype);
  40137. return _this;
  40138. }
  40139. return UnsupportedStrategy;
  40140. }(Error));
  40141. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40142. var channel_extends = (undefined && undefined.__extends) || (function () {
  40143. var extendStatics = function (d, b) {
  40144. extendStatics = Object.setPrototypeOf ||
  40145. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40146. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40147. return extendStatics(d, b);
  40148. };
  40149. return function (d, b) {
  40150. extendStatics(d, b);
  40151. function __() { this.constructor = d; }
  40152. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40153. };
  40154. })();
  40155. var channel_Channel = (function (_super) {
  40156. channel_extends(Channel, _super);
  40157. function Channel(name, pusher) {
  40158. var _this = _super.call(this, function (event, data) {
  40159. logger.debug('No callbacks on ' + name + ' for ' + event);
  40160. }) || this;
  40161. _this.name = name;
  40162. _this.pusher = pusher;
  40163. _this.subscribed = false;
  40164. _this.subscriptionPending = false;
  40165. _this.subscriptionCancelled = false;
  40166. return _this;
  40167. }
  40168. Channel.prototype.authorize = function (socketId, callback) {
  40169. return callback(false, {});
  40170. };
  40171. Channel.prototype.trigger = function (event, data) {
  40172. if (event.indexOf("client-") !== 0) {
  40173. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40174. }
  40175. if (!this.subscribed) {
  40176. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40177. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40178. }
  40179. return this.pusher.send_event(event, data, this.name);
  40180. };
  40181. Channel.prototype.disconnect = function () {
  40182. this.subscribed = false;
  40183. this.subscriptionPending = false;
  40184. };
  40185. Channel.prototype.handleEvent = function (event) {
  40186. var eventName = event.event;
  40187. var data = event.data;
  40188. if (eventName === "pusher_internal:subscription_succeeded") {
  40189. this.handleSubscriptionSucceededEvent(event);
  40190. }
  40191. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40192. var metadata = {};
  40193. this.emit(eventName, data, metadata);
  40194. }
  40195. };
  40196. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40197. this.subscriptionPending = false;
  40198. this.subscribed = true;
  40199. if (this.subscriptionCancelled) {
  40200. this.pusher.unsubscribe(this.name);
  40201. }
  40202. else {
  40203. this.emit("pusher:subscription_succeeded", event.data);
  40204. }
  40205. };
  40206. Channel.prototype.subscribe = function () {
  40207. var _this = this;
  40208. if (this.subscribed) {
  40209. return;
  40210. }
  40211. this.subscriptionPending = true;
  40212. this.subscriptionCancelled = false;
  40213. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40214. if (error) {
  40215. logger.error(data);
  40216. _this.emit('pusher:subscription_error', data);
  40217. }
  40218. else {
  40219. _this.pusher.send_event('pusher:subscribe', {
  40220. auth: data.auth,
  40221. channel_data: data.channel_data,
  40222. channel: _this.name
  40223. });
  40224. }
  40225. });
  40226. };
  40227. Channel.prototype.unsubscribe = function () {
  40228. this.subscribed = false;
  40229. this.pusher.send_event('pusher:unsubscribe', {
  40230. channel: this.name
  40231. });
  40232. };
  40233. Channel.prototype.cancelSubscription = function () {
  40234. this.subscriptionCancelled = true;
  40235. };
  40236. Channel.prototype.reinstateSubscription = function () {
  40237. this.subscriptionCancelled = false;
  40238. };
  40239. return Channel;
  40240. }(dispatcher));
  40241. /* harmony default export */ var channels_channel = (channel_Channel);
  40242. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40243. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40244. var extendStatics = function (d, b) {
  40245. extendStatics = Object.setPrototypeOf ||
  40246. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40247. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40248. return extendStatics(d, b);
  40249. };
  40250. return function (d, b) {
  40251. extendStatics(d, b);
  40252. function __() { this.constructor = d; }
  40253. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40254. };
  40255. })();
  40256. var private_channel_PrivateChannel = (function (_super) {
  40257. private_channel_extends(PrivateChannel, _super);
  40258. function PrivateChannel() {
  40259. return _super !== null && _super.apply(this, arguments) || this;
  40260. }
  40261. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40262. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40263. return authorizer.authorize(socketId, callback);
  40264. };
  40265. return PrivateChannel;
  40266. }(channels_channel));
  40267. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40268. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40269. var members_Members = (function () {
  40270. function Members() {
  40271. this.reset();
  40272. }
  40273. Members.prototype.get = function (id) {
  40274. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40275. return {
  40276. id: id,
  40277. info: this.members[id]
  40278. };
  40279. }
  40280. else {
  40281. return null;
  40282. }
  40283. };
  40284. Members.prototype.each = function (callback) {
  40285. var _this = this;
  40286. objectApply(this.members, function (member, id) {
  40287. callback(_this.get(id));
  40288. });
  40289. };
  40290. Members.prototype.setMyID = function (id) {
  40291. this.myID = id;
  40292. };
  40293. Members.prototype.onSubscription = function (subscriptionData) {
  40294. this.members = subscriptionData.presence.hash;
  40295. this.count = subscriptionData.presence.count;
  40296. this.me = this.get(this.myID);
  40297. };
  40298. Members.prototype.addMember = function (memberData) {
  40299. if (this.get(memberData.user_id) === null) {
  40300. this.count++;
  40301. }
  40302. this.members[memberData.user_id] = memberData.user_info;
  40303. return this.get(memberData.user_id);
  40304. };
  40305. Members.prototype.removeMember = function (memberData) {
  40306. var member = this.get(memberData.user_id);
  40307. if (member) {
  40308. delete this.members[memberData.user_id];
  40309. this.count--;
  40310. }
  40311. return member;
  40312. };
  40313. Members.prototype.reset = function () {
  40314. this.members = {};
  40315. this.count = 0;
  40316. this.myID = null;
  40317. this.me = null;
  40318. };
  40319. return Members;
  40320. }());
  40321. /* harmony default export */ var members = (members_Members);
  40322. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40323. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40324. var extendStatics = function (d, b) {
  40325. extendStatics = Object.setPrototypeOf ||
  40326. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40327. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40328. return extendStatics(d, b);
  40329. };
  40330. return function (d, b) {
  40331. extendStatics(d, b);
  40332. function __() { this.constructor = d; }
  40333. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40334. };
  40335. })();
  40336. var presence_channel_PresenceChannel = (function (_super) {
  40337. presence_channel_extends(PresenceChannel, _super);
  40338. function PresenceChannel(name, pusher) {
  40339. var _this = _super.call(this, name, pusher) || this;
  40340. _this.members = new members();
  40341. return _this;
  40342. }
  40343. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40344. var _this = this;
  40345. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40346. if (!error) {
  40347. if (authData.channel_data === undefined) {
  40348. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40349. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40350. ("expected 'channel_data' field. " + suffix));
  40351. callback("Invalid auth response");
  40352. return;
  40353. }
  40354. var channelData = JSON.parse(authData.channel_data);
  40355. _this.members.setMyID(channelData.user_id);
  40356. }
  40357. callback(error, authData);
  40358. });
  40359. };
  40360. PresenceChannel.prototype.handleEvent = function (event) {
  40361. var eventName = event.event;
  40362. if (eventName.indexOf("pusher_internal:") === 0) {
  40363. this.handleInternalEvent(event);
  40364. }
  40365. else {
  40366. var data = event.data;
  40367. var metadata = {};
  40368. if (event.user_id) {
  40369. metadata.user_id = event.user_id;
  40370. }
  40371. this.emit(eventName, data, metadata);
  40372. }
  40373. };
  40374. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40375. var eventName = event.event;
  40376. var data = event.data;
  40377. switch (eventName) {
  40378. case "pusher_internal:subscription_succeeded":
  40379. this.handleSubscriptionSucceededEvent(event);
  40380. break;
  40381. case "pusher_internal:member_added":
  40382. var addedMember = this.members.addMember(data);
  40383. this.emit('pusher:member_added', addedMember);
  40384. break;
  40385. case "pusher_internal:member_removed":
  40386. var removedMember = this.members.removeMember(data);
  40387. if (removedMember) {
  40388. this.emit('pusher:member_removed', removedMember);
  40389. }
  40390. break;
  40391. }
  40392. };
  40393. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40394. this.subscriptionPending = false;
  40395. this.subscribed = true;
  40396. if (this.subscriptionCancelled) {
  40397. this.pusher.unsubscribe(this.name);
  40398. }
  40399. else {
  40400. this.members.onSubscription(event.data);
  40401. this.emit("pusher:subscription_succeeded", this.members);
  40402. }
  40403. };
  40404. PresenceChannel.prototype.disconnect = function () {
  40405. this.members.reset();
  40406. _super.prototype.disconnect.call(this);
  40407. };
  40408. return PresenceChannel;
  40409. }(private_channel));
  40410. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40411. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40412. var nacl_fast = __webpack_require__(0);
  40413. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40414. var nacl_util = __webpack_require__(1);
  40415. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40416. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40417. var extendStatics = function (d, b) {
  40418. extendStatics = Object.setPrototypeOf ||
  40419. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40420. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40421. return extendStatics(d, b);
  40422. };
  40423. return function (d, b) {
  40424. extendStatics(d, b);
  40425. function __() { this.constructor = d; }
  40426. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40427. };
  40428. })();
  40429. var encrypted_channel_EncryptedChannel = (function (_super) {
  40430. encrypted_channel_extends(EncryptedChannel, _super);
  40431. function EncryptedChannel() {
  40432. var _this = _super !== null && _super.apply(this, arguments) || this;
  40433. _this.key = null;
  40434. return _this;
  40435. }
  40436. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40437. var _this = this;
  40438. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40439. if (error) {
  40440. callback(true, authData);
  40441. return;
  40442. }
  40443. var sharedSecret = authData["shared_secret"];
  40444. if (!sharedSecret) {
  40445. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40446. callback(true, errorMsg);
  40447. return;
  40448. }
  40449. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40450. delete authData["shared_secret"];
  40451. callback(false, authData);
  40452. });
  40453. };
  40454. EncryptedChannel.prototype.trigger = function (event, data) {
  40455. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40456. };
  40457. EncryptedChannel.prototype.handleEvent = function (event) {
  40458. var eventName = event.event;
  40459. var data = event.data;
  40460. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40461. _super.prototype.handleEvent.call(this, event);
  40462. return;
  40463. }
  40464. this.handleEncryptedEvent(eventName, data);
  40465. };
  40466. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40467. var _this = this;
  40468. if (!this.key) {
  40469. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40470. return;
  40471. }
  40472. if (!data.ciphertext || !data.nonce) {
  40473. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40474. return;
  40475. }
  40476. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40477. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40478. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40479. return;
  40480. }
  40481. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40482. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40483. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40484. return;
  40485. }
  40486. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40487. if (bytes === null) {
  40488. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40489. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40490. if (error) {
  40491. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40492. return;
  40493. }
  40494. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40495. if (bytes === null) {
  40496. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40497. return;
  40498. }
  40499. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40500. return;
  40501. });
  40502. return;
  40503. }
  40504. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40505. };
  40506. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40507. try {
  40508. this.emit(eventName, JSON.parse(data));
  40509. }
  40510. catch (e) {
  40511. this.emit(eventName, data);
  40512. }
  40513. return this;
  40514. };
  40515. return EncryptedChannel;
  40516. }(private_channel));
  40517. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40518. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40519. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40520. var extendStatics = function (d, b) {
  40521. extendStatics = Object.setPrototypeOf ||
  40522. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40523. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40524. return extendStatics(d, b);
  40525. };
  40526. return function (d, b) {
  40527. extendStatics(d, b);
  40528. function __() { this.constructor = d; }
  40529. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40530. };
  40531. })();
  40532. var connection_manager_ConnectionManager = (function (_super) {
  40533. connection_manager_extends(ConnectionManager, _super);
  40534. function ConnectionManager(key, options) {
  40535. var _this = _super.call(this) || this;
  40536. _this.key = key;
  40537. _this.options = options || {};
  40538. _this.state = "initialized";
  40539. _this.connection = null;
  40540. _this.usingTLS = !!options.useTLS;
  40541. _this.timeline = _this.options.timeline;
  40542. _this.errorCallbacks = _this.buildErrorCallbacks();
  40543. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40544. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40545. var Network = runtime.getNetwork();
  40546. Network.bind("online", function () {
  40547. _this.timeline.info({ netinfo: "online" });
  40548. if (_this.state === "connecting" || _this.state === "unavailable") {
  40549. _this.retryIn(0);
  40550. }
  40551. });
  40552. Network.bind("offline", function () {
  40553. _this.timeline.info({ netinfo: "offline" });
  40554. if (_this.connection) {
  40555. _this.sendActivityCheck();
  40556. }
  40557. });
  40558. _this.updateStrategy();
  40559. return _this;
  40560. }
  40561. ConnectionManager.prototype.connect = function () {
  40562. if (this.connection || this.runner) {
  40563. return;
  40564. }
  40565. if (!this.strategy.isSupported()) {
  40566. this.updateState("failed");
  40567. return;
  40568. }
  40569. this.updateState("connecting");
  40570. this.startConnecting();
  40571. this.setUnavailableTimer();
  40572. };
  40573. ;
  40574. ConnectionManager.prototype.send = function (data) {
  40575. if (this.connection) {
  40576. return this.connection.send(data);
  40577. }
  40578. else {
  40579. return false;
  40580. }
  40581. };
  40582. ;
  40583. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40584. if (this.connection) {
  40585. return this.connection.send_event(name, data, channel);
  40586. }
  40587. else {
  40588. return false;
  40589. }
  40590. };
  40591. ;
  40592. ConnectionManager.prototype.disconnect = function () {
  40593. this.disconnectInternally();
  40594. this.updateState("disconnected");
  40595. };
  40596. ;
  40597. ConnectionManager.prototype.isUsingTLS = function () {
  40598. return this.usingTLS;
  40599. };
  40600. ;
  40601. ConnectionManager.prototype.startConnecting = function () {
  40602. var _this = this;
  40603. var callback = function (error, handshake) {
  40604. if (error) {
  40605. _this.runner = _this.strategy.connect(0, callback);
  40606. }
  40607. else {
  40608. if (handshake.action === "error") {
  40609. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40610. _this.timeline.error({ handshakeError: handshake.error });
  40611. }
  40612. else {
  40613. _this.abortConnecting();
  40614. _this.handshakeCallbacks[handshake.action](handshake);
  40615. }
  40616. }
  40617. };
  40618. this.runner = this.strategy.connect(0, callback);
  40619. };
  40620. ;
  40621. ConnectionManager.prototype.abortConnecting = function () {
  40622. if (this.runner) {
  40623. this.runner.abort();
  40624. this.runner = null;
  40625. }
  40626. };
  40627. ;
  40628. ConnectionManager.prototype.disconnectInternally = function () {
  40629. this.abortConnecting();
  40630. this.clearRetryTimer();
  40631. this.clearUnavailableTimer();
  40632. if (this.connection) {
  40633. var connection = this.abandonConnection();
  40634. connection.close();
  40635. }
  40636. };
  40637. ;
  40638. ConnectionManager.prototype.updateStrategy = function () {
  40639. this.strategy = this.options.getStrategy({
  40640. key: this.key,
  40641. timeline: this.timeline,
  40642. useTLS: this.usingTLS
  40643. });
  40644. };
  40645. ;
  40646. ConnectionManager.prototype.retryIn = function (delay) {
  40647. var _this = this;
  40648. this.timeline.info({ action: "retry", delay: delay });
  40649. if (delay > 0) {
  40650. this.emit("connecting_in", Math.round(delay / 1000));
  40651. }
  40652. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40653. _this.disconnectInternally();
  40654. _this.connect();
  40655. });
  40656. };
  40657. ;
  40658. ConnectionManager.prototype.clearRetryTimer = function () {
  40659. if (this.retryTimer) {
  40660. this.retryTimer.ensureAborted();
  40661. this.retryTimer = null;
  40662. }
  40663. };
  40664. ;
  40665. ConnectionManager.prototype.setUnavailableTimer = function () {
  40666. var _this = this;
  40667. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40668. _this.updateState("unavailable");
  40669. });
  40670. };
  40671. ;
  40672. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40673. if (this.unavailableTimer) {
  40674. this.unavailableTimer.ensureAborted();
  40675. }
  40676. };
  40677. ;
  40678. ConnectionManager.prototype.sendActivityCheck = function () {
  40679. var _this = this;
  40680. this.stopActivityCheck();
  40681. this.connection.ping();
  40682. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40683. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40684. _this.retryIn(0);
  40685. });
  40686. };
  40687. ;
  40688. ConnectionManager.prototype.resetActivityCheck = function () {
  40689. var _this = this;
  40690. this.stopActivityCheck();
  40691. if (this.connection && !this.connection.handlesActivityChecks()) {
  40692. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40693. _this.sendActivityCheck();
  40694. });
  40695. }
  40696. };
  40697. ;
  40698. ConnectionManager.prototype.stopActivityCheck = function () {
  40699. if (this.activityTimer) {
  40700. this.activityTimer.ensureAborted();
  40701. }
  40702. };
  40703. ;
  40704. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40705. var _this = this;
  40706. return extend({}, errorCallbacks, {
  40707. message: function (message) {
  40708. _this.resetActivityCheck();
  40709. _this.emit('message', message);
  40710. },
  40711. ping: function () {
  40712. _this.send_event('pusher:pong', {});
  40713. },
  40714. activity: function () {
  40715. _this.resetActivityCheck();
  40716. },
  40717. error: function (error) {
  40718. _this.emit("error", { type: "WebSocketError", error: error });
  40719. },
  40720. closed: function () {
  40721. _this.abandonConnection();
  40722. if (_this.shouldRetry()) {
  40723. _this.retryIn(1000);
  40724. }
  40725. }
  40726. });
  40727. };
  40728. ;
  40729. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40730. var _this = this;
  40731. return extend({}, errorCallbacks, {
  40732. connected: function (handshake) {
  40733. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40734. _this.clearUnavailableTimer();
  40735. _this.setConnection(handshake.connection);
  40736. _this.socket_id = _this.connection.id;
  40737. _this.updateState("connected", { socket_id: _this.socket_id });
  40738. }
  40739. });
  40740. };
  40741. ;
  40742. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40743. var _this = this;
  40744. var withErrorEmitted = function (callback) {
  40745. return function (result) {
  40746. if (result.error) {
  40747. _this.emit("error", { type: "WebSocketError", error: result.error });
  40748. }
  40749. callback(result);
  40750. };
  40751. };
  40752. return {
  40753. tls_only: withErrorEmitted(function () {
  40754. _this.usingTLS = true;
  40755. _this.updateStrategy();
  40756. _this.retryIn(0);
  40757. }),
  40758. refused: withErrorEmitted(function () {
  40759. _this.disconnect();
  40760. }),
  40761. backoff: withErrorEmitted(function () {
  40762. _this.retryIn(1000);
  40763. }),
  40764. retry: withErrorEmitted(function () {
  40765. _this.retryIn(0);
  40766. })
  40767. };
  40768. };
  40769. ;
  40770. ConnectionManager.prototype.setConnection = function (connection) {
  40771. this.connection = connection;
  40772. for (var event in this.connectionCallbacks) {
  40773. this.connection.bind(event, this.connectionCallbacks[event]);
  40774. }
  40775. this.resetActivityCheck();
  40776. };
  40777. ;
  40778. ConnectionManager.prototype.abandonConnection = function () {
  40779. if (!this.connection) {
  40780. return;
  40781. }
  40782. this.stopActivityCheck();
  40783. for (var event in this.connectionCallbacks) {
  40784. this.connection.unbind(event, this.connectionCallbacks[event]);
  40785. }
  40786. var connection = this.connection;
  40787. this.connection = null;
  40788. return connection;
  40789. };
  40790. ConnectionManager.prototype.updateState = function (newState, data) {
  40791. var previousState = this.state;
  40792. this.state = newState;
  40793. if (previousState !== newState) {
  40794. var newStateDescription = newState;
  40795. if (newStateDescription === "connected") {
  40796. newStateDescription += " with new socket ID " + data.socket_id;
  40797. }
  40798. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40799. this.timeline.info({ state: newState, params: data });
  40800. this.emit('state_change', { previous: previousState, current: newState });
  40801. this.emit(newState, data);
  40802. }
  40803. };
  40804. ConnectionManager.prototype.shouldRetry = function () {
  40805. return this.state === "connecting" || this.state === "connected";
  40806. };
  40807. return ConnectionManager;
  40808. }(dispatcher));
  40809. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40810. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40811. var channels_Channels = (function () {
  40812. function Channels() {
  40813. this.channels = {};
  40814. }
  40815. Channels.prototype.add = function (name, pusher) {
  40816. if (!this.channels[name]) {
  40817. this.channels[name] = createChannel(name, pusher);
  40818. }
  40819. return this.channels[name];
  40820. };
  40821. Channels.prototype.all = function () {
  40822. return values(this.channels);
  40823. };
  40824. Channels.prototype.find = function (name) {
  40825. return this.channels[name];
  40826. };
  40827. Channels.prototype.remove = function (name) {
  40828. var channel = this.channels[name];
  40829. delete this.channels[name];
  40830. return channel;
  40831. };
  40832. Channels.prototype.disconnect = function () {
  40833. objectApply(this.channels, function (channel) {
  40834. channel.disconnect();
  40835. });
  40836. };
  40837. return Channels;
  40838. }());
  40839. /* harmony default export */ var channels = (channels_Channels);
  40840. function createChannel(name, pusher) {
  40841. if (name.indexOf('private-encrypted-') === 0) {
  40842. if (false) { var errorMsg; }
  40843. return factory.createEncryptedChannel(name, pusher);
  40844. }
  40845. else if (name.indexOf('private-') === 0) {
  40846. return factory.createPrivateChannel(name, pusher);
  40847. }
  40848. else if (name.indexOf('presence-') === 0) {
  40849. return factory.createPresenceChannel(name, pusher);
  40850. }
  40851. else {
  40852. return factory.createChannel(name, pusher);
  40853. }
  40854. }
  40855. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40856. var Factory = {
  40857. createChannels: function () {
  40858. return new channels();
  40859. },
  40860. createConnectionManager: function (key, options) {
  40861. return new connection_manager(key, options);
  40862. },
  40863. createChannel: function (name, pusher) {
  40864. return new channels_channel(name, pusher);
  40865. },
  40866. createPrivateChannel: function (name, pusher) {
  40867. return new private_channel(name, pusher);
  40868. },
  40869. createPresenceChannel: function (name, pusher) {
  40870. return new presence_channel(name, pusher);
  40871. },
  40872. createEncryptedChannel: function (name, pusher) {
  40873. return new encrypted_channel(name, pusher);
  40874. },
  40875. createTimelineSender: function (timeline, options) {
  40876. return new timeline_sender(timeline, options);
  40877. },
  40878. createAuthorizer: function (channel, options) {
  40879. if (options.authorizer) {
  40880. return options.authorizer(channel, options);
  40881. }
  40882. return new pusher_authorizer(channel, options);
  40883. },
  40884. createHandshake: function (transport, callback) {
  40885. return new connection_handshake(transport, callback);
  40886. },
  40887. createAssistantToTheTransportManager: function (manager, transport, options) {
  40888. return new assistant_to_the_transport_manager(manager, transport, options);
  40889. }
  40890. };
  40891. /* harmony default export */ var factory = (Factory);
  40892. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  40893. var transport_manager_TransportManager = (function () {
  40894. function TransportManager(options) {
  40895. this.options = options || {};
  40896. this.livesLeft = this.options.lives || Infinity;
  40897. }
  40898. TransportManager.prototype.getAssistant = function (transport) {
  40899. return factory.createAssistantToTheTransportManager(this, transport, {
  40900. minPingDelay: this.options.minPingDelay,
  40901. maxPingDelay: this.options.maxPingDelay
  40902. });
  40903. };
  40904. TransportManager.prototype.isAlive = function () {
  40905. return this.livesLeft > 0;
  40906. };
  40907. TransportManager.prototype.reportDeath = function () {
  40908. this.livesLeft -= 1;
  40909. };
  40910. return TransportManager;
  40911. }());
  40912. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  40913. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  40914. var sequential_strategy_SequentialStrategy = (function () {
  40915. function SequentialStrategy(strategies, options) {
  40916. this.strategies = strategies;
  40917. this.loop = Boolean(options.loop);
  40918. this.failFast = Boolean(options.failFast);
  40919. this.timeout = options.timeout;
  40920. this.timeoutLimit = options.timeoutLimit;
  40921. }
  40922. SequentialStrategy.prototype.isSupported = function () {
  40923. return any(this.strategies, util.method("isSupported"));
  40924. };
  40925. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  40926. var _this = this;
  40927. var strategies = this.strategies;
  40928. var current = 0;
  40929. var timeout = this.timeout;
  40930. var runner = null;
  40931. var tryNextStrategy = function (error, handshake) {
  40932. if (handshake) {
  40933. callback(null, handshake);
  40934. }
  40935. else {
  40936. current = current + 1;
  40937. if (_this.loop) {
  40938. current = current % strategies.length;
  40939. }
  40940. if (current < strategies.length) {
  40941. if (timeout) {
  40942. timeout = timeout * 2;
  40943. if (_this.timeoutLimit) {
  40944. timeout = Math.min(timeout, _this.timeoutLimit);
  40945. }
  40946. }
  40947. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  40948. }
  40949. else {
  40950. callback(true);
  40951. }
  40952. }
  40953. };
  40954. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  40955. return {
  40956. abort: function () {
  40957. runner.abort();
  40958. },
  40959. forceMinPriority: function (p) {
  40960. minPriority = p;
  40961. if (runner) {
  40962. runner.forceMinPriority(p);
  40963. }
  40964. }
  40965. };
  40966. };
  40967. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  40968. var timer = null;
  40969. var runner = null;
  40970. if (options.timeout > 0) {
  40971. timer = new OneOffTimer(options.timeout, function () {
  40972. runner.abort();
  40973. callback(true);
  40974. });
  40975. }
  40976. runner = strategy.connect(minPriority, function (error, handshake) {
  40977. if (error && timer && timer.isRunning() && !options.failFast) {
  40978. return;
  40979. }
  40980. if (timer) {
  40981. timer.ensureAborted();
  40982. }
  40983. callback(error, handshake);
  40984. });
  40985. return {
  40986. abort: function () {
  40987. if (timer) {
  40988. timer.ensureAborted();
  40989. }
  40990. runner.abort();
  40991. },
  40992. forceMinPriority: function (p) {
  40993. runner.forceMinPriority(p);
  40994. }
  40995. };
  40996. };
  40997. return SequentialStrategy;
  40998. }());
  40999. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41000. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41001. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41002. function BestConnectedEverStrategy(strategies) {
  41003. this.strategies = strategies;
  41004. }
  41005. BestConnectedEverStrategy.prototype.isSupported = function () {
  41006. return any(this.strategies, util.method("isSupported"));
  41007. };
  41008. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41009. return connect(this.strategies, minPriority, function (i, runners) {
  41010. return function (error, handshake) {
  41011. runners[i].error = error;
  41012. if (error) {
  41013. if (allRunnersFailed(runners)) {
  41014. callback(true);
  41015. }
  41016. return;
  41017. }
  41018. apply(runners, function (runner) {
  41019. runner.forceMinPriority(handshake.transport.priority);
  41020. });
  41021. callback(null, handshake);
  41022. };
  41023. });
  41024. };
  41025. return BestConnectedEverStrategy;
  41026. }());
  41027. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41028. function connect(strategies, minPriority, callbackBuilder) {
  41029. var runners = map(strategies, function (strategy, i, _, rs) {
  41030. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41031. });
  41032. return {
  41033. abort: function () {
  41034. apply(runners, abortRunner);
  41035. },
  41036. forceMinPriority: function (p) {
  41037. apply(runners, function (runner) {
  41038. runner.forceMinPriority(p);
  41039. });
  41040. }
  41041. };
  41042. }
  41043. function allRunnersFailed(runners) {
  41044. return collections_all(runners, function (runner) {
  41045. return Boolean(runner.error);
  41046. });
  41047. }
  41048. function abortRunner(runner) {
  41049. if (!runner.error && !runner.aborted) {
  41050. runner.abort();
  41051. runner.aborted = true;
  41052. }
  41053. }
  41054. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41055. var cached_strategy_CachedStrategy = (function () {
  41056. function CachedStrategy(strategy, transports, options) {
  41057. this.strategy = strategy;
  41058. this.transports = transports;
  41059. this.ttl = options.ttl || 1800 * 1000;
  41060. this.usingTLS = options.useTLS;
  41061. this.timeline = options.timeline;
  41062. }
  41063. CachedStrategy.prototype.isSupported = function () {
  41064. return this.strategy.isSupported();
  41065. };
  41066. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41067. var usingTLS = this.usingTLS;
  41068. var info = fetchTransportCache(usingTLS);
  41069. var strategies = [this.strategy];
  41070. if (info && info.timestamp + this.ttl >= util.now()) {
  41071. var transport = this.transports[info.transport];
  41072. if (transport) {
  41073. this.timeline.info({
  41074. cached: true,
  41075. transport: info.transport,
  41076. latency: info.latency
  41077. });
  41078. strategies.push(new sequential_strategy([transport], {
  41079. timeout: info.latency * 2 + 1000,
  41080. failFast: true
  41081. }));
  41082. }
  41083. }
  41084. var startTimestamp = util.now();
  41085. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41086. if (error) {
  41087. flushTransportCache(usingTLS);
  41088. if (strategies.length > 0) {
  41089. startTimestamp = util.now();
  41090. runner = strategies.pop().connect(minPriority, cb);
  41091. }
  41092. else {
  41093. callback(error);
  41094. }
  41095. }
  41096. else {
  41097. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41098. callback(null, handshake);
  41099. }
  41100. });
  41101. return {
  41102. abort: function () {
  41103. runner.abort();
  41104. },
  41105. forceMinPriority: function (p) {
  41106. minPriority = p;
  41107. if (runner) {
  41108. runner.forceMinPriority(p);
  41109. }
  41110. }
  41111. };
  41112. };
  41113. return CachedStrategy;
  41114. }());
  41115. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41116. function getTransportCacheKey(usingTLS) {
  41117. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41118. }
  41119. function fetchTransportCache(usingTLS) {
  41120. var storage = runtime.getLocalStorage();
  41121. if (storage) {
  41122. try {
  41123. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41124. if (serializedCache) {
  41125. return JSON.parse(serializedCache);
  41126. }
  41127. }
  41128. catch (e) {
  41129. flushTransportCache(usingTLS);
  41130. }
  41131. }
  41132. return null;
  41133. }
  41134. function storeTransportCache(usingTLS, transport, latency) {
  41135. var storage = runtime.getLocalStorage();
  41136. if (storage) {
  41137. try {
  41138. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41139. timestamp: util.now(),
  41140. transport: transport,
  41141. latency: latency
  41142. });
  41143. }
  41144. catch (e) {
  41145. }
  41146. }
  41147. }
  41148. function flushTransportCache(usingTLS) {
  41149. var storage = runtime.getLocalStorage();
  41150. if (storage) {
  41151. try {
  41152. delete storage[getTransportCacheKey(usingTLS)];
  41153. }
  41154. catch (e) {
  41155. }
  41156. }
  41157. }
  41158. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41159. var delayed_strategy_DelayedStrategy = (function () {
  41160. function DelayedStrategy(strategy, _a) {
  41161. var number = _a.delay;
  41162. this.strategy = strategy;
  41163. this.options = { delay: number };
  41164. }
  41165. DelayedStrategy.prototype.isSupported = function () {
  41166. return this.strategy.isSupported();
  41167. };
  41168. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41169. var strategy = this.strategy;
  41170. var runner;
  41171. var timer = new OneOffTimer(this.options.delay, function () {
  41172. runner = strategy.connect(minPriority, callback);
  41173. });
  41174. return {
  41175. abort: function () {
  41176. timer.ensureAborted();
  41177. if (runner) {
  41178. runner.abort();
  41179. }
  41180. },
  41181. forceMinPriority: function (p) {
  41182. minPriority = p;
  41183. if (runner) {
  41184. runner.forceMinPriority(p);
  41185. }
  41186. }
  41187. };
  41188. };
  41189. return DelayedStrategy;
  41190. }());
  41191. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41192. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41193. var IfStrategy = (function () {
  41194. function IfStrategy(test, trueBranch, falseBranch) {
  41195. this.test = test;
  41196. this.trueBranch = trueBranch;
  41197. this.falseBranch = falseBranch;
  41198. }
  41199. IfStrategy.prototype.isSupported = function () {
  41200. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41201. return branch.isSupported();
  41202. };
  41203. IfStrategy.prototype.connect = function (minPriority, callback) {
  41204. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41205. return branch.connect(minPriority, callback);
  41206. };
  41207. return IfStrategy;
  41208. }());
  41209. /* harmony default export */ var if_strategy = (IfStrategy);
  41210. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41211. var FirstConnectedStrategy = (function () {
  41212. function FirstConnectedStrategy(strategy) {
  41213. this.strategy = strategy;
  41214. }
  41215. FirstConnectedStrategy.prototype.isSupported = function () {
  41216. return this.strategy.isSupported();
  41217. };
  41218. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41219. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41220. if (handshake) {
  41221. runner.abort();
  41222. }
  41223. callback(error, handshake);
  41224. });
  41225. return runner;
  41226. };
  41227. return FirstConnectedStrategy;
  41228. }());
  41229. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41230. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41231. function testSupportsStrategy(strategy) {
  41232. return function () {
  41233. return strategy.isSupported();
  41234. };
  41235. }
  41236. var getDefaultStrategy = function (config, defineTransport) {
  41237. var definedTransports = {};
  41238. function defineTransportStrategy(name, type, priority, options, manager) {
  41239. var transport = defineTransport(config, name, type, priority, options, manager);
  41240. definedTransports[name] = transport;
  41241. return transport;
  41242. }
  41243. var ws_options = {
  41244. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41245. hostTLS: config.wsHost + ":" + config.wssPort,
  41246. httpPath: config.wsPath
  41247. };
  41248. var wss_options = extend({}, ws_options, {
  41249. useTLS: true
  41250. });
  41251. var sockjs_options = {
  41252. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41253. hostTLS: config.httpHost + ":" + config.httpsPort,
  41254. httpPath: config.httpPath
  41255. };
  41256. var timeouts = {
  41257. loop: true,
  41258. timeout: 15000,
  41259. timeoutLimit: 60000
  41260. };
  41261. var ws_manager = new transport_manager({
  41262. lives: 2,
  41263. minPingDelay: 10000,
  41264. maxPingDelay: config.activity_timeout
  41265. });
  41266. var streaming_manager = new transport_manager({
  41267. lives: 2,
  41268. minPingDelay: 10000,
  41269. maxPingDelay: config.activity_timeout
  41270. });
  41271. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41272. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41273. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41274. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41275. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41276. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41277. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41278. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41279. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41280. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41281. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41282. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41283. 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);
  41284. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41285. var wsStrategy;
  41286. if (config.useTLS) {
  41287. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41288. }
  41289. else {
  41290. wsStrategy = new best_connected_ever_strategy([
  41291. ws_loop,
  41292. new delayed_strategy(wss_loop, { delay: 2000 }),
  41293. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41294. ]);
  41295. }
  41296. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41297. ttl: 1800000,
  41298. timeline: config.timeline,
  41299. useTLS: config.useTLS
  41300. });
  41301. };
  41302. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41303. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41304. /* harmony default export */ var transport_connection_initializer = (function () {
  41305. var self = this;
  41306. self.timeline.info(self.buildTimelineMessage({
  41307. transport: self.name + (self.options.useTLS ? "s" : "")
  41308. }));
  41309. if (self.hooks.isInitialized()) {
  41310. self.changeState("initialized");
  41311. }
  41312. else if (self.hooks.file) {
  41313. self.changeState("initializing");
  41314. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41315. if (self.hooks.isInitialized()) {
  41316. self.changeState("initialized");
  41317. callback(true);
  41318. }
  41319. else {
  41320. if (error) {
  41321. self.onError(error);
  41322. }
  41323. self.onClose();
  41324. callback(false);
  41325. }
  41326. });
  41327. }
  41328. else {
  41329. self.onClose();
  41330. }
  41331. });
  41332. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41333. var http_xdomain_request_hooks = {
  41334. getRequest: function (socket) {
  41335. var xdr = new window.XDomainRequest();
  41336. xdr.ontimeout = function () {
  41337. socket.emit("error", new RequestTimedOut());
  41338. socket.close();
  41339. };
  41340. xdr.onerror = function (e) {
  41341. socket.emit("error", e);
  41342. socket.close();
  41343. };
  41344. xdr.onprogress = function () {
  41345. if (xdr.responseText && xdr.responseText.length > 0) {
  41346. socket.onChunk(200, xdr.responseText);
  41347. }
  41348. };
  41349. xdr.onload = function () {
  41350. if (xdr.responseText && xdr.responseText.length > 0) {
  41351. socket.onChunk(200, xdr.responseText);
  41352. }
  41353. socket.emit("finished", 200);
  41354. socket.close();
  41355. };
  41356. return xdr;
  41357. },
  41358. abortRequest: function (xdr) {
  41359. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41360. xdr.abort();
  41361. }
  41362. };
  41363. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41364. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41365. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41366. var extendStatics = function (d, b) {
  41367. extendStatics = Object.setPrototypeOf ||
  41368. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41369. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41370. return extendStatics(d, b);
  41371. };
  41372. return function (d, b) {
  41373. extendStatics(d, b);
  41374. function __() { this.constructor = d; }
  41375. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41376. };
  41377. })();
  41378. var MAX_BUFFER_LENGTH = 256 * 1024;
  41379. var http_request_HTTPRequest = (function (_super) {
  41380. http_request_extends(HTTPRequest, _super);
  41381. function HTTPRequest(hooks, method, url) {
  41382. var _this = _super.call(this) || this;
  41383. _this.hooks = hooks;
  41384. _this.method = method;
  41385. _this.url = url;
  41386. return _this;
  41387. }
  41388. HTTPRequest.prototype.start = function (payload) {
  41389. var _this = this;
  41390. this.position = 0;
  41391. this.xhr = this.hooks.getRequest(this);
  41392. this.unloader = function () {
  41393. _this.close();
  41394. };
  41395. runtime.addUnloadListener(this.unloader);
  41396. this.xhr.open(this.method, this.url, true);
  41397. if (this.xhr.setRequestHeader) {
  41398. this.xhr.setRequestHeader("Content-Type", "application/json");
  41399. }
  41400. this.xhr.send(payload);
  41401. };
  41402. HTTPRequest.prototype.close = function () {
  41403. if (this.unloader) {
  41404. runtime.removeUnloadListener(this.unloader);
  41405. this.unloader = null;
  41406. }
  41407. if (this.xhr) {
  41408. this.hooks.abortRequest(this.xhr);
  41409. this.xhr = null;
  41410. }
  41411. };
  41412. HTTPRequest.prototype.onChunk = function (status, data) {
  41413. while (true) {
  41414. var chunk = this.advanceBuffer(data);
  41415. if (chunk) {
  41416. this.emit("chunk", { status: status, data: chunk });
  41417. }
  41418. else {
  41419. break;
  41420. }
  41421. }
  41422. if (this.isBufferTooLong(data)) {
  41423. this.emit("buffer_too_long");
  41424. }
  41425. };
  41426. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41427. var unreadData = buffer.slice(this.position);
  41428. var endOfLinePosition = unreadData.indexOf("\n");
  41429. if (endOfLinePosition !== -1) {
  41430. this.position += endOfLinePosition + 1;
  41431. return unreadData.slice(0, endOfLinePosition);
  41432. }
  41433. else {
  41434. return null;
  41435. }
  41436. };
  41437. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41438. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41439. };
  41440. return HTTPRequest;
  41441. }(dispatcher));
  41442. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41443. // CONCATENATED MODULE: ./src/core/http/state.ts
  41444. var State;
  41445. (function (State) {
  41446. State[State["CONNECTING"] = 0] = "CONNECTING";
  41447. State[State["OPEN"] = 1] = "OPEN";
  41448. State[State["CLOSED"] = 3] = "CLOSED";
  41449. })(State || (State = {}));
  41450. /* harmony default export */ var state = (State);
  41451. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41452. var autoIncrement = 1;
  41453. var http_socket_HTTPSocket = (function () {
  41454. function HTTPSocket(hooks, url) {
  41455. this.hooks = hooks;
  41456. this.session = randomNumber(1000) + "/" + randomString(8);
  41457. this.location = getLocation(url);
  41458. this.readyState = state.CONNECTING;
  41459. this.openStream();
  41460. }
  41461. HTTPSocket.prototype.send = function (payload) {
  41462. return this.sendRaw(JSON.stringify([payload]));
  41463. };
  41464. HTTPSocket.prototype.ping = function () {
  41465. this.hooks.sendHeartbeat(this);
  41466. };
  41467. HTTPSocket.prototype.close = function (code, reason) {
  41468. this.onClose(code, reason, true);
  41469. };
  41470. HTTPSocket.prototype.sendRaw = function (payload) {
  41471. if (this.readyState === state.OPEN) {
  41472. try {
  41473. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41474. return true;
  41475. }
  41476. catch (e) {
  41477. return false;
  41478. }
  41479. }
  41480. else {
  41481. return false;
  41482. }
  41483. };
  41484. HTTPSocket.prototype.reconnect = function () {
  41485. this.closeStream();
  41486. this.openStream();
  41487. };
  41488. ;
  41489. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41490. this.closeStream();
  41491. this.readyState = state.CLOSED;
  41492. if (this.onclose) {
  41493. this.onclose({
  41494. code: code,
  41495. reason: reason,
  41496. wasClean: wasClean
  41497. });
  41498. }
  41499. };
  41500. HTTPSocket.prototype.onChunk = function (chunk) {
  41501. if (chunk.status !== 200) {
  41502. return;
  41503. }
  41504. if (this.readyState === state.OPEN) {
  41505. this.onActivity();
  41506. }
  41507. var payload;
  41508. var type = chunk.data.slice(0, 1);
  41509. switch (type) {
  41510. case 'o':
  41511. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41512. this.onOpen(payload);
  41513. break;
  41514. case 'a':
  41515. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41516. for (var i = 0; i < payload.length; i++) {
  41517. this.onEvent(payload[i]);
  41518. }
  41519. break;
  41520. case 'm':
  41521. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41522. this.onEvent(payload);
  41523. break;
  41524. case 'h':
  41525. this.hooks.onHeartbeat(this);
  41526. break;
  41527. case 'c':
  41528. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41529. this.onClose(payload[0], payload[1], true);
  41530. break;
  41531. }
  41532. };
  41533. HTTPSocket.prototype.onOpen = function (options) {
  41534. if (this.readyState === state.CONNECTING) {
  41535. if (options && options.hostname) {
  41536. this.location.base = replaceHost(this.location.base, options.hostname);
  41537. }
  41538. this.readyState = state.OPEN;
  41539. if (this.onopen) {
  41540. this.onopen();
  41541. }
  41542. }
  41543. else {
  41544. this.onClose(1006, "Server lost session", true);
  41545. }
  41546. };
  41547. HTTPSocket.prototype.onEvent = function (event) {
  41548. if (this.readyState === state.OPEN && this.onmessage) {
  41549. this.onmessage({ data: event });
  41550. }
  41551. };
  41552. HTTPSocket.prototype.onActivity = function () {
  41553. if (this.onactivity) {
  41554. this.onactivity();
  41555. }
  41556. };
  41557. HTTPSocket.prototype.onError = function (error) {
  41558. if (this.onerror) {
  41559. this.onerror(error);
  41560. }
  41561. };
  41562. HTTPSocket.prototype.openStream = function () {
  41563. var _this = this;
  41564. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41565. this.stream.bind("chunk", function (chunk) {
  41566. _this.onChunk(chunk);
  41567. });
  41568. this.stream.bind("finished", function (status) {
  41569. _this.hooks.onFinished(_this, status);
  41570. });
  41571. this.stream.bind("buffer_too_long", function () {
  41572. _this.reconnect();
  41573. });
  41574. try {
  41575. this.stream.start();
  41576. }
  41577. catch (error) {
  41578. util.defer(function () {
  41579. _this.onError(error);
  41580. _this.onClose(1006, "Could not start streaming", false);
  41581. });
  41582. }
  41583. };
  41584. HTTPSocket.prototype.closeStream = function () {
  41585. if (this.stream) {
  41586. this.stream.unbind_all();
  41587. this.stream.close();
  41588. this.stream = null;
  41589. }
  41590. };
  41591. return HTTPSocket;
  41592. }());
  41593. function getLocation(url) {
  41594. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41595. return {
  41596. base: parts[1],
  41597. queryString: parts[2]
  41598. };
  41599. }
  41600. function getSendURL(url, session) {
  41601. return url.base + "/" + session + "/xhr_send";
  41602. }
  41603. function getUniqueURL(url) {
  41604. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41605. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41606. }
  41607. function replaceHost(url, hostname) {
  41608. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41609. return urlParts[1] + hostname + urlParts[3];
  41610. }
  41611. function randomNumber(max) {
  41612. return Math.floor(Math.random() * max);
  41613. }
  41614. function randomString(length) {
  41615. var result = [];
  41616. for (var i = 0; i < length; i++) {
  41617. result.push(randomNumber(32).toString(32));
  41618. }
  41619. return result.join('');
  41620. }
  41621. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41622. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41623. var http_streaming_socket_hooks = {
  41624. getReceiveURL: function (url, session) {
  41625. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41626. },
  41627. onHeartbeat: function (socket) {
  41628. socket.sendRaw("[]");
  41629. },
  41630. sendHeartbeat: function (socket) {
  41631. socket.sendRaw("[]");
  41632. },
  41633. onFinished: function (socket, status) {
  41634. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41635. }
  41636. };
  41637. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41638. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41639. var http_polling_socket_hooks = {
  41640. getReceiveURL: function (url, session) {
  41641. return url.base + "/" + session + "/xhr" + url.queryString;
  41642. },
  41643. onHeartbeat: function () {
  41644. },
  41645. sendHeartbeat: function (socket) {
  41646. socket.sendRaw("[]");
  41647. },
  41648. onFinished: function (socket, status) {
  41649. if (status === 200) {
  41650. socket.reconnect();
  41651. }
  41652. else {
  41653. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41654. }
  41655. }
  41656. };
  41657. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41658. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41659. var http_xhr_request_hooks = {
  41660. getRequest: function (socket) {
  41661. var Constructor = runtime.getXHRAPI();
  41662. var xhr = new Constructor();
  41663. xhr.onreadystatechange = xhr.onprogress = function () {
  41664. switch (xhr.readyState) {
  41665. case 3:
  41666. if (xhr.responseText && xhr.responseText.length > 0) {
  41667. socket.onChunk(xhr.status, xhr.responseText);
  41668. }
  41669. break;
  41670. case 4:
  41671. if (xhr.responseText && xhr.responseText.length > 0) {
  41672. socket.onChunk(xhr.status, xhr.responseText);
  41673. }
  41674. socket.emit("finished", xhr.status);
  41675. socket.close();
  41676. break;
  41677. }
  41678. };
  41679. return xhr;
  41680. },
  41681. abortRequest: function (xhr) {
  41682. xhr.onreadystatechange = null;
  41683. xhr.abort();
  41684. }
  41685. };
  41686. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41687. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41688. var HTTP = {
  41689. createStreamingSocket: function (url) {
  41690. return this.createSocket(http_streaming_socket, url);
  41691. },
  41692. createPollingSocket: function (url) {
  41693. return this.createSocket(http_polling_socket, url);
  41694. },
  41695. createSocket: function (hooks, url) {
  41696. return new http_socket(hooks, url);
  41697. },
  41698. createXHR: function (method, url) {
  41699. return this.createRequest(http_xhr_request, method, url);
  41700. },
  41701. createRequest: function (hooks, method, url) {
  41702. return new http_request(hooks, method, url);
  41703. }
  41704. };
  41705. /* harmony default export */ var http_http = (HTTP);
  41706. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41707. http_http.createXDR = function (method, url) {
  41708. return this.createRequest(http_xdomain_request, method, url);
  41709. };
  41710. /* harmony default export */ var web_http_http = (http_http);
  41711. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41712. var Runtime = {
  41713. nextAuthCallbackID: 1,
  41714. auth_callbacks: {},
  41715. ScriptReceivers: ScriptReceivers,
  41716. DependenciesReceivers: DependenciesReceivers,
  41717. getDefaultStrategy: default_strategy,
  41718. Transports: transports_transports,
  41719. transportConnectionInitializer: transport_connection_initializer,
  41720. HTTPFactory: web_http_http,
  41721. TimelineTransport: jsonp_timeline,
  41722. getXHRAPI: function () {
  41723. return window.XMLHttpRequest;
  41724. },
  41725. getWebSocketAPI: function () {
  41726. return window.WebSocket || window.MozWebSocket;
  41727. },
  41728. setup: function (PusherClass) {
  41729. var _this = this;
  41730. window.Pusher = PusherClass;
  41731. var initializeOnDocumentBody = function () {
  41732. _this.onDocumentBody(PusherClass.ready);
  41733. };
  41734. if (!window.JSON) {
  41735. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41736. }
  41737. else {
  41738. initializeOnDocumentBody();
  41739. }
  41740. },
  41741. getDocument: function () {
  41742. return document;
  41743. },
  41744. getProtocol: function () {
  41745. return this.getDocument().location.protocol;
  41746. },
  41747. getAuthorizers: function () {
  41748. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41749. },
  41750. onDocumentBody: function (callback) {
  41751. var _this = this;
  41752. if (document.body) {
  41753. callback();
  41754. }
  41755. else {
  41756. setTimeout(function () {
  41757. _this.onDocumentBody(callback);
  41758. }, 0);
  41759. }
  41760. },
  41761. createJSONPRequest: function (url, data) {
  41762. return new jsonp_request(url, data);
  41763. },
  41764. createScriptRequest: function (src) {
  41765. return new script_request(src);
  41766. },
  41767. getLocalStorage: function () {
  41768. try {
  41769. return window.localStorage;
  41770. }
  41771. catch (e) {
  41772. return undefined;
  41773. }
  41774. },
  41775. createXHR: function () {
  41776. if (this.getXHRAPI()) {
  41777. return this.createXMLHttpRequest();
  41778. }
  41779. else {
  41780. return this.createMicrosoftXHR();
  41781. }
  41782. },
  41783. createXMLHttpRequest: function () {
  41784. var Constructor = this.getXHRAPI();
  41785. return new Constructor();
  41786. },
  41787. createMicrosoftXHR: function () {
  41788. return new ActiveXObject("Microsoft.XMLHTTP");
  41789. },
  41790. getNetwork: function () {
  41791. return net_info_Network;
  41792. },
  41793. createWebSocket: function (url) {
  41794. var Constructor = this.getWebSocketAPI();
  41795. return new Constructor(url);
  41796. },
  41797. createSocketRequest: function (method, url) {
  41798. if (this.isXHRSupported()) {
  41799. return this.HTTPFactory.createXHR(method, url);
  41800. }
  41801. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41802. return this.HTTPFactory.createXDR(method, url);
  41803. }
  41804. else {
  41805. throw "Cross-origin HTTP requests are not supported";
  41806. }
  41807. },
  41808. isXHRSupported: function () {
  41809. var Constructor = this.getXHRAPI();
  41810. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41811. },
  41812. isXDRSupported: function (useTLS) {
  41813. var protocol = useTLS ? "https:" : "http:";
  41814. var documentProtocol = this.getProtocol();
  41815. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41816. },
  41817. addUnloadListener: function (listener) {
  41818. if (window.addEventListener !== undefined) {
  41819. window.addEventListener("unload", listener, false);
  41820. }
  41821. else if (window.attachEvent !== undefined) {
  41822. window.attachEvent("onunload", listener);
  41823. }
  41824. },
  41825. removeUnloadListener: function (listener) {
  41826. if (window.addEventListener !== undefined) {
  41827. window.removeEventListener("unload", listener, false);
  41828. }
  41829. else if (window.detachEvent !== undefined) {
  41830. window.detachEvent("onunload", listener);
  41831. }
  41832. }
  41833. };
  41834. /* harmony default export */ var runtime = (Runtime);
  41835. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41836. var TimelineLevel;
  41837. (function (TimelineLevel) {
  41838. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41839. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41840. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41841. })(TimelineLevel || (TimelineLevel = {}));
  41842. /* harmony default export */ var timeline_level = (TimelineLevel);
  41843. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41844. var timeline_Timeline = (function () {
  41845. function Timeline(key, session, options) {
  41846. this.key = key;
  41847. this.session = session;
  41848. this.events = [];
  41849. this.options = options || {};
  41850. this.sent = 0;
  41851. this.uniqueID = 0;
  41852. }
  41853. Timeline.prototype.log = function (level, event) {
  41854. if (level <= this.options.level) {
  41855. this.events.push(extend({}, event, { timestamp: util.now() }));
  41856. if (this.options.limit && this.events.length > this.options.limit) {
  41857. this.events.shift();
  41858. }
  41859. }
  41860. };
  41861. Timeline.prototype.error = function (event) {
  41862. this.log(timeline_level.ERROR, event);
  41863. };
  41864. Timeline.prototype.info = function (event) {
  41865. this.log(timeline_level.INFO, event);
  41866. };
  41867. Timeline.prototype.debug = function (event) {
  41868. this.log(timeline_level.DEBUG, event);
  41869. };
  41870. Timeline.prototype.isEmpty = function () {
  41871. return this.events.length === 0;
  41872. };
  41873. Timeline.prototype.send = function (sendfn, callback) {
  41874. var _this = this;
  41875. var data = extend({
  41876. session: this.session,
  41877. bundle: this.sent + 1,
  41878. key: this.key,
  41879. lib: "js",
  41880. version: this.options.version,
  41881. cluster: this.options.cluster,
  41882. features: this.options.features,
  41883. timeline: this.events
  41884. }, this.options.params);
  41885. this.events = [];
  41886. sendfn(data, function (error, result) {
  41887. if (!error) {
  41888. _this.sent++;
  41889. }
  41890. if (callback) {
  41891. callback(error, result);
  41892. }
  41893. });
  41894. return true;
  41895. };
  41896. Timeline.prototype.generateUniqueID = function () {
  41897. this.uniqueID++;
  41898. return this.uniqueID;
  41899. };
  41900. return Timeline;
  41901. }());
  41902. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  41903. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  41904. var transport_strategy_TransportStrategy = (function () {
  41905. function TransportStrategy(name, priority, transport, options) {
  41906. this.name = name;
  41907. this.priority = priority;
  41908. this.transport = transport;
  41909. this.options = options || {};
  41910. }
  41911. TransportStrategy.prototype.isSupported = function () {
  41912. return this.transport.isSupported({
  41913. useTLS: this.options.useTLS
  41914. });
  41915. };
  41916. TransportStrategy.prototype.connect = function (minPriority, callback) {
  41917. var _this = this;
  41918. if (!this.isSupported()) {
  41919. return failAttempt(new UnsupportedStrategy(), callback);
  41920. }
  41921. else if (this.priority < minPriority) {
  41922. return failAttempt(new TransportPriorityTooLow(), callback);
  41923. }
  41924. var connected = false;
  41925. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  41926. var handshake = null;
  41927. var onInitialized = function () {
  41928. transport.unbind("initialized", onInitialized);
  41929. transport.connect();
  41930. };
  41931. var onOpen = function () {
  41932. handshake = factory.createHandshake(transport, function (result) {
  41933. connected = true;
  41934. unbindListeners();
  41935. callback(null, result);
  41936. });
  41937. };
  41938. var onError = function (error) {
  41939. unbindListeners();
  41940. callback(error);
  41941. };
  41942. var onClosed = function () {
  41943. unbindListeners();
  41944. var serializedTransport;
  41945. serializedTransport = safeJSONStringify(transport);
  41946. callback(new TransportClosed(serializedTransport));
  41947. };
  41948. var unbindListeners = function () {
  41949. transport.unbind("initialized", onInitialized);
  41950. transport.unbind("open", onOpen);
  41951. transport.unbind("error", onError);
  41952. transport.unbind("closed", onClosed);
  41953. };
  41954. transport.bind("initialized", onInitialized);
  41955. transport.bind("open", onOpen);
  41956. transport.bind("error", onError);
  41957. transport.bind("closed", onClosed);
  41958. transport.initialize();
  41959. return {
  41960. abort: function () {
  41961. if (connected) {
  41962. return;
  41963. }
  41964. unbindListeners();
  41965. if (handshake) {
  41966. handshake.close();
  41967. }
  41968. else {
  41969. transport.close();
  41970. }
  41971. },
  41972. forceMinPriority: function (p) {
  41973. if (connected) {
  41974. return;
  41975. }
  41976. if (_this.priority < p) {
  41977. if (handshake) {
  41978. handshake.close();
  41979. }
  41980. else {
  41981. transport.close();
  41982. }
  41983. }
  41984. }
  41985. };
  41986. };
  41987. return TransportStrategy;
  41988. }());
  41989. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  41990. function failAttempt(error, callback) {
  41991. util.defer(function () {
  41992. callback(error);
  41993. });
  41994. return {
  41995. abort: function () { },
  41996. forceMinPriority: function () { }
  41997. };
  41998. }
  41999. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42000. var strategy_builder_Transports = runtime.Transports;
  42001. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42002. var transportClass = strategy_builder_Transports[type];
  42003. if (!transportClass) {
  42004. throw new UnsupportedTransport(type);
  42005. }
  42006. var enabled = (!config.enabledTransports ||
  42007. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42008. (!config.disabledTransports ||
  42009. arrayIndexOf(config.disabledTransports, name) === -1);
  42010. var transport;
  42011. if (enabled) {
  42012. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42013. key: config.key,
  42014. useTLS: config.useTLS,
  42015. timeline: config.timeline,
  42016. ignoreNullOrigin: config.ignoreNullOrigin
  42017. }, options));
  42018. }
  42019. else {
  42020. transport = strategy_builder_UnsupportedStrategy;
  42021. }
  42022. return transport;
  42023. };
  42024. var strategy_builder_UnsupportedStrategy = {
  42025. isSupported: function () {
  42026. return false;
  42027. },
  42028. connect: function (_, callback) {
  42029. var deferred = util.defer(function () {
  42030. callback(new UnsupportedStrategy());
  42031. });
  42032. return {
  42033. abort: function () {
  42034. deferred.ensureAborted();
  42035. },
  42036. forceMinPriority: function () { }
  42037. };
  42038. }
  42039. };
  42040. // CONCATENATED MODULE: ./src/core/config.ts
  42041. var getGlobalConfig = function () {
  42042. return {
  42043. wsHost: defaults.host,
  42044. wsPort: defaults.ws_port,
  42045. wssPort: defaults.wss_port,
  42046. wsPath: defaults.ws_path,
  42047. httpHost: defaults.sockjs_host,
  42048. httpPort: defaults.sockjs_http_port,
  42049. httpsPort: defaults.sockjs_https_port,
  42050. httpPath: defaults.sockjs_path,
  42051. statsHost: defaults.stats_host,
  42052. authEndpoint: defaults.channel_auth_endpoint,
  42053. authTransport: defaults.channel_auth_transport,
  42054. activity_timeout: defaults.activity_timeout,
  42055. pong_timeout: defaults.pong_timeout,
  42056. unavailable_timeout: defaults.unavailable_timeout
  42057. };
  42058. };
  42059. var getClusterConfig = function (clusterName) {
  42060. return {
  42061. wsHost: 'ws-' + clusterName + '.pusher.com',
  42062. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42063. };
  42064. };
  42065. // CONCATENATED MODULE: ./src/core/pusher.ts
  42066. var pusher_Pusher = (function () {
  42067. function Pusher(app_key, options) {
  42068. var _this = this;
  42069. checkAppKey(app_key);
  42070. options = options || {};
  42071. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42072. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42073. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42074. }
  42075. this.key = app_key;
  42076. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42077. this.channels = factory.createChannels();
  42078. this.global_emitter = new dispatcher();
  42079. this.sessionID = Math.floor(Math.random() * 1000000000);
  42080. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42081. cluster: this.config.cluster,
  42082. features: Pusher.getClientFeatures(),
  42083. params: this.config.timelineParams || {},
  42084. limit: 50,
  42085. level: timeline_level.INFO,
  42086. version: defaults.VERSION
  42087. });
  42088. if (!this.config.disableStats) {
  42089. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42090. host: this.config.statsHost,
  42091. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42092. });
  42093. }
  42094. var getStrategy = function (options) {
  42095. var config = extend({}, _this.config, options);
  42096. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42097. };
  42098. this.connection = factory.createConnectionManager(this.key, extend({
  42099. getStrategy: getStrategy,
  42100. timeline: this.timeline,
  42101. activityTimeout: this.config.activity_timeout,
  42102. pongTimeout: this.config.pong_timeout,
  42103. unavailableTimeout: this.config.unavailable_timeout
  42104. }, this.config, { useTLS: this.shouldUseTLS() }));
  42105. this.connection.bind('connected', function () {
  42106. _this.subscribeAll();
  42107. if (_this.timelineSender) {
  42108. _this.timelineSender.send(_this.connection.isUsingTLS());
  42109. }
  42110. });
  42111. this.connection.bind('message', function (event) {
  42112. var eventName = event.event;
  42113. var internal = eventName.indexOf('pusher_internal:') === 0;
  42114. if (event.channel) {
  42115. var channel = _this.channel(event.channel);
  42116. if (channel) {
  42117. channel.handleEvent(event);
  42118. }
  42119. }
  42120. if (!internal) {
  42121. _this.global_emitter.emit(event.event, event.data);
  42122. }
  42123. });
  42124. this.connection.bind('connecting', function () {
  42125. _this.channels.disconnect();
  42126. });
  42127. this.connection.bind('disconnected', function () {
  42128. _this.channels.disconnect();
  42129. });
  42130. this.connection.bind('error', function (err) {
  42131. logger.warn(err);
  42132. });
  42133. Pusher.instances.push(this);
  42134. this.timeline.info({ instances: Pusher.instances.length });
  42135. if (Pusher.isReady) {
  42136. this.connect();
  42137. }
  42138. }
  42139. Pusher.ready = function () {
  42140. Pusher.isReady = true;
  42141. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42142. Pusher.instances[i].connect();
  42143. }
  42144. };
  42145. Pusher.getClientFeatures = function () {
  42146. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42147. return t.isSupported({});
  42148. }));
  42149. };
  42150. Pusher.prototype.channel = function (name) {
  42151. return this.channels.find(name);
  42152. };
  42153. Pusher.prototype.allChannels = function () {
  42154. return this.channels.all();
  42155. };
  42156. Pusher.prototype.connect = function () {
  42157. this.connection.connect();
  42158. if (this.timelineSender) {
  42159. if (!this.timelineSenderTimer) {
  42160. var usingTLS = this.connection.isUsingTLS();
  42161. var timelineSender = this.timelineSender;
  42162. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42163. timelineSender.send(usingTLS);
  42164. });
  42165. }
  42166. }
  42167. };
  42168. Pusher.prototype.disconnect = function () {
  42169. this.connection.disconnect();
  42170. if (this.timelineSenderTimer) {
  42171. this.timelineSenderTimer.ensureAborted();
  42172. this.timelineSenderTimer = null;
  42173. }
  42174. };
  42175. Pusher.prototype.bind = function (event_name, callback, context) {
  42176. this.global_emitter.bind(event_name, callback, context);
  42177. return this;
  42178. };
  42179. Pusher.prototype.unbind = function (event_name, callback, context) {
  42180. this.global_emitter.unbind(event_name, callback, context);
  42181. return this;
  42182. };
  42183. Pusher.prototype.bind_global = function (callback) {
  42184. this.global_emitter.bind_global(callback);
  42185. return this;
  42186. };
  42187. Pusher.prototype.unbind_global = function (callback) {
  42188. this.global_emitter.unbind_global(callback);
  42189. return this;
  42190. };
  42191. Pusher.prototype.unbind_all = function (callback) {
  42192. this.global_emitter.unbind_all();
  42193. return this;
  42194. };
  42195. Pusher.prototype.subscribeAll = function () {
  42196. var channelName;
  42197. for (channelName in this.channels.channels) {
  42198. if (this.channels.channels.hasOwnProperty(channelName)) {
  42199. this.subscribe(channelName);
  42200. }
  42201. }
  42202. };
  42203. Pusher.prototype.subscribe = function (channel_name) {
  42204. var channel = this.channels.add(channel_name, this);
  42205. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42206. channel.reinstateSubscription();
  42207. }
  42208. else if (!channel.subscriptionPending &&
  42209. this.connection.state === 'connected') {
  42210. channel.subscribe();
  42211. }
  42212. return channel;
  42213. };
  42214. Pusher.prototype.unsubscribe = function (channel_name) {
  42215. var channel = this.channels.find(channel_name);
  42216. if (channel && channel.subscriptionPending) {
  42217. channel.cancelSubscription();
  42218. }
  42219. else {
  42220. channel = this.channels.remove(channel_name);
  42221. if (channel && this.connection.state === 'connected') {
  42222. channel.unsubscribe();
  42223. }
  42224. }
  42225. };
  42226. Pusher.prototype.send_event = function (event_name, data, channel) {
  42227. return this.connection.send_event(event_name, data, channel);
  42228. };
  42229. Pusher.prototype.shouldUseTLS = function () {
  42230. if (runtime.getProtocol() === 'https:') {
  42231. return true;
  42232. }
  42233. else if (this.config.forceTLS === true) {
  42234. return true;
  42235. }
  42236. else {
  42237. return Boolean(this.config.encrypted);
  42238. }
  42239. };
  42240. Pusher.instances = [];
  42241. Pusher.isReady = false;
  42242. Pusher.logToConsole = false;
  42243. Pusher.Runtime = runtime;
  42244. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42245. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42246. Pusher.auth_callbacks = runtime.auth_callbacks;
  42247. return Pusher;
  42248. }());
  42249. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42250. function checkAppKey(key) {
  42251. if (key === null || key === undefined) {
  42252. throw 'You must pass your app key when you instantiate Pusher.';
  42253. }
  42254. }
  42255. runtime.setup(pusher_Pusher);
  42256. /***/ })
  42257. /******/ ]);
  42258. });
  42259. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42260. /***/ }),
  42261. /***/ "./node_modules/setimmediate/setImmediate.js":
  42262. /*!***************************************************!*\
  42263. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42264. \***************************************************/
  42265. /*! no static exports found */
  42266. /***/ (function(module, exports, __webpack_require__) {
  42267. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42268. "use strict";
  42269. if (global.setImmediate) {
  42270. return;
  42271. }
  42272. var nextHandle = 1; // Spec says greater than zero
  42273. var tasksByHandle = {};
  42274. var currentlyRunningATask = false;
  42275. var doc = global.document;
  42276. var registerImmediate;
  42277. function setImmediate(callback) {
  42278. // Callback can either be a function or a string
  42279. if (typeof callback !== "function") {
  42280. callback = new Function("" + callback);
  42281. }
  42282. // Copy function arguments
  42283. var args = new Array(arguments.length - 1);
  42284. for (var i = 0; i < args.length; i++) {
  42285. args[i] = arguments[i + 1];
  42286. }
  42287. // Store and register the task
  42288. var task = { callback: callback, args: args };
  42289. tasksByHandle[nextHandle] = task;
  42290. registerImmediate(nextHandle);
  42291. return nextHandle++;
  42292. }
  42293. function clearImmediate(handle) {
  42294. delete tasksByHandle[handle];
  42295. }
  42296. function run(task) {
  42297. var callback = task.callback;
  42298. var args = task.args;
  42299. switch (args.length) {
  42300. case 0:
  42301. callback();
  42302. break;
  42303. case 1:
  42304. callback(args[0]);
  42305. break;
  42306. case 2:
  42307. callback(args[0], args[1]);
  42308. break;
  42309. case 3:
  42310. callback(args[0], args[1], args[2]);
  42311. break;
  42312. default:
  42313. callback.apply(undefined, args);
  42314. break;
  42315. }
  42316. }
  42317. function runIfPresent(handle) {
  42318. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42319. // So if we're currently running a task, we'll need to delay this invocation.
  42320. if (currentlyRunningATask) {
  42321. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42322. // "too much recursion" error.
  42323. setTimeout(runIfPresent, 0, handle);
  42324. } else {
  42325. var task = tasksByHandle[handle];
  42326. if (task) {
  42327. currentlyRunningATask = true;
  42328. try {
  42329. run(task);
  42330. } finally {
  42331. clearImmediate(handle);
  42332. currentlyRunningATask = false;
  42333. }
  42334. }
  42335. }
  42336. }
  42337. function installNextTickImplementation() {
  42338. registerImmediate = function(handle) {
  42339. process.nextTick(function () { runIfPresent(handle); });
  42340. };
  42341. }
  42342. function canUsePostMessage() {
  42343. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42344. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42345. if (global.postMessage && !global.importScripts) {
  42346. var postMessageIsAsynchronous = true;
  42347. var oldOnMessage = global.onmessage;
  42348. global.onmessage = function() {
  42349. postMessageIsAsynchronous = false;
  42350. };
  42351. global.postMessage("", "*");
  42352. global.onmessage = oldOnMessage;
  42353. return postMessageIsAsynchronous;
  42354. }
  42355. }
  42356. function installPostMessageImplementation() {
  42357. // Installs an event handler on `global` for the `message` event: see
  42358. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42359. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42360. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42361. var onGlobalMessage = function(event) {
  42362. if (event.source === global &&
  42363. typeof event.data === "string" &&
  42364. event.data.indexOf(messagePrefix) === 0) {
  42365. runIfPresent(+event.data.slice(messagePrefix.length));
  42366. }
  42367. };
  42368. if (global.addEventListener) {
  42369. global.addEventListener("message", onGlobalMessage, false);
  42370. } else {
  42371. global.attachEvent("onmessage", onGlobalMessage);
  42372. }
  42373. registerImmediate = function(handle) {
  42374. global.postMessage(messagePrefix + handle, "*");
  42375. };
  42376. }
  42377. function installMessageChannelImplementation() {
  42378. var channel = new MessageChannel();
  42379. channel.port1.onmessage = function(event) {
  42380. var handle = event.data;
  42381. runIfPresent(handle);
  42382. };
  42383. registerImmediate = function(handle) {
  42384. channel.port2.postMessage(handle);
  42385. };
  42386. }
  42387. function installReadyStateChangeImplementation() {
  42388. var html = doc.documentElement;
  42389. registerImmediate = function(handle) {
  42390. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42391. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42392. var script = doc.createElement("script");
  42393. script.onreadystatechange = function () {
  42394. runIfPresent(handle);
  42395. script.onreadystatechange = null;
  42396. html.removeChild(script);
  42397. script = null;
  42398. };
  42399. html.appendChild(script);
  42400. };
  42401. }
  42402. function installSetTimeoutImplementation() {
  42403. registerImmediate = function(handle) {
  42404. setTimeout(runIfPresent, 0, handle);
  42405. };
  42406. }
  42407. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42408. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42409. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42410. // Don't get fooled by e.g. browserify environments.
  42411. if ({}.toString.call(global.process) === "[object process]") {
  42412. // For Node.js before 0.9
  42413. installNextTickImplementation();
  42414. } else if (canUsePostMessage()) {
  42415. // For non-IE10 modern browsers
  42416. installPostMessageImplementation();
  42417. } else if (global.MessageChannel) {
  42418. // For web workers, where supported
  42419. installMessageChannelImplementation();
  42420. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42421. // For IE 6–8
  42422. installReadyStateChangeImplementation();
  42423. } else {
  42424. // For older browsers
  42425. installSetTimeoutImplementation();
  42426. }
  42427. attachTo.setImmediate = setImmediate;
  42428. attachTo.clearImmediate = clearImmediate;
  42429. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42430. /* 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")))
  42431. /***/ }),
  42432. /***/ "./node_modules/timers-browserify/main.js":
  42433. /*!************************************************!*\
  42434. !*** ./node_modules/timers-browserify/main.js ***!
  42435. \************************************************/
  42436. /*! no static exports found */
  42437. /***/ (function(module, exports, __webpack_require__) {
  42438. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42439. (typeof self !== "undefined" && self) ||
  42440. window;
  42441. var apply = Function.prototype.apply;
  42442. // DOM APIs, for completeness
  42443. exports.setTimeout = function() {
  42444. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42445. };
  42446. exports.setInterval = function() {
  42447. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42448. };
  42449. exports.clearTimeout =
  42450. exports.clearInterval = function(timeout) {
  42451. if (timeout) {
  42452. timeout.close();
  42453. }
  42454. };
  42455. function Timeout(id, clearFn) {
  42456. this._id = id;
  42457. this._clearFn = clearFn;
  42458. }
  42459. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42460. Timeout.prototype.close = function() {
  42461. this._clearFn.call(scope, this._id);
  42462. };
  42463. // Does not start the time, just sets up the members needed.
  42464. exports.enroll = function(item, msecs) {
  42465. clearTimeout(item._idleTimeoutId);
  42466. item._idleTimeout = msecs;
  42467. };
  42468. exports.unenroll = function(item) {
  42469. clearTimeout(item._idleTimeoutId);
  42470. item._idleTimeout = -1;
  42471. };
  42472. exports._unrefActive = exports.active = function(item) {
  42473. clearTimeout(item._idleTimeoutId);
  42474. var msecs = item._idleTimeout;
  42475. if (msecs >= 0) {
  42476. item._idleTimeoutId = setTimeout(function onTimeout() {
  42477. if (item._onTimeout)
  42478. item._onTimeout();
  42479. }, msecs);
  42480. }
  42481. };
  42482. // setimmediate attaches itself to the global object
  42483. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42484. // On some exotic environments, it's not clear which object `setimmediate` was
  42485. // able to install onto. Search each possibility in the same order as the
  42486. // `setimmediate` library.
  42487. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42488. (typeof global !== "undefined" && global.setImmediate) ||
  42489. (this && this.setImmediate);
  42490. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42491. (typeof global !== "undefined" && global.clearImmediate) ||
  42492. (this && this.clearImmediate);
  42493. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42494. /***/ }),
  42495. /***/ "./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&":
  42496. /*!*******************************************************************************************************************************************************************************************************************!*\
  42497. !*** ./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& ***!
  42498. \*******************************************************************************************************************************************************************************************************************/
  42499. /*! exports provided: render, staticRenderFns */
  42500. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42501. "use strict";
  42502. __webpack_require__.r(__webpack_exports__);
  42503. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42504. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42505. var render = function() {
  42506. var _vm = this
  42507. var _h = _vm.$createElement
  42508. var _c = _vm._self._c || _h
  42509. return _vm._m(0)
  42510. }
  42511. var staticRenderFns = [
  42512. function() {
  42513. var _vm = this
  42514. var _h = _vm.$createElement
  42515. var _c = _vm._self._c || _h
  42516. return _c("div", { staticClass: "container" }, [
  42517. _c("div", { staticClass: "row justify-content-center" }, [
  42518. _c("div", { staticClass: "col-md-8" }, [
  42519. _c("div", { staticClass: "card" }, [
  42520. _c("div", { staticClass: "card-header" }, [
  42521. _vm._v("Example Component")
  42522. ]),
  42523. _vm._v(" "),
  42524. _c("div", { staticClass: "card-body" }, [
  42525. _vm._v(
  42526. "\n I'm an example component.\n "
  42527. )
  42528. ])
  42529. ])
  42530. ])
  42531. ])
  42532. ])
  42533. }
  42534. ]
  42535. render._withStripped = true
  42536. /***/ }),
  42537. /***/ "./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&":
  42538. /*!************************************************************************************************************************************************************************************************************!*\
  42539. !*** ./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& ***!
  42540. \************************************************************************************************************************************************************************************************************/
  42541. /*! exports provided: render, staticRenderFns */
  42542. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42543. "use strict";
  42544. __webpack_require__.r(__webpack_exports__);
  42545. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42546. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42547. var render = function() {
  42548. var _vm = this
  42549. var _h = _vm.$createElement
  42550. var _c = _vm._self._c || _h
  42551. return _c("div", [
  42552. _c("h4", { staticClass: "text-center" }, [
  42553. _vm._v(_vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "),
  42554. _c("small", { staticClass: "text-muted" }, [
  42555. _vm._v(_vm._s(this.data.pcnickname))
  42556. ])
  42557. ]),
  42558. _vm._v(" "),
  42559. _c("p", [_vm._v("S/N: " + _vm._s(this.data.pcserial))]),
  42560. _vm._v(" "),
  42561. _c("p", [_vm._v("CPU: " + _vm._s(this.data.pcproc))]),
  42562. _vm._v(" "),
  42563. _c("p", [_vm._v("RAM: " + _vm._s(this.data.pcram))]),
  42564. _vm._v(" "),
  42565. _c("p", [_vm._v("OS: " + _vm._s(this.data.pcos))])
  42566. ])
  42567. }
  42568. var staticRenderFns = []
  42569. render._withStripped = true
  42570. /***/ }),
  42571. /***/ "./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&":
  42572. /*!*************************************************************************************************************************************************************************************************************!*\
  42573. !*** ./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& ***!
  42574. \*************************************************************************************************************************************************************************************************************/
  42575. /*! exports provided: render, staticRenderFns */
  42576. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42577. "use strict";
  42578. __webpack_require__.r(__webpack_exports__);
  42579. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42580. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42581. var render = function() {
  42582. var _vm = this
  42583. var _h = _vm.$createElement
  42584. var _c = _vm._self._c || _h
  42585. return _c(
  42586. "div",
  42587. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42588. [
  42589. _c("div", { staticClass: "row no-gutters" }, [
  42590. _c("div", { staticClass: "h5 col-3 text-left" }, [
  42591. _vm._v(_vm._s(this.data.creddesc))
  42592. ]),
  42593. _vm._v(" "),
  42594. _c("div", { staticClass: "col-9 text-right" }, [
  42595. _vm._v(_vm._s(this.data.creddate))
  42596. ])
  42597. ]),
  42598. _vm._v(" "),
  42599. _c("div", { staticClass: "row" }, [
  42600. _c("div", { staticClass: "col-lg-9" }, [
  42601. _c("div", [
  42602. _vm._m(0),
  42603. _vm._v(" "),
  42604. _c("input", {
  42605. staticClass: "border-0 credential",
  42606. attrs: {
  42607. type: "text",
  42608. id: "username" + this.data.credid,
  42609. readonly: ""
  42610. },
  42611. domProps: { value: this.data.creduser }
  42612. }),
  42613. _vm._v(" "),
  42614. _c(
  42615. "button",
  42616. {
  42617. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42618. attrs: {
  42619. id: "btn-username" + this.data.credid,
  42620. "data-clipboard-target": "#username" + this.data.credid
  42621. }
  42622. },
  42623. [_c("i", { staticClass: "far fa-clone" })]
  42624. )
  42625. ]),
  42626. _vm._v(" "),
  42627. _c("div", [
  42628. _vm._m(1),
  42629. _vm._v(" "),
  42630. _c("input", {
  42631. staticClass: "border-0 credential",
  42632. attrs: {
  42633. type: "text",
  42634. id: "password" + this.data.credid,
  42635. readonly: ""
  42636. },
  42637. domProps: { value: this.data.credpass }
  42638. }),
  42639. _vm._v(" "),
  42640. _c(
  42641. "button",
  42642. {
  42643. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42644. attrs: {
  42645. id: "btn-password" + this.data.credid,
  42646. "data-clipboard-target": "#password" + this.data.credid
  42647. }
  42648. },
  42649. [_c("i", { staticClass: "far fa-clone" })]
  42650. )
  42651. ])
  42652. ]),
  42653. _vm._v(" "),
  42654. _vm._m(2)
  42655. ])
  42656. ]
  42657. )
  42658. }
  42659. var staticRenderFns = [
  42660. function() {
  42661. var _vm = this
  42662. var _h = _vm.$createElement
  42663. var _c = _vm._self._c || _h
  42664. return _c("label", { attrs: { for: "username" } }, [
  42665. _c("i", { staticClass: "fas fa-fw fa-user" })
  42666. ])
  42667. },
  42668. function() {
  42669. var _vm = this
  42670. var _h = _vm.$createElement
  42671. var _c = _vm._self._c || _h
  42672. return _c("label", { attrs: { for: "password" } }, [
  42673. _c("i", { staticClass: "fas fa-fw fa-key" })
  42674. ])
  42675. },
  42676. function() {
  42677. var _vm = this
  42678. var _h = _vm.$createElement
  42679. var _c = _vm._self._c || _h
  42680. return _c(
  42681. "div",
  42682. {
  42683. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  42684. attrs: { role: "group", "aria-label": "Edit and Delete" }
  42685. },
  42686. [
  42687. _c(
  42688. "button",
  42689. {
  42690. staticClass: "btn btn-sm btn-secondary p-lg-1",
  42691. attrs: { type: "button" }
  42692. },
  42693. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  42694. ),
  42695. _vm._v(" "),
  42696. _c(
  42697. "button",
  42698. {
  42699. staticClass: "btn btn-sm btn-danger p-lg-1",
  42700. attrs: { type: "button" }
  42701. },
  42702. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  42703. )
  42704. ]
  42705. )
  42706. }
  42707. ]
  42708. render._withStripped = true
  42709. /***/ }),
  42710. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  42711. /*!********************************************************************************************************************************************************************************************************!*\
  42712. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  42713. \********************************************************************************************************************************************************************************************************/
  42714. /*! exports provided: render, staticRenderFns */
  42715. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42716. "use strict";
  42717. __webpack_require__.r(__webpack_exports__);
  42718. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42719. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42720. var render = function() {
  42721. var _vm = this
  42722. var _h = _vm.$createElement
  42723. var _c = _vm._self._c || _h
  42724. return _c("div", { staticClass: "modal fade" }, [
  42725. _c(
  42726. "div",
  42727. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  42728. [
  42729. _c("div", { staticClass: "modal-content" }, [
  42730. _c(
  42731. "div",
  42732. { staticClass: "modal-header" },
  42733. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  42734. 2
  42735. ),
  42736. _vm._v(" "),
  42737. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  42738. _vm._v(" "),
  42739. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  42740. ])
  42741. ]
  42742. )
  42743. ])
  42744. }
  42745. var staticRenderFns = [
  42746. function() {
  42747. var _vm = this
  42748. var _h = _vm.$createElement
  42749. var _c = _vm._self._c || _h
  42750. return _c(
  42751. "button",
  42752. {
  42753. staticClass: "close",
  42754. attrs: {
  42755. type: "button",
  42756. "data-dismiss": "modal",
  42757. "aria-label": "Close"
  42758. }
  42759. },
  42760. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  42761. )
  42762. }
  42763. ]
  42764. render._withStripped = true
  42765. /***/ }),
  42766. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  42767. /*!********************************************************************************************************************************************************************************************************!*\
  42768. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  42769. \********************************************************************************************************************************************************************************************************/
  42770. /*! exports provided: render, staticRenderFns */
  42771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42772. "use strict";
  42773. __webpack_require__.r(__webpack_exports__);
  42774. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42775. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42776. var render = function() {
  42777. var _vm = this
  42778. var _h = _vm.$createElement
  42779. var _c = _vm._self._c || _h
  42780. return _c(
  42781. "ul",
  42782. { staticClass: "list-unstyled" },
  42783. _vm._l(this.notes, function(note) {
  42784. return _c(
  42785. "li",
  42786. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  42787. [
  42788. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  42789. _c("div", { staticClass: "text-center p-0 m-0" }, [
  42790. _vm._v(_vm._s(note.noteuser))
  42791. ]),
  42792. _vm._v(" "),
  42793. _c(
  42794. "div",
  42795. { staticClass: "text-muted text-small text-center p-0 m-0" },
  42796. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  42797. ),
  42798. _vm._v(" "),
  42799. _c(
  42800. "div",
  42801. { staticClass: "btn-group justify-content-center p-0 m-0" },
  42802. [
  42803. _vm.authusername === note.noteuser ||
  42804. _vm.authusername === "admin"
  42805. ? [
  42806. _vm._m(0, true),
  42807. _vm._v(" "),
  42808. _vm._m(1, true),
  42809. _vm._v(" "),
  42810. _vm._m(2, true)
  42811. ]
  42812. : _vm._e()
  42813. ],
  42814. 2
  42815. )
  42816. ]),
  42817. _vm._v(" "),
  42818. _c("div", { staticClass: "col-md-10" }, [
  42819. _c("div", { staticClass: "card m-2" }, [
  42820. _c("div", { staticClass: "card-body p-2" }, [
  42821. _vm._v(
  42822. "\n " +
  42823. _vm._s(note.thenote) +
  42824. "\n "
  42825. )
  42826. ])
  42827. ])
  42828. ])
  42829. ]
  42830. )
  42831. }),
  42832. 0
  42833. )
  42834. }
  42835. var staticRenderFns = [
  42836. function() {
  42837. var _vm = this
  42838. var _h = _vm.$createElement
  42839. var _c = _vm._self._c || _h
  42840. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  42841. _c("i", { staticClass: "fas fa-fw fa-edit" })
  42842. ])
  42843. },
  42844. function() {
  42845. var _vm = this
  42846. var _h = _vm.$createElement
  42847. var _c = _vm._self._c || _h
  42848. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  42849. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  42850. ])
  42851. },
  42852. function() {
  42853. var _vm = this
  42854. var _h = _vm.$createElement
  42855. var _c = _vm._self._c || _h
  42856. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  42857. _c("i", { staticClass: "fa fa-fw fa-random" })
  42858. ])
  42859. }
  42860. ]
  42861. render._withStripped = true
  42862. /***/ }),
  42863. /***/ "./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&":
  42864. /*!*********************************************************************************************************************************************************************************************************!*\
  42865. !*** ./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& ***!
  42866. \*********************************************************************************************************************************************************************************************************/
  42867. /*! exports provided: render, staticRenderFns */
  42868. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42869. "use strict";
  42870. __webpack_require__.r(__webpack_exports__);
  42871. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42873. var render = function() {
  42874. var _vm = this
  42875. var _h = _vm.$createElement
  42876. var _c = _vm._self._c || _h
  42877. return _c(
  42878. "div",
  42879. [
  42880. _c(
  42881. "modal",
  42882. {
  42883. attrs: {
  42884. id: "workordereditModal",
  42885. tabindex: "-1",
  42886. role: "dialog",
  42887. "aria-labelledby": "workordereditModalLabel"
  42888. }
  42889. },
  42890. [
  42891. _c(
  42892. "h5",
  42893. {
  42894. staticClass: "modal-title",
  42895. attrs: { slot: "header", id: "workordereditModalLabel" },
  42896. slot: "header"
  42897. },
  42898. [_vm._v("\n Edit Work Order Information\n ")]
  42899. ),
  42900. _vm._v(" "),
  42901. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42902. _c("div", { staticClass: "form-group" }, [
  42903. _c("label", { attrs: { for: "probdesc" } }, [
  42904. _vm._v("Problem Description")
  42905. ]),
  42906. _vm._v(" "),
  42907. _c("textarea", {
  42908. directives: [
  42909. {
  42910. name: "model",
  42911. rawName: "v-model",
  42912. value: _vm.data.probdesc,
  42913. expression: "data.probdesc"
  42914. }
  42915. ],
  42916. staticClass: "form-control",
  42917. attrs: { id: "probdesc", name: "probdesc" },
  42918. domProps: { value: _vm.data.probdesc },
  42919. on: {
  42920. input: function($event) {
  42921. if ($event.target.composing) {
  42922. return
  42923. }
  42924. _vm.$set(_vm.data, "probdesc", $event.target.value)
  42925. }
  42926. }
  42927. })
  42928. ]),
  42929. _vm._v(" "),
  42930. _c("div", { staticClass: "form-group" }, [
  42931. _c("label", { attrs: { for: "suggested" } }, [
  42932. _vm._v("Suggested Solution")
  42933. ]),
  42934. _vm._v(" "),
  42935. _c("textarea", {
  42936. directives: [
  42937. {
  42938. name: "model",
  42939. rawName: "v-model",
  42940. value: _vm.data.suggested,
  42941. expression: "data.suggested"
  42942. }
  42943. ],
  42944. staticClass: "form-control",
  42945. attrs: { id: "suggested", name: "suggested" },
  42946. domProps: { value: _vm.data.suggested },
  42947. on: {
  42948. input: function($event) {
  42949. if ($event.target.composing) {
  42950. return
  42951. }
  42952. _vm.$set(_vm.data, "suggested", $event.target.value)
  42953. }
  42954. }
  42955. })
  42956. ])
  42957. ]),
  42958. _vm._v(" "),
  42959. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42960. _c(
  42961. "button",
  42962. {
  42963. staticClass: "btn btn-secondary",
  42964. attrs: { type: "button", "data-dismiss": "modal" }
  42965. },
  42966. [_vm._v("Close")]
  42967. ),
  42968. _vm._v(" "),
  42969. _c(
  42970. "button",
  42971. {
  42972. staticClass: "btn btn-primary",
  42973. attrs: { type: "button" },
  42974. on: {
  42975. click: function($event) {
  42976. return _vm.updateWorkOrder()
  42977. }
  42978. }
  42979. },
  42980. [_vm._v("Save")]
  42981. )
  42982. ])
  42983. ]
  42984. ),
  42985. _vm._v(" "),
  42986. _c("p", [
  42987. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  42988. _vm._v(" "),
  42989. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  42990. ]),
  42991. _vm._v(" "),
  42992. _c("p", [
  42993. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  42994. _vm._v(" "),
  42995. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  42996. ]),
  42997. _vm._v(" "),
  42998. _c("p", [
  42999. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43000. _vm._v(" "),
  43001. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43002. ]),
  43003. _vm._v(" "),
  43004. _c("p", [
  43005. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43006. _vm._v(" "),
  43007. _c("span", { domProps: { textContent: _vm._s(this.data.storeid) } })
  43008. ]),
  43009. _vm._v(" "),
  43010. _c("p", [
  43011. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43012. _vm._v(" "),
  43013. _c(
  43014. "span",
  43015. {
  43016. staticClass: "dashed-underline",
  43017. attrs: {
  43018. "data-toggle": "tooltip",
  43019. "data-placement": "bottom",
  43020. title: this.getHRDate(this.data.dropdate)
  43021. }
  43022. },
  43023. [
  43024. _vm._v(
  43025. "\n " +
  43026. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43027. " days ago\n "
  43028. )
  43029. ]
  43030. )
  43031. ]),
  43032. _vm._v(" "),
  43033. _c("p", [
  43034. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43035. _vm._v(" "),
  43036. !this.isZero(this.data.pickupdate)
  43037. ? _c(
  43038. "span",
  43039. {
  43040. staticClass: "dashed-underline",
  43041. attrs: {
  43042. "data-toggle": "tooltip",
  43043. "data-placement": "bottom",
  43044. tittle: this.getHRDate(this.data.pickupdate)
  43045. }
  43046. },
  43047. [
  43048. _vm._v(
  43049. "\n " +
  43050. _vm._s(
  43051. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43052. ) +
  43053. " days ago\n "
  43054. )
  43055. ]
  43056. )
  43057. : _vm._e()
  43058. ]),
  43059. _vm._v(" "),
  43060. _c(
  43061. "button",
  43062. {
  43063. staticClass: "btn btn-primary",
  43064. attrs: {
  43065. type: "button",
  43066. "data-toggle": "modal",
  43067. "data-target": "#workordereditModal"
  43068. }
  43069. },
  43070. [_vm._v("Edit")]
  43071. )
  43072. ],
  43073. 1
  43074. )
  43075. }
  43076. var staticRenderFns = []
  43077. render._withStripped = true
  43078. /***/ }),
  43079. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43080. /*!********************************************************************!*\
  43081. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43082. \********************************************************************/
  43083. /*! exports provided: default */
  43084. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43085. "use strict";
  43086. __webpack_require__.r(__webpack_exports__);
  43087. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43088. /* globals __VUE_SSR_CONTEXT__ */
  43089. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43090. // This module is a runtime utility for cleaner component module output and will
  43091. // be included in the final webpack user bundle.
  43092. function normalizeComponent (
  43093. scriptExports,
  43094. render,
  43095. staticRenderFns,
  43096. functionalTemplate,
  43097. injectStyles,
  43098. scopeId,
  43099. moduleIdentifier, /* server only */
  43100. shadowMode /* vue-cli only */
  43101. ) {
  43102. // Vue.extend constructor export interop
  43103. var options = typeof scriptExports === 'function'
  43104. ? scriptExports.options
  43105. : scriptExports
  43106. // render functions
  43107. if (render) {
  43108. options.render = render
  43109. options.staticRenderFns = staticRenderFns
  43110. options._compiled = true
  43111. }
  43112. // functional template
  43113. if (functionalTemplate) {
  43114. options.functional = true
  43115. }
  43116. // scopedId
  43117. if (scopeId) {
  43118. options._scopeId = 'data-v-' + scopeId
  43119. }
  43120. var hook
  43121. if (moduleIdentifier) { // server build
  43122. hook = function (context) {
  43123. // 2.3 injection
  43124. context =
  43125. context || // cached call
  43126. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43127. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43128. // 2.2 with runInNewContext: true
  43129. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43130. context = __VUE_SSR_CONTEXT__
  43131. }
  43132. // inject component styles
  43133. if (injectStyles) {
  43134. injectStyles.call(this, context)
  43135. }
  43136. // register component module identifier for async chunk inferrence
  43137. if (context && context._registeredComponents) {
  43138. context._registeredComponents.add(moduleIdentifier)
  43139. }
  43140. }
  43141. // used by ssr in case component is cached and beforeCreate
  43142. // never gets called
  43143. options._ssrRegister = hook
  43144. } else if (injectStyles) {
  43145. hook = shadowMode
  43146. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43147. : injectStyles
  43148. }
  43149. if (hook) {
  43150. if (options.functional) {
  43151. // for template-only hot-reload because in that case the render fn doesn't
  43152. // go through the normalizer
  43153. options._injectStyles = hook
  43154. // register for functioal component in vue file
  43155. var originalRender = options.render
  43156. options.render = function renderWithStyleInjection (h, context) {
  43157. hook.call(context)
  43158. return originalRender(h, context)
  43159. }
  43160. } else {
  43161. // inject component registration as beforeCreate hook
  43162. var existing = options.beforeCreate
  43163. options.beforeCreate = existing
  43164. ? [].concat(existing, hook)
  43165. : [hook]
  43166. }
  43167. }
  43168. return {
  43169. exports: scriptExports,
  43170. options: options
  43171. }
  43172. }
  43173. /***/ }),
  43174. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43175. /*!*************************************************!*\
  43176. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  43177. \*************************************************/
  43178. /*! no static exports found */
  43179. /***/ (function(module, exports, __webpack_require__) {
  43180. "use strict";
  43181. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  43182. * Vue.js v2.6.11
  43183. * (c) 2014-2019 Evan You
  43184. * Released under the MIT License.
  43185. */
  43186. /* */
  43187. var emptyObject = Object.freeze({});
  43188. // These helpers produce better VM code in JS engines due to their
  43189. // explicitness and function inlining.
  43190. function isUndef (v) {
  43191. return v === undefined || v === null
  43192. }
  43193. function isDef (v) {
  43194. return v !== undefined && v !== null
  43195. }
  43196. function isTrue (v) {
  43197. return v === true
  43198. }
  43199. function isFalse (v) {
  43200. return v === false
  43201. }
  43202. /**
  43203. * Check if value is primitive.
  43204. */
  43205. function isPrimitive (value) {
  43206. return (
  43207. typeof value === 'string' ||
  43208. typeof value === 'number' ||
  43209. // $flow-disable-line
  43210. typeof value === 'symbol' ||
  43211. typeof value === 'boolean'
  43212. )
  43213. }
  43214. /**
  43215. * Quick object check - this is primarily used to tell
  43216. * Objects from primitive values when we know the value
  43217. * is a JSON-compliant type.
  43218. */
  43219. function isObject (obj) {
  43220. return obj !== null && typeof obj === 'object'
  43221. }
  43222. /**
  43223. * Get the raw type string of a value, e.g., [object Object].
  43224. */
  43225. var _toString = Object.prototype.toString;
  43226. function toRawType (value) {
  43227. return _toString.call(value).slice(8, -1)
  43228. }
  43229. /**
  43230. * Strict object type check. Only returns true
  43231. * for plain JavaScript objects.
  43232. */
  43233. function isPlainObject (obj) {
  43234. return _toString.call(obj) === '[object Object]'
  43235. }
  43236. function isRegExp (v) {
  43237. return _toString.call(v) === '[object RegExp]'
  43238. }
  43239. /**
  43240. * Check if val is a valid array index.
  43241. */
  43242. function isValidArrayIndex (val) {
  43243. var n = parseFloat(String(val));
  43244. return n >= 0 && Math.floor(n) === n && isFinite(val)
  43245. }
  43246. function isPromise (val) {
  43247. return (
  43248. isDef(val) &&
  43249. typeof val.then === 'function' &&
  43250. typeof val.catch === 'function'
  43251. )
  43252. }
  43253. /**
  43254. * Convert a value to a string that is actually rendered.
  43255. */
  43256. function toString (val) {
  43257. return val == null
  43258. ? ''
  43259. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  43260. ? JSON.stringify(val, null, 2)
  43261. : String(val)
  43262. }
  43263. /**
  43264. * Convert an input value to a number for persistence.
  43265. * If the conversion fails, return original string.
  43266. */
  43267. function toNumber (val) {
  43268. var n = parseFloat(val);
  43269. return isNaN(n) ? val : n
  43270. }
  43271. /**
  43272. * Make a map and return a function for checking if a key
  43273. * is in that map.
  43274. */
  43275. function makeMap (
  43276. str,
  43277. expectsLowerCase
  43278. ) {
  43279. var map = Object.create(null);
  43280. var list = str.split(',');
  43281. for (var i = 0; i < list.length; i++) {
  43282. map[list[i]] = true;
  43283. }
  43284. return expectsLowerCase
  43285. ? function (val) { return map[val.toLowerCase()]; }
  43286. : function (val) { return map[val]; }
  43287. }
  43288. /**
  43289. * Check if a tag is a built-in tag.
  43290. */
  43291. var isBuiltInTag = makeMap('slot,component', true);
  43292. /**
  43293. * Check if an attribute is a reserved attribute.
  43294. */
  43295. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  43296. /**
  43297. * Remove an item from an array.
  43298. */
  43299. function remove (arr, item) {
  43300. if (arr.length) {
  43301. var index = arr.indexOf(item);
  43302. if (index > -1) {
  43303. return arr.splice(index, 1)
  43304. }
  43305. }
  43306. }
  43307. /**
  43308. * Check whether an object has the property.
  43309. */
  43310. var hasOwnProperty = Object.prototype.hasOwnProperty;
  43311. function hasOwn (obj, key) {
  43312. return hasOwnProperty.call(obj, key)
  43313. }
  43314. /**
  43315. * Create a cached version of a pure function.
  43316. */
  43317. function cached (fn) {
  43318. var cache = Object.create(null);
  43319. return (function cachedFn (str) {
  43320. var hit = cache[str];
  43321. return hit || (cache[str] = fn(str))
  43322. })
  43323. }
  43324. /**
  43325. * Camelize a hyphen-delimited string.
  43326. */
  43327. var camelizeRE = /-(\w)/g;
  43328. var camelize = cached(function (str) {
  43329. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  43330. });
  43331. /**
  43332. * Capitalize a string.
  43333. */
  43334. var capitalize = cached(function (str) {
  43335. return str.charAt(0).toUpperCase() + str.slice(1)
  43336. });
  43337. /**
  43338. * Hyphenate a camelCase string.
  43339. */
  43340. var hyphenateRE = /\B([A-Z])/g;
  43341. var hyphenate = cached(function (str) {
  43342. return str.replace(hyphenateRE, '-$1').toLowerCase()
  43343. });
  43344. /**
  43345. * Simple bind polyfill for environments that do not support it,
  43346. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43347. * since native bind is now performant enough in most browsers.
  43348. * But removing it would mean breaking code that was able to run in
  43349. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43350. */
  43351. /* istanbul ignore next */
  43352. function polyfillBind (fn, ctx) {
  43353. function boundFn (a) {
  43354. var l = arguments.length;
  43355. return l
  43356. ? l > 1
  43357. ? fn.apply(ctx, arguments)
  43358. : fn.call(ctx, a)
  43359. : fn.call(ctx)
  43360. }
  43361. boundFn._length = fn.length;
  43362. return boundFn
  43363. }
  43364. function nativeBind (fn, ctx) {
  43365. return fn.bind(ctx)
  43366. }
  43367. var bind = Function.prototype.bind
  43368. ? nativeBind
  43369. : polyfillBind;
  43370. /**
  43371. * Convert an Array-like object to a real Array.
  43372. */
  43373. function toArray (list, start) {
  43374. start = start || 0;
  43375. var i = list.length - start;
  43376. var ret = new Array(i);
  43377. while (i--) {
  43378. ret[i] = list[i + start];
  43379. }
  43380. return ret
  43381. }
  43382. /**
  43383. * Mix properties into target object.
  43384. */
  43385. function extend (to, _from) {
  43386. for (var key in _from) {
  43387. to[key] = _from[key];
  43388. }
  43389. return to
  43390. }
  43391. /**
  43392. * Merge an Array of Objects into a single Object.
  43393. */
  43394. function toObject (arr) {
  43395. var res = {};
  43396. for (var i = 0; i < arr.length; i++) {
  43397. if (arr[i]) {
  43398. extend(res, arr[i]);
  43399. }
  43400. }
  43401. return res
  43402. }
  43403. /* eslint-disable no-unused-vars */
  43404. /**
  43405. * Perform no operation.
  43406. * Stubbing args to make Flow happy without leaving useless transpiled code
  43407. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  43408. */
  43409. function noop (a, b, c) {}
  43410. /**
  43411. * Always return false.
  43412. */
  43413. var no = function (a, b, c) { return false; };
  43414. /* eslint-enable no-unused-vars */
  43415. /**
  43416. * Return the same value.
  43417. */
  43418. var identity = function (_) { return _; };
  43419. /**
  43420. * Generate a string containing static keys from compiler modules.
  43421. */
  43422. function genStaticKeys (modules) {
  43423. return modules.reduce(function (keys, m) {
  43424. return keys.concat(m.staticKeys || [])
  43425. }, []).join(',')
  43426. }
  43427. /**
  43428. * Check if two values are loosely equal - that is,
  43429. * if they are plain objects, do they have the same shape?
  43430. */
  43431. function looseEqual (a, b) {
  43432. if (a === b) { return true }
  43433. var isObjectA = isObject(a);
  43434. var isObjectB = isObject(b);
  43435. if (isObjectA && isObjectB) {
  43436. try {
  43437. var isArrayA = Array.isArray(a);
  43438. var isArrayB = Array.isArray(b);
  43439. if (isArrayA && isArrayB) {
  43440. return a.length === b.length && a.every(function (e, i) {
  43441. return looseEqual(e, b[i])
  43442. })
  43443. } else if (a instanceof Date && b instanceof Date) {
  43444. return a.getTime() === b.getTime()
  43445. } else if (!isArrayA && !isArrayB) {
  43446. var keysA = Object.keys(a);
  43447. var keysB = Object.keys(b);
  43448. return keysA.length === keysB.length && keysA.every(function (key) {
  43449. return looseEqual(a[key], b[key])
  43450. })
  43451. } else {
  43452. /* istanbul ignore next */
  43453. return false
  43454. }
  43455. } catch (e) {
  43456. /* istanbul ignore next */
  43457. return false
  43458. }
  43459. } else if (!isObjectA && !isObjectB) {
  43460. return String(a) === String(b)
  43461. } else {
  43462. return false
  43463. }
  43464. }
  43465. /**
  43466. * Return the first index at which a loosely equal value can be
  43467. * found in the array (if value is a plain object, the array must
  43468. * contain an object of the same shape), or -1 if it is not present.
  43469. */
  43470. function looseIndexOf (arr, val) {
  43471. for (var i = 0; i < arr.length; i++) {
  43472. if (looseEqual(arr[i], val)) { return i }
  43473. }
  43474. return -1
  43475. }
  43476. /**
  43477. * Ensure a function is called only once.
  43478. */
  43479. function once (fn) {
  43480. var called = false;
  43481. return function () {
  43482. if (!called) {
  43483. called = true;
  43484. fn.apply(this, arguments);
  43485. }
  43486. }
  43487. }
  43488. var SSR_ATTR = 'data-server-rendered';
  43489. var ASSET_TYPES = [
  43490. 'component',
  43491. 'directive',
  43492. 'filter'
  43493. ];
  43494. var LIFECYCLE_HOOKS = [
  43495. 'beforeCreate',
  43496. 'created',
  43497. 'beforeMount',
  43498. 'mounted',
  43499. 'beforeUpdate',
  43500. 'updated',
  43501. 'beforeDestroy',
  43502. 'destroyed',
  43503. 'activated',
  43504. 'deactivated',
  43505. 'errorCaptured',
  43506. 'serverPrefetch'
  43507. ];
  43508. /* */
  43509. var config = ({
  43510. /**
  43511. * Option merge strategies (used in core/util/options)
  43512. */
  43513. // $flow-disable-line
  43514. optionMergeStrategies: Object.create(null),
  43515. /**
  43516. * Whether to suppress warnings.
  43517. */
  43518. silent: false,
  43519. /**
  43520. * Show production mode tip message on boot?
  43521. */
  43522. productionTip: "development" !== 'production',
  43523. /**
  43524. * Whether to enable devtools
  43525. */
  43526. devtools: "development" !== 'production',
  43527. /**
  43528. * Whether to record perf
  43529. */
  43530. performance: false,
  43531. /**
  43532. * Error handler for watcher errors
  43533. */
  43534. errorHandler: null,
  43535. /**
  43536. * Warn handler for watcher warns
  43537. */
  43538. warnHandler: null,
  43539. /**
  43540. * Ignore certain custom elements
  43541. */
  43542. ignoredElements: [],
  43543. /**
  43544. * Custom user key aliases for v-on
  43545. */
  43546. // $flow-disable-line
  43547. keyCodes: Object.create(null),
  43548. /**
  43549. * Check if a tag is reserved so that it cannot be registered as a
  43550. * component. This is platform-dependent and may be overwritten.
  43551. */
  43552. isReservedTag: no,
  43553. /**
  43554. * Check if an attribute is reserved so that it cannot be used as a component
  43555. * prop. This is platform-dependent and may be overwritten.
  43556. */
  43557. isReservedAttr: no,
  43558. /**
  43559. * Check if a tag is an unknown element.
  43560. * Platform-dependent.
  43561. */
  43562. isUnknownElement: no,
  43563. /**
  43564. * Get the namespace of an element
  43565. */
  43566. getTagNamespace: noop,
  43567. /**
  43568. * Parse the real tag name for the specific platform.
  43569. */
  43570. parsePlatformTagName: identity,
  43571. /**
  43572. * Check if an attribute must be bound using property, e.g. value
  43573. * Platform-dependent.
  43574. */
  43575. mustUseProp: no,
  43576. /**
  43577. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  43578. * This will significantly reduce performance if set to false.
  43579. */
  43580. async: true,
  43581. /**
  43582. * Exposed for legacy reasons
  43583. */
  43584. _lifecycleHooks: LIFECYCLE_HOOKS
  43585. });
  43586. /* */
  43587. /**
  43588. * unicode letters used for parsing html tags, component names and property paths.
  43589. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  43590. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  43591. */
  43592. 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/;
  43593. /**
  43594. * Check if a string starts with $ or _
  43595. */
  43596. function isReserved (str) {
  43597. var c = (str + '').charCodeAt(0);
  43598. return c === 0x24 || c === 0x5F
  43599. }
  43600. /**
  43601. * Define a property.
  43602. */
  43603. function def (obj, key, val, enumerable) {
  43604. Object.defineProperty(obj, key, {
  43605. value: val,
  43606. enumerable: !!enumerable,
  43607. writable: true,
  43608. configurable: true
  43609. });
  43610. }
  43611. /**
  43612. * Parse simple path.
  43613. */
  43614. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  43615. function parsePath (path) {
  43616. if (bailRE.test(path)) {
  43617. return
  43618. }
  43619. var segments = path.split('.');
  43620. return function (obj) {
  43621. for (var i = 0; i < segments.length; i++) {
  43622. if (!obj) { return }
  43623. obj = obj[segments[i]];
  43624. }
  43625. return obj
  43626. }
  43627. }
  43628. /* */
  43629. // can we use __proto__?
  43630. var hasProto = '__proto__' in {};
  43631. // Browser environment sniffing
  43632. var inBrowser = typeof window !== 'undefined';
  43633. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  43634. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  43635. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  43636. var isIE = UA && /msie|trident/.test(UA);
  43637. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  43638. var isEdge = UA && UA.indexOf('edge/') > 0;
  43639. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  43640. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  43641. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  43642. var isPhantomJS = UA && /phantomjs/.test(UA);
  43643. var isFF = UA && UA.match(/firefox\/(\d+)/);
  43644. // Firefox has a "watch" function on Object.prototype...
  43645. var nativeWatch = ({}).watch;
  43646. var supportsPassive = false;
  43647. if (inBrowser) {
  43648. try {
  43649. var opts = {};
  43650. Object.defineProperty(opts, 'passive', ({
  43651. get: function get () {
  43652. /* istanbul ignore next */
  43653. supportsPassive = true;
  43654. }
  43655. })); // https://github.com/facebook/flow/issues/285
  43656. window.addEventListener('test-passive', null, opts);
  43657. } catch (e) {}
  43658. }
  43659. // this needs to be lazy-evaled because vue may be required before
  43660. // vue-server-renderer can set VUE_ENV
  43661. var _isServer;
  43662. var isServerRendering = function () {
  43663. if (_isServer === undefined) {
  43664. /* istanbul ignore if */
  43665. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  43666. // detect presence of vue-server-renderer and avoid
  43667. // Webpack shimming the process
  43668. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  43669. } else {
  43670. _isServer = false;
  43671. }
  43672. }
  43673. return _isServer
  43674. };
  43675. // detect devtools
  43676. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  43677. /* istanbul ignore next */
  43678. function isNative (Ctor) {
  43679. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  43680. }
  43681. var hasSymbol =
  43682. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  43683. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  43684. var _Set;
  43685. /* istanbul ignore if */ // $flow-disable-line
  43686. if (typeof Set !== 'undefined' && isNative(Set)) {
  43687. // use native Set when available.
  43688. _Set = Set;
  43689. } else {
  43690. // a non-standard Set polyfill that only works with primitive keys.
  43691. _Set = /*@__PURE__*/(function () {
  43692. function Set () {
  43693. this.set = Object.create(null);
  43694. }
  43695. Set.prototype.has = function has (key) {
  43696. return this.set[key] === true
  43697. };
  43698. Set.prototype.add = function add (key) {
  43699. this.set[key] = true;
  43700. };
  43701. Set.prototype.clear = function clear () {
  43702. this.set = Object.create(null);
  43703. };
  43704. return Set;
  43705. }());
  43706. }
  43707. /* */
  43708. var warn = noop;
  43709. var tip = noop;
  43710. var generateComponentTrace = (noop); // work around flow check
  43711. var formatComponentName = (noop);
  43712. {
  43713. var hasConsole = typeof console !== 'undefined';
  43714. var classifyRE = /(?:^|[-_])(\w)/g;
  43715. var classify = function (str) { return str
  43716. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  43717. .replace(/[-_]/g, ''); };
  43718. warn = function (msg, vm) {
  43719. var trace = vm ? generateComponentTrace(vm) : '';
  43720. if (config.warnHandler) {
  43721. config.warnHandler.call(null, msg, vm, trace);
  43722. } else if (hasConsole && (!config.silent)) {
  43723. console.error(("[Vue warn]: " + msg + trace));
  43724. }
  43725. };
  43726. tip = function (msg, vm) {
  43727. if (hasConsole && (!config.silent)) {
  43728. console.warn("[Vue tip]: " + msg + (
  43729. vm ? generateComponentTrace(vm) : ''
  43730. ));
  43731. }
  43732. };
  43733. formatComponentName = function (vm, includeFile) {
  43734. if (vm.$root === vm) {
  43735. return '<Root>'
  43736. }
  43737. var options = typeof vm === 'function' && vm.cid != null
  43738. ? vm.options
  43739. : vm._isVue
  43740. ? vm.$options || vm.constructor.options
  43741. : vm;
  43742. var name = options.name || options._componentTag;
  43743. var file = options.__file;
  43744. if (!name && file) {
  43745. var match = file.match(/([^/\\]+)\.vue$/);
  43746. name = match && match[1];
  43747. }
  43748. return (
  43749. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  43750. (file && includeFile !== false ? (" at " + file) : '')
  43751. )
  43752. };
  43753. var repeat = function (str, n) {
  43754. var res = '';
  43755. while (n) {
  43756. if (n % 2 === 1) { res += str; }
  43757. if (n > 1) { str += str; }
  43758. n >>= 1;
  43759. }
  43760. return res
  43761. };
  43762. generateComponentTrace = function (vm) {
  43763. if (vm._isVue && vm.$parent) {
  43764. var tree = [];
  43765. var currentRecursiveSequence = 0;
  43766. while (vm) {
  43767. if (tree.length > 0) {
  43768. var last = tree[tree.length - 1];
  43769. if (last.constructor === vm.constructor) {
  43770. currentRecursiveSequence++;
  43771. vm = vm.$parent;
  43772. continue
  43773. } else if (currentRecursiveSequence > 0) {
  43774. tree[tree.length - 1] = [last, currentRecursiveSequence];
  43775. currentRecursiveSequence = 0;
  43776. }
  43777. }
  43778. tree.push(vm);
  43779. vm = vm.$parent;
  43780. }
  43781. return '\n\nfound in\n\n' + tree
  43782. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  43783. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  43784. : formatComponentName(vm))); })
  43785. .join('\n')
  43786. } else {
  43787. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  43788. }
  43789. };
  43790. }
  43791. /* */
  43792. var uid = 0;
  43793. /**
  43794. * A dep is an observable that can have multiple
  43795. * directives subscribing to it.
  43796. */
  43797. var Dep = function Dep () {
  43798. this.id = uid++;
  43799. this.subs = [];
  43800. };
  43801. Dep.prototype.addSub = function addSub (sub) {
  43802. this.subs.push(sub);
  43803. };
  43804. Dep.prototype.removeSub = function removeSub (sub) {
  43805. remove(this.subs, sub);
  43806. };
  43807. Dep.prototype.depend = function depend () {
  43808. if (Dep.target) {
  43809. Dep.target.addDep(this);
  43810. }
  43811. };
  43812. Dep.prototype.notify = function notify () {
  43813. // stabilize the subscriber list first
  43814. var subs = this.subs.slice();
  43815. if (!config.async) {
  43816. // subs aren't sorted in scheduler if not running async
  43817. // we need to sort them now to make sure they fire in correct
  43818. // order
  43819. subs.sort(function (a, b) { return a.id - b.id; });
  43820. }
  43821. for (var i = 0, l = subs.length; i < l; i++) {
  43822. subs[i].update();
  43823. }
  43824. };
  43825. // The current target watcher being evaluated.
  43826. // This is globally unique because only one watcher
  43827. // can be evaluated at a time.
  43828. Dep.target = null;
  43829. var targetStack = [];
  43830. function pushTarget (target) {
  43831. targetStack.push(target);
  43832. Dep.target = target;
  43833. }
  43834. function popTarget () {
  43835. targetStack.pop();
  43836. Dep.target = targetStack[targetStack.length - 1];
  43837. }
  43838. /* */
  43839. var VNode = function VNode (
  43840. tag,
  43841. data,
  43842. children,
  43843. text,
  43844. elm,
  43845. context,
  43846. componentOptions,
  43847. asyncFactory
  43848. ) {
  43849. this.tag = tag;
  43850. this.data = data;
  43851. this.children = children;
  43852. this.text = text;
  43853. this.elm = elm;
  43854. this.ns = undefined;
  43855. this.context = context;
  43856. this.fnContext = undefined;
  43857. this.fnOptions = undefined;
  43858. this.fnScopeId = undefined;
  43859. this.key = data && data.key;
  43860. this.componentOptions = componentOptions;
  43861. this.componentInstance = undefined;
  43862. this.parent = undefined;
  43863. this.raw = false;
  43864. this.isStatic = false;
  43865. this.isRootInsert = true;
  43866. this.isComment = false;
  43867. this.isCloned = false;
  43868. this.isOnce = false;
  43869. this.asyncFactory = asyncFactory;
  43870. this.asyncMeta = undefined;
  43871. this.isAsyncPlaceholder = false;
  43872. };
  43873. var prototypeAccessors = { child: { configurable: true } };
  43874. // DEPRECATED: alias for componentInstance for backwards compat.
  43875. /* istanbul ignore next */
  43876. prototypeAccessors.child.get = function () {
  43877. return this.componentInstance
  43878. };
  43879. Object.defineProperties( VNode.prototype, prototypeAccessors );
  43880. var createEmptyVNode = function (text) {
  43881. if ( text === void 0 ) text = '';
  43882. var node = new VNode();
  43883. node.text = text;
  43884. node.isComment = true;
  43885. return node
  43886. };
  43887. function createTextVNode (val) {
  43888. return new VNode(undefined, undefined, undefined, String(val))
  43889. }
  43890. // optimized shallow clone
  43891. // used for static nodes and slot nodes because they may be reused across
  43892. // multiple renders, cloning them avoids errors when DOM manipulations rely
  43893. // on their elm reference.
  43894. function cloneVNode (vnode) {
  43895. var cloned = new VNode(
  43896. vnode.tag,
  43897. vnode.data,
  43898. // #7975
  43899. // clone children array to avoid mutating original in case of cloning
  43900. // a child.
  43901. vnode.children && vnode.children.slice(),
  43902. vnode.text,
  43903. vnode.elm,
  43904. vnode.context,
  43905. vnode.componentOptions,
  43906. vnode.asyncFactory
  43907. );
  43908. cloned.ns = vnode.ns;
  43909. cloned.isStatic = vnode.isStatic;
  43910. cloned.key = vnode.key;
  43911. cloned.isComment = vnode.isComment;
  43912. cloned.fnContext = vnode.fnContext;
  43913. cloned.fnOptions = vnode.fnOptions;
  43914. cloned.fnScopeId = vnode.fnScopeId;
  43915. cloned.asyncMeta = vnode.asyncMeta;
  43916. cloned.isCloned = true;
  43917. return cloned
  43918. }
  43919. /*
  43920. * not type checking this file because flow doesn't play well with
  43921. * dynamically accessing methods on Array prototype
  43922. */
  43923. var arrayProto = Array.prototype;
  43924. var arrayMethods = Object.create(arrayProto);
  43925. var methodsToPatch = [
  43926. 'push',
  43927. 'pop',
  43928. 'shift',
  43929. 'unshift',
  43930. 'splice',
  43931. 'sort',
  43932. 'reverse'
  43933. ];
  43934. /**
  43935. * Intercept mutating methods and emit events
  43936. */
  43937. methodsToPatch.forEach(function (method) {
  43938. // cache original method
  43939. var original = arrayProto[method];
  43940. def(arrayMethods, method, function mutator () {
  43941. var args = [], len = arguments.length;
  43942. while ( len-- ) args[ len ] = arguments[ len ];
  43943. var result = original.apply(this, args);
  43944. var ob = this.__ob__;
  43945. var inserted;
  43946. switch (method) {
  43947. case 'push':
  43948. case 'unshift':
  43949. inserted = args;
  43950. break
  43951. case 'splice':
  43952. inserted = args.slice(2);
  43953. break
  43954. }
  43955. if (inserted) { ob.observeArray(inserted); }
  43956. // notify change
  43957. ob.dep.notify();
  43958. return result
  43959. });
  43960. });
  43961. /* */
  43962. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  43963. /**
  43964. * In some cases we may want to disable observation inside a component's
  43965. * update computation.
  43966. */
  43967. var shouldObserve = true;
  43968. function toggleObserving (value) {
  43969. shouldObserve = value;
  43970. }
  43971. /**
  43972. * Observer class that is attached to each observed
  43973. * object. Once attached, the observer converts the target
  43974. * object's property keys into getter/setters that
  43975. * collect dependencies and dispatch updates.
  43976. */
  43977. var Observer = function Observer (value) {
  43978. this.value = value;
  43979. this.dep = new Dep();
  43980. this.vmCount = 0;
  43981. def(value, '__ob__', this);
  43982. if (Array.isArray(value)) {
  43983. if (hasProto) {
  43984. protoAugment(value, arrayMethods);
  43985. } else {
  43986. copyAugment(value, arrayMethods, arrayKeys);
  43987. }
  43988. this.observeArray(value);
  43989. } else {
  43990. this.walk(value);
  43991. }
  43992. };
  43993. /**
  43994. * Walk through all properties and convert them into
  43995. * getter/setters. This method should only be called when
  43996. * value type is Object.
  43997. */
  43998. Observer.prototype.walk = function walk (obj) {
  43999. var keys = Object.keys(obj);
  44000. for (var i = 0; i < keys.length; i++) {
  44001. defineReactive$$1(obj, keys[i]);
  44002. }
  44003. };
  44004. /**
  44005. * Observe a list of Array items.
  44006. */
  44007. Observer.prototype.observeArray = function observeArray (items) {
  44008. for (var i = 0, l = items.length; i < l; i++) {
  44009. observe(items[i]);
  44010. }
  44011. };
  44012. // helpers
  44013. /**
  44014. * Augment a target Object or Array by intercepting
  44015. * the prototype chain using __proto__
  44016. */
  44017. function protoAugment (target, src) {
  44018. /* eslint-disable no-proto */
  44019. target.__proto__ = src;
  44020. /* eslint-enable no-proto */
  44021. }
  44022. /**
  44023. * Augment a target Object or Array by defining
  44024. * hidden properties.
  44025. */
  44026. /* istanbul ignore next */
  44027. function copyAugment (target, src, keys) {
  44028. for (var i = 0, l = keys.length; i < l; i++) {
  44029. var key = keys[i];
  44030. def(target, key, src[key]);
  44031. }
  44032. }
  44033. /**
  44034. * Attempt to create an observer instance for a value,
  44035. * returns the new observer if successfully observed,
  44036. * or the existing observer if the value already has one.
  44037. */
  44038. function observe (value, asRootData) {
  44039. if (!isObject(value) || value instanceof VNode) {
  44040. return
  44041. }
  44042. var ob;
  44043. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44044. ob = value.__ob__;
  44045. } else if (
  44046. shouldObserve &&
  44047. !isServerRendering() &&
  44048. (Array.isArray(value) || isPlainObject(value)) &&
  44049. Object.isExtensible(value) &&
  44050. !value._isVue
  44051. ) {
  44052. ob = new Observer(value);
  44053. }
  44054. if (asRootData && ob) {
  44055. ob.vmCount++;
  44056. }
  44057. return ob
  44058. }
  44059. /**
  44060. * Define a reactive property on an Object.
  44061. */
  44062. function defineReactive$$1 (
  44063. obj,
  44064. key,
  44065. val,
  44066. customSetter,
  44067. shallow
  44068. ) {
  44069. var dep = new Dep();
  44070. var property = Object.getOwnPropertyDescriptor(obj, key);
  44071. if (property && property.configurable === false) {
  44072. return
  44073. }
  44074. // cater for pre-defined getter/setters
  44075. var getter = property && property.get;
  44076. var setter = property && property.set;
  44077. if ((!getter || setter) && arguments.length === 2) {
  44078. val = obj[key];
  44079. }
  44080. var childOb = !shallow && observe(val);
  44081. Object.defineProperty(obj, key, {
  44082. enumerable: true,
  44083. configurable: true,
  44084. get: function reactiveGetter () {
  44085. var value = getter ? getter.call(obj) : val;
  44086. if (Dep.target) {
  44087. dep.depend();
  44088. if (childOb) {
  44089. childOb.dep.depend();
  44090. if (Array.isArray(value)) {
  44091. dependArray(value);
  44092. }
  44093. }
  44094. }
  44095. return value
  44096. },
  44097. set: function reactiveSetter (newVal) {
  44098. var value = getter ? getter.call(obj) : val;
  44099. /* eslint-disable no-self-compare */
  44100. if (newVal === value || (newVal !== newVal && value !== value)) {
  44101. return
  44102. }
  44103. /* eslint-enable no-self-compare */
  44104. if (customSetter) {
  44105. customSetter();
  44106. }
  44107. // #7981: for accessor properties without setter
  44108. if (getter && !setter) { return }
  44109. if (setter) {
  44110. setter.call(obj, newVal);
  44111. } else {
  44112. val = newVal;
  44113. }
  44114. childOb = !shallow && observe(newVal);
  44115. dep.notify();
  44116. }
  44117. });
  44118. }
  44119. /**
  44120. * Set a property on an object. Adds the new property and
  44121. * triggers change notification if the property doesn't
  44122. * already exist.
  44123. */
  44124. function set (target, key, val) {
  44125. if (isUndef(target) || isPrimitive(target)
  44126. ) {
  44127. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44128. }
  44129. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44130. target.length = Math.max(target.length, key);
  44131. target.splice(key, 1, val);
  44132. return val
  44133. }
  44134. if (key in target && !(key in Object.prototype)) {
  44135. target[key] = val;
  44136. return val
  44137. }
  44138. var ob = (target).__ob__;
  44139. if (target._isVue || (ob && ob.vmCount)) {
  44140. warn(
  44141. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44142. 'at runtime - declare it upfront in the data option.'
  44143. );
  44144. return val
  44145. }
  44146. if (!ob) {
  44147. target[key] = val;
  44148. return val
  44149. }
  44150. defineReactive$$1(ob.value, key, val);
  44151. ob.dep.notify();
  44152. return val
  44153. }
  44154. /**
  44155. * Delete a property and trigger change if necessary.
  44156. */
  44157. function del (target, key) {
  44158. if (isUndef(target) || isPrimitive(target)
  44159. ) {
  44160. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44161. }
  44162. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44163. target.splice(key, 1);
  44164. return
  44165. }
  44166. var ob = (target).__ob__;
  44167. if (target._isVue || (ob && ob.vmCount)) {
  44168. warn(
  44169. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44170. '- just set it to null.'
  44171. );
  44172. return
  44173. }
  44174. if (!hasOwn(target, key)) {
  44175. return
  44176. }
  44177. delete target[key];
  44178. if (!ob) {
  44179. return
  44180. }
  44181. ob.dep.notify();
  44182. }
  44183. /**
  44184. * Collect dependencies on array elements when the array is touched, since
  44185. * we cannot intercept array element access like property getters.
  44186. */
  44187. function dependArray (value) {
  44188. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  44189. e = value[i];
  44190. e && e.__ob__ && e.__ob__.dep.depend();
  44191. if (Array.isArray(e)) {
  44192. dependArray(e);
  44193. }
  44194. }
  44195. }
  44196. /* */
  44197. /**
  44198. * Option overwriting strategies are functions that handle
  44199. * how to merge a parent option value and a child option
  44200. * value into the final value.
  44201. */
  44202. var strats = config.optionMergeStrategies;
  44203. /**
  44204. * Options with restrictions
  44205. */
  44206. {
  44207. strats.el = strats.propsData = function (parent, child, vm, key) {
  44208. if (!vm) {
  44209. warn(
  44210. "option \"" + key + "\" can only be used during instance " +
  44211. 'creation with the `new` keyword.'
  44212. );
  44213. }
  44214. return defaultStrat(parent, child)
  44215. };
  44216. }
  44217. /**
  44218. * Helper that recursively merges two data objects together.
  44219. */
  44220. function mergeData (to, from) {
  44221. if (!from) { return to }
  44222. var key, toVal, fromVal;
  44223. var keys = hasSymbol
  44224. ? Reflect.ownKeys(from)
  44225. : Object.keys(from);
  44226. for (var i = 0; i < keys.length; i++) {
  44227. key = keys[i];
  44228. // in case the object is already observed...
  44229. if (key === '__ob__') { continue }
  44230. toVal = to[key];
  44231. fromVal = from[key];
  44232. if (!hasOwn(to, key)) {
  44233. set(to, key, fromVal);
  44234. } else if (
  44235. toVal !== fromVal &&
  44236. isPlainObject(toVal) &&
  44237. isPlainObject(fromVal)
  44238. ) {
  44239. mergeData(toVal, fromVal);
  44240. }
  44241. }
  44242. return to
  44243. }
  44244. /**
  44245. * Data
  44246. */
  44247. function mergeDataOrFn (
  44248. parentVal,
  44249. childVal,
  44250. vm
  44251. ) {
  44252. if (!vm) {
  44253. // in a Vue.extend merge, both should be functions
  44254. if (!childVal) {
  44255. return parentVal
  44256. }
  44257. if (!parentVal) {
  44258. return childVal
  44259. }
  44260. // when parentVal & childVal are both present,
  44261. // we need to return a function that returns the
  44262. // merged result of both functions... no need to
  44263. // check if parentVal is a function here because
  44264. // it has to be a function to pass previous merges.
  44265. return function mergedDataFn () {
  44266. return mergeData(
  44267. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  44268. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  44269. )
  44270. }
  44271. } else {
  44272. return function mergedInstanceDataFn () {
  44273. // instance merge
  44274. var instanceData = typeof childVal === 'function'
  44275. ? childVal.call(vm, vm)
  44276. : childVal;
  44277. var defaultData = typeof parentVal === 'function'
  44278. ? parentVal.call(vm, vm)
  44279. : parentVal;
  44280. if (instanceData) {
  44281. return mergeData(instanceData, defaultData)
  44282. } else {
  44283. return defaultData
  44284. }
  44285. }
  44286. }
  44287. }
  44288. strats.data = function (
  44289. parentVal,
  44290. childVal,
  44291. vm
  44292. ) {
  44293. if (!vm) {
  44294. if (childVal && typeof childVal !== 'function') {
  44295. warn(
  44296. 'The "data" option should be a function ' +
  44297. 'that returns a per-instance value in component ' +
  44298. 'definitions.',
  44299. vm
  44300. );
  44301. return parentVal
  44302. }
  44303. return mergeDataOrFn(parentVal, childVal)
  44304. }
  44305. return mergeDataOrFn(parentVal, childVal, vm)
  44306. };
  44307. /**
  44308. * Hooks and props are merged as arrays.
  44309. */
  44310. function mergeHook (
  44311. parentVal,
  44312. childVal
  44313. ) {
  44314. var res = childVal
  44315. ? parentVal
  44316. ? parentVal.concat(childVal)
  44317. : Array.isArray(childVal)
  44318. ? childVal
  44319. : [childVal]
  44320. : parentVal;
  44321. return res
  44322. ? dedupeHooks(res)
  44323. : res
  44324. }
  44325. function dedupeHooks (hooks) {
  44326. var res = [];
  44327. for (var i = 0; i < hooks.length; i++) {
  44328. if (res.indexOf(hooks[i]) === -1) {
  44329. res.push(hooks[i]);
  44330. }
  44331. }
  44332. return res
  44333. }
  44334. LIFECYCLE_HOOKS.forEach(function (hook) {
  44335. strats[hook] = mergeHook;
  44336. });
  44337. /**
  44338. * Assets
  44339. *
  44340. * When a vm is present (instance creation), we need to do
  44341. * a three-way merge between constructor options, instance
  44342. * options and parent options.
  44343. */
  44344. function mergeAssets (
  44345. parentVal,
  44346. childVal,
  44347. vm,
  44348. key
  44349. ) {
  44350. var res = Object.create(parentVal || null);
  44351. if (childVal) {
  44352. assertObjectType(key, childVal, vm);
  44353. return extend(res, childVal)
  44354. } else {
  44355. return res
  44356. }
  44357. }
  44358. ASSET_TYPES.forEach(function (type) {
  44359. strats[type + 's'] = mergeAssets;
  44360. });
  44361. /**
  44362. * Watchers.
  44363. *
  44364. * Watchers hashes should not overwrite one
  44365. * another, so we merge them as arrays.
  44366. */
  44367. strats.watch = function (
  44368. parentVal,
  44369. childVal,
  44370. vm,
  44371. key
  44372. ) {
  44373. // work around Firefox's Object.prototype.watch...
  44374. if (parentVal === nativeWatch) { parentVal = undefined; }
  44375. if (childVal === nativeWatch) { childVal = undefined; }
  44376. /* istanbul ignore if */
  44377. if (!childVal) { return Object.create(parentVal || null) }
  44378. {
  44379. assertObjectType(key, childVal, vm);
  44380. }
  44381. if (!parentVal) { return childVal }
  44382. var ret = {};
  44383. extend(ret, parentVal);
  44384. for (var key$1 in childVal) {
  44385. var parent = ret[key$1];
  44386. var child = childVal[key$1];
  44387. if (parent && !Array.isArray(parent)) {
  44388. parent = [parent];
  44389. }
  44390. ret[key$1] = parent
  44391. ? parent.concat(child)
  44392. : Array.isArray(child) ? child : [child];
  44393. }
  44394. return ret
  44395. };
  44396. /**
  44397. * Other object hashes.
  44398. */
  44399. strats.props =
  44400. strats.methods =
  44401. strats.inject =
  44402. strats.computed = function (
  44403. parentVal,
  44404. childVal,
  44405. vm,
  44406. key
  44407. ) {
  44408. if (childVal && "development" !== 'production') {
  44409. assertObjectType(key, childVal, vm);
  44410. }
  44411. if (!parentVal) { return childVal }
  44412. var ret = Object.create(null);
  44413. extend(ret, parentVal);
  44414. if (childVal) { extend(ret, childVal); }
  44415. return ret
  44416. };
  44417. strats.provide = mergeDataOrFn;
  44418. /**
  44419. * Default strategy.
  44420. */
  44421. var defaultStrat = function (parentVal, childVal) {
  44422. return childVal === undefined
  44423. ? parentVal
  44424. : childVal
  44425. };
  44426. /**
  44427. * Validate component names
  44428. */
  44429. function checkComponents (options) {
  44430. for (var key in options.components) {
  44431. validateComponentName(key);
  44432. }
  44433. }
  44434. function validateComponentName (name) {
  44435. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  44436. warn(
  44437. 'Invalid component name: "' + name + '". Component names ' +
  44438. 'should conform to valid custom element name in html5 specification.'
  44439. );
  44440. }
  44441. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  44442. warn(
  44443. 'Do not use built-in or reserved HTML elements as component ' +
  44444. 'id: ' + name
  44445. );
  44446. }
  44447. }
  44448. /**
  44449. * Ensure all props option syntax are normalized into the
  44450. * Object-based format.
  44451. */
  44452. function normalizeProps (options, vm) {
  44453. var props = options.props;
  44454. if (!props) { return }
  44455. var res = {};
  44456. var i, val, name;
  44457. if (Array.isArray(props)) {
  44458. i = props.length;
  44459. while (i--) {
  44460. val = props[i];
  44461. if (typeof val === 'string') {
  44462. name = camelize(val);
  44463. res[name] = { type: null };
  44464. } else {
  44465. warn('props must be strings when using array syntax.');
  44466. }
  44467. }
  44468. } else if (isPlainObject(props)) {
  44469. for (var key in props) {
  44470. val = props[key];
  44471. name = camelize(key);
  44472. res[name] = isPlainObject(val)
  44473. ? val
  44474. : { type: val };
  44475. }
  44476. } else {
  44477. warn(
  44478. "Invalid value for option \"props\": expected an Array or an Object, " +
  44479. "but got " + (toRawType(props)) + ".",
  44480. vm
  44481. );
  44482. }
  44483. options.props = res;
  44484. }
  44485. /**
  44486. * Normalize all injections into Object-based format
  44487. */
  44488. function normalizeInject (options, vm) {
  44489. var inject = options.inject;
  44490. if (!inject) { return }
  44491. var normalized = options.inject = {};
  44492. if (Array.isArray(inject)) {
  44493. for (var i = 0; i < inject.length; i++) {
  44494. normalized[inject[i]] = { from: inject[i] };
  44495. }
  44496. } else if (isPlainObject(inject)) {
  44497. for (var key in inject) {
  44498. var val = inject[key];
  44499. normalized[key] = isPlainObject(val)
  44500. ? extend({ from: key }, val)
  44501. : { from: val };
  44502. }
  44503. } else {
  44504. warn(
  44505. "Invalid value for option \"inject\": expected an Array or an Object, " +
  44506. "but got " + (toRawType(inject)) + ".",
  44507. vm
  44508. );
  44509. }
  44510. }
  44511. /**
  44512. * Normalize raw function directives into object format.
  44513. */
  44514. function normalizeDirectives (options) {
  44515. var dirs = options.directives;
  44516. if (dirs) {
  44517. for (var key in dirs) {
  44518. var def$$1 = dirs[key];
  44519. if (typeof def$$1 === 'function') {
  44520. dirs[key] = { bind: def$$1, update: def$$1 };
  44521. }
  44522. }
  44523. }
  44524. }
  44525. function assertObjectType (name, value, vm) {
  44526. if (!isPlainObject(value)) {
  44527. warn(
  44528. "Invalid value for option \"" + name + "\": expected an Object, " +
  44529. "but got " + (toRawType(value)) + ".",
  44530. vm
  44531. );
  44532. }
  44533. }
  44534. /**
  44535. * Merge two option objects into a new one.
  44536. * Core utility used in both instantiation and inheritance.
  44537. */
  44538. function mergeOptions (
  44539. parent,
  44540. child,
  44541. vm
  44542. ) {
  44543. {
  44544. checkComponents(child);
  44545. }
  44546. if (typeof child === 'function') {
  44547. child = child.options;
  44548. }
  44549. normalizeProps(child, vm);
  44550. normalizeInject(child, vm);
  44551. normalizeDirectives(child);
  44552. // Apply extends and mixins on the child options,
  44553. // but only if it is a raw options object that isn't
  44554. // the result of another mergeOptions call.
  44555. // Only merged options has the _base property.
  44556. if (!child._base) {
  44557. if (child.extends) {
  44558. parent = mergeOptions(parent, child.extends, vm);
  44559. }
  44560. if (child.mixins) {
  44561. for (var i = 0, l = child.mixins.length; i < l; i++) {
  44562. parent = mergeOptions(parent, child.mixins[i], vm);
  44563. }
  44564. }
  44565. }
  44566. var options = {};
  44567. var key;
  44568. for (key in parent) {
  44569. mergeField(key);
  44570. }
  44571. for (key in child) {
  44572. if (!hasOwn(parent, key)) {
  44573. mergeField(key);
  44574. }
  44575. }
  44576. function mergeField (key) {
  44577. var strat = strats[key] || defaultStrat;
  44578. options[key] = strat(parent[key], child[key], vm, key);
  44579. }
  44580. return options
  44581. }
  44582. /**
  44583. * Resolve an asset.
  44584. * This function is used because child instances need access
  44585. * to assets defined in its ancestor chain.
  44586. */
  44587. function resolveAsset (
  44588. options,
  44589. type,
  44590. id,
  44591. warnMissing
  44592. ) {
  44593. /* istanbul ignore if */
  44594. if (typeof id !== 'string') {
  44595. return
  44596. }
  44597. var assets = options[type];
  44598. // check local registration variations first
  44599. if (hasOwn(assets, id)) { return assets[id] }
  44600. var camelizedId = camelize(id);
  44601. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  44602. var PascalCaseId = capitalize(camelizedId);
  44603. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  44604. // fallback to prototype chain
  44605. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  44606. if (warnMissing && !res) {
  44607. warn(
  44608. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  44609. options
  44610. );
  44611. }
  44612. return res
  44613. }
  44614. /* */
  44615. function validateProp (
  44616. key,
  44617. propOptions,
  44618. propsData,
  44619. vm
  44620. ) {
  44621. var prop = propOptions[key];
  44622. var absent = !hasOwn(propsData, key);
  44623. var value = propsData[key];
  44624. // boolean casting
  44625. var booleanIndex = getTypeIndex(Boolean, prop.type);
  44626. if (booleanIndex > -1) {
  44627. if (absent && !hasOwn(prop, 'default')) {
  44628. value = false;
  44629. } else if (value === '' || value === hyphenate(key)) {
  44630. // only cast empty string / same name to boolean if
  44631. // boolean has higher priority
  44632. var stringIndex = getTypeIndex(String, prop.type);
  44633. if (stringIndex < 0 || booleanIndex < stringIndex) {
  44634. value = true;
  44635. }
  44636. }
  44637. }
  44638. // check default value
  44639. if (value === undefined) {
  44640. value = getPropDefaultValue(vm, prop, key);
  44641. // since the default value is a fresh copy,
  44642. // make sure to observe it.
  44643. var prevShouldObserve = shouldObserve;
  44644. toggleObserving(true);
  44645. observe(value);
  44646. toggleObserving(prevShouldObserve);
  44647. }
  44648. {
  44649. assertProp(prop, key, value, vm, absent);
  44650. }
  44651. return value
  44652. }
  44653. /**
  44654. * Get the default value of a prop.
  44655. */
  44656. function getPropDefaultValue (vm, prop, key) {
  44657. // no default, return undefined
  44658. if (!hasOwn(prop, 'default')) {
  44659. return undefined
  44660. }
  44661. var def = prop.default;
  44662. // warn against non-factory defaults for Object & Array
  44663. if (isObject(def)) {
  44664. warn(
  44665. 'Invalid default value for prop "' + key + '": ' +
  44666. 'Props with type Object/Array must use a factory function ' +
  44667. 'to return the default value.',
  44668. vm
  44669. );
  44670. }
  44671. // the raw prop value was also undefined from previous render,
  44672. // return previous default value to avoid unnecessary watcher trigger
  44673. if (vm && vm.$options.propsData &&
  44674. vm.$options.propsData[key] === undefined &&
  44675. vm._props[key] !== undefined
  44676. ) {
  44677. return vm._props[key]
  44678. }
  44679. // call factory function for non-Function types
  44680. // a value is Function if its prototype is function even across different execution context
  44681. return typeof def === 'function' && getType(prop.type) !== 'Function'
  44682. ? def.call(vm)
  44683. : def
  44684. }
  44685. /**
  44686. * Assert whether a prop is valid.
  44687. */
  44688. function assertProp (
  44689. prop,
  44690. name,
  44691. value,
  44692. vm,
  44693. absent
  44694. ) {
  44695. if (prop.required && absent) {
  44696. warn(
  44697. 'Missing required prop: "' + name + '"',
  44698. vm
  44699. );
  44700. return
  44701. }
  44702. if (value == null && !prop.required) {
  44703. return
  44704. }
  44705. var type = prop.type;
  44706. var valid = !type || type === true;
  44707. var expectedTypes = [];
  44708. if (type) {
  44709. if (!Array.isArray(type)) {
  44710. type = [type];
  44711. }
  44712. for (var i = 0; i < type.length && !valid; i++) {
  44713. var assertedType = assertType(value, type[i]);
  44714. expectedTypes.push(assertedType.expectedType || '');
  44715. valid = assertedType.valid;
  44716. }
  44717. }
  44718. if (!valid) {
  44719. warn(
  44720. getInvalidTypeMessage(name, value, expectedTypes),
  44721. vm
  44722. );
  44723. return
  44724. }
  44725. var validator = prop.validator;
  44726. if (validator) {
  44727. if (!validator(value)) {
  44728. warn(
  44729. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  44730. vm
  44731. );
  44732. }
  44733. }
  44734. }
  44735. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  44736. function assertType (value, type) {
  44737. var valid;
  44738. var expectedType = getType(type);
  44739. if (simpleCheckRE.test(expectedType)) {
  44740. var t = typeof value;
  44741. valid = t === expectedType.toLowerCase();
  44742. // for primitive wrapper objects
  44743. if (!valid && t === 'object') {
  44744. valid = value instanceof type;
  44745. }
  44746. } else if (expectedType === 'Object') {
  44747. valid = isPlainObject(value);
  44748. } else if (expectedType === 'Array') {
  44749. valid = Array.isArray(value);
  44750. } else {
  44751. valid = value instanceof type;
  44752. }
  44753. return {
  44754. valid: valid,
  44755. expectedType: expectedType
  44756. }
  44757. }
  44758. /**
  44759. * Use function string name to check built-in types,
  44760. * because a simple equality check will fail when running
  44761. * across different vms / iframes.
  44762. */
  44763. function getType (fn) {
  44764. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  44765. return match ? match[1] : ''
  44766. }
  44767. function isSameType (a, b) {
  44768. return getType(a) === getType(b)
  44769. }
  44770. function getTypeIndex (type, expectedTypes) {
  44771. if (!Array.isArray(expectedTypes)) {
  44772. return isSameType(expectedTypes, type) ? 0 : -1
  44773. }
  44774. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  44775. if (isSameType(expectedTypes[i], type)) {
  44776. return i
  44777. }
  44778. }
  44779. return -1
  44780. }
  44781. function getInvalidTypeMessage (name, value, expectedTypes) {
  44782. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  44783. " Expected " + (expectedTypes.map(capitalize).join(', '));
  44784. var expectedType = expectedTypes[0];
  44785. var receivedType = toRawType(value);
  44786. var expectedValue = styleValue(value, expectedType);
  44787. var receivedValue = styleValue(value, receivedType);
  44788. // check if we need to specify expected value
  44789. if (expectedTypes.length === 1 &&
  44790. isExplicable(expectedType) &&
  44791. !isBoolean(expectedType, receivedType)) {
  44792. message += " with value " + expectedValue;
  44793. }
  44794. message += ", got " + receivedType + " ";
  44795. // check if we need to specify received value
  44796. if (isExplicable(receivedType)) {
  44797. message += "with value " + receivedValue + ".";
  44798. }
  44799. return message
  44800. }
  44801. function styleValue (value, type) {
  44802. if (type === 'String') {
  44803. return ("\"" + value + "\"")
  44804. } else if (type === 'Number') {
  44805. return ("" + (Number(value)))
  44806. } else {
  44807. return ("" + value)
  44808. }
  44809. }
  44810. function isExplicable (value) {
  44811. var explicitTypes = ['string', 'number', 'boolean'];
  44812. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  44813. }
  44814. function isBoolean () {
  44815. var args = [], len = arguments.length;
  44816. while ( len-- ) args[ len ] = arguments[ len ];
  44817. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  44818. }
  44819. /* */
  44820. function handleError (err, vm, info) {
  44821. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  44822. // See: https://github.com/vuejs/vuex/issues/1505
  44823. pushTarget();
  44824. try {
  44825. if (vm) {
  44826. var cur = vm;
  44827. while ((cur = cur.$parent)) {
  44828. var hooks = cur.$options.errorCaptured;
  44829. if (hooks) {
  44830. for (var i = 0; i < hooks.length; i++) {
  44831. try {
  44832. var capture = hooks[i].call(cur, err, vm, info) === false;
  44833. if (capture) { return }
  44834. } catch (e) {
  44835. globalHandleError(e, cur, 'errorCaptured hook');
  44836. }
  44837. }
  44838. }
  44839. }
  44840. }
  44841. globalHandleError(err, vm, info);
  44842. } finally {
  44843. popTarget();
  44844. }
  44845. }
  44846. function invokeWithErrorHandling (
  44847. handler,
  44848. context,
  44849. args,
  44850. vm,
  44851. info
  44852. ) {
  44853. var res;
  44854. try {
  44855. res = args ? handler.apply(context, args) : handler.call(context);
  44856. if (res && !res._isVue && isPromise(res) && !res._handled) {
  44857. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  44858. // issue #9511
  44859. // avoid catch triggering multiple times when nested calls
  44860. res._handled = true;
  44861. }
  44862. } catch (e) {
  44863. handleError(e, vm, info);
  44864. }
  44865. return res
  44866. }
  44867. function globalHandleError (err, vm, info) {
  44868. if (config.errorHandler) {
  44869. try {
  44870. return config.errorHandler.call(null, err, vm, info)
  44871. } catch (e) {
  44872. // if the user intentionally throws the original error in the handler,
  44873. // do not log it twice
  44874. if (e !== err) {
  44875. logError(e, null, 'config.errorHandler');
  44876. }
  44877. }
  44878. }
  44879. logError(err, vm, info);
  44880. }
  44881. function logError (err, vm, info) {
  44882. {
  44883. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  44884. }
  44885. /* istanbul ignore else */
  44886. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  44887. console.error(err);
  44888. } else {
  44889. throw err
  44890. }
  44891. }
  44892. /* */
  44893. var isUsingMicroTask = false;
  44894. var callbacks = [];
  44895. var pending = false;
  44896. function flushCallbacks () {
  44897. pending = false;
  44898. var copies = callbacks.slice(0);
  44899. callbacks.length = 0;
  44900. for (var i = 0; i < copies.length; i++) {
  44901. copies[i]();
  44902. }
  44903. }
  44904. // Here we have async deferring wrappers using microtasks.
  44905. // In 2.5 we used (macro) tasks (in combination with microtasks).
  44906. // However, it has subtle problems when state is changed right before repaint
  44907. // (e.g. #6813, out-in transitions).
  44908. // Also, using (macro) tasks in event handler would cause some weird behaviors
  44909. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  44910. // So we now use microtasks everywhere, again.
  44911. // A major drawback of this tradeoff is that there are some scenarios
  44912. // where microtasks have too high a priority and fire in between supposedly
  44913. // sequential events (e.g. #4521, #6690, which have workarounds)
  44914. // or even between bubbling of the same event (#6566).
  44915. var timerFunc;
  44916. // The nextTick behavior leverages the microtask queue, which can be accessed
  44917. // via either native Promise.then or MutationObserver.
  44918. // MutationObserver has wider support, however it is seriously bugged in
  44919. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  44920. // completely stops working after triggering a few times... so, if native
  44921. // Promise is available, we will use it:
  44922. /* istanbul ignore next, $flow-disable-line */
  44923. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  44924. var p = Promise.resolve();
  44925. timerFunc = function () {
  44926. p.then(flushCallbacks);
  44927. // In problematic UIWebViews, Promise.then doesn't completely break, but
  44928. // it can get stuck in a weird state where callbacks are pushed into the
  44929. // microtask queue but the queue isn't being flushed, until the browser
  44930. // needs to do some other work, e.g. handle a timer. Therefore we can
  44931. // "force" the microtask queue to be flushed by adding an empty timer.
  44932. if (isIOS) { setTimeout(noop); }
  44933. };
  44934. isUsingMicroTask = true;
  44935. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  44936. isNative(MutationObserver) ||
  44937. // PhantomJS and iOS 7.x
  44938. MutationObserver.toString() === '[object MutationObserverConstructor]'
  44939. )) {
  44940. // Use MutationObserver where native Promise is not available,
  44941. // e.g. PhantomJS, iOS7, Android 4.4
  44942. // (#6466 MutationObserver is unreliable in IE11)
  44943. var counter = 1;
  44944. var observer = new MutationObserver(flushCallbacks);
  44945. var textNode = document.createTextNode(String(counter));
  44946. observer.observe(textNode, {
  44947. characterData: true
  44948. });
  44949. timerFunc = function () {
  44950. counter = (counter + 1) % 2;
  44951. textNode.data = String(counter);
  44952. };
  44953. isUsingMicroTask = true;
  44954. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  44955. // Fallback to setImmediate.
  44956. // Technically it leverages the (macro) task queue,
  44957. // but it is still a better choice than setTimeout.
  44958. timerFunc = function () {
  44959. setImmediate(flushCallbacks);
  44960. };
  44961. } else {
  44962. // Fallback to setTimeout.
  44963. timerFunc = function () {
  44964. setTimeout(flushCallbacks, 0);
  44965. };
  44966. }
  44967. function nextTick (cb, ctx) {
  44968. var _resolve;
  44969. callbacks.push(function () {
  44970. if (cb) {
  44971. try {
  44972. cb.call(ctx);
  44973. } catch (e) {
  44974. handleError(e, ctx, 'nextTick');
  44975. }
  44976. } else if (_resolve) {
  44977. _resolve(ctx);
  44978. }
  44979. });
  44980. if (!pending) {
  44981. pending = true;
  44982. timerFunc();
  44983. }
  44984. // $flow-disable-line
  44985. if (!cb && typeof Promise !== 'undefined') {
  44986. return new Promise(function (resolve) {
  44987. _resolve = resolve;
  44988. })
  44989. }
  44990. }
  44991. /* */
  44992. var mark;
  44993. var measure;
  44994. {
  44995. var perf = inBrowser && window.performance;
  44996. /* istanbul ignore if */
  44997. if (
  44998. perf &&
  44999. perf.mark &&
  45000. perf.measure &&
  45001. perf.clearMarks &&
  45002. perf.clearMeasures
  45003. ) {
  45004. mark = function (tag) { return perf.mark(tag); };
  45005. measure = function (name, startTag, endTag) {
  45006. perf.measure(name, startTag, endTag);
  45007. perf.clearMarks(startTag);
  45008. perf.clearMarks(endTag);
  45009. // perf.clearMeasures(name)
  45010. };
  45011. }
  45012. }
  45013. /* not type checking this file because flow doesn't play well with Proxy */
  45014. var initProxy;
  45015. {
  45016. var allowedGlobals = makeMap(
  45017. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45018. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45019. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45020. 'require' // for Webpack/Browserify
  45021. );
  45022. var warnNonPresent = function (target, key) {
  45023. warn(
  45024. "Property or method \"" + key + "\" is not defined on the instance but " +
  45025. 'referenced during render. Make sure that this property is reactive, ' +
  45026. 'either in the data option, or for class-based components, by ' +
  45027. 'initializing the property. ' +
  45028. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45029. target
  45030. );
  45031. };
  45032. var warnReservedPrefix = function (target, key) {
  45033. warn(
  45034. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45035. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45036. 'prevent conflicts with Vue internals. ' +
  45037. 'See: https://vuejs.org/v2/api/#data',
  45038. target
  45039. );
  45040. };
  45041. var hasProxy =
  45042. typeof Proxy !== 'undefined' && isNative(Proxy);
  45043. if (hasProxy) {
  45044. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45045. config.keyCodes = new Proxy(config.keyCodes, {
  45046. set: function set (target, key, value) {
  45047. if (isBuiltInModifier(key)) {
  45048. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45049. return false
  45050. } else {
  45051. target[key] = value;
  45052. return true
  45053. }
  45054. }
  45055. });
  45056. }
  45057. var hasHandler = {
  45058. has: function has (target, key) {
  45059. var has = key in target;
  45060. var isAllowed = allowedGlobals(key) ||
  45061. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45062. if (!has && !isAllowed) {
  45063. if (key in target.$data) { warnReservedPrefix(target, key); }
  45064. else { warnNonPresent(target, key); }
  45065. }
  45066. return has || !isAllowed
  45067. }
  45068. };
  45069. var getHandler = {
  45070. get: function get (target, key) {
  45071. if (typeof key === 'string' && !(key in target)) {
  45072. if (key in target.$data) { warnReservedPrefix(target, key); }
  45073. else { warnNonPresent(target, key); }
  45074. }
  45075. return target[key]
  45076. }
  45077. };
  45078. initProxy = function initProxy (vm) {
  45079. if (hasProxy) {
  45080. // determine which proxy handler to use
  45081. var options = vm.$options;
  45082. var handlers = options.render && options.render._withStripped
  45083. ? getHandler
  45084. : hasHandler;
  45085. vm._renderProxy = new Proxy(vm, handlers);
  45086. } else {
  45087. vm._renderProxy = vm;
  45088. }
  45089. };
  45090. }
  45091. /* */
  45092. var seenObjects = new _Set();
  45093. /**
  45094. * Recursively traverse an object to evoke all converted
  45095. * getters, so that every nested property inside the object
  45096. * is collected as a "deep" dependency.
  45097. */
  45098. function traverse (val) {
  45099. _traverse(val, seenObjects);
  45100. seenObjects.clear();
  45101. }
  45102. function _traverse (val, seen) {
  45103. var i, keys;
  45104. var isA = Array.isArray(val);
  45105. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45106. return
  45107. }
  45108. if (val.__ob__) {
  45109. var depId = val.__ob__.dep.id;
  45110. if (seen.has(depId)) {
  45111. return
  45112. }
  45113. seen.add(depId);
  45114. }
  45115. if (isA) {
  45116. i = val.length;
  45117. while (i--) { _traverse(val[i], seen); }
  45118. } else {
  45119. keys = Object.keys(val);
  45120. i = keys.length;
  45121. while (i--) { _traverse(val[keys[i]], seen); }
  45122. }
  45123. }
  45124. /* */
  45125. var normalizeEvent = cached(function (name) {
  45126. var passive = name.charAt(0) === '&';
  45127. name = passive ? name.slice(1) : name;
  45128. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45129. name = once$$1 ? name.slice(1) : name;
  45130. var capture = name.charAt(0) === '!';
  45131. name = capture ? name.slice(1) : name;
  45132. return {
  45133. name: name,
  45134. once: once$$1,
  45135. capture: capture,
  45136. passive: passive
  45137. }
  45138. });
  45139. function createFnInvoker (fns, vm) {
  45140. function invoker () {
  45141. var arguments$1 = arguments;
  45142. var fns = invoker.fns;
  45143. if (Array.isArray(fns)) {
  45144. var cloned = fns.slice();
  45145. for (var i = 0; i < cloned.length; i++) {
  45146. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45147. }
  45148. } else {
  45149. // return handler return value for single handlers
  45150. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45151. }
  45152. }
  45153. invoker.fns = fns;
  45154. return invoker
  45155. }
  45156. function updateListeners (
  45157. on,
  45158. oldOn,
  45159. add,
  45160. remove$$1,
  45161. createOnceHandler,
  45162. vm
  45163. ) {
  45164. var name, def$$1, cur, old, event;
  45165. for (name in on) {
  45166. def$$1 = cur = on[name];
  45167. old = oldOn[name];
  45168. event = normalizeEvent(name);
  45169. if (isUndef(cur)) {
  45170. warn(
  45171. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45172. vm
  45173. );
  45174. } else if (isUndef(old)) {
  45175. if (isUndef(cur.fns)) {
  45176. cur = on[name] = createFnInvoker(cur, vm);
  45177. }
  45178. if (isTrue(event.once)) {
  45179. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  45180. }
  45181. add(event.name, cur, event.capture, event.passive, event.params);
  45182. } else if (cur !== old) {
  45183. old.fns = cur;
  45184. on[name] = old;
  45185. }
  45186. }
  45187. for (name in oldOn) {
  45188. if (isUndef(on[name])) {
  45189. event = normalizeEvent(name);
  45190. remove$$1(event.name, oldOn[name], event.capture);
  45191. }
  45192. }
  45193. }
  45194. /* */
  45195. function mergeVNodeHook (def, hookKey, hook) {
  45196. if (def instanceof VNode) {
  45197. def = def.data.hook || (def.data.hook = {});
  45198. }
  45199. var invoker;
  45200. var oldHook = def[hookKey];
  45201. function wrappedHook () {
  45202. hook.apply(this, arguments);
  45203. // important: remove merged hook to ensure it's called only once
  45204. // and prevent memory leak
  45205. remove(invoker.fns, wrappedHook);
  45206. }
  45207. if (isUndef(oldHook)) {
  45208. // no existing hook
  45209. invoker = createFnInvoker([wrappedHook]);
  45210. } else {
  45211. /* istanbul ignore if */
  45212. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  45213. // already a merged invoker
  45214. invoker = oldHook;
  45215. invoker.fns.push(wrappedHook);
  45216. } else {
  45217. // existing plain hook
  45218. invoker = createFnInvoker([oldHook, wrappedHook]);
  45219. }
  45220. }
  45221. invoker.merged = true;
  45222. def[hookKey] = invoker;
  45223. }
  45224. /* */
  45225. function extractPropsFromVNodeData (
  45226. data,
  45227. Ctor,
  45228. tag
  45229. ) {
  45230. // we are only extracting raw values here.
  45231. // validation and default values are handled in the child
  45232. // component itself.
  45233. var propOptions = Ctor.options.props;
  45234. if (isUndef(propOptions)) {
  45235. return
  45236. }
  45237. var res = {};
  45238. var attrs = data.attrs;
  45239. var props = data.props;
  45240. if (isDef(attrs) || isDef(props)) {
  45241. for (var key in propOptions) {
  45242. var altKey = hyphenate(key);
  45243. {
  45244. var keyInLowerCase = key.toLowerCase();
  45245. if (
  45246. key !== keyInLowerCase &&
  45247. attrs && hasOwn(attrs, keyInLowerCase)
  45248. ) {
  45249. tip(
  45250. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  45251. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  45252. " \"" + key + "\". " +
  45253. "Note that HTML attributes are case-insensitive and camelCased " +
  45254. "props need to use their kebab-case equivalents when using in-DOM " +
  45255. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  45256. );
  45257. }
  45258. }
  45259. checkProp(res, props, key, altKey, true) ||
  45260. checkProp(res, attrs, key, altKey, false);
  45261. }
  45262. }
  45263. return res
  45264. }
  45265. function checkProp (
  45266. res,
  45267. hash,
  45268. key,
  45269. altKey,
  45270. preserve
  45271. ) {
  45272. if (isDef(hash)) {
  45273. if (hasOwn(hash, key)) {
  45274. res[key] = hash[key];
  45275. if (!preserve) {
  45276. delete hash[key];
  45277. }
  45278. return true
  45279. } else if (hasOwn(hash, altKey)) {
  45280. res[key] = hash[altKey];
  45281. if (!preserve) {
  45282. delete hash[altKey];
  45283. }
  45284. return true
  45285. }
  45286. }
  45287. return false
  45288. }
  45289. /* */
  45290. // The template compiler attempts to minimize the need for normalization by
  45291. // statically analyzing the template at compile time.
  45292. //
  45293. // For plain HTML markup, normalization can be completely skipped because the
  45294. // generated render function is guaranteed to return Array<VNode>. There are
  45295. // two cases where extra normalization is needed:
  45296. // 1. When the children contains components - because a functional component
  45297. // may return an Array instead of a single root. In this case, just a simple
  45298. // normalization is needed - if any child is an Array, we flatten the whole
  45299. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  45300. // because functional components already normalize their own children.
  45301. function simpleNormalizeChildren (children) {
  45302. for (var i = 0; i < children.length; i++) {
  45303. if (Array.isArray(children[i])) {
  45304. return Array.prototype.concat.apply([], children)
  45305. }
  45306. }
  45307. return children
  45308. }
  45309. // 2. When the children contains constructs that always generated nested Arrays,
  45310. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  45311. // with hand-written render functions / JSX. In such cases a full normalization
  45312. // is needed to cater to all possible types of children values.
  45313. function normalizeChildren (children) {
  45314. return isPrimitive(children)
  45315. ? [createTextVNode(children)]
  45316. : Array.isArray(children)
  45317. ? normalizeArrayChildren(children)
  45318. : undefined
  45319. }
  45320. function isTextNode (node) {
  45321. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  45322. }
  45323. function normalizeArrayChildren (children, nestedIndex) {
  45324. var res = [];
  45325. var i, c, lastIndex, last;
  45326. for (i = 0; i < children.length; i++) {
  45327. c = children[i];
  45328. if (isUndef(c) || typeof c === 'boolean') { continue }
  45329. lastIndex = res.length - 1;
  45330. last = res[lastIndex];
  45331. // nested
  45332. if (Array.isArray(c)) {
  45333. if (c.length > 0) {
  45334. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  45335. // merge adjacent text nodes
  45336. if (isTextNode(c[0]) && isTextNode(last)) {
  45337. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  45338. c.shift();
  45339. }
  45340. res.push.apply(res, c);
  45341. }
  45342. } else if (isPrimitive(c)) {
  45343. if (isTextNode(last)) {
  45344. // merge adjacent text nodes
  45345. // this is necessary for SSR hydration because text nodes are
  45346. // essentially merged when rendered to HTML strings
  45347. res[lastIndex] = createTextVNode(last.text + c);
  45348. } else if (c !== '') {
  45349. // convert primitive to vnode
  45350. res.push(createTextVNode(c));
  45351. }
  45352. } else {
  45353. if (isTextNode(c) && isTextNode(last)) {
  45354. // merge adjacent text nodes
  45355. res[lastIndex] = createTextVNode(last.text + c.text);
  45356. } else {
  45357. // default key for nested array children (likely generated by v-for)
  45358. if (isTrue(children._isVList) &&
  45359. isDef(c.tag) &&
  45360. isUndef(c.key) &&
  45361. isDef(nestedIndex)) {
  45362. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45363. }
  45364. res.push(c);
  45365. }
  45366. }
  45367. }
  45368. return res
  45369. }
  45370. /* */
  45371. function initProvide (vm) {
  45372. var provide = vm.$options.provide;
  45373. if (provide) {
  45374. vm._provided = typeof provide === 'function'
  45375. ? provide.call(vm)
  45376. : provide;
  45377. }
  45378. }
  45379. function initInjections (vm) {
  45380. var result = resolveInject(vm.$options.inject, vm);
  45381. if (result) {
  45382. toggleObserving(false);
  45383. Object.keys(result).forEach(function (key) {
  45384. /* istanbul ignore else */
  45385. {
  45386. defineReactive$$1(vm, key, result[key], function () {
  45387. warn(
  45388. "Avoid mutating an injected value directly since the changes will be " +
  45389. "overwritten whenever the provided component re-renders. " +
  45390. "injection being mutated: \"" + key + "\"",
  45391. vm
  45392. );
  45393. });
  45394. }
  45395. });
  45396. toggleObserving(true);
  45397. }
  45398. }
  45399. function resolveInject (inject, vm) {
  45400. if (inject) {
  45401. // inject is :any because flow is not smart enough to figure out cached
  45402. var result = Object.create(null);
  45403. var keys = hasSymbol
  45404. ? Reflect.ownKeys(inject)
  45405. : Object.keys(inject);
  45406. for (var i = 0; i < keys.length; i++) {
  45407. var key = keys[i];
  45408. // #6574 in case the inject object is observed...
  45409. if (key === '__ob__') { continue }
  45410. var provideKey = inject[key].from;
  45411. var source = vm;
  45412. while (source) {
  45413. if (source._provided && hasOwn(source._provided, provideKey)) {
  45414. result[key] = source._provided[provideKey];
  45415. break
  45416. }
  45417. source = source.$parent;
  45418. }
  45419. if (!source) {
  45420. if ('default' in inject[key]) {
  45421. var provideDefault = inject[key].default;
  45422. result[key] = typeof provideDefault === 'function'
  45423. ? provideDefault.call(vm)
  45424. : provideDefault;
  45425. } else {
  45426. warn(("Injection \"" + key + "\" not found"), vm);
  45427. }
  45428. }
  45429. }
  45430. return result
  45431. }
  45432. }
  45433. /* */
  45434. /**
  45435. * Runtime helper for resolving raw children VNodes into a slot object.
  45436. */
  45437. function resolveSlots (
  45438. children,
  45439. context
  45440. ) {
  45441. if (!children || !children.length) {
  45442. return {}
  45443. }
  45444. var slots = {};
  45445. for (var i = 0, l = children.length; i < l; i++) {
  45446. var child = children[i];
  45447. var data = child.data;
  45448. // remove slot attribute if the node is resolved as a Vue slot node
  45449. if (data && data.attrs && data.attrs.slot) {
  45450. delete data.attrs.slot;
  45451. }
  45452. // named slots should only be respected if the vnode was rendered in the
  45453. // same context.
  45454. if ((child.context === context || child.fnContext === context) &&
  45455. data && data.slot != null
  45456. ) {
  45457. var name = data.slot;
  45458. var slot = (slots[name] || (slots[name] = []));
  45459. if (child.tag === 'template') {
  45460. slot.push.apply(slot, child.children || []);
  45461. } else {
  45462. slot.push(child);
  45463. }
  45464. } else {
  45465. (slots.default || (slots.default = [])).push(child);
  45466. }
  45467. }
  45468. // ignore slots that contains only whitespace
  45469. for (var name$1 in slots) {
  45470. if (slots[name$1].every(isWhitespace)) {
  45471. delete slots[name$1];
  45472. }
  45473. }
  45474. return slots
  45475. }
  45476. function isWhitespace (node) {
  45477. return (node.isComment && !node.asyncFactory) || node.text === ' '
  45478. }
  45479. /* */
  45480. function normalizeScopedSlots (
  45481. slots,
  45482. normalSlots,
  45483. prevSlots
  45484. ) {
  45485. var res;
  45486. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  45487. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  45488. var key = slots && slots.$key;
  45489. if (!slots) {
  45490. res = {};
  45491. } else if (slots._normalized) {
  45492. // fast path 1: child component re-render only, parent did not change
  45493. return slots._normalized
  45494. } else if (
  45495. isStable &&
  45496. prevSlots &&
  45497. prevSlots !== emptyObject &&
  45498. key === prevSlots.$key &&
  45499. !hasNormalSlots &&
  45500. !prevSlots.$hasNormal
  45501. ) {
  45502. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  45503. // only need to normalize once
  45504. return prevSlots
  45505. } else {
  45506. res = {};
  45507. for (var key$1 in slots) {
  45508. if (slots[key$1] && key$1[0] !== '$') {
  45509. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  45510. }
  45511. }
  45512. }
  45513. // expose normal slots on scopedSlots
  45514. for (var key$2 in normalSlots) {
  45515. if (!(key$2 in res)) {
  45516. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  45517. }
  45518. }
  45519. // avoriaz seems to mock a non-extensible $scopedSlots object
  45520. // and when that is passed down this would cause an error
  45521. if (slots && Object.isExtensible(slots)) {
  45522. (slots)._normalized = res;
  45523. }
  45524. def(res, '$stable', isStable);
  45525. def(res, '$key', key);
  45526. def(res, '$hasNormal', hasNormalSlots);
  45527. return res
  45528. }
  45529. function normalizeScopedSlot(normalSlots, key, fn) {
  45530. var normalized = function () {
  45531. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  45532. res = res && typeof res === 'object' && !Array.isArray(res)
  45533. ? [res] // single vnode
  45534. : normalizeChildren(res);
  45535. return res && (
  45536. res.length === 0 ||
  45537. (res.length === 1 && res[0].isComment) // #9658
  45538. ) ? undefined
  45539. : res
  45540. };
  45541. // this is a slot using the new v-slot syntax without scope. although it is
  45542. // compiled as a scoped slot, render fn users would expect it to be present
  45543. // on this.$slots because the usage is semantically a normal slot.
  45544. if (fn.proxy) {
  45545. Object.defineProperty(normalSlots, key, {
  45546. get: normalized,
  45547. enumerable: true,
  45548. configurable: true
  45549. });
  45550. }
  45551. return normalized
  45552. }
  45553. function proxyNormalSlot(slots, key) {
  45554. return function () { return slots[key]; }
  45555. }
  45556. /* */
  45557. /**
  45558. * Runtime helper for rendering v-for lists.
  45559. */
  45560. function renderList (
  45561. val,
  45562. render
  45563. ) {
  45564. var ret, i, l, keys, key;
  45565. if (Array.isArray(val) || typeof val === 'string') {
  45566. ret = new Array(val.length);
  45567. for (i = 0, l = val.length; i < l; i++) {
  45568. ret[i] = render(val[i], i);
  45569. }
  45570. } else if (typeof val === 'number') {
  45571. ret = new Array(val);
  45572. for (i = 0; i < val; i++) {
  45573. ret[i] = render(i + 1, i);
  45574. }
  45575. } else if (isObject(val)) {
  45576. if (hasSymbol && val[Symbol.iterator]) {
  45577. ret = [];
  45578. var iterator = val[Symbol.iterator]();
  45579. var result = iterator.next();
  45580. while (!result.done) {
  45581. ret.push(render(result.value, ret.length));
  45582. result = iterator.next();
  45583. }
  45584. } else {
  45585. keys = Object.keys(val);
  45586. ret = new Array(keys.length);
  45587. for (i = 0, l = keys.length; i < l; i++) {
  45588. key = keys[i];
  45589. ret[i] = render(val[key], key, i);
  45590. }
  45591. }
  45592. }
  45593. if (!isDef(ret)) {
  45594. ret = [];
  45595. }
  45596. (ret)._isVList = true;
  45597. return ret
  45598. }
  45599. /* */
  45600. /**
  45601. * Runtime helper for rendering <slot>
  45602. */
  45603. function renderSlot (
  45604. name,
  45605. fallback,
  45606. props,
  45607. bindObject
  45608. ) {
  45609. var scopedSlotFn = this.$scopedSlots[name];
  45610. var nodes;
  45611. if (scopedSlotFn) { // scoped slot
  45612. props = props || {};
  45613. if (bindObject) {
  45614. if (!isObject(bindObject)) {
  45615. warn(
  45616. 'slot v-bind without argument expects an Object',
  45617. this
  45618. );
  45619. }
  45620. props = extend(extend({}, bindObject), props);
  45621. }
  45622. nodes = scopedSlotFn(props) || fallback;
  45623. } else {
  45624. nodes = this.$slots[name] || fallback;
  45625. }
  45626. var target = props && props.slot;
  45627. if (target) {
  45628. return this.$createElement('template', { slot: target }, nodes)
  45629. } else {
  45630. return nodes
  45631. }
  45632. }
  45633. /* */
  45634. /**
  45635. * Runtime helper for resolving filters
  45636. */
  45637. function resolveFilter (id) {
  45638. return resolveAsset(this.$options, 'filters', id, true) || identity
  45639. }
  45640. /* */
  45641. function isKeyNotMatch (expect, actual) {
  45642. if (Array.isArray(expect)) {
  45643. return expect.indexOf(actual) === -1
  45644. } else {
  45645. return expect !== actual
  45646. }
  45647. }
  45648. /**
  45649. * Runtime helper for checking keyCodes from config.
  45650. * exposed as Vue.prototype._k
  45651. * passing in eventKeyName as last argument separately for backwards compat
  45652. */
  45653. function checkKeyCodes (
  45654. eventKeyCode,
  45655. key,
  45656. builtInKeyCode,
  45657. eventKeyName,
  45658. builtInKeyName
  45659. ) {
  45660. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  45661. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  45662. return isKeyNotMatch(builtInKeyName, eventKeyName)
  45663. } else if (mappedKeyCode) {
  45664. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  45665. } else if (eventKeyName) {
  45666. return hyphenate(eventKeyName) !== key
  45667. }
  45668. }
  45669. /* */
  45670. /**
  45671. * Runtime helper for merging v-bind="object" into a VNode's data.
  45672. */
  45673. function bindObjectProps (
  45674. data,
  45675. tag,
  45676. value,
  45677. asProp,
  45678. isSync
  45679. ) {
  45680. if (value) {
  45681. if (!isObject(value)) {
  45682. warn(
  45683. 'v-bind without argument expects an Object or Array value',
  45684. this
  45685. );
  45686. } else {
  45687. if (Array.isArray(value)) {
  45688. value = toObject(value);
  45689. }
  45690. var hash;
  45691. var loop = function ( key ) {
  45692. if (
  45693. key === 'class' ||
  45694. key === 'style' ||
  45695. isReservedAttribute(key)
  45696. ) {
  45697. hash = data;
  45698. } else {
  45699. var type = data.attrs && data.attrs.type;
  45700. hash = asProp || config.mustUseProp(tag, type, key)
  45701. ? data.domProps || (data.domProps = {})
  45702. : data.attrs || (data.attrs = {});
  45703. }
  45704. var camelizedKey = camelize(key);
  45705. var hyphenatedKey = hyphenate(key);
  45706. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  45707. hash[key] = value[key];
  45708. if (isSync) {
  45709. var on = data.on || (data.on = {});
  45710. on[("update:" + key)] = function ($event) {
  45711. value[key] = $event;
  45712. };
  45713. }
  45714. }
  45715. };
  45716. for (var key in value) loop( key );
  45717. }
  45718. }
  45719. return data
  45720. }
  45721. /* */
  45722. /**
  45723. * Runtime helper for rendering static trees.
  45724. */
  45725. function renderStatic (
  45726. index,
  45727. isInFor
  45728. ) {
  45729. var cached = this._staticTrees || (this._staticTrees = []);
  45730. var tree = cached[index];
  45731. // if has already-rendered static tree and not inside v-for,
  45732. // we can reuse the same tree.
  45733. if (tree && !isInFor) {
  45734. return tree
  45735. }
  45736. // otherwise, render a fresh tree.
  45737. tree = cached[index] = this.$options.staticRenderFns[index].call(
  45738. this._renderProxy,
  45739. null,
  45740. this // for render fns generated for functional component templates
  45741. );
  45742. markStatic(tree, ("__static__" + index), false);
  45743. return tree
  45744. }
  45745. /**
  45746. * Runtime helper for v-once.
  45747. * Effectively it means marking the node as static with a unique key.
  45748. */
  45749. function markOnce (
  45750. tree,
  45751. index,
  45752. key
  45753. ) {
  45754. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  45755. return tree
  45756. }
  45757. function markStatic (
  45758. tree,
  45759. key,
  45760. isOnce
  45761. ) {
  45762. if (Array.isArray(tree)) {
  45763. for (var i = 0; i < tree.length; i++) {
  45764. if (tree[i] && typeof tree[i] !== 'string') {
  45765. markStaticNode(tree[i], (key + "_" + i), isOnce);
  45766. }
  45767. }
  45768. } else {
  45769. markStaticNode(tree, key, isOnce);
  45770. }
  45771. }
  45772. function markStaticNode (node, key, isOnce) {
  45773. node.isStatic = true;
  45774. node.key = key;
  45775. node.isOnce = isOnce;
  45776. }
  45777. /* */
  45778. function bindObjectListeners (data, value) {
  45779. if (value) {
  45780. if (!isPlainObject(value)) {
  45781. warn(
  45782. 'v-on without argument expects an Object value',
  45783. this
  45784. );
  45785. } else {
  45786. var on = data.on = data.on ? extend({}, data.on) : {};
  45787. for (var key in value) {
  45788. var existing = on[key];
  45789. var ours = value[key];
  45790. on[key] = existing ? [].concat(existing, ours) : ours;
  45791. }
  45792. }
  45793. }
  45794. return data
  45795. }
  45796. /* */
  45797. function resolveScopedSlots (
  45798. fns, // see flow/vnode
  45799. res,
  45800. // the following are added in 2.6
  45801. hasDynamicKeys,
  45802. contentHashKey
  45803. ) {
  45804. res = res || { $stable: !hasDynamicKeys };
  45805. for (var i = 0; i < fns.length; i++) {
  45806. var slot = fns[i];
  45807. if (Array.isArray(slot)) {
  45808. resolveScopedSlots(slot, res, hasDynamicKeys);
  45809. } else if (slot) {
  45810. // marker for reverse proxying v-slot without scope on this.$slots
  45811. if (slot.proxy) {
  45812. slot.fn.proxy = true;
  45813. }
  45814. res[slot.key] = slot.fn;
  45815. }
  45816. }
  45817. if (contentHashKey) {
  45818. (res).$key = contentHashKey;
  45819. }
  45820. return res
  45821. }
  45822. /* */
  45823. function bindDynamicKeys (baseObj, values) {
  45824. for (var i = 0; i < values.length; i += 2) {
  45825. var key = values[i];
  45826. if (typeof key === 'string' && key) {
  45827. baseObj[values[i]] = values[i + 1];
  45828. } else if (key !== '' && key !== null) {
  45829. // null is a special value for explicitly removing a binding
  45830. warn(
  45831. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  45832. this
  45833. );
  45834. }
  45835. }
  45836. return baseObj
  45837. }
  45838. // helper to dynamically append modifier runtime markers to event names.
  45839. // ensure only append when value is already string, otherwise it will be cast
  45840. // to string and cause the type check to miss.
  45841. function prependModifier (value, symbol) {
  45842. return typeof value === 'string' ? symbol + value : value
  45843. }
  45844. /* */
  45845. function installRenderHelpers (target) {
  45846. target._o = markOnce;
  45847. target._n = toNumber;
  45848. target._s = toString;
  45849. target._l = renderList;
  45850. target._t = renderSlot;
  45851. target._q = looseEqual;
  45852. target._i = looseIndexOf;
  45853. target._m = renderStatic;
  45854. target._f = resolveFilter;
  45855. target._k = checkKeyCodes;
  45856. target._b = bindObjectProps;
  45857. target._v = createTextVNode;
  45858. target._e = createEmptyVNode;
  45859. target._u = resolveScopedSlots;
  45860. target._g = bindObjectListeners;
  45861. target._d = bindDynamicKeys;
  45862. target._p = prependModifier;
  45863. }
  45864. /* */
  45865. function FunctionalRenderContext (
  45866. data,
  45867. props,
  45868. children,
  45869. parent,
  45870. Ctor
  45871. ) {
  45872. var this$1 = this;
  45873. var options = Ctor.options;
  45874. // ensure the createElement function in functional components
  45875. // gets a unique context - this is necessary for correct named slot check
  45876. var contextVm;
  45877. if (hasOwn(parent, '_uid')) {
  45878. contextVm = Object.create(parent);
  45879. // $flow-disable-line
  45880. contextVm._original = parent;
  45881. } else {
  45882. // the context vm passed in is a functional context as well.
  45883. // in this case we want to make sure we are able to get a hold to the
  45884. // real context instance.
  45885. contextVm = parent;
  45886. // $flow-disable-line
  45887. parent = parent._original;
  45888. }
  45889. var isCompiled = isTrue(options._compiled);
  45890. var needNormalization = !isCompiled;
  45891. this.data = data;
  45892. this.props = props;
  45893. this.children = children;
  45894. this.parent = parent;
  45895. this.listeners = data.on || emptyObject;
  45896. this.injections = resolveInject(options.inject, parent);
  45897. this.slots = function () {
  45898. if (!this$1.$slots) {
  45899. normalizeScopedSlots(
  45900. data.scopedSlots,
  45901. this$1.$slots = resolveSlots(children, parent)
  45902. );
  45903. }
  45904. return this$1.$slots
  45905. };
  45906. Object.defineProperty(this, 'scopedSlots', ({
  45907. enumerable: true,
  45908. get: function get () {
  45909. return normalizeScopedSlots(data.scopedSlots, this.slots())
  45910. }
  45911. }));
  45912. // support for compiled functional template
  45913. if (isCompiled) {
  45914. // exposing $options for renderStatic()
  45915. this.$options = options;
  45916. // pre-resolve slots for renderSlot()
  45917. this.$slots = this.slots();
  45918. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  45919. }
  45920. if (options._scopeId) {
  45921. this._c = function (a, b, c, d) {
  45922. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  45923. if (vnode && !Array.isArray(vnode)) {
  45924. vnode.fnScopeId = options._scopeId;
  45925. vnode.fnContext = parent;
  45926. }
  45927. return vnode
  45928. };
  45929. } else {
  45930. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  45931. }
  45932. }
  45933. installRenderHelpers(FunctionalRenderContext.prototype);
  45934. function createFunctionalComponent (
  45935. Ctor,
  45936. propsData,
  45937. data,
  45938. contextVm,
  45939. children
  45940. ) {
  45941. var options = Ctor.options;
  45942. var props = {};
  45943. var propOptions = options.props;
  45944. if (isDef(propOptions)) {
  45945. for (var key in propOptions) {
  45946. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  45947. }
  45948. } else {
  45949. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  45950. if (isDef(data.props)) { mergeProps(props, data.props); }
  45951. }
  45952. var renderContext = new FunctionalRenderContext(
  45953. data,
  45954. props,
  45955. children,
  45956. contextVm,
  45957. Ctor
  45958. );
  45959. var vnode = options.render.call(null, renderContext._c, renderContext);
  45960. if (vnode instanceof VNode) {
  45961. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  45962. } else if (Array.isArray(vnode)) {
  45963. var vnodes = normalizeChildren(vnode) || [];
  45964. var res = new Array(vnodes.length);
  45965. for (var i = 0; i < vnodes.length; i++) {
  45966. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  45967. }
  45968. return res
  45969. }
  45970. }
  45971. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  45972. // #7817 clone node before setting fnContext, otherwise if the node is reused
  45973. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  45974. // that should not be matched to match.
  45975. var clone = cloneVNode(vnode);
  45976. clone.fnContext = contextVm;
  45977. clone.fnOptions = options;
  45978. {
  45979. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  45980. }
  45981. if (data.slot) {
  45982. (clone.data || (clone.data = {})).slot = data.slot;
  45983. }
  45984. return clone
  45985. }
  45986. function mergeProps (to, from) {
  45987. for (var key in from) {
  45988. to[camelize(key)] = from[key];
  45989. }
  45990. }
  45991. /* */
  45992. /* */
  45993. /* */
  45994. /* */
  45995. // inline hooks to be invoked on component VNodes during patch
  45996. var componentVNodeHooks = {
  45997. init: function init (vnode, hydrating) {
  45998. if (
  45999. vnode.componentInstance &&
  46000. !vnode.componentInstance._isDestroyed &&
  46001. vnode.data.keepAlive
  46002. ) {
  46003. // kept-alive components, treat as a patch
  46004. var mountedNode = vnode; // work around flow
  46005. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46006. } else {
  46007. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46008. vnode,
  46009. activeInstance
  46010. );
  46011. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46012. }
  46013. },
  46014. prepatch: function prepatch (oldVnode, vnode) {
  46015. var options = vnode.componentOptions;
  46016. var child = vnode.componentInstance = oldVnode.componentInstance;
  46017. updateChildComponent(
  46018. child,
  46019. options.propsData, // updated props
  46020. options.listeners, // updated listeners
  46021. vnode, // new parent vnode
  46022. options.children // new children
  46023. );
  46024. },
  46025. insert: function insert (vnode) {
  46026. var context = vnode.context;
  46027. var componentInstance = vnode.componentInstance;
  46028. if (!componentInstance._isMounted) {
  46029. componentInstance._isMounted = true;
  46030. callHook(componentInstance, 'mounted');
  46031. }
  46032. if (vnode.data.keepAlive) {
  46033. if (context._isMounted) {
  46034. // vue-router#1212
  46035. // During updates, a kept-alive component's child components may
  46036. // change, so directly walking the tree here may call activated hooks
  46037. // on incorrect children. Instead we push them into a queue which will
  46038. // be processed after the whole patch process ended.
  46039. queueActivatedComponent(componentInstance);
  46040. } else {
  46041. activateChildComponent(componentInstance, true /* direct */);
  46042. }
  46043. }
  46044. },
  46045. destroy: function destroy (vnode) {
  46046. var componentInstance = vnode.componentInstance;
  46047. if (!componentInstance._isDestroyed) {
  46048. if (!vnode.data.keepAlive) {
  46049. componentInstance.$destroy();
  46050. } else {
  46051. deactivateChildComponent(componentInstance, true /* direct */);
  46052. }
  46053. }
  46054. }
  46055. };
  46056. var hooksToMerge = Object.keys(componentVNodeHooks);
  46057. function createComponent (
  46058. Ctor,
  46059. data,
  46060. context,
  46061. children,
  46062. tag
  46063. ) {
  46064. if (isUndef(Ctor)) {
  46065. return
  46066. }
  46067. var baseCtor = context.$options._base;
  46068. // plain options object: turn it into a constructor
  46069. if (isObject(Ctor)) {
  46070. Ctor = baseCtor.extend(Ctor);
  46071. }
  46072. // if at this stage it's not a constructor or an async component factory,
  46073. // reject.
  46074. if (typeof Ctor !== 'function') {
  46075. {
  46076. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46077. }
  46078. return
  46079. }
  46080. // async component
  46081. var asyncFactory;
  46082. if (isUndef(Ctor.cid)) {
  46083. asyncFactory = Ctor;
  46084. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46085. if (Ctor === undefined) {
  46086. // return a placeholder node for async component, which is rendered
  46087. // as a comment node but preserves all the raw information for the node.
  46088. // the information will be used for async server-rendering and hydration.
  46089. return createAsyncPlaceholder(
  46090. asyncFactory,
  46091. data,
  46092. context,
  46093. children,
  46094. tag
  46095. )
  46096. }
  46097. }
  46098. data = data || {};
  46099. // resolve constructor options in case global mixins are applied after
  46100. // component constructor creation
  46101. resolveConstructorOptions(Ctor);
  46102. // transform component v-model data into props & events
  46103. if (isDef(data.model)) {
  46104. transformModel(Ctor.options, data);
  46105. }
  46106. // extract props
  46107. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46108. // functional component
  46109. if (isTrue(Ctor.options.functional)) {
  46110. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46111. }
  46112. // extract listeners, since these needs to be treated as
  46113. // child component listeners instead of DOM listeners
  46114. var listeners = data.on;
  46115. // replace with listeners with .native modifier
  46116. // so it gets processed during parent component patch.
  46117. data.on = data.nativeOn;
  46118. if (isTrue(Ctor.options.abstract)) {
  46119. // abstract components do not keep anything
  46120. // other than props & listeners & slot
  46121. // work around flow
  46122. var slot = data.slot;
  46123. data = {};
  46124. if (slot) {
  46125. data.slot = slot;
  46126. }
  46127. }
  46128. // install component management hooks onto the placeholder node
  46129. installComponentHooks(data);
  46130. // return a placeholder vnode
  46131. var name = Ctor.options.name || tag;
  46132. var vnode = new VNode(
  46133. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46134. data, undefined, undefined, undefined, context,
  46135. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46136. asyncFactory
  46137. );
  46138. return vnode
  46139. }
  46140. function createComponentInstanceForVnode (
  46141. vnode, // we know it's MountedComponentVNode but flow doesn't
  46142. parent // activeInstance in lifecycle state
  46143. ) {
  46144. var options = {
  46145. _isComponent: true,
  46146. _parentVnode: vnode,
  46147. parent: parent
  46148. };
  46149. // check inline-template render functions
  46150. var inlineTemplate = vnode.data.inlineTemplate;
  46151. if (isDef(inlineTemplate)) {
  46152. options.render = inlineTemplate.render;
  46153. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46154. }
  46155. return new vnode.componentOptions.Ctor(options)
  46156. }
  46157. function installComponentHooks (data) {
  46158. var hooks = data.hook || (data.hook = {});
  46159. for (var i = 0; i < hooksToMerge.length; i++) {
  46160. var key = hooksToMerge[i];
  46161. var existing = hooks[key];
  46162. var toMerge = componentVNodeHooks[key];
  46163. if (existing !== toMerge && !(existing && existing._merged)) {
  46164. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46165. }
  46166. }
  46167. }
  46168. function mergeHook$1 (f1, f2) {
  46169. var merged = function (a, b) {
  46170. // flow complains about extra args which is why we use any
  46171. f1(a, b);
  46172. f2(a, b);
  46173. };
  46174. merged._merged = true;
  46175. return merged
  46176. }
  46177. // transform component v-model info (value and callback) into
  46178. // prop and event handler respectively.
  46179. function transformModel (options, data) {
  46180. var prop = (options.model && options.model.prop) || 'value';
  46181. var event = (options.model && options.model.event) || 'input'
  46182. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  46183. var on = data.on || (data.on = {});
  46184. var existing = on[event];
  46185. var callback = data.model.callback;
  46186. if (isDef(existing)) {
  46187. if (
  46188. Array.isArray(existing)
  46189. ? existing.indexOf(callback) === -1
  46190. : existing !== callback
  46191. ) {
  46192. on[event] = [callback].concat(existing);
  46193. }
  46194. } else {
  46195. on[event] = callback;
  46196. }
  46197. }
  46198. /* */
  46199. var SIMPLE_NORMALIZE = 1;
  46200. var ALWAYS_NORMALIZE = 2;
  46201. // wrapper function for providing a more flexible interface
  46202. // without getting yelled at by flow
  46203. function createElement (
  46204. context,
  46205. tag,
  46206. data,
  46207. children,
  46208. normalizationType,
  46209. alwaysNormalize
  46210. ) {
  46211. if (Array.isArray(data) || isPrimitive(data)) {
  46212. normalizationType = children;
  46213. children = data;
  46214. data = undefined;
  46215. }
  46216. if (isTrue(alwaysNormalize)) {
  46217. normalizationType = ALWAYS_NORMALIZE;
  46218. }
  46219. return _createElement(context, tag, data, children, normalizationType)
  46220. }
  46221. function _createElement (
  46222. context,
  46223. tag,
  46224. data,
  46225. children,
  46226. normalizationType
  46227. ) {
  46228. if (isDef(data) && isDef((data).__ob__)) {
  46229. warn(
  46230. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  46231. 'Always create fresh vnode data objects in each render!',
  46232. context
  46233. );
  46234. return createEmptyVNode()
  46235. }
  46236. // object syntax in v-bind
  46237. if (isDef(data) && isDef(data.is)) {
  46238. tag = data.is;
  46239. }
  46240. if (!tag) {
  46241. // in case of component :is set to falsy value
  46242. return createEmptyVNode()
  46243. }
  46244. // warn against non-primitive key
  46245. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  46246. ) {
  46247. {
  46248. warn(
  46249. 'Avoid using non-primitive value as key, ' +
  46250. 'use string/number value instead.',
  46251. context
  46252. );
  46253. }
  46254. }
  46255. // support single function children as default scoped slot
  46256. if (Array.isArray(children) &&
  46257. typeof children[0] === 'function'
  46258. ) {
  46259. data = data || {};
  46260. data.scopedSlots = { default: children[0] };
  46261. children.length = 0;
  46262. }
  46263. if (normalizationType === ALWAYS_NORMALIZE) {
  46264. children = normalizeChildren(children);
  46265. } else if (normalizationType === SIMPLE_NORMALIZE) {
  46266. children = simpleNormalizeChildren(children);
  46267. }
  46268. var vnode, ns;
  46269. if (typeof tag === 'string') {
  46270. var Ctor;
  46271. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  46272. if (config.isReservedTag(tag)) {
  46273. // platform built-in elements
  46274. if (isDef(data) && isDef(data.nativeOn)) {
  46275. warn(
  46276. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  46277. context
  46278. );
  46279. }
  46280. vnode = new VNode(
  46281. config.parsePlatformTagName(tag), data, children,
  46282. undefined, undefined, context
  46283. );
  46284. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  46285. // component
  46286. vnode = createComponent(Ctor, data, context, children, tag);
  46287. } else {
  46288. // unknown or unlisted namespaced elements
  46289. // check at runtime because it may get assigned a namespace when its
  46290. // parent normalizes children
  46291. vnode = new VNode(
  46292. tag, data, children,
  46293. undefined, undefined, context
  46294. );
  46295. }
  46296. } else {
  46297. // direct component options / constructor
  46298. vnode = createComponent(tag, data, context, children);
  46299. }
  46300. if (Array.isArray(vnode)) {
  46301. return vnode
  46302. } else if (isDef(vnode)) {
  46303. if (isDef(ns)) { applyNS(vnode, ns); }
  46304. if (isDef(data)) { registerDeepBindings(data); }
  46305. return vnode
  46306. } else {
  46307. return createEmptyVNode()
  46308. }
  46309. }
  46310. function applyNS (vnode, ns, force) {
  46311. vnode.ns = ns;
  46312. if (vnode.tag === 'foreignObject') {
  46313. // use default namespace inside foreignObject
  46314. ns = undefined;
  46315. force = true;
  46316. }
  46317. if (isDef(vnode.children)) {
  46318. for (var i = 0, l = vnode.children.length; i < l; i++) {
  46319. var child = vnode.children[i];
  46320. if (isDef(child.tag) && (
  46321. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  46322. applyNS(child, ns, force);
  46323. }
  46324. }
  46325. }
  46326. }
  46327. // ref #5318
  46328. // necessary to ensure parent re-render when deep bindings like :style and
  46329. // :class are used on slot nodes
  46330. function registerDeepBindings (data) {
  46331. if (isObject(data.style)) {
  46332. traverse(data.style);
  46333. }
  46334. if (isObject(data.class)) {
  46335. traverse(data.class);
  46336. }
  46337. }
  46338. /* */
  46339. function initRender (vm) {
  46340. vm._vnode = null; // the root of the child tree
  46341. vm._staticTrees = null; // v-once cached trees
  46342. var options = vm.$options;
  46343. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  46344. var renderContext = parentVnode && parentVnode.context;
  46345. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  46346. vm.$scopedSlots = emptyObject;
  46347. // bind the createElement fn to this instance
  46348. // so that we get proper render context inside it.
  46349. // args order: tag, data, children, normalizationType, alwaysNormalize
  46350. // internal version is used by render functions compiled from templates
  46351. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46352. // normalization is always applied for the public version, used in
  46353. // user-written render functions.
  46354. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46355. // $attrs & $listeners are exposed for easier HOC creation.
  46356. // they need to be reactive so that HOCs using them are always updated
  46357. var parentData = parentVnode && parentVnode.data;
  46358. /* istanbul ignore else */
  46359. {
  46360. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46361. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46362. }, true);
  46363. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46364. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46365. }, true);
  46366. }
  46367. }
  46368. var currentRenderingInstance = null;
  46369. function renderMixin (Vue) {
  46370. // install runtime convenience helpers
  46371. installRenderHelpers(Vue.prototype);
  46372. Vue.prototype.$nextTick = function (fn) {
  46373. return nextTick(fn, this)
  46374. };
  46375. Vue.prototype._render = function () {
  46376. var vm = this;
  46377. var ref = vm.$options;
  46378. var render = ref.render;
  46379. var _parentVnode = ref._parentVnode;
  46380. if (_parentVnode) {
  46381. vm.$scopedSlots = normalizeScopedSlots(
  46382. _parentVnode.data.scopedSlots,
  46383. vm.$slots,
  46384. vm.$scopedSlots
  46385. );
  46386. }
  46387. // set parent vnode. this allows render functions to have access
  46388. // to the data on the placeholder node.
  46389. vm.$vnode = _parentVnode;
  46390. // render self
  46391. var vnode;
  46392. try {
  46393. // There's no need to maintain a stack because all render fns are called
  46394. // separately from one another. Nested component's render fns are called
  46395. // when parent component is patched.
  46396. currentRenderingInstance = vm;
  46397. vnode = render.call(vm._renderProxy, vm.$createElement);
  46398. } catch (e) {
  46399. handleError(e, vm, "render");
  46400. // return error render result,
  46401. // or previous vnode to prevent render error causing blank component
  46402. /* istanbul ignore else */
  46403. if (vm.$options.renderError) {
  46404. try {
  46405. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46406. } catch (e) {
  46407. handleError(e, vm, "renderError");
  46408. vnode = vm._vnode;
  46409. }
  46410. } else {
  46411. vnode = vm._vnode;
  46412. }
  46413. } finally {
  46414. currentRenderingInstance = null;
  46415. }
  46416. // if the returned array contains only a single node, allow it
  46417. if (Array.isArray(vnode) && vnode.length === 1) {
  46418. vnode = vnode[0];
  46419. }
  46420. // return empty vnode in case the render function errored out
  46421. if (!(vnode instanceof VNode)) {
  46422. if (Array.isArray(vnode)) {
  46423. warn(
  46424. 'Multiple root nodes returned from render function. Render function ' +
  46425. 'should return a single root node.',
  46426. vm
  46427. );
  46428. }
  46429. vnode = createEmptyVNode();
  46430. }
  46431. // set parent
  46432. vnode.parent = _parentVnode;
  46433. return vnode
  46434. };
  46435. }
  46436. /* */
  46437. function ensureCtor (comp, base) {
  46438. if (
  46439. comp.__esModule ||
  46440. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  46441. ) {
  46442. comp = comp.default;
  46443. }
  46444. return isObject(comp)
  46445. ? base.extend(comp)
  46446. : comp
  46447. }
  46448. function createAsyncPlaceholder (
  46449. factory,
  46450. data,
  46451. context,
  46452. children,
  46453. tag
  46454. ) {
  46455. var node = createEmptyVNode();
  46456. node.asyncFactory = factory;
  46457. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  46458. return node
  46459. }
  46460. function resolveAsyncComponent (
  46461. factory,
  46462. baseCtor
  46463. ) {
  46464. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  46465. return factory.errorComp
  46466. }
  46467. if (isDef(factory.resolved)) {
  46468. return factory.resolved
  46469. }
  46470. var owner = currentRenderingInstance;
  46471. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  46472. // already pending
  46473. factory.owners.push(owner);
  46474. }
  46475. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  46476. return factory.loadingComp
  46477. }
  46478. if (owner && !isDef(factory.owners)) {
  46479. var owners = factory.owners = [owner];
  46480. var sync = true;
  46481. var timerLoading = null;
  46482. var timerTimeout = null
  46483. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  46484. var forceRender = function (renderCompleted) {
  46485. for (var i = 0, l = owners.length; i < l; i++) {
  46486. (owners[i]).$forceUpdate();
  46487. }
  46488. if (renderCompleted) {
  46489. owners.length = 0;
  46490. if (timerLoading !== null) {
  46491. clearTimeout(timerLoading);
  46492. timerLoading = null;
  46493. }
  46494. if (timerTimeout !== null) {
  46495. clearTimeout(timerTimeout);
  46496. timerTimeout = null;
  46497. }
  46498. }
  46499. };
  46500. var resolve = once(function (res) {
  46501. // cache resolved
  46502. factory.resolved = ensureCtor(res, baseCtor);
  46503. // invoke callbacks only if this is not a synchronous resolve
  46504. // (async resolves are shimmed as synchronous during SSR)
  46505. if (!sync) {
  46506. forceRender(true);
  46507. } else {
  46508. owners.length = 0;
  46509. }
  46510. });
  46511. var reject = once(function (reason) {
  46512. warn(
  46513. "Failed to resolve async component: " + (String(factory)) +
  46514. (reason ? ("\nReason: " + reason) : '')
  46515. );
  46516. if (isDef(factory.errorComp)) {
  46517. factory.error = true;
  46518. forceRender(true);
  46519. }
  46520. });
  46521. var res = factory(resolve, reject);
  46522. if (isObject(res)) {
  46523. if (isPromise(res)) {
  46524. // () => Promise
  46525. if (isUndef(factory.resolved)) {
  46526. res.then(resolve, reject);
  46527. }
  46528. } else if (isPromise(res.component)) {
  46529. res.component.then(resolve, reject);
  46530. if (isDef(res.error)) {
  46531. factory.errorComp = ensureCtor(res.error, baseCtor);
  46532. }
  46533. if (isDef(res.loading)) {
  46534. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  46535. if (res.delay === 0) {
  46536. factory.loading = true;
  46537. } else {
  46538. timerLoading = setTimeout(function () {
  46539. timerLoading = null;
  46540. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  46541. factory.loading = true;
  46542. forceRender(false);
  46543. }
  46544. }, res.delay || 200);
  46545. }
  46546. }
  46547. if (isDef(res.timeout)) {
  46548. timerTimeout = setTimeout(function () {
  46549. timerTimeout = null;
  46550. if (isUndef(factory.resolved)) {
  46551. reject(
  46552. "timeout (" + (res.timeout) + "ms)"
  46553. );
  46554. }
  46555. }, res.timeout);
  46556. }
  46557. }
  46558. }
  46559. sync = false;
  46560. // return in case resolved synchronously
  46561. return factory.loading
  46562. ? factory.loadingComp
  46563. : factory.resolved
  46564. }
  46565. }
  46566. /* */
  46567. function isAsyncPlaceholder (node) {
  46568. return node.isComment && node.asyncFactory
  46569. }
  46570. /* */
  46571. function getFirstComponentChild (children) {
  46572. if (Array.isArray(children)) {
  46573. for (var i = 0; i < children.length; i++) {
  46574. var c = children[i];
  46575. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  46576. return c
  46577. }
  46578. }
  46579. }
  46580. }
  46581. /* */
  46582. /* */
  46583. function initEvents (vm) {
  46584. vm._events = Object.create(null);
  46585. vm._hasHookEvent = false;
  46586. // init parent attached events
  46587. var listeners = vm.$options._parentListeners;
  46588. if (listeners) {
  46589. updateComponentListeners(vm, listeners);
  46590. }
  46591. }
  46592. var target;
  46593. function add (event, fn) {
  46594. target.$on(event, fn);
  46595. }
  46596. function remove$1 (event, fn) {
  46597. target.$off(event, fn);
  46598. }
  46599. function createOnceHandler (event, fn) {
  46600. var _target = target;
  46601. return function onceHandler () {
  46602. var res = fn.apply(null, arguments);
  46603. if (res !== null) {
  46604. _target.$off(event, onceHandler);
  46605. }
  46606. }
  46607. }
  46608. function updateComponentListeners (
  46609. vm,
  46610. listeners,
  46611. oldListeners
  46612. ) {
  46613. target = vm;
  46614. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  46615. target = undefined;
  46616. }
  46617. function eventsMixin (Vue) {
  46618. var hookRE = /^hook:/;
  46619. Vue.prototype.$on = function (event, fn) {
  46620. var vm = this;
  46621. if (Array.isArray(event)) {
  46622. for (var i = 0, l = event.length; i < l; i++) {
  46623. vm.$on(event[i], fn);
  46624. }
  46625. } else {
  46626. (vm._events[event] || (vm._events[event] = [])).push(fn);
  46627. // optimize hook:event cost by using a boolean flag marked at registration
  46628. // instead of a hash lookup
  46629. if (hookRE.test(event)) {
  46630. vm._hasHookEvent = true;
  46631. }
  46632. }
  46633. return vm
  46634. };
  46635. Vue.prototype.$once = function (event, fn) {
  46636. var vm = this;
  46637. function on () {
  46638. vm.$off(event, on);
  46639. fn.apply(vm, arguments);
  46640. }
  46641. on.fn = fn;
  46642. vm.$on(event, on);
  46643. return vm
  46644. };
  46645. Vue.prototype.$off = function (event, fn) {
  46646. var vm = this;
  46647. // all
  46648. if (!arguments.length) {
  46649. vm._events = Object.create(null);
  46650. return vm
  46651. }
  46652. // array of events
  46653. if (Array.isArray(event)) {
  46654. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  46655. vm.$off(event[i$1], fn);
  46656. }
  46657. return vm
  46658. }
  46659. // specific event
  46660. var cbs = vm._events[event];
  46661. if (!cbs) {
  46662. return vm
  46663. }
  46664. if (!fn) {
  46665. vm._events[event] = null;
  46666. return vm
  46667. }
  46668. // specific handler
  46669. var cb;
  46670. var i = cbs.length;
  46671. while (i--) {
  46672. cb = cbs[i];
  46673. if (cb === fn || cb.fn === fn) {
  46674. cbs.splice(i, 1);
  46675. break
  46676. }
  46677. }
  46678. return vm
  46679. };
  46680. Vue.prototype.$emit = function (event) {
  46681. var vm = this;
  46682. {
  46683. var lowerCaseEvent = event.toLowerCase();
  46684. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  46685. tip(
  46686. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  46687. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  46688. "Note that HTML attributes are case-insensitive and you cannot use " +
  46689. "v-on to listen to camelCase events when using in-DOM templates. " +
  46690. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  46691. );
  46692. }
  46693. }
  46694. var cbs = vm._events[event];
  46695. if (cbs) {
  46696. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  46697. var args = toArray(arguments, 1);
  46698. var info = "event handler for \"" + event + "\"";
  46699. for (var i = 0, l = cbs.length; i < l; i++) {
  46700. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  46701. }
  46702. }
  46703. return vm
  46704. };
  46705. }
  46706. /* */
  46707. var activeInstance = null;
  46708. var isUpdatingChildComponent = false;
  46709. function setActiveInstance(vm) {
  46710. var prevActiveInstance = activeInstance;
  46711. activeInstance = vm;
  46712. return function () {
  46713. activeInstance = prevActiveInstance;
  46714. }
  46715. }
  46716. function initLifecycle (vm) {
  46717. var options = vm.$options;
  46718. // locate first non-abstract parent
  46719. var parent = options.parent;
  46720. if (parent && !options.abstract) {
  46721. while (parent.$options.abstract && parent.$parent) {
  46722. parent = parent.$parent;
  46723. }
  46724. parent.$children.push(vm);
  46725. }
  46726. vm.$parent = parent;
  46727. vm.$root = parent ? parent.$root : vm;
  46728. vm.$children = [];
  46729. vm.$refs = {};
  46730. vm._watcher = null;
  46731. vm._inactive = null;
  46732. vm._directInactive = false;
  46733. vm._isMounted = false;
  46734. vm._isDestroyed = false;
  46735. vm._isBeingDestroyed = false;
  46736. }
  46737. function lifecycleMixin (Vue) {
  46738. Vue.prototype._update = function (vnode, hydrating) {
  46739. var vm = this;
  46740. var prevEl = vm.$el;
  46741. var prevVnode = vm._vnode;
  46742. var restoreActiveInstance = setActiveInstance(vm);
  46743. vm._vnode = vnode;
  46744. // Vue.prototype.__patch__ is injected in entry points
  46745. // based on the rendering backend used.
  46746. if (!prevVnode) {
  46747. // initial render
  46748. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  46749. } else {
  46750. // updates
  46751. vm.$el = vm.__patch__(prevVnode, vnode);
  46752. }
  46753. restoreActiveInstance();
  46754. // update __vue__ reference
  46755. if (prevEl) {
  46756. prevEl.__vue__ = null;
  46757. }
  46758. if (vm.$el) {
  46759. vm.$el.__vue__ = vm;
  46760. }
  46761. // if parent is an HOC, update its $el as well
  46762. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  46763. vm.$parent.$el = vm.$el;
  46764. }
  46765. // updated hook is called by the scheduler to ensure that children are
  46766. // updated in a parent's updated hook.
  46767. };
  46768. Vue.prototype.$forceUpdate = function () {
  46769. var vm = this;
  46770. if (vm._watcher) {
  46771. vm._watcher.update();
  46772. }
  46773. };
  46774. Vue.prototype.$destroy = function () {
  46775. var vm = this;
  46776. if (vm._isBeingDestroyed) {
  46777. return
  46778. }
  46779. callHook(vm, 'beforeDestroy');
  46780. vm._isBeingDestroyed = true;
  46781. // remove self from parent
  46782. var parent = vm.$parent;
  46783. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  46784. remove(parent.$children, vm);
  46785. }
  46786. // teardown watchers
  46787. if (vm._watcher) {
  46788. vm._watcher.teardown();
  46789. }
  46790. var i = vm._watchers.length;
  46791. while (i--) {
  46792. vm._watchers[i].teardown();
  46793. }
  46794. // remove reference from data ob
  46795. // frozen object may not have observer.
  46796. if (vm._data.__ob__) {
  46797. vm._data.__ob__.vmCount--;
  46798. }
  46799. // call the last hook...
  46800. vm._isDestroyed = true;
  46801. // invoke destroy hooks on current rendered tree
  46802. vm.__patch__(vm._vnode, null);
  46803. // fire destroyed hook
  46804. callHook(vm, 'destroyed');
  46805. // turn off all instance listeners.
  46806. vm.$off();
  46807. // remove __vue__ reference
  46808. if (vm.$el) {
  46809. vm.$el.__vue__ = null;
  46810. }
  46811. // release circular reference (#6759)
  46812. if (vm.$vnode) {
  46813. vm.$vnode.parent = null;
  46814. }
  46815. };
  46816. }
  46817. function mountComponent (
  46818. vm,
  46819. el,
  46820. hydrating
  46821. ) {
  46822. vm.$el = el;
  46823. if (!vm.$options.render) {
  46824. vm.$options.render = createEmptyVNode;
  46825. {
  46826. /* istanbul ignore if */
  46827. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  46828. vm.$options.el || el) {
  46829. warn(
  46830. 'You are using the runtime-only build of Vue where the template ' +
  46831. 'compiler is not available. Either pre-compile the templates into ' +
  46832. 'render functions, or use the compiler-included build.',
  46833. vm
  46834. );
  46835. } else {
  46836. warn(
  46837. 'Failed to mount component: template or render function not defined.',
  46838. vm
  46839. );
  46840. }
  46841. }
  46842. }
  46843. callHook(vm, 'beforeMount');
  46844. var updateComponent;
  46845. /* istanbul ignore if */
  46846. if (config.performance && mark) {
  46847. updateComponent = function () {
  46848. var name = vm._name;
  46849. var id = vm._uid;
  46850. var startTag = "vue-perf-start:" + id;
  46851. var endTag = "vue-perf-end:" + id;
  46852. mark(startTag);
  46853. var vnode = vm._render();
  46854. mark(endTag);
  46855. measure(("vue " + name + " render"), startTag, endTag);
  46856. mark(startTag);
  46857. vm._update(vnode, hydrating);
  46858. mark(endTag);
  46859. measure(("vue " + name + " patch"), startTag, endTag);
  46860. };
  46861. } else {
  46862. updateComponent = function () {
  46863. vm._update(vm._render(), hydrating);
  46864. };
  46865. }
  46866. // we set this to vm._watcher inside the watcher's constructor
  46867. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  46868. // component's mounted hook), which relies on vm._watcher being already defined
  46869. new Watcher(vm, updateComponent, noop, {
  46870. before: function before () {
  46871. if (vm._isMounted && !vm._isDestroyed) {
  46872. callHook(vm, 'beforeUpdate');
  46873. }
  46874. }
  46875. }, true /* isRenderWatcher */);
  46876. hydrating = false;
  46877. // manually mounted instance, call mounted on self
  46878. // mounted is called for render-created child components in its inserted hook
  46879. if (vm.$vnode == null) {
  46880. vm._isMounted = true;
  46881. callHook(vm, 'mounted');
  46882. }
  46883. return vm
  46884. }
  46885. function updateChildComponent (
  46886. vm,
  46887. propsData,
  46888. listeners,
  46889. parentVnode,
  46890. renderChildren
  46891. ) {
  46892. {
  46893. isUpdatingChildComponent = true;
  46894. }
  46895. // determine whether component has slot children
  46896. // we need to do this before overwriting $options._renderChildren.
  46897. // check if there are dynamic scopedSlots (hand-written or compiled but with
  46898. // dynamic slot names). Static scoped slots compiled from template has the
  46899. // "$stable" marker.
  46900. var newScopedSlots = parentVnode.data.scopedSlots;
  46901. var oldScopedSlots = vm.$scopedSlots;
  46902. var hasDynamicScopedSlot = !!(
  46903. (newScopedSlots && !newScopedSlots.$stable) ||
  46904. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  46905. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  46906. );
  46907. // Any static slot children from the parent may have changed during parent's
  46908. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  46909. // update is necessary to ensure correctness.
  46910. var needsForceUpdate = !!(
  46911. renderChildren || // has new static slots
  46912. vm.$options._renderChildren || // has old static slots
  46913. hasDynamicScopedSlot
  46914. );
  46915. vm.$options._parentVnode = parentVnode;
  46916. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  46917. if (vm._vnode) { // update child tree's parent
  46918. vm._vnode.parent = parentVnode;
  46919. }
  46920. vm.$options._renderChildren = renderChildren;
  46921. // update $attrs and $listeners hash
  46922. // these are also reactive so they may trigger child update if the child
  46923. // used them during render
  46924. vm.$attrs = parentVnode.data.attrs || emptyObject;
  46925. vm.$listeners = listeners || emptyObject;
  46926. // update props
  46927. if (propsData && vm.$options.props) {
  46928. toggleObserving(false);
  46929. var props = vm._props;
  46930. var propKeys = vm.$options._propKeys || [];
  46931. for (var i = 0; i < propKeys.length; i++) {
  46932. var key = propKeys[i];
  46933. var propOptions = vm.$options.props; // wtf flow?
  46934. props[key] = validateProp(key, propOptions, propsData, vm);
  46935. }
  46936. toggleObserving(true);
  46937. // keep a copy of raw propsData
  46938. vm.$options.propsData = propsData;
  46939. }
  46940. // update listeners
  46941. listeners = listeners || emptyObject;
  46942. var oldListeners = vm.$options._parentListeners;
  46943. vm.$options._parentListeners = listeners;
  46944. updateComponentListeners(vm, listeners, oldListeners);
  46945. // resolve slots + force update if has children
  46946. if (needsForceUpdate) {
  46947. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  46948. vm.$forceUpdate();
  46949. }
  46950. {
  46951. isUpdatingChildComponent = false;
  46952. }
  46953. }
  46954. function isInInactiveTree (vm) {
  46955. while (vm && (vm = vm.$parent)) {
  46956. if (vm._inactive) { return true }
  46957. }
  46958. return false
  46959. }
  46960. function activateChildComponent (vm, direct) {
  46961. if (direct) {
  46962. vm._directInactive = false;
  46963. if (isInInactiveTree(vm)) {
  46964. return
  46965. }
  46966. } else if (vm._directInactive) {
  46967. return
  46968. }
  46969. if (vm._inactive || vm._inactive === null) {
  46970. vm._inactive = false;
  46971. for (var i = 0; i < vm.$children.length; i++) {
  46972. activateChildComponent(vm.$children[i]);
  46973. }
  46974. callHook(vm, 'activated');
  46975. }
  46976. }
  46977. function deactivateChildComponent (vm, direct) {
  46978. if (direct) {
  46979. vm._directInactive = true;
  46980. if (isInInactiveTree(vm)) {
  46981. return
  46982. }
  46983. }
  46984. if (!vm._inactive) {
  46985. vm._inactive = true;
  46986. for (var i = 0; i < vm.$children.length; i++) {
  46987. deactivateChildComponent(vm.$children[i]);
  46988. }
  46989. callHook(vm, 'deactivated');
  46990. }
  46991. }
  46992. function callHook (vm, hook) {
  46993. // #7573 disable dep collection when invoking lifecycle hooks
  46994. pushTarget();
  46995. var handlers = vm.$options[hook];
  46996. var info = hook + " hook";
  46997. if (handlers) {
  46998. for (var i = 0, j = handlers.length; i < j; i++) {
  46999. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47000. }
  47001. }
  47002. if (vm._hasHookEvent) {
  47003. vm.$emit('hook:' + hook);
  47004. }
  47005. popTarget();
  47006. }
  47007. /* */
  47008. var MAX_UPDATE_COUNT = 100;
  47009. var queue = [];
  47010. var activatedChildren = [];
  47011. var has = {};
  47012. var circular = {};
  47013. var waiting = false;
  47014. var flushing = false;
  47015. var index = 0;
  47016. /**
  47017. * Reset the scheduler's state.
  47018. */
  47019. function resetSchedulerState () {
  47020. index = queue.length = activatedChildren.length = 0;
  47021. has = {};
  47022. {
  47023. circular = {};
  47024. }
  47025. waiting = flushing = false;
  47026. }
  47027. // Async edge case #6566 requires saving the timestamp when event listeners are
  47028. // attached. However, calling performance.now() has a perf overhead especially
  47029. // if the page has thousands of event listeners. Instead, we take a timestamp
  47030. // every time the scheduler flushes and use that for all event listeners
  47031. // attached during that flush.
  47032. var currentFlushTimestamp = 0;
  47033. // Async edge case fix requires storing an event listener's attach timestamp.
  47034. var getNow = Date.now;
  47035. // Determine what event timestamp the browser is using. Annoyingly, the
  47036. // timestamp can either be hi-res (relative to page load) or low-res
  47037. // (relative to UNIX epoch), so in order to compare time we have to use the
  47038. // same timestamp type when saving the flush timestamp.
  47039. // All IE versions use low-res event timestamps, and have problematic clock
  47040. // implementations (#9632)
  47041. if (inBrowser && !isIE) {
  47042. var performance = window.performance;
  47043. if (
  47044. performance &&
  47045. typeof performance.now === 'function' &&
  47046. getNow() > document.createEvent('Event').timeStamp
  47047. ) {
  47048. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47049. // smaller than it, it means the event is using a hi-res timestamp,
  47050. // and we need to use the hi-res version for event listener timestamps as
  47051. // well.
  47052. getNow = function () { return performance.now(); };
  47053. }
  47054. }
  47055. /**
  47056. * Flush both queues and run the watchers.
  47057. */
  47058. function flushSchedulerQueue () {
  47059. currentFlushTimestamp = getNow();
  47060. flushing = true;
  47061. var watcher, id;
  47062. // Sort queue before flush.
  47063. // This ensures that:
  47064. // 1. Components are updated from parent to child. (because parent is always
  47065. // created before the child)
  47066. // 2. A component's user watchers are run before its render watcher (because
  47067. // user watchers are created before the render watcher)
  47068. // 3. If a component is destroyed during a parent component's watcher run,
  47069. // its watchers can be skipped.
  47070. queue.sort(function (a, b) { return a.id - b.id; });
  47071. // do not cache length because more watchers might be pushed
  47072. // as we run existing watchers
  47073. for (index = 0; index < queue.length; index++) {
  47074. watcher = queue[index];
  47075. if (watcher.before) {
  47076. watcher.before();
  47077. }
  47078. id = watcher.id;
  47079. has[id] = null;
  47080. watcher.run();
  47081. // in dev build, check and stop circular updates.
  47082. if (has[id] != null) {
  47083. circular[id] = (circular[id] || 0) + 1;
  47084. if (circular[id] > MAX_UPDATE_COUNT) {
  47085. warn(
  47086. 'You may have an infinite update loop ' + (
  47087. watcher.user
  47088. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47089. : "in a component render function."
  47090. ),
  47091. watcher.vm
  47092. );
  47093. break
  47094. }
  47095. }
  47096. }
  47097. // keep copies of post queues before resetting state
  47098. var activatedQueue = activatedChildren.slice();
  47099. var updatedQueue = queue.slice();
  47100. resetSchedulerState();
  47101. // call component updated and activated hooks
  47102. callActivatedHooks(activatedQueue);
  47103. callUpdatedHooks(updatedQueue);
  47104. // devtool hook
  47105. /* istanbul ignore if */
  47106. if (devtools && config.devtools) {
  47107. devtools.emit('flush');
  47108. }
  47109. }
  47110. function callUpdatedHooks (queue) {
  47111. var i = queue.length;
  47112. while (i--) {
  47113. var watcher = queue[i];
  47114. var vm = watcher.vm;
  47115. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47116. callHook(vm, 'updated');
  47117. }
  47118. }
  47119. }
  47120. /**
  47121. * Queue a kept-alive component that was activated during patch.
  47122. * The queue will be processed after the entire tree has been patched.
  47123. */
  47124. function queueActivatedComponent (vm) {
  47125. // setting _inactive to false here so that a render function can
  47126. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47127. vm._inactive = false;
  47128. activatedChildren.push(vm);
  47129. }
  47130. function callActivatedHooks (queue) {
  47131. for (var i = 0; i < queue.length; i++) {
  47132. queue[i]._inactive = true;
  47133. activateChildComponent(queue[i], true /* true */);
  47134. }
  47135. }
  47136. /**
  47137. * Push a watcher into the watcher queue.
  47138. * Jobs with duplicate IDs will be skipped unless it's
  47139. * pushed when the queue is being flushed.
  47140. */
  47141. function queueWatcher (watcher) {
  47142. var id = watcher.id;
  47143. if (has[id] == null) {
  47144. has[id] = true;
  47145. if (!flushing) {
  47146. queue.push(watcher);
  47147. } else {
  47148. // if already flushing, splice the watcher based on its id
  47149. // if already past its id, it will be run next immediately.
  47150. var i = queue.length - 1;
  47151. while (i > index && queue[i].id > watcher.id) {
  47152. i--;
  47153. }
  47154. queue.splice(i + 1, 0, watcher);
  47155. }
  47156. // queue the flush
  47157. if (!waiting) {
  47158. waiting = true;
  47159. if (!config.async) {
  47160. flushSchedulerQueue();
  47161. return
  47162. }
  47163. nextTick(flushSchedulerQueue);
  47164. }
  47165. }
  47166. }
  47167. /* */
  47168. var uid$2 = 0;
  47169. /**
  47170. * A watcher parses an expression, collects dependencies,
  47171. * and fires callback when the expression value changes.
  47172. * This is used for both the $watch() api and directives.
  47173. */
  47174. var Watcher = function Watcher (
  47175. vm,
  47176. expOrFn,
  47177. cb,
  47178. options,
  47179. isRenderWatcher
  47180. ) {
  47181. this.vm = vm;
  47182. if (isRenderWatcher) {
  47183. vm._watcher = this;
  47184. }
  47185. vm._watchers.push(this);
  47186. // options
  47187. if (options) {
  47188. this.deep = !!options.deep;
  47189. this.user = !!options.user;
  47190. this.lazy = !!options.lazy;
  47191. this.sync = !!options.sync;
  47192. this.before = options.before;
  47193. } else {
  47194. this.deep = this.user = this.lazy = this.sync = false;
  47195. }
  47196. this.cb = cb;
  47197. this.id = ++uid$2; // uid for batching
  47198. this.active = true;
  47199. this.dirty = this.lazy; // for lazy watchers
  47200. this.deps = [];
  47201. this.newDeps = [];
  47202. this.depIds = new _Set();
  47203. this.newDepIds = new _Set();
  47204. this.expression = expOrFn.toString();
  47205. // parse expression for getter
  47206. if (typeof expOrFn === 'function') {
  47207. this.getter = expOrFn;
  47208. } else {
  47209. this.getter = parsePath(expOrFn);
  47210. if (!this.getter) {
  47211. this.getter = noop;
  47212. warn(
  47213. "Failed watching path: \"" + expOrFn + "\" " +
  47214. 'Watcher only accepts simple dot-delimited paths. ' +
  47215. 'For full control, use a function instead.',
  47216. vm
  47217. );
  47218. }
  47219. }
  47220. this.value = this.lazy
  47221. ? undefined
  47222. : this.get();
  47223. };
  47224. /**
  47225. * Evaluate the getter, and re-collect dependencies.
  47226. */
  47227. Watcher.prototype.get = function get () {
  47228. pushTarget(this);
  47229. var value;
  47230. var vm = this.vm;
  47231. try {
  47232. value = this.getter.call(vm, vm);
  47233. } catch (e) {
  47234. if (this.user) {
  47235. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  47236. } else {
  47237. throw e
  47238. }
  47239. } finally {
  47240. // "touch" every property so they are all tracked as
  47241. // dependencies for deep watching
  47242. if (this.deep) {
  47243. traverse(value);
  47244. }
  47245. popTarget();
  47246. this.cleanupDeps();
  47247. }
  47248. return value
  47249. };
  47250. /**
  47251. * Add a dependency to this directive.
  47252. */
  47253. Watcher.prototype.addDep = function addDep (dep) {
  47254. var id = dep.id;
  47255. if (!this.newDepIds.has(id)) {
  47256. this.newDepIds.add(id);
  47257. this.newDeps.push(dep);
  47258. if (!this.depIds.has(id)) {
  47259. dep.addSub(this);
  47260. }
  47261. }
  47262. };
  47263. /**
  47264. * Clean up for dependency collection.
  47265. */
  47266. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  47267. var i = this.deps.length;
  47268. while (i--) {
  47269. var dep = this.deps[i];
  47270. if (!this.newDepIds.has(dep.id)) {
  47271. dep.removeSub(this);
  47272. }
  47273. }
  47274. var tmp = this.depIds;
  47275. this.depIds = this.newDepIds;
  47276. this.newDepIds = tmp;
  47277. this.newDepIds.clear();
  47278. tmp = this.deps;
  47279. this.deps = this.newDeps;
  47280. this.newDeps = tmp;
  47281. this.newDeps.length = 0;
  47282. };
  47283. /**
  47284. * Subscriber interface.
  47285. * Will be called when a dependency changes.
  47286. */
  47287. Watcher.prototype.update = function update () {
  47288. /* istanbul ignore else */
  47289. if (this.lazy) {
  47290. this.dirty = true;
  47291. } else if (this.sync) {
  47292. this.run();
  47293. } else {
  47294. queueWatcher(this);
  47295. }
  47296. };
  47297. /**
  47298. * Scheduler job interface.
  47299. * Will be called by the scheduler.
  47300. */
  47301. Watcher.prototype.run = function run () {
  47302. if (this.active) {
  47303. var value = this.get();
  47304. if (
  47305. value !== this.value ||
  47306. // Deep watchers and watchers on Object/Arrays should fire even
  47307. // when the value is the same, because the value may
  47308. // have mutated.
  47309. isObject(value) ||
  47310. this.deep
  47311. ) {
  47312. // set new value
  47313. var oldValue = this.value;
  47314. this.value = value;
  47315. if (this.user) {
  47316. try {
  47317. this.cb.call(this.vm, value, oldValue);
  47318. } catch (e) {
  47319. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  47320. }
  47321. } else {
  47322. this.cb.call(this.vm, value, oldValue);
  47323. }
  47324. }
  47325. }
  47326. };
  47327. /**
  47328. * Evaluate the value of the watcher.
  47329. * This only gets called for lazy watchers.
  47330. */
  47331. Watcher.prototype.evaluate = function evaluate () {
  47332. this.value = this.get();
  47333. this.dirty = false;
  47334. };
  47335. /**
  47336. * Depend on all deps collected by this watcher.
  47337. */
  47338. Watcher.prototype.depend = function depend () {
  47339. var i = this.deps.length;
  47340. while (i--) {
  47341. this.deps[i].depend();
  47342. }
  47343. };
  47344. /**
  47345. * Remove self from all dependencies' subscriber list.
  47346. */
  47347. Watcher.prototype.teardown = function teardown () {
  47348. if (this.active) {
  47349. // remove self from vm's watcher list
  47350. // this is a somewhat expensive operation so we skip it
  47351. // if the vm is being destroyed.
  47352. if (!this.vm._isBeingDestroyed) {
  47353. remove(this.vm._watchers, this);
  47354. }
  47355. var i = this.deps.length;
  47356. while (i--) {
  47357. this.deps[i].removeSub(this);
  47358. }
  47359. this.active = false;
  47360. }
  47361. };
  47362. /* */
  47363. var sharedPropertyDefinition = {
  47364. enumerable: true,
  47365. configurable: true,
  47366. get: noop,
  47367. set: noop
  47368. };
  47369. function proxy (target, sourceKey, key) {
  47370. sharedPropertyDefinition.get = function proxyGetter () {
  47371. return this[sourceKey][key]
  47372. };
  47373. sharedPropertyDefinition.set = function proxySetter (val) {
  47374. this[sourceKey][key] = val;
  47375. };
  47376. Object.defineProperty(target, key, sharedPropertyDefinition);
  47377. }
  47378. function initState (vm) {
  47379. vm._watchers = [];
  47380. var opts = vm.$options;
  47381. if (opts.props) { initProps(vm, opts.props); }
  47382. if (opts.methods) { initMethods(vm, opts.methods); }
  47383. if (opts.data) {
  47384. initData(vm);
  47385. } else {
  47386. observe(vm._data = {}, true /* asRootData */);
  47387. }
  47388. if (opts.computed) { initComputed(vm, opts.computed); }
  47389. if (opts.watch && opts.watch !== nativeWatch) {
  47390. initWatch(vm, opts.watch);
  47391. }
  47392. }
  47393. function initProps (vm, propsOptions) {
  47394. var propsData = vm.$options.propsData || {};
  47395. var props = vm._props = {};
  47396. // cache prop keys so that future props updates can iterate using Array
  47397. // instead of dynamic object key enumeration.
  47398. var keys = vm.$options._propKeys = [];
  47399. var isRoot = !vm.$parent;
  47400. // root instance props should be converted
  47401. if (!isRoot) {
  47402. toggleObserving(false);
  47403. }
  47404. var loop = function ( key ) {
  47405. keys.push(key);
  47406. var value = validateProp(key, propsOptions, propsData, vm);
  47407. /* istanbul ignore else */
  47408. {
  47409. var hyphenatedKey = hyphenate(key);
  47410. if (isReservedAttribute(hyphenatedKey) ||
  47411. config.isReservedAttr(hyphenatedKey)) {
  47412. warn(
  47413. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  47414. vm
  47415. );
  47416. }
  47417. defineReactive$$1(props, key, value, function () {
  47418. if (!isRoot && !isUpdatingChildComponent) {
  47419. warn(
  47420. "Avoid mutating a prop directly since the value will be " +
  47421. "overwritten whenever the parent component re-renders. " +
  47422. "Instead, use a data or computed property based on the prop's " +
  47423. "value. Prop being mutated: \"" + key + "\"",
  47424. vm
  47425. );
  47426. }
  47427. });
  47428. }
  47429. // static props are already proxied on the component's prototype
  47430. // during Vue.extend(). We only need to proxy props defined at
  47431. // instantiation here.
  47432. if (!(key in vm)) {
  47433. proxy(vm, "_props", key);
  47434. }
  47435. };
  47436. for (var key in propsOptions) loop( key );
  47437. toggleObserving(true);
  47438. }
  47439. function initData (vm) {
  47440. var data = vm.$options.data;
  47441. data = vm._data = typeof data === 'function'
  47442. ? getData(data, vm)
  47443. : data || {};
  47444. if (!isPlainObject(data)) {
  47445. data = {};
  47446. warn(
  47447. 'data functions should return an object:\n' +
  47448. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  47449. vm
  47450. );
  47451. }
  47452. // proxy data on instance
  47453. var keys = Object.keys(data);
  47454. var props = vm.$options.props;
  47455. var methods = vm.$options.methods;
  47456. var i = keys.length;
  47457. while (i--) {
  47458. var key = keys[i];
  47459. {
  47460. if (methods && hasOwn(methods, key)) {
  47461. warn(
  47462. ("Method \"" + key + "\" has already been defined as a data property."),
  47463. vm
  47464. );
  47465. }
  47466. }
  47467. if (props && hasOwn(props, key)) {
  47468. warn(
  47469. "The data property \"" + key + "\" is already declared as a prop. " +
  47470. "Use prop default value instead.",
  47471. vm
  47472. );
  47473. } else if (!isReserved(key)) {
  47474. proxy(vm, "_data", key);
  47475. }
  47476. }
  47477. // observe data
  47478. observe(data, true /* asRootData */);
  47479. }
  47480. function getData (data, vm) {
  47481. // #7573 disable dep collection when invoking data getters
  47482. pushTarget();
  47483. try {
  47484. return data.call(vm, vm)
  47485. } catch (e) {
  47486. handleError(e, vm, "data()");
  47487. return {}
  47488. } finally {
  47489. popTarget();
  47490. }
  47491. }
  47492. var computedWatcherOptions = { lazy: true };
  47493. function initComputed (vm, computed) {
  47494. // $flow-disable-line
  47495. var watchers = vm._computedWatchers = Object.create(null);
  47496. // computed properties are just getters during SSR
  47497. var isSSR = isServerRendering();
  47498. for (var key in computed) {
  47499. var userDef = computed[key];
  47500. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  47501. if (getter == null) {
  47502. warn(
  47503. ("Getter is missing for computed property \"" + key + "\"."),
  47504. vm
  47505. );
  47506. }
  47507. if (!isSSR) {
  47508. // create internal watcher for the computed property.
  47509. watchers[key] = new Watcher(
  47510. vm,
  47511. getter || noop,
  47512. noop,
  47513. computedWatcherOptions
  47514. );
  47515. }
  47516. // component-defined computed properties are already defined on the
  47517. // component prototype. We only need to define computed properties defined
  47518. // at instantiation here.
  47519. if (!(key in vm)) {
  47520. defineComputed(vm, key, userDef);
  47521. } else {
  47522. if (key in vm.$data) {
  47523. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  47524. } else if (vm.$options.props && key in vm.$options.props) {
  47525. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  47526. }
  47527. }
  47528. }
  47529. }
  47530. function defineComputed (
  47531. target,
  47532. key,
  47533. userDef
  47534. ) {
  47535. var shouldCache = !isServerRendering();
  47536. if (typeof userDef === 'function') {
  47537. sharedPropertyDefinition.get = shouldCache
  47538. ? createComputedGetter(key)
  47539. : createGetterInvoker(userDef);
  47540. sharedPropertyDefinition.set = noop;
  47541. } else {
  47542. sharedPropertyDefinition.get = userDef.get
  47543. ? shouldCache && userDef.cache !== false
  47544. ? createComputedGetter(key)
  47545. : createGetterInvoker(userDef.get)
  47546. : noop;
  47547. sharedPropertyDefinition.set = userDef.set || noop;
  47548. }
  47549. if (sharedPropertyDefinition.set === noop) {
  47550. sharedPropertyDefinition.set = function () {
  47551. warn(
  47552. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  47553. this
  47554. );
  47555. };
  47556. }
  47557. Object.defineProperty(target, key, sharedPropertyDefinition);
  47558. }
  47559. function createComputedGetter (key) {
  47560. return function computedGetter () {
  47561. var watcher = this._computedWatchers && this._computedWatchers[key];
  47562. if (watcher) {
  47563. if (watcher.dirty) {
  47564. watcher.evaluate();
  47565. }
  47566. if (Dep.target) {
  47567. watcher.depend();
  47568. }
  47569. return watcher.value
  47570. }
  47571. }
  47572. }
  47573. function createGetterInvoker(fn) {
  47574. return function computedGetter () {
  47575. return fn.call(this, this)
  47576. }
  47577. }
  47578. function initMethods (vm, methods) {
  47579. var props = vm.$options.props;
  47580. for (var key in methods) {
  47581. {
  47582. if (typeof methods[key] !== 'function') {
  47583. warn(
  47584. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  47585. "Did you reference the function correctly?",
  47586. vm
  47587. );
  47588. }
  47589. if (props && hasOwn(props, key)) {
  47590. warn(
  47591. ("Method \"" + key + "\" has already been defined as a prop."),
  47592. vm
  47593. );
  47594. }
  47595. if ((key in vm) && isReserved(key)) {
  47596. warn(
  47597. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  47598. "Avoid defining component methods that start with _ or $."
  47599. );
  47600. }
  47601. }
  47602. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  47603. }
  47604. }
  47605. function initWatch (vm, watch) {
  47606. for (var key in watch) {
  47607. var handler = watch[key];
  47608. if (Array.isArray(handler)) {
  47609. for (var i = 0; i < handler.length; i++) {
  47610. createWatcher(vm, key, handler[i]);
  47611. }
  47612. } else {
  47613. createWatcher(vm, key, handler);
  47614. }
  47615. }
  47616. }
  47617. function createWatcher (
  47618. vm,
  47619. expOrFn,
  47620. handler,
  47621. options
  47622. ) {
  47623. if (isPlainObject(handler)) {
  47624. options = handler;
  47625. handler = handler.handler;
  47626. }
  47627. if (typeof handler === 'string') {
  47628. handler = vm[handler];
  47629. }
  47630. return vm.$watch(expOrFn, handler, options)
  47631. }
  47632. function stateMixin (Vue) {
  47633. // flow somehow has problems with directly declared definition object
  47634. // when using Object.defineProperty, so we have to procedurally build up
  47635. // the object here.
  47636. var dataDef = {};
  47637. dataDef.get = function () { return this._data };
  47638. var propsDef = {};
  47639. propsDef.get = function () { return this._props };
  47640. {
  47641. dataDef.set = function () {
  47642. warn(
  47643. 'Avoid replacing instance root $data. ' +
  47644. 'Use nested data properties instead.',
  47645. this
  47646. );
  47647. };
  47648. propsDef.set = function () {
  47649. warn("$props is readonly.", this);
  47650. };
  47651. }
  47652. Object.defineProperty(Vue.prototype, '$data', dataDef);
  47653. Object.defineProperty(Vue.prototype, '$props', propsDef);
  47654. Vue.prototype.$set = set;
  47655. Vue.prototype.$delete = del;
  47656. Vue.prototype.$watch = function (
  47657. expOrFn,
  47658. cb,
  47659. options
  47660. ) {
  47661. var vm = this;
  47662. if (isPlainObject(cb)) {
  47663. return createWatcher(vm, expOrFn, cb, options)
  47664. }
  47665. options = options || {};
  47666. options.user = true;
  47667. var watcher = new Watcher(vm, expOrFn, cb, options);
  47668. if (options.immediate) {
  47669. try {
  47670. cb.call(vm, watcher.value);
  47671. } catch (error) {
  47672. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  47673. }
  47674. }
  47675. return function unwatchFn () {
  47676. watcher.teardown();
  47677. }
  47678. };
  47679. }
  47680. /* */
  47681. var uid$3 = 0;
  47682. function initMixin (Vue) {
  47683. Vue.prototype._init = function (options) {
  47684. var vm = this;
  47685. // a uid
  47686. vm._uid = uid$3++;
  47687. var startTag, endTag;
  47688. /* istanbul ignore if */
  47689. if (config.performance && mark) {
  47690. startTag = "vue-perf-start:" + (vm._uid);
  47691. endTag = "vue-perf-end:" + (vm._uid);
  47692. mark(startTag);
  47693. }
  47694. // a flag to avoid this being observed
  47695. vm._isVue = true;
  47696. // merge options
  47697. if (options && options._isComponent) {
  47698. // optimize internal component instantiation
  47699. // since dynamic options merging is pretty slow, and none of the
  47700. // internal component options needs special treatment.
  47701. initInternalComponent(vm, options);
  47702. } else {
  47703. vm.$options = mergeOptions(
  47704. resolveConstructorOptions(vm.constructor),
  47705. options || {},
  47706. vm
  47707. );
  47708. }
  47709. /* istanbul ignore else */
  47710. {
  47711. initProxy(vm);
  47712. }
  47713. // expose real self
  47714. vm._self = vm;
  47715. initLifecycle(vm);
  47716. initEvents(vm);
  47717. initRender(vm);
  47718. callHook(vm, 'beforeCreate');
  47719. initInjections(vm); // resolve injections before data/props
  47720. initState(vm);
  47721. initProvide(vm); // resolve provide after data/props
  47722. callHook(vm, 'created');
  47723. /* istanbul ignore if */
  47724. if (config.performance && mark) {
  47725. vm._name = formatComponentName(vm, false);
  47726. mark(endTag);
  47727. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  47728. }
  47729. if (vm.$options.el) {
  47730. vm.$mount(vm.$options.el);
  47731. }
  47732. };
  47733. }
  47734. function initInternalComponent (vm, options) {
  47735. var opts = vm.$options = Object.create(vm.constructor.options);
  47736. // doing this because it's faster than dynamic enumeration.
  47737. var parentVnode = options._parentVnode;
  47738. opts.parent = options.parent;
  47739. opts._parentVnode = parentVnode;
  47740. var vnodeComponentOptions = parentVnode.componentOptions;
  47741. opts.propsData = vnodeComponentOptions.propsData;
  47742. opts._parentListeners = vnodeComponentOptions.listeners;
  47743. opts._renderChildren = vnodeComponentOptions.children;
  47744. opts._componentTag = vnodeComponentOptions.tag;
  47745. if (options.render) {
  47746. opts.render = options.render;
  47747. opts.staticRenderFns = options.staticRenderFns;
  47748. }
  47749. }
  47750. function resolveConstructorOptions (Ctor) {
  47751. var options = Ctor.options;
  47752. if (Ctor.super) {
  47753. var superOptions = resolveConstructorOptions(Ctor.super);
  47754. var cachedSuperOptions = Ctor.superOptions;
  47755. if (superOptions !== cachedSuperOptions) {
  47756. // super option changed,
  47757. // need to resolve new options.
  47758. Ctor.superOptions = superOptions;
  47759. // check if there are any late-modified/attached options (#4976)
  47760. var modifiedOptions = resolveModifiedOptions(Ctor);
  47761. // update base extend options
  47762. if (modifiedOptions) {
  47763. extend(Ctor.extendOptions, modifiedOptions);
  47764. }
  47765. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  47766. if (options.name) {
  47767. options.components[options.name] = Ctor;
  47768. }
  47769. }
  47770. }
  47771. return options
  47772. }
  47773. function resolveModifiedOptions (Ctor) {
  47774. var modified;
  47775. var latest = Ctor.options;
  47776. var sealed = Ctor.sealedOptions;
  47777. for (var key in latest) {
  47778. if (latest[key] !== sealed[key]) {
  47779. if (!modified) { modified = {}; }
  47780. modified[key] = latest[key];
  47781. }
  47782. }
  47783. return modified
  47784. }
  47785. function Vue (options) {
  47786. if (!(this instanceof Vue)
  47787. ) {
  47788. warn('Vue is a constructor and should be called with the `new` keyword');
  47789. }
  47790. this._init(options);
  47791. }
  47792. initMixin(Vue);
  47793. stateMixin(Vue);
  47794. eventsMixin(Vue);
  47795. lifecycleMixin(Vue);
  47796. renderMixin(Vue);
  47797. /* */
  47798. function initUse (Vue) {
  47799. Vue.use = function (plugin) {
  47800. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  47801. if (installedPlugins.indexOf(plugin) > -1) {
  47802. return this
  47803. }
  47804. // additional parameters
  47805. var args = toArray(arguments, 1);
  47806. args.unshift(this);
  47807. if (typeof plugin.install === 'function') {
  47808. plugin.install.apply(plugin, args);
  47809. } else if (typeof plugin === 'function') {
  47810. plugin.apply(null, args);
  47811. }
  47812. installedPlugins.push(plugin);
  47813. return this
  47814. };
  47815. }
  47816. /* */
  47817. function initMixin$1 (Vue) {
  47818. Vue.mixin = function (mixin) {
  47819. this.options = mergeOptions(this.options, mixin);
  47820. return this
  47821. };
  47822. }
  47823. /* */
  47824. function initExtend (Vue) {
  47825. /**
  47826. * Each instance constructor, including Vue, has a unique
  47827. * cid. This enables us to create wrapped "child
  47828. * constructors" for prototypal inheritance and cache them.
  47829. */
  47830. Vue.cid = 0;
  47831. var cid = 1;
  47832. /**
  47833. * Class inheritance
  47834. */
  47835. Vue.extend = function (extendOptions) {
  47836. extendOptions = extendOptions || {};
  47837. var Super = this;
  47838. var SuperId = Super.cid;
  47839. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  47840. if (cachedCtors[SuperId]) {
  47841. return cachedCtors[SuperId]
  47842. }
  47843. var name = extendOptions.name || Super.options.name;
  47844. if (name) {
  47845. validateComponentName(name);
  47846. }
  47847. var Sub = function VueComponent (options) {
  47848. this._init(options);
  47849. };
  47850. Sub.prototype = Object.create(Super.prototype);
  47851. Sub.prototype.constructor = Sub;
  47852. Sub.cid = cid++;
  47853. Sub.options = mergeOptions(
  47854. Super.options,
  47855. extendOptions
  47856. );
  47857. Sub['super'] = Super;
  47858. // For props and computed properties, we define the proxy getters on
  47859. // the Vue instances at extension time, on the extended prototype. This
  47860. // avoids Object.defineProperty calls for each instance created.
  47861. if (Sub.options.props) {
  47862. initProps$1(Sub);
  47863. }
  47864. if (Sub.options.computed) {
  47865. initComputed$1(Sub);
  47866. }
  47867. // allow further extension/mixin/plugin usage
  47868. Sub.extend = Super.extend;
  47869. Sub.mixin = Super.mixin;
  47870. Sub.use = Super.use;
  47871. // create asset registers, so extended classes
  47872. // can have their private assets too.
  47873. ASSET_TYPES.forEach(function (type) {
  47874. Sub[type] = Super[type];
  47875. });
  47876. // enable recursive self-lookup
  47877. if (name) {
  47878. Sub.options.components[name] = Sub;
  47879. }
  47880. // keep a reference to the super options at extension time.
  47881. // later at instantiation we can check if Super's options have
  47882. // been updated.
  47883. Sub.superOptions = Super.options;
  47884. Sub.extendOptions = extendOptions;
  47885. Sub.sealedOptions = extend({}, Sub.options);
  47886. // cache constructor
  47887. cachedCtors[SuperId] = Sub;
  47888. return Sub
  47889. };
  47890. }
  47891. function initProps$1 (Comp) {
  47892. var props = Comp.options.props;
  47893. for (var key in props) {
  47894. proxy(Comp.prototype, "_props", key);
  47895. }
  47896. }
  47897. function initComputed$1 (Comp) {
  47898. var computed = Comp.options.computed;
  47899. for (var key in computed) {
  47900. defineComputed(Comp.prototype, key, computed[key]);
  47901. }
  47902. }
  47903. /* */
  47904. function initAssetRegisters (Vue) {
  47905. /**
  47906. * Create asset registration methods.
  47907. */
  47908. ASSET_TYPES.forEach(function (type) {
  47909. Vue[type] = function (
  47910. id,
  47911. definition
  47912. ) {
  47913. if (!definition) {
  47914. return this.options[type + 's'][id]
  47915. } else {
  47916. /* istanbul ignore if */
  47917. if (type === 'component') {
  47918. validateComponentName(id);
  47919. }
  47920. if (type === 'component' && isPlainObject(definition)) {
  47921. definition.name = definition.name || id;
  47922. definition = this.options._base.extend(definition);
  47923. }
  47924. if (type === 'directive' && typeof definition === 'function') {
  47925. definition = { bind: definition, update: definition };
  47926. }
  47927. this.options[type + 's'][id] = definition;
  47928. return definition
  47929. }
  47930. };
  47931. });
  47932. }
  47933. /* */
  47934. function getComponentName (opts) {
  47935. return opts && (opts.Ctor.options.name || opts.tag)
  47936. }
  47937. function matches (pattern, name) {
  47938. if (Array.isArray(pattern)) {
  47939. return pattern.indexOf(name) > -1
  47940. } else if (typeof pattern === 'string') {
  47941. return pattern.split(',').indexOf(name) > -1
  47942. } else if (isRegExp(pattern)) {
  47943. return pattern.test(name)
  47944. }
  47945. /* istanbul ignore next */
  47946. return false
  47947. }
  47948. function pruneCache (keepAliveInstance, filter) {
  47949. var cache = keepAliveInstance.cache;
  47950. var keys = keepAliveInstance.keys;
  47951. var _vnode = keepAliveInstance._vnode;
  47952. for (var key in cache) {
  47953. var cachedNode = cache[key];
  47954. if (cachedNode) {
  47955. var name = getComponentName(cachedNode.componentOptions);
  47956. if (name && !filter(name)) {
  47957. pruneCacheEntry(cache, key, keys, _vnode);
  47958. }
  47959. }
  47960. }
  47961. }
  47962. function pruneCacheEntry (
  47963. cache,
  47964. key,
  47965. keys,
  47966. current
  47967. ) {
  47968. var cached$$1 = cache[key];
  47969. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  47970. cached$$1.componentInstance.$destroy();
  47971. }
  47972. cache[key] = null;
  47973. remove(keys, key);
  47974. }
  47975. var patternTypes = [String, RegExp, Array];
  47976. var KeepAlive = {
  47977. name: 'keep-alive',
  47978. abstract: true,
  47979. props: {
  47980. include: patternTypes,
  47981. exclude: patternTypes,
  47982. max: [String, Number]
  47983. },
  47984. created: function created () {
  47985. this.cache = Object.create(null);
  47986. this.keys = [];
  47987. },
  47988. destroyed: function destroyed () {
  47989. for (var key in this.cache) {
  47990. pruneCacheEntry(this.cache, key, this.keys);
  47991. }
  47992. },
  47993. mounted: function mounted () {
  47994. var this$1 = this;
  47995. this.$watch('include', function (val) {
  47996. pruneCache(this$1, function (name) { return matches(val, name); });
  47997. });
  47998. this.$watch('exclude', function (val) {
  47999. pruneCache(this$1, function (name) { return !matches(val, name); });
  48000. });
  48001. },
  48002. render: function render () {
  48003. var slot = this.$slots.default;
  48004. var vnode = getFirstComponentChild(slot);
  48005. var componentOptions = vnode && vnode.componentOptions;
  48006. if (componentOptions) {
  48007. // check pattern
  48008. var name = getComponentName(componentOptions);
  48009. var ref = this;
  48010. var include = ref.include;
  48011. var exclude = ref.exclude;
  48012. if (
  48013. // not included
  48014. (include && (!name || !matches(include, name))) ||
  48015. // excluded
  48016. (exclude && name && matches(exclude, name))
  48017. ) {
  48018. return vnode
  48019. }
  48020. var ref$1 = this;
  48021. var cache = ref$1.cache;
  48022. var keys = ref$1.keys;
  48023. var key = vnode.key == null
  48024. // same constructor may get registered as different local components
  48025. // so cid alone is not enough (#3269)
  48026. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48027. : vnode.key;
  48028. if (cache[key]) {
  48029. vnode.componentInstance = cache[key].componentInstance;
  48030. // make current key freshest
  48031. remove(keys, key);
  48032. keys.push(key);
  48033. } else {
  48034. cache[key] = vnode;
  48035. keys.push(key);
  48036. // prune oldest entry
  48037. if (this.max && keys.length > parseInt(this.max)) {
  48038. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48039. }
  48040. }
  48041. vnode.data.keepAlive = true;
  48042. }
  48043. return vnode || (slot && slot[0])
  48044. }
  48045. };
  48046. var builtInComponents = {
  48047. KeepAlive: KeepAlive
  48048. };
  48049. /* */
  48050. function initGlobalAPI (Vue) {
  48051. // config
  48052. var configDef = {};
  48053. configDef.get = function () { return config; };
  48054. {
  48055. configDef.set = function () {
  48056. warn(
  48057. 'Do not replace the Vue.config object, set individual fields instead.'
  48058. );
  48059. };
  48060. }
  48061. Object.defineProperty(Vue, 'config', configDef);
  48062. // exposed util methods.
  48063. // NOTE: these are not considered part of the public API - avoid relying on
  48064. // them unless you are aware of the risk.
  48065. Vue.util = {
  48066. warn: warn,
  48067. extend: extend,
  48068. mergeOptions: mergeOptions,
  48069. defineReactive: defineReactive$$1
  48070. };
  48071. Vue.set = set;
  48072. Vue.delete = del;
  48073. Vue.nextTick = nextTick;
  48074. // 2.6 explicit observable API
  48075. Vue.observable = function (obj) {
  48076. observe(obj);
  48077. return obj
  48078. };
  48079. Vue.options = Object.create(null);
  48080. ASSET_TYPES.forEach(function (type) {
  48081. Vue.options[type + 's'] = Object.create(null);
  48082. });
  48083. // this is used to identify the "base" constructor to extend all plain-object
  48084. // components with in Weex's multi-instance scenarios.
  48085. Vue.options._base = Vue;
  48086. extend(Vue.options.components, builtInComponents);
  48087. initUse(Vue);
  48088. initMixin$1(Vue);
  48089. initExtend(Vue);
  48090. initAssetRegisters(Vue);
  48091. }
  48092. initGlobalAPI(Vue);
  48093. Object.defineProperty(Vue.prototype, '$isServer', {
  48094. get: isServerRendering
  48095. });
  48096. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48097. get: function get () {
  48098. /* istanbul ignore next */
  48099. return this.$vnode && this.$vnode.ssrContext
  48100. }
  48101. });
  48102. // expose FunctionalRenderContext for ssr runtime helper installation
  48103. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48104. value: FunctionalRenderContext
  48105. });
  48106. Vue.version = '2.6.11';
  48107. /* */
  48108. // these are reserved for web because they are directly compiled away
  48109. // during template compilation
  48110. var isReservedAttr = makeMap('style,class');
  48111. // attributes that should be using props for binding
  48112. var acceptValue = makeMap('input,textarea,option,select,progress');
  48113. var mustUseProp = function (tag, type, attr) {
  48114. return (
  48115. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48116. (attr === 'selected' && tag === 'option') ||
  48117. (attr === 'checked' && tag === 'input') ||
  48118. (attr === 'muted' && tag === 'video')
  48119. )
  48120. };
  48121. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48122. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48123. var convertEnumeratedValue = function (key, value) {
  48124. return isFalsyAttrValue(value) || value === 'false'
  48125. ? 'false'
  48126. // allow arbitrary string value for contenteditable
  48127. : key === 'contenteditable' && isValidContentEditableValue(value)
  48128. ? value
  48129. : 'true'
  48130. };
  48131. var isBooleanAttr = makeMap(
  48132. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48133. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48134. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48135. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48136. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48137. 'truespeed,typemustmatch,visible'
  48138. );
  48139. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48140. var isXlink = function (name) {
  48141. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48142. };
  48143. var getXlinkProp = function (name) {
  48144. return isXlink(name) ? name.slice(6, name.length) : ''
  48145. };
  48146. var isFalsyAttrValue = function (val) {
  48147. return val == null || val === false
  48148. };
  48149. /* */
  48150. function genClassForVnode (vnode) {
  48151. var data = vnode.data;
  48152. var parentNode = vnode;
  48153. var childNode = vnode;
  48154. while (isDef(childNode.componentInstance)) {
  48155. childNode = childNode.componentInstance._vnode;
  48156. if (childNode && childNode.data) {
  48157. data = mergeClassData(childNode.data, data);
  48158. }
  48159. }
  48160. while (isDef(parentNode = parentNode.parent)) {
  48161. if (parentNode && parentNode.data) {
  48162. data = mergeClassData(data, parentNode.data);
  48163. }
  48164. }
  48165. return renderClass(data.staticClass, data.class)
  48166. }
  48167. function mergeClassData (child, parent) {
  48168. return {
  48169. staticClass: concat(child.staticClass, parent.staticClass),
  48170. class: isDef(child.class)
  48171. ? [child.class, parent.class]
  48172. : parent.class
  48173. }
  48174. }
  48175. function renderClass (
  48176. staticClass,
  48177. dynamicClass
  48178. ) {
  48179. if (isDef(staticClass) || isDef(dynamicClass)) {
  48180. return concat(staticClass, stringifyClass(dynamicClass))
  48181. }
  48182. /* istanbul ignore next */
  48183. return ''
  48184. }
  48185. function concat (a, b) {
  48186. return a ? b ? (a + ' ' + b) : a : (b || '')
  48187. }
  48188. function stringifyClass (value) {
  48189. if (Array.isArray(value)) {
  48190. return stringifyArray(value)
  48191. }
  48192. if (isObject(value)) {
  48193. return stringifyObject(value)
  48194. }
  48195. if (typeof value === 'string') {
  48196. return value
  48197. }
  48198. /* istanbul ignore next */
  48199. return ''
  48200. }
  48201. function stringifyArray (value) {
  48202. var res = '';
  48203. var stringified;
  48204. for (var i = 0, l = value.length; i < l; i++) {
  48205. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  48206. if (res) { res += ' '; }
  48207. res += stringified;
  48208. }
  48209. }
  48210. return res
  48211. }
  48212. function stringifyObject (value) {
  48213. var res = '';
  48214. for (var key in value) {
  48215. if (value[key]) {
  48216. if (res) { res += ' '; }
  48217. res += key;
  48218. }
  48219. }
  48220. return res
  48221. }
  48222. /* */
  48223. var namespaceMap = {
  48224. svg: 'http://www.w3.org/2000/svg',
  48225. math: 'http://www.w3.org/1998/Math/MathML'
  48226. };
  48227. var isHTMLTag = makeMap(
  48228. 'html,body,base,head,link,meta,style,title,' +
  48229. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  48230. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  48231. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  48232. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  48233. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  48234. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  48235. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  48236. 'output,progress,select,textarea,' +
  48237. 'details,dialog,menu,menuitem,summary,' +
  48238. 'content,element,shadow,template,blockquote,iframe,tfoot'
  48239. );
  48240. // this map is intentionally selective, only covering SVG elements that may
  48241. // contain child elements.
  48242. var isSVG = makeMap(
  48243. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  48244. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  48245. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  48246. true
  48247. );
  48248. var isPreTag = function (tag) { return tag === 'pre'; };
  48249. var isReservedTag = function (tag) {
  48250. return isHTMLTag(tag) || isSVG(tag)
  48251. };
  48252. function getTagNamespace (tag) {
  48253. if (isSVG(tag)) {
  48254. return 'svg'
  48255. }
  48256. // basic support for MathML
  48257. // note it doesn't support other MathML elements being component roots
  48258. if (tag === 'math') {
  48259. return 'math'
  48260. }
  48261. }
  48262. var unknownElementCache = Object.create(null);
  48263. function isUnknownElement (tag) {
  48264. /* istanbul ignore if */
  48265. if (!inBrowser) {
  48266. return true
  48267. }
  48268. if (isReservedTag(tag)) {
  48269. return false
  48270. }
  48271. tag = tag.toLowerCase();
  48272. /* istanbul ignore if */
  48273. if (unknownElementCache[tag] != null) {
  48274. return unknownElementCache[tag]
  48275. }
  48276. var el = document.createElement(tag);
  48277. if (tag.indexOf('-') > -1) {
  48278. // http://stackoverflow.com/a/28210364/1070244
  48279. return (unknownElementCache[tag] = (
  48280. el.constructor === window.HTMLUnknownElement ||
  48281. el.constructor === window.HTMLElement
  48282. ))
  48283. } else {
  48284. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  48285. }
  48286. }
  48287. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  48288. /* */
  48289. /**
  48290. * Query an element selector if it's not an element already.
  48291. */
  48292. function query (el) {
  48293. if (typeof el === 'string') {
  48294. var selected = document.querySelector(el);
  48295. if (!selected) {
  48296. warn(
  48297. 'Cannot find element: ' + el
  48298. );
  48299. return document.createElement('div')
  48300. }
  48301. return selected
  48302. } else {
  48303. return el
  48304. }
  48305. }
  48306. /* */
  48307. function createElement$1 (tagName, vnode) {
  48308. var elm = document.createElement(tagName);
  48309. if (tagName !== 'select') {
  48310. return elm
  48311. }
  48312. // false or null will remove the attribute but undefined will not
  48313. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  48314. elm.setAttribute('multiple', 'multiple');
  48315. }
  48316. return elm
  48317. }
  48318. function createElementNS (namespace, tagName) {
  48319. return document.createElementNS(namespaceMap[namespace], tagName)
  48320. }
  48321. function createTextNode (text) {
  48322. return document.createTextNode(text)
  48323. }
  48324. function createComment (text) {
  48325. return document.createComment(text)
  48326. }
  48327. function insertBefore (parentNode, newNode, referenceNode) {
  48328. parentNode.insertBefore(newNode, referenceNode);
  48329. }
  48330. function removeChild (node, child) {
  48331. node.removeChild(child);
  48332. }
  48333. function appendChild (node, child) {
  48334. node.appendChild(child);
  48335. }
  48336. function parentNode (node) {
  48337. return node.parentNode
  48338. }
  48339. function nextSibling (node) {
  48340. return node.nextSibling
  48341. }
  48342. function tagName (node) {
  48343. return node.tagName
  48344. }
  48345. function setTextContent (node, text) {
  48346. node.textContent = text;
  48347. }
  48348. function setStyleScope (node, scopeId) {
  48349. node.setAttribute(scopeId, '');
  48350. }
  48351. var nodeOps = /*#__PURE__*/Object.freeze({
  48352. createElement: createElement$1,
  48353. createElementNS: createElementNS,
  48354. createTextNode: createTextNode,
  48355. createComment: createComment,
  48356. insertBefore: insertBefore,
  48357. removeChild: removeChild,
  48358. appendChild: appendChild,
  48359. parentNode: parentNode,
  48360. nextSibling: nextSibling,
  48361. tagName: tagName,
  48362. setTextContent: setTextContent,
  48363. setStyleScope: setStyleScope
  48364. });
  48365. /* */
  48366. var ref = {
  48367. create: function create (_, vnode) {
  48368. registerRef(vnode);
  48369. },
  48370. update: function update (oldVnode, vnode) {
  48371. if (oldVnode.data.ref !== vnode.data.ref) {
  48372. registerRef(oldVnode, true);
  48373. registerRef(vnode);
  48374. }
  48375. },
  48376. destroy: function destroy (vnode) {
  48377. registerRef(vnode, true);
  48378. }
  48379. };
  48380. function registerRef (vnode, isRemoval) {
  48381. var key = vnode.data.ref;
  48382. if (!isDef(key)) { return }
  48383. var vm = vnode.context;
  48384. var ref = vnode.componentInstance || vnode.elm;
  48385. var refs = vm.$refs;
  48386. if (isRemoval) {
  48387. if (Array.isArray(refs[key])) {
  48388. remove(refs[key], ref);
  48389. } else if (refs[key] === ref) {
  48390. refs[key] = undefined;
  48391. }
  48392. } else {
  48393. if (vnode.data.refInFor) {
  48394. if (!Array.isArray(refs[key])) {
  48395. refs[key] = [ref];
  48396. } else if (refs[key].indexOf(ref) < 0) {
  48397. // $flow-disable-line
  48398. refs[key].push(ref);
  48399. }
  48400. } else {
  48401. refs[key] = ref;
  48402. }
  48403. }
  48404. }
  48405. /**
  48406. * Virtual DOM patching algorithm based on Snabbdom by
  48407. * Simon Friis Vindum (@paldepind)
  48408. * Licensed under the MIT License
  48409. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  48410. *
  48411. * modified by Evan You (@yyx990803)
  48412. *
  48413. * Not type-checking this because this file is perf-critical and the cost
  48414. * of making flow understand it is not worth it.
  48415. */
  48416. var emptyNode = new VNode('', {}, []);
  48417. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  48418. function sameVnode (a, b) {
  48419. return (
  48420. a.key === b.key && (
  48421. (
  48422. a.tag === b.tag &&
  48423. a.isComment === b.isComment &&
  48424. isDef(a.data) === isDef(b.data) &&
  48425. sameInputType(a, b)
  48426. ) || (
  48427. isTrue(a.isAsyncPlaceholder) &&
  48428. a.asyncFactory === b.asyncFactory &&
  48429. isUndef(b.asyncFactory.error)
  48430. )
  48431. )
  48432. )
  48433. }
  48434. function sameInputType (a, b) {
  48435. if (a.tag !== 'input') { return true }
  48436. var i;
  48437. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  48438. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  48439. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  48440. }
  48441. function createKeyToOldIdx (children, beginIdx, endIdx) {
  48442. var i, key;
  48443. var map = {};
  48444. for (i = beginIdx; i <= endIdx; ++i) {
  48445. key = children[i].key;
  48446. if (isDef(key)) { map[key] = i; }
  48447. }
  48448. return map
  48449. }
  48450. function createPatchFunction (backend) {
  48451. var i, j;
  48452. var cbs = {};
  48453. var modules = backend.modules;
  48454. var nodeOps = backend.nodeOps;
  48455. for (i = 0; i < hooks.length; ++i) {
  48456. cbs[hooks[i]] = [];
  48457. for (j = 0; j < modules.length; ++j) {
  48458. if (isDef(modules[j][hooks[i]])) {
  48459. cbs[hooks[i]].push(modules[j][hooks[i]]);
  48460. }
  48461. }
  48462. }
  48463. function emptyNodeAt (elm) {
  48464. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  48465. }
  48466. function createRmCb (childElm, listeners) {
  48467. function remove$$1 () {
  48468. if (--remove$$1.listeners === 0) {
  48469. removeNode(childElm);
  48470. }
  48471. }
  48472. remove$$1.listeners = listeners;
  48473. return remove$$1
  48474. }
  48475. function removeNode (el) {
  48476. var parent = nodeOps.parentNode(el);
  48477. // element may have already been removed due to v-html / v-text
  48478. if (isDef(parent)) {
  48479. nodeOps.removeChild(parent, el);
  48480. }
  48481. }
  48482. function isUnknownElement$$1 (vnode, inVPre) {
  48483. return (
  48484. !inVPre &&
  48485. !vnode.ns &&
  48486. !(
  48487. config.ignoredElements.length &&
  48488. config.ignoredElements.some(function (ignore) {
  48489. return isRegExp(ignore)
  48490. ? ignore.test(vnode.tag)
  48491. : ignore === vnode.tag
  48492. })
  48493. ) &&
  48494. config.isUnknownElement(vnode.tag)
  48495. )
  48496. }
  48497. var creatingElmInVPre = 0;
  48498. function createElm (
  48499. vnode,
  48500. insertedVnodeQueue,
  48501. parentElm,
  48502. refElm,
  48503. nested,
  48504. ownerArray,
  48505. index
  48506. ) {
  48507. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48508. // This vnode was used in a previous render!
  48509. // now it's used as a new node, overwriting its elm would cause
  48510. // potential patch errors down the road when it's used as an insertion
  48511. // reference node. Instead, we clone the node on-demand before creating
  48512. // associated DOM element for it.
  48513. vnode = ownerArray[index] = cloneVNode(vnode);
  48514. }
  48515. vnode.isRootInsert = !nested; // for transition enter check
  48516. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  48517. return
  48518. }
  48519. var data = vnode.data;
  48520. var children = vnode.children;
  48521. var tag = vnode.tag;
  48522. if (isDef(tag)) {
  48523. {
  48524. if (data && data.pre) {
  48525. creatingElmInVPre++;
  48526. }
  48527. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  48528. warn(
  48529. 'Unknown custom element: <' + tag + '> - did you ' +
  48530. 'register the component correctly? For recursive components, ' +
  48531. 'make sure to provide the "name" option.',
  48532. vnode.context
  48533. );
  48534. }
  48535. }
  48536. vnode.elm = vnode.ns
  48537. ? nodeOps.createElementNS(vnode.ns, tag)
  48538. : nodeOps.createElement(tag, vnode);
  48539. setScope(vnode);
  48540. /* istanbul ignore if */
  48541. {
  48542. createChildren(vnode, children, insertedVnodeQueue);
  48543. if (isDef(data)) {
  48544. invokeCreateHooks(vnode, insertedVnodeQueue);
  48545. }
  48546. insert(parentElm, vnode.elm, refElm);
  48547. }
  48548. if (data && data.pre) {
  48549. creatingElmInVPre--;
  48550. }
  48551. } else if (isTrue(vnode.isComment)) {
  48552. vnode.elm = nodeOps.createComment(vnode.text);
  48553. insert(parentElm, vnode.elm, refElm);
  48554. } else {
  48555. vnode.elm = nodeOps.createTextNode(vnode.text);
  48556. insert(parentElm, vnode.elm, refElm);
  48557. }
  48558. }
  48559. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48560. var i = vnode.data;
  48561. if (isDef(i)) {
  48562. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  48563. if (isDef(i = i.hook) && isDef(i = i.init)) {
  48564. i(vnode, false /* hydrating */);
  48565. }
  48566. // after calling the init hook, if the vnode is a child component
  48567. // it should've created a child instance and mounted it. the child
  48568. // component also has set the placeholder vnode's elm.
  48569. // in that case we can just return the element and be done.
  48570. if (isDef(vnode.componentInstance)) {
  48571. initComponent(vnode, insertedVnodeQueue);
  48572. insert(parentElm, vnode.elm, refElm);
  48573. if (isTrue(isReactivated)) {
  48574. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  48575. }
  48576. return true
  48577. }
  48578. }
  48579. }
  48580. function initComponent (vnode, insertedVnodeQueue) {
  48581. if (isDef(vnode.data.pendingInsert)) {
  48582. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  48583. vnode.data.pendingInsert = null;
  48584. }
  48585. vnode.elm = vnode.componentInstance.$el;
  48586. if (isPatchable(vnode)) {
  48587. invokeCreateHooks(vnode, insertedVnodeQueue);
  48588. setScope(vnode);
  48589. } else {
  48590. // empty component root.
  48591. // skip all element-related modules except for ref (#3455)
  48592. registerRef(vnode);
  48593. // make sure to invoke the insert hook
  48594. insertedVnodeQueue.push(vnode);
  48595. }
  48596. }
  48597. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48598. var i;
  48599. // hack for #4339: a reactivated component with inner transition
  48600. // does not trigger because the inner node's created hooks are not called
  48601. // again. It's not ideal to involve module-specific logic in here but
  48602. // there doesn't seem to be a better way to do it.
  48603. var innerNode = vnode;
  48604. while (innerNode.componentInstance) {
  48605. innerNode = innerNode.componentInstance._vnode;
  48606. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  48607. for (i = 0; i < cbs.activate.length; ++i) {
  48608. cbs.activate[i](emptyNode, innerNode);
  48609. }
  48610. insertedVnodeQueue.push(innerNode);
  48611. break
  48612. }
  48613. }
  48614. // unlike a newly created component,
  48615. // a reactivated keep-alive component doesn't insert itself
  48616. insert(parentElm, vnode.elm, refElm);
  48617. }
  48618. function insert (parent, elm, ref$$1) {
  48619. if (isDef(parent)) {
  48620. if (isDef(ref$$1)) {
  48621. if (nodeOps.parentNode(ref$$1) === parent) {
  48622. nodeOps.insertBefore(parent, elm, ref$$1);
  48623. }
  48624. } else {
  48625. nodeOps.appendChild(parent, elm);
  48626. }
  48627. }
  48628. }
  48629. function createChildren (vnode, children, insertedVnodeQueue) {
  48630. if (Array.isArray(children)) {
  48631. {
  48632. checkDuplicateKeys(children);
  48633. }
  48634. for (var i = 0; i < children.length; ++i) {
  48635. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  48636. }
  48637. } else if (isPrimitive(vnode.text)) {
  48638. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  48639. }
  48640. }
  48641. function isPatchable (vnode) {
  48642. while (vnode.componentInstance) {
  48643. vnode = vnode.componentInstance._vnode;
  48644. }
  48645. return isDef(vnode.tag)
  48646. }
  48647. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  48648. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  48649. cbs.create[i$1](emptyNode, vnode);
  48650. }
  48651. i = vnode.data.hook; // Reuse variable
  48652. if (isDef(i)) {
  48653. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  48654. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  48655. }
  48656. }
  48657. // set scope id attribute for scoped CSS.
  48658. // this is implemented as a special case to avoid the overhead
  48659. // of going through the normal attribute patching process.
  48660. function setScope (vnode) {
  48661. var i;
  48662. if (isDef(i = vnode.fnScopeId)) {
  48663. nodeOps.setStyleScope(vnode.elm, i);
  48664. } else {
  48665. var ancestor = vnode;
  48666. while (ancestor) {
  48667. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  48668. nodeOps.setStyleScope(vnode.elm, i);
  48669. }
  48670. ancestor = ancestor.parent;
  48671. }
  48672. }
  48673. // for slot content they should also get the scopeId from the host instance.
  48674. if (isDef(i = activeInstance) &&
  48675. i !== vnode.context &&
  48676. i !== vnode.fnContext &&
  48677. isDef(i = i.$options._scopeId)
  48678. ) {
  48679. nodeOps.setStyleScope(vnode.elm, i);
  48680. }
  48681. }
  48682. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  48683. for (; startIdx <= endIdx; ++startIdx) {
  48684. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  48685. }
  48686. }
  48687. function invokeDestroyHook (vnode) {
  48688. var i, j;
  48689. var data = vnode.data;
  48690. if (isDef(data)) {
  48691. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  48692. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  48693. }
  48694. if (isDef(i = vnode.children)) {
  48695. for (j = 0; j < vnode.children.length; ++j) {
  48696. invokeDestroyHook(vnode.children[j]);
  48697. }
  48698. }
  48699. }
  48700. function removeVnodes (vnodes, startIdx, endIdx) {
  48701. for (; startIdx <= endIdx; ++startIdx) {
  48702. var ch = vnodes[startIdx];
  48703. if (isDef(ch)) {
  48704. if (isDef(ch.tag)) {
  48705. removeAndInvokeRemoveHook(ch);
  48706. invokeDestroyHook(ch);
  48707. } else { // Text node
  48708. removeNode(ch.elm);
  48709. }
  48710. }
  48711. }
  48712. }
  48713. function removeAndInvokeRemoveHook (vnode, rm) {
  48714. if (isDef(rm) || isDef(vnode.data)) {
  48715. var i;
  48716. var listeners = cbs.remove.length + 1;
  48717. if (isDef(rm)) {
  48718. // we have a recursively passed down rm callback
  48719. // increase the listeners count
  48720. rm.listeners += listeners;
  48721. } else {
  48722. // directly removing
  48723. rm = createRmCb(vnode.elm, listeners);
  48724. }
  48725. // recursively invoke hooks on child component root node
  48726. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  48727. removeAndInvokeRemoveHook(i, rm);
  48728. }
  48729. for (i = 0; i < cbs.remove.length; ++i) {
  48730. cbs.remove[i](vnode, rm);
  48731. }
  48732. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  48733. i(vnode, rm);
  48734. } else {
  48735. rm();
  48736. }
  48737. } else {
  48738. removeNode(vnode.elm);
  48739. }
  48740. }
  48741. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  48742. var oldStartIdx = 0;
  48743. var newStartIdx = 0;
  48744. var oldEndIdx = oldCh.length - 1;
  48745. var oldStartVnode = oldCh[0];
  48746. var oldEndVnode = oldCh[oldEndIdx];
  48747. var newEndIdx = newCh.length - 1;
  48748. var newStartVnode = newCh[0];
  48749. var newEndVnode = newCh[newEndIdx];
  48750. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  48751. // removeOnly is a special flag used only by <transition-group>
  48752. // to ensure removed elements stay in correct relative positions
  48753. // during leaving transitions
  48754. var canMove = !removeOnly;
  48755. {
  48756. checkDuplicateKeys(newCh);
  48757. }
  48758. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  48759. if (isUndef(oldStartVnode)) {
  48760. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  48761. } else if (isUndef(oldEndVnode)) {
  48762. oldEndVnode = oldCh[--oldEndIdx];
  48763. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  48764. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48765. oldStartVnode = oldCh[++oldStartIdx];
  48766. newStartVnode = newCh[++newStartIdx];
  48767. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  48768. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48769. oldEndVnode = oldCh[--oldEndIdx];
  48770. newEndVnode = newCh[--newEndIdx];
  48771. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  48772. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48773. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  48774. oldStartVnode = oldCh[++oldStartIdx];
  48775. newEndVnode = newCh[--newEndIdx];
  48776. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  48777. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48778. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  48779. oldEndVnode = oldCh[--oldEndIdx];
  48780. newStartVnode = newCh[++newStartIdx];
  48781. } else {
  48782. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  48783. idxInOld = isDef(newStartVnode.key)
  48784. ? oldKeyToIdx[newStartVnode.key]
  48785. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  48786. if (isUndef(idxInOld)) { // New element
  48787. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48788. } else {
  48789. vnodeToMove = oldCh[idxInOld];
  48790. if (sameVnode(vnodeToMove, newStartVnode)) {
  48791. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48792. oldCh[idxInOld] = undefined;
  48793. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  48794. } else {
  48795. // same key but different element. treat as new element
  48796. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48797. }
  48798. }
  48799. newStartVnode = newCh[++newStartIdx];
  48800. }
  48801. }
  48802. if (oldStartIdx > oldEndIdx) {
  48803. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  48804. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  48805. } else if (newStartIdx > newEndIdx) {
  48806. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  48807. }
  48808. }
  48809. function checkDuplicateKeys (children) {
  48810. var seenKeys = {};
  48811. for (var i = 0; i < children.length; i++) {
  48812. var vnode = children[i];
  48813. var key = vnode.key;
  48814. if (isDef(key)) {
  48815. if (seenKeys[key]) {
  48816. warn(
  48817. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  48818. vnode.context
  48819. );
  48820. } else {
  48821. seenKeys[key] = true;
  48822. }
  48823. }
  48824. }
  48825. }
  48826. function findIdxInOld (node, oldCh, start, end) {
  48827. for (var i = start; i < end; i++) {
  48828. var c = oldCh[i];
  48829. if (isDef(c) && sameVnode(node, c)) { return i }
  48830. }
  48831. }
  48832. function patchVnode (
  48833. oldVnode,
  48834. vnode,
  48835. insertedVnodeQueue,
  48836. ownerArray,
  48837. index,
  48838. removeOnly
  48839. ) {
  48840. if (oldVnode === vnode) {
  48841. return
  48842. }
  48843. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48844. // clone reused vnode
  48845. vnode = ownerArray[index] = cloneVNode(vnode);
  48846. }
  48847. var elm = vnode.elm = oldVnode.elm;
  48848. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  48849. if (isDef(vnode.asyncFactory.resolved)) {
  48850. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  48851. } else {
  48852. vnode.isAsyncPlaceholder = true;
  48853. }
  48854. return
  48855. }
  48856. // reuse element for static trees.
  48857. // note we only do this if the vnode is cloned -
  48858. // if the new node is not cloned it means the render functions have been
  48859. // reset by the hot-reload-api and we need to do a proper re-render.
  48860. if (isTrue(vnode.isStatic) &&
  48861. isTrue(oldVnode.isStatic) &&
  48862. vnode.key === oldVnode.key &&
  48863. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  48864. ) {
  48865. vnode.componentInstance = oldVnode.componentInstance;
  48866. return
  48867. }
  48868. var i;
  48869. var data = vnode.data;
  48870. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  48871. i(oldVnode, vnode);
  48872. }
  48873. var oldCh = oldVnode.children;
  48874. var ch = vnode.children;
  48875. if (isDef(data) && isPatchable(vnode)) {
  48876. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  48877. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  48878. }
  48879. if (isUndef(vnode.text)) {
  48880. if (isDef(oldCh) && isDef(ch)) {
  48881. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  48882. } else if (isDef(ch)) {
  48883. {
  48884. checkDuplicateKeys(ch);
  48885. }
  48886. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  48887. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  48888. } else if (isDef(oldCh)) {
  48889. removeVnodes(oldCh, 0, oldCh.length - 1);
  48890. } else if (isDef(oldVnode.text)) {
  48891. nodeOps.setTextContent(elm, '');
  48892. }
  48893. } else if (oldVnode.text !== vnode.text) {
  48894. nodeOps.setTextContent(elm, vnode.text);
  48895. }
  48896. if (isDef(data)) {
  48897. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  48898. }
  48899. }
  48900. function invokeInsertHook (vnode, queue, initial) {
  48901. // delay insert hooks for component root nodes, invoke them after the
  48902. // element is really inserted
  48903. if (isTrue(initial) && isDef(vnode.parent)) {
  48904. vnode.parent.data.pendingInsert = queue;
  48905. } else {
  48906. for (var i = 0; i < queue.length; ++i) {
  48907. queue[i].data.hook.insert(queue[i]);
  48908. }
  48909. }
  48910. }
  48911. var hydrationBailed = false;
  48912. // list of modules that can skip create hook during hydration because they
  48913. // are already rendered on the client or has no need for initialization
  48914. // Note: style is excluded because it relies on initial clone for future
  48915. // deep updates (#7063).
  48916. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  48917. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  48918. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  48919. var i;
  48920. var tag = vnode.tag;
  48921. var data = vnode.data;
  48922. var children = vnode.children;
  48923. inVPre = inVPre || (data && data.pre);
  48924. vnode.elm = elm;
  48925. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  48926. vnode.isAsyncPlaceholder = true;
  48927. return true
  48928. }
  48929. // assert node match
  48930. {
  48931. if (!assertNodeMatch(elm, vnode, inVPre)) {
  48932. return false
  48933. }
  48934. }
  48935. if (isDef(data)) {
  48936. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  48937. if (isDef(i = vnode.componentInstance)) {
  48938. // child component. it should have hydrated its own tree.
  48939. initComponent(vnode, insertedVnodeQueue);
  48940. return true
  48941. }
  48942. }
  48943. if (isDef(tag)) {
  48944. if (isDef(children)) {
  48945. // empty element, allow client to pick up and populate children
  48946. if (!elm.hasChildNodes()) {
  48947. createChildren(vnode, children, insertedVnodeQueue);
  48948. } else {
  48949. // v-html and domProps: innerHTML
  48950. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  48951. if (i !== elm.innerHTML) {
  48952. /* istanbul ignore if */
  48953. if (typeof console !== 'undefined' &&
  48954. !hydrationBailed
  48955. ) {
  48956. hydrationBailed = true;
  48957. console.warn('Parent: ', elm);
  48958. console.warn('server innerHTML: ', i);
  48959. console.warn('client innerHTML: ', elm.innerHTML);
  48960. }
  48961. return false
  48962. }
  48963. } else {
  48964. // iterate and compare children lists
  48965. var childrenMatch = true;
  48966. var childNode = elm.firstChild;
  48967. for (var i$1 = 0; i$1 < children.length; i$1++) {
  48968. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  48969. childrenMatch = false;
  48970. break
  48971. }
  48972. childNode = childNode.nextSibling;
  48973. }
  48974. // if childNode is not null, it means the actual childNodes list is
  48975. // longer than the virtual children list.
  48976. if (!childrenMatch || childNode) {
  48977. /* istanbul ignore if */
  48978. if (typeof console !== 'undefined' &&
  48979. !hydrationBailed
  48980. ) {
  48981. hydrationBailed = true;
  48982. console.warn('Parent: ', elm);
  48983. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  48984. }
  48985. return false
  48986. }
  48987. }
  48988. }
  48989. }
  48990. if (isDef(data)) {
  48991. var fullInvoke = false;
  48992. for (var key in data) {
  48993. if (!isRenderedModule(key)) {
  48994. fullInvoke = true;
  48995. invokeCreateHooks(vnode, insertedVnodeQueue);
  48996. break
  48997. }
  48998. }
  48999. if (!fullInvoke && data['class']) {
  49000. // ensure collecting deps for deep class bindings for future updates
  49001. traverse(data['class']);
  49002. }
  49003. }
  49004. } else if (elm.data !== vnode.text) {
  49005. elm.data = vnode.text;
  49006. }
  49007. return true
  49008. }
  49009. function assertNodeMatch (node, vnode, inVPre) {
  49010. if (isDef(vnode.tag)) {
  49011. return vnode.tag.indexOf('vue-component') === 0 || (
  49012. !isUnknownElement$$1(vnode, inVPre) &&
  49013. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49014. )
  49015. } else {
  49016. return node.nodeType === (vnode.isComment ? 8 : 3)
  49017. }
  49018. }
  49019. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49020. if (isUndef(vnode)) {
  49021. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49022. return
  49023. }
  49024. var isInitialPatch = false;
  49025. var insertedVnodeQueue = [];
  49026. if (isUndef(oldVnode)) {
  49027. // empty mount (likely as component), create new root element
  49028. isInitialPatch = true;
  49029. createElm(vnode, insertedVnodeQueue);
  49030. } else {
  49031. var isRealElement = isDef(oldVnode.nodeType);
  49032. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49033. // patch existing root node
  49034. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49035. } else {
  49036. if (isRealElement) {
  49037. // mounting to a real element
  49038. // check if this is server-rendered content and if we can perform
  49039. // a successful hydration.
  49040. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49041. oldVnode.removeAttribute(SSR_ATTR);
  49042. hydrating = true;
  49043. }
  49044. if (isTrue(hydrating)) {
  49045. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49046. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49047. return oldVnode
  49048. } else {
  49049. warn(
  49050. 'The client-side rendered virtual DOM tree is not matching ' +
  49051. 'server-rendered content. This is likely caused by incorrect ' +
  49052. 'HTML markup, for example nesting block-level elements inside ' +
  49053. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49054. 'full client-side render.'
  49055. );
  49056. }
  49057. }
  49058. // either not server-rendered, or hydration failed.
  49059. // create an empty node and replace it
  49060. oldVnode = emptyNodeAt(oldVnode);
  49061. }
  49062. // replacing existing element
  49063. var oldElm = oldVnode.elm;
  49064. var parentElm = nodeOps.parentNode(oldElm);
  49065. // create new node
  49066. createElm(
  49067. vnode,
  49068. insertedVnodeQueue,
  49069. // extremely rare edge case: do not insert if old element is in a
  49070. // leaving transition. Only happens when combining transition +
  49071. // keep-alive + HOCs. (#4590)
  49072. oldElm._leaveCb ? null : parentElm,
  49073. nodeOps.nextSibling(oldElm)
  49074. );
  49075. // update parent placeholder node element, recursively
  49076. if (isDef(vnode.parent)) {
  49077. var ancestor = vnode.parent;
  49078. var patchable = isPatchable(vnode);
  49079. while (ancestor) {
  49080. for (var i = 0; i < cbs.destroy.length; ++i) {
  49081. cbs.destroy[i](ancestor);
  49082. }
  49083. ancestor.elm = vnode.elm;
  49084. if (patchable) {
  49085. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49086. cbs.create[i$1](emptyNode, ancestor);
  49087. }
  49088. // #6513
  49089. // invoke insert hooks that may have been merged by create hooks.
  49090. // e.g. for directives that uses the "inserted" hook.
  49091. var insert = ancestor.data.hook.insert;
  49092. if (insert.merged) {
  49093. // start at index 1 to avoid re-invoking component mounted hook
  49094. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49095. insert.fns[i$2]();
  49096. }
  49097. }
  49098. } else {
  49099. registerRef(ancestor);
  49100. }
  49101. ancestor = ancestor.parent;
  49102. }
  49103. }
  49104. // destroy old node
  49105. if (isDef(parentElm)) {
  49106. removeVnodes([oldVnode], 0, 0);
  49107. } else if (isDef(oldVnode.tag)) {
  49108. invokeDestroyHook(oldVnode);
  49109. }
  49110. }
  49111. }
  49112. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49113. return vnode.elm
  49114. }
  49115. }
  49116. /* */
  49117. var directives = {
  49118. create: updateDirectives,
  49119. update: updateDirectives,
  49120. destroy: function unbindDirectives (vnode) {
  49121. updateDirectives(vnode, emptyNode);
  49122. }
  49123. };
  49124. function updateDirectives (oldVnode, vnode) {
  49125. if (oldVnode.data.directives || vnode.data.directives) {
  49126. _update(oldVnode, vnode);
  49127. }
  49128. }
  49129. function _update (oldVnode, vnode) {
  49130. var isCreate = oldVnode === emptyNode;
  49131. var isDestroy = vnode === emptyNode;
  49132. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49133. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49134. var dirsWithInsert = [];
  49135. var dirsWithPostpatch = [];
  49136. var key, oldDir, dir;
  49137. for (key in newDirs) {
  49138. oldDir = oldDirs[key];
  49139. dir = newDirs[key];
  49140. if (!oldDir) {
  49141. // new directive, bind
  49142. callHook$1(dir, 'bind', vnode, oldVnode);
  49143. if (dir.def && dir.def.inserted) {
  49144. dirsWithInsert.push(dir);
  49145. }
  49146. } else {
  49147. // existing directive, update
  49148. dir.oldValue = oldDir.value;
  49149. dir.oldArg = oldDir.arg;
  49150. callHook$1(dir, 'update', vnode, oldVnode);
  49151. if (dir.def && dir.def.componentUpdated) {
  49152. dirsWithPostpatch.push(dir);
  49153. }
  49154. }
  49155. }
  49156. if (dirsWithInsert.length) {
  49157. var callInsert = function () {
  49158. for (var i = 0; i < dirsWithInsert.length; i++) {
  49159. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49160. }
  49161. };
  49162. if (isCreate) {
  49163. mergeVNodeHook(vnode, 'insert', callInsert);
  49164. } else {
  49165. callInsert();
  49166. }
  49167. }
  49168. if (dirsWithPostpatch.length) {
  49169. mergeVNodeHook(vnode, 'postpatch', function () {
  49170. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49171. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49172. }
  49173. });
  49174. }
  49175. if (!isCreate) {
  49176. for (key in oldDirs) {
  49177. if (!newDirs[key]) {
  49178. // no longer present, unbind
  49179. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  49180. }
  49181. }
  49182. }
  49183. }
  49184. var emptyModifiers = Object.create(null);
  49185. function normalizeDirectives$1 (
  49186. dirs,
  49187. vm
  49188. ) {
  49189. var res = Object.create(null);
  49190. if (!dirs) {
  49191. // $flow-disable-line
  49192. return res
  49193. }
  49194. var i, dir;
  49195. for (i = 0; i < dirs.length; i++) {
  49196. dir = dirs[i];
  49197. if (!dir.modifiers) {
  49198. // $flow-disable-line
  49199. dir.modifiers = emptyModifiers;
  49200. }
  49201. res[getRawDirName(dir)] = dir;
  49202. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  49203. }
  49204. // $flow-disable-line
  49205. return res
  49206. }
  49207. function getRawDirName (dir) {
  49208. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  49209. }
  49210. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  49211. var fn = dir.def && dir.def[hook];
  49212. if (fn) {
  49213. try {
  49214. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  49215. } catch (e) {
  49216. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  49217. }
  49218. }
  49219. }
  49220. var baseModules = [
  49221. ref,
  49222. directives
  49223. ];
  49224. /* */
  49225. function updateAttrs (oldVnode, vnode) {
  49226. var opts = vnode.componentOptions;
  49227. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  49228. return
  49229. }
  49230. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  49231. return
  49232. }
  49233. var key, cur, old;
  49234. var elm = vnode.elm;
  49235. var oldAttrs = oldVnode.data.attrs || {};
  49236. var attrs = vnode.data.attrs || {};
  49237. // clone observed objects, as the user probably wants to mutate it
  49238. if (isDef(attrs.__ob__)) {
  49239. attrs = vnode.data.attrs = extend({}, attrs);
  49240. }
  49241. for (key in attrs) {
  49242. cur = attrs[key];
  49243. old = oldAttrs[key];
  49244. if (old !== cur) {
  49245. setAttr(elm, key, cur);
  49246. }
  49247. }
  49248. // #4391: in IE9, setting type can reset value for input[type=radio]
  49249. // #6666: IE/Edge forces progress value down to 1 before setting a max
  49250. /* istanbul ignore if */
  49251. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  49252. setAttr(elm, 'value', attrs.value);
  49253. }
  49254. for (key in oldAttrs) {
  49255. if (isUndef(attrs[key])) {
  49256. if (isXlink(key)) {
  49257. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49258. } else if (!isEnumeratedAttr(key)) {
  49259. elm.removeAttribute(key);
  49260. }
  49261. }
  49262. }
  49263. }
  49264. function setAttr (el, key, value) {
  49265. if (el.tagName.indexOf('-') > -1) {
  49266. baseSetAttr(el, key, value);
  49267. } else if (isBooleanAttr(key)) {
  49268. // set attribute for blank value
  49269. // e.g. <option disabled>Select one</option>
  49270. if (isFalsyAttrValue(value)) {
  49271. el.removeAttribute(key);
  49272. } else {
  49273. // technically allowfullscreen is a boolean attribute for <iframe>,
  49274. // but Flash expects a value of "true" when used on <embed> tag
  49275. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  49276. ? 'true'
  49277. : key;
  49278. el.setAttribute(key, value);
  49279. }
  49280. } else if (isEnumeratedAttr(key)) {
  49281. el.setAttribute(key, convertEnumeratedValue(key, value));
  49282. } else if (isXlink(key)) {
  49283. if (isFalsyAttrValue(value)) {
  49284. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49285. } else {
  49286. el.setAttributeNS(xlinkNS, key, value);
  49287. }
  49288. } else {
  49289. baseSetAttr(el, key, value);
  49290. }
  49291. }
  49292. function baseSetAttr (el, key, value) {
  49293. if (isFalsyAttrValue(value)) {
  49294. el.removeAttribute(key);
  49295. } else {
  49296. // #7138: IE10 & 11 fires input event when setting placeholder on
  49297. // <textarea>... block the first input event and remove the blocker
  49298. // immediately.
  49299. /* istanbul ignore if */
  49300. if (
  49301. isIE && !isIE9 &&
  49302. el.tagName === 'TEXTAREA' &&
  49303. key === 'placeholder' && value !== '' && !el.__ieph
  49304. ) {
  49305. var blocker = function (e) {
  49306. e.stopImmediatePropagation();
  49307. el.removeEventListener('input', blocker);
  49308. };
  49309. el.addEventListener('input', blocker);
  49310. // $flow-disable-line
  49311. el.__ieph = true; /* IE placeholder patched */
  49312. }
  49313. el.setAttribute(key, value);
  49314. }
  49315. }
  49316. var attrs = {
  49317. create: updateAttrs,
  49318. update: updateAttrs
  49319. };
  49320. /* */
  49321. function updateClass (oldVnode, vnode) {
  49322. var el = vnode.elm;
  49323. var data = vnode.data;
  49324. var oldData = oldVnode.data;
  49325. if (
  49326. isUndef(data.staticClass) &&
  49327. isUndef(data.class) && (
  49328. isUndef(oldData) || (
  49329. isUndef(oldData.staticClass) &&
  49330. isUndef(oldData.class)
  49331. )
  49332. )
  49333. ) {
  49334. return
  49335. }
  49336. var cls = genClassForVnode(vnode);
  49337. // handle transition classes
  49338. var transitionClass = el._transitionClasses;
  49339. if (isDef(transitionClass)) {
  49340. cls = concat(cls, stringifyClass(transitionClass));
  49341. }
  49342. // set the class
  49343. if (cls !== el._prevClass) {
  49344. el.setAttribute('class', cls);
  49345. el._prevClass = cls;
  49346. }
  49347. }
  49348. var klass = {
  49349. create: updateClass,
  49350. update: updateClass
  49351. };
  49352. /* */
  49353. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49354. function parseFilters (exp) {
  49355. var inSingle = false;
  49356. var inDouble = false;
  49357. var inTemplateString = false;
  49358. var inRegex = false;
  49359. var curly = 0;
  49360. var square = 0;
  49361. var paren = 0;
  49362. var lastFilterIndex = 0;
  49363. var c, prev, i, expression, filters;
  49364. for (i = 0; i < exp.length; i++) {
  49365. prev = c;
  49366. c = exp.charCodeAt(i);
  49367. if (inSingle) {
  49368. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49369. } else if (inDouble) {
  49370. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49371. } else if (inTemplateString) {
  49372. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49373. } else if (inRegex) {
  49374. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49375. } else if (
  49376. c === 0x7C && // pipe
  49377. exp.charCodeAt(i + 1) !== 0x7C &&
  49378. exp.charCodeAt(i - 1) !== 0x7C &&
  49379. !curly && !square && !paren
  49380. ) {
  49381. if (expression === undefined) {
  49382. // first filter, end of expression
  49383. lastFilterIndex = i + 1;
  49384. expression = exp.slice(0, i).trim();
  49385. } else {
  49386. pushFilter();
  49387. }
  49388. } else {
  49389. switch (c) {
  49390. case 0x22: inDouble = true; break // "
  49391. case 0x27: inSingle = true; break // '
  49392. case 0x60: inTemplateString = true; break // `
  49393. case 0x28: paren++; break // (
  49394. case 0x29: paren--; break // )
  49395. case 0x5B: square++; break // [
  49396. case 0x5D: square--; break // ]
  49397. case 0x7B: curly++; break // {
  49398. case 0x7D: curly--; break // }
  49399. }
  49400. if (c === 0x2f) { // /
  49401. var j = i - 1;
  49402. var p = (void 0);
  49403. // find first non-whitespace prev char
  49404. for (; j >= 0; j--) {
  49405. p = exp.charAt(j);
  49406. if (p !== ' ') { break }
  49407. }
  49408. if (!p || !validDivisionCharRE.test(p)) {
  49409. inRegex = true;
  49410. }
  49411. }
  49412. }
  49413. }
  49414. if (expression === undefined) {
  49415. expression = exp.slice(0, i).trim();
  49416. } else if (lastFilterIndex !== 0) {
  49417. pushFilter();
  49418. }
  49419. function pushFilter () {
  49420. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  49421. lastFilterIndex = i + 1;
  49422. }
  49423. if (filters) {
  49424. for (i = 0; i < filters.length; i++) {
  49425. expression = wrapFilter(expression, filters[i]);
  49426. }
  49427. }
  49428. return expression
  49429. }
  49430. function wrapFilter (exp, filter) {
  49431. var i = filter.indexOf('(');
  49432. if (i < 0) {
  49433. // _f: resolveFilter
  49434. return ("_f(\"" + filter + "\")(" + exp + ")")
  49435. } else {
  49436. var name = filter.slice(0, i);
  49437. var args = filter.slice(i + 1);
  49438. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  49439. }
  49440. }
  49441. /* */
  49442. /* eslint-disable no-unused-vars */
  49443. function baseWarn (msg, range) {
  49444. console.error(("[Vue compiler]: " + msg));
  49445. }
  49446. /* eslint-enable no-unused-vars */
  49447. function pluckModuleFunction (
  49448. modules,
  49449. key
  49450. ) {
  49451. return modules
  49452. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  49453. : []
  49454. }
  49455. function addProp (el, name, value, range, dynamic) {
  49456. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49457. el.plain = false;
  49458. }
  49459. function addAttr (el, name, value, range, dynamic) {
  49460. var attrs = dynamic
  49461. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  49462. : (el.attrs || (el.attrs = []));
  49463. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49464. el.plain = false;
  49465. }
  49466. // add a raw attr (use this in preTransforms)
  49467. function addRawAttr (el, name, value, range) {
  49468. el.attrsMap[name] = value;
  49469. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  49470. }
  49471. function addDirective (
  49472. el,
  49473. name,
  49474. rawName,
  49475. value,
  49476. arg,
  49477. isDynamicArg,
  49478. modifiers,
  49479. range
  49480. ) {
  49481. (el.directives || (el.directives = [])).push(rangeSetItem({
  49482. name: name,
  49483. rawName: rawName,
  49484. value: value,
  49485. arg: arg,
  49486. isDynamicArg: isDynamicArg,
  49487. modifiers: modifiers
  49488. }, range));
  49489. el.plain = false;
  49490. }
  49491. function prependModifierMarker (symbol, name, dynamic) {
  49492. return dynamic
  49493. ? ("_p(" + name + ",\"" + symbol + "\")")
  49494. : symbol + name // mark the event as captured
  49495. }
  49496. function addHandler (
  49497. el,
  49498. name,
  49499. value,
  49500. modifiers,
  49501. important,
  49502. warn,
  49503. range,
  49504. dynamic
  49505. ) {
  49506. modifiers = modifiers || emptyObject;
  49507. // warn prevent and passive modifier
  49508. /* istanbul ignore if */
  49509. if (
  49510. warn &&
  49511. modifiers.prevent && modifiers.passive
  49512. ) {
  49513. warn(
  49514. 'passive and prevent can\'t be used together. ' +
  49515. 'Passive handler can\'t prevent default event.',
  49516. range
  49517. );
  49518. }
  49519. // normalize click.right and click.middle since they don't actually fire
  49520. // this is technically browser-specific, but at least for now browsers are
  49521. // the only target envs that have right/middle clicks.
  49522. if (modifiers.right) {
  49523. if (dynamic) {
  49524. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  49525. } else if (name === 'click') {
  49526. name = 'contextmenu';
  49527. delete modifiers.right;
  49528. }
  49529. } else if (modifiers.middle) {
  49530. if (dynamic) {
  49531. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  49532. } else if (name === 'click') {
  49533. name = 'mouseup';
  49534. }
  49535. }
  49536. // check capture modifier
  49537. if (modifiers.capture) {
  49538. delete modifiers.capture;
  49539. name = prependModifierMarker('!', name, dynamic);
  49540. }
  49541. if (modifiers.once) {
  49542. delete modifiers.once;
  49543. name = prependModifierMarker('~', name, dynamic);
  49544. }
  49545. /* istanbul ignore if */
  49546. if (modifiers.passive) {
  49547. delete modifiers.passive;
  49548. name = prependModifierMarker('&', name, dynamic);
  49549. }
  49550. var events;
  49551. if (modifiers.native) {
  49552. delete modifiers.native;
  49553. events = el.nativeEvents || (el.nativeEvents = {});
  49554. } else {
  49555. events = el.events || (el.events = {});
  49556. }
  49557. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  49558. if (modifiers !== emptyObject) {
  49559. newHandler.modifiers = modifiers;
  49560. }
  49561. var handlers = events[name];
  49562. /* istanbul ignore if */
  49563. if (Array.isArray(handlers)) {
  49564. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  49565. } else if (handlers) {
  49566. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  49567. } else {
  49568. events[name] = newHandler;
  49569. }
  49570. el.plain = false;
  49571. }
  49572. function getRawBindingAttr (
  49573. el,
  49574. name
  49575. ) {
  49576. return el.rawAttrsMap[':' + name] ||
  49577. el.rawAttrsMap['v-bind:' + name] ||
  49578. el.rawAttrsMap[name]
  49579. }
  49580. function getBindingAttr (
  49581. el,
  49582. name,
  49583. getStatic
  49584. ) {
  49585. var dynamicValue =
  49586. getAndRemoveAttr(el, ':' + name) ||
  49587. getAndRemoveAttr(el, 'v-bind:' + name);
  49588. if (dynamicValue != null) {
  49589. return parseFilters(dynamicValue)
  49590. } else if (getStatic !== false) {
  49591. var staticValue = getAndRemoveAttr(el, name);
  49592. if (staticValue != null) {
  49593. return JSON.stringify(staticValue)
  49594. }
  49595. }
  49596. }
  49597. // note: this only removes the attr from the Array (attrsList) so that it
  49598. // doesn't get processed by processAttrs.
  49599. // By default it does NOT remove it from the map (attrsMap) because the map is
  49600. // needed during codegen.
  49601. function getAndRemoveAttr (
  49602. el,
  49603. name,
  49604. removeFromMap
  49605. ) {
  49606. var val;
  49607. if ((val = el.attrsMap[name]) != null) {
  49608. var list = el.attrsList;
  49609. for (var i = 0, l = list.length; i < l; i++) {
  49610. if (list[i].name === name) {
  49611. list.splice(i, 1);
  49612. break
  49613. }
  49614. }
  49615. }
  49616. if (removeFromMap) {
  49617. delete el.attrsMap[name];
  49618. }
  49619. return val
  49620. }
  49621. function getAndRemoveAttrByRegex (
  49622. el,
  49623. name
  49624. ) {
  49625. var list = el.attrsList;
  49626. for (var i = 0, l = list.length; i < l; i++) {
  49627. var attr = list[i];
  49628. if (name.test(attr.name)) {
  49629. list.splice(i, 1);
  49630. return attr
  49631. }
  49632. }
  49633. }
  49634. function rangeSetItem (
  49635. item,
  49636. range
  49637. ) {
  49638. if (range) {
  49639. if (range.start != null) {
  49640. item.start = range.start;
  49641. }
  49642. if (range.end != null) {
  49643. item.end = range.end;
  49644. }
  49645. }
  49646. return item
  49647. }
  49648. /* */
  49649. /**
  49650. * Cross-platform code generation for component v-model
  49651. */
  49652. function genComponentModel (
  49653. el,
  49654. value,
  49655. modifiers
  49656. ) {
  49657. var ref = modifiers || {};
  49658. var number = ref.number;
  49659. var trim = ref.trim;
  49660. var baseValueExpression = '$$v';
  49661. var valueExpression = baseValueExpression;
  49662. if (trim) {
  49663. valueExpression =
  49664. "(typeof " + baseValueExpression + " === 'string'" +
  49665. "? " + baseValueExpression + ".trim()" +
  49666. ": " + baseValueExpression + ")";
  49667. }
  49668. if (number) {
  49669. valueExpression = "_n(" + valueExpression + ")";
  49670. }
  49671. var assignment = genAssignmentCode(value, valueExpression);
  49672. el.model = {
  49673. value: ("(" + value + ")"),
  49674. expression: JSON.stringify(value),
  49675. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  49676. };
  49677. }
  49678. /**
  49679. * Cross-platform codegen helper for generating v-model value assignment code.
  49680. */
  49681. function genAssignmentCode (
  49682. value,
  49683. assignment
  49684. ) {
  49685. var res = parseModel(value);
  49686. if (res.key === null) {
  49687. return (value + "=" + assignment)
  49688. } else {
  49689. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  49690. }
  49691. }
  49692. /**
  49693. * Parse a v-model expression into a base path and a final key segment.
  49694. * Handles both dot-path and possible square brackets.
  49695. *
  49696. * Possible cases:
  49697. *
  49698. * - test
  49699. * - test[key]
  49700. * - test[test1[key]]
  49701. * - test["a"][key]
  49702. * - xxx.test[a[a].test1[key]]
  49703. * - test.xxx.a["asa"][test1[key]]
  49704. *
  49705. */
  49706. var len, str, chr, index$1, expressionPos, expressionEndPos;
  49707. function parseModel (val) {
  49708. // Fix https://github.com/vuejs/vue/pull/7730
  49709. // allow v-model="obj.val " (trailing whitespace)
  49710. val = val.trim();
  49711. len = val.length;
  49712. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  49713. index$1 = val.lastIndexOf('.');
  49714. if (index$1 > -1) {
  49715. return {
  49716. exp: val.slice(0, index$1),
  49717. key: '"' + val.slice(index$1 + 1) + '"'
  49718. }
  49719. } else {
  49720. return {
  49721. exp: val,
  49722. key: null
  49723. }
  49724. }
  49725. }
  49726. str = val;
  49727. index$1 = expressionPos = expressionEndPos = 0;
  49728. while (!eof()) {
  49729. chr = next();
  49730. /* istanbul ignore if */
  49731. if (isStringStart(chr)) {
  49732. parseString(chr);
  49733. } else if (chr === 0x5B) {
  49734. parseBracket(chr);
  49735. }
  49736. }
  49737. return {
  49738. exp: val.slice(0, expressionPos),
  49739. key: val.slice(expressionPos + 1, expressionEndPos)
  49740. }
  49741. }
  49742. function next () {
  49743. return str.charCodeAt(++index$1)
  49744. }
  49745. function eof () {
  49746. return index$1 >= len
  49747. }
  49748. function isStringStart (chr) {
  49749. return chr === 0x22 || chr === 0x27
  49750. }
  49751. function parseBracket (chr) {
  49752. var inBracket = 1;
  49753. expressionPos = index$1;
  49754. while (!eof()) {
  49755. chr = next();
  49756. if (isStringStart(chr)) {
  49757. parseString(chr);
  49758. continue
  49759. }
  49760. if (chr === 0x5B) { inBracket++; }
  49761. if (chr === 0x5D) { inBracket--; }
  49762. if (inBracket === 0) {
  49763. expressionEndPos = index$1;
  49764. break
  49765. }
  49766. }
  49767. }
  49768. function parseString (chr) {
  49769. var stringQuote = chr;
  49770. while (!eof()) {
  49771. chr = next();
  49772. if (chr === stringQuote) {
  49773. break
  49774. }
  49775. }
  49776. }
  49777. /* */
  49778. var warn$1;
  49779. // in some cases, the event used has to be determined at runtime
  49780. // so we used some reserved tokens during compile.
  49781. var RANGE_TOKEN = '__r';
  49782. var CHECKBOX_RADIO_TOKEN = '__c';
  49783. function model (
  49784. el,
  49785. dir,
  49786. _warn
  49787. ) {
  49788. warn$1 = _warn;
  49789. var value = dir.value;
  49790. var modifiers = dir.modifiers;
  49791. var tag = el.tag;
  49792. var type = el.attrsMap.type;
  49793. {
  49794. // inputs with type="file" are read only and setting the input's
  49795. // value will throw an error.
  49796. if (tag === 'input' && type === 'file') {
  49797. warn$1(
  49798. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  49799. "File inputs are read only. Use a v-on:change listener instead.",
  49800. el.rawAttrsMap['v-model']
  49801. );
  49802. }
  49803. }
  49804. if (el.component) {
  49805. genComponentModel(el, value, modifiers);
  49806. // component v-model doesn't need extra runtime
  49807. return false
  49808. } else if (tag === 'select') {
  49809. genSelect(el, value, modifiers);
  49810. } else if (tag === 'input' && type === 'checkbox') {
  49811. genCheckboxModel(el, value, modifiers);
  49812. } else if (tag === 'input' && type === 'radio') {
  49813. genRadioModel(el, value, modifiers);
  49814. } else if (tag === 'input' || tag === 'textarea') {
  49815. genDefaultModel(el, value, modifiers);
  49816. } else if (!config.isReservedTag(tag)) {
  49817. genComponentModel(el, value, modifiers);
  49818. // component v-model doesn't need extra runtime
  49819. return false
  49820. } else {
  49821. warn$1(
  49822. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  49823. "v-model is not supported on this element type. " +
  49824. 'If you are working with contenteditable, it\'s recommended to ' +
  49825. 'wrap a library dedicated for that purpose inside a custom component.',
  49826. el.rawAttrsMap['v-model']
  49827. );
  49828. }
  49829. // ensure runtime directive metadata
  49830. return true
  49831. }
  49832. function genCheckboxModel (
  49833. el,
  49834. value,
  49835. modifiers
  49836. ) {
  49837. var number = modifiers && modifiers.number;
  49838. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49839. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  49840. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  49841. addProp(el, 'checked',
  49842. "Array.isArray(" + value + ")" +
  49843. "?_i(" + value + "," + valueBinding + ")>-1" + (
  49844. trueValueBinding === 'true'
  49845. ? (":(" + value + ")")
  49846. : (":_q(" + value + "," + trueValueBinding + ")")
  49847. )
  49848. );
  49849. addHandler(el, 'change',
  49850. "var $$a=" + value + "," +
  49851. '$$el=$event.target,' +
  49852. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  49853. 'if(Array.isArray($$a)){' +
  49854. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  49855. '$$i=_i($$a,$$v);' +
  49856. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  49857. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  49858. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  49859. null, true
  49860. );
  49861. }
  49862. function genRadioModel (
  49863. el,
  49864. value,
  49865. modifiers
  49866. ) {
  49867. var number = modifiers && modifiers.number;
  49868. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49869. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  49870. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  49871. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  49872. }
  49873. function genSelect (
  49874. el,
  49875. value,
  49876. modifiers
  49877. ) {
  49878. var number = modifiers && modifiers.number;
  49879. var selectedVal = "Array.prototype.filter" +
  49880. ".call($event.target.options,function(o){return o.selected})" +
  49881. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  49882. "return " + (number ? '_n(val)' : 'val') + "})";
  49883. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  49884. var code = "var $$selectedVal = " + selectedVal + ";";
  49885. code = code + " " + (genAssignmentCode(value, assignment));
  49886. addHandler(el, 'change', code, null, true);
  49887. }
  49888. function genDefaultModel (
  49889. el,
  49890. value,
  49891. modifiers
  49892. ) {
  49893. var type = el.attrsMap.type;
  49894. // warn if v-bind:value conflicts with v-model
  49895. // except for inputs with v-bind:type
  49896. {
  49897. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  49898. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  49899. if (value$1 && !typeBinding) {
  49900. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  49901. warn$1(
  49902. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  49903. 'because the latter already expands to a value binding internally',
  49904. el.rawAttrsMap[binding]
  49905. );
  49906. }
  49907. }
  49908. var ref = modifiers || {};
  49909. var lazy = ref.lazy;
  49910. var number = ref.number;
  49911. var trim = ref.trim;
  49912. var needCompositionGuard = !lazy && type !== 'range';
  49913. var event = lazy
  49914. ? 'change'
  49915. : type === 'range'
  49916. ? RANGE_TOKEN
  49917. : 'input';
  49918. var valueExpression = '$event.target.value';
  49919. if (trim) {
  49920. valueExpression = "$event.target.value.trim()";
  49921. }
  49922. if (number) {
  49923. valueExpression = "_n(" + valueExpression + ")";
  49924. }
  49925. var code = genAssignmentCode(value, valueExpression);
  49926. if (needCompositionGuard) {
  49927. code = "if($event.target.composing)return;" + code;
  49928. }
  49929. addProp(el, 'value', ("(" + value + ")"));
  49930. addHandler(el, event, code, null, true);
  49931. if (trim || number) {
  49932. addHandler(el, 'blur', '$forceUpdate()');
  49933. }
  49934. }
  49935. /* */
  49936. // normalize v-model event tokens that can only be determined at runtime.
  49937. // it's important to place the event as the first in the array because
  49938. // the whole point is ensuring the v-model callback gets called before
  49939. // user-attached handlers.
  49940. function normalizeEvents (on) {
  49941. /* istanbul ignore if */
  49942. if (isDef(on[RANGE_TOKEN])) {
  49943. // IE input[type=range] only supports `change` event
  49944. var event = isIE ? 'change' : 'input';
  49945. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  49946. delete on[RANGE_TOKEN];
  49947. }
  49948. // This was originally intended to fix #4521 but no longer necessary
  49949. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  49950. /* istanbul ignore if */
  49951. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  49952. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  49953. delete on[CHECKBOX_RADIO_TOKEN];
  49954. }
  49955. }
  49956. var target$1;
  49957. function createOnceHandler$1 (event, handler, capture) {
  49958. var _target = target$1; // save current target element in closure
  49959. return function onceHandler () {
  49960. var res = handler.apply(null, arguments);
  49961. if (res !== null) {
  49962. remove$2(event, onceHandler, capture, _target);
  49963. }
  49964. }
  49965. }
  49966. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  49967. // implementation and does not fire microtasks in between event propagation, so
  49968. // safe to exclude.
  49969. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  49970. function add$1 (
  49971. name,
  49972. handler,
  49973. capture,
  49974. passive
  49975. ) {
  49976. // async edge case #6566: inner click event triggers patch, event handler
  49977. // attached to outer element during patch, and triggered again. This
  49978. // happens because browsers fire microtask ticks between event propagation.
  49979. // the solution is simple: we save the timestamp when a handler is attached,
  49980. // and the handler would only fire if the event passed to it was fired
  49981. // AFTER it was attached.
  49982. if (useMicrotaskFix) {
  49983. var attachedTimestamp = currentFlushTimestamp;
  49984. var original = handler;
  49985. handler = original._wrapper = function (e) {
  49986. if (
  49987. // no bubbling, should always fire.
  49988. // this is just a safety net in case event.timeStamp is unreliable in
  49989. // certain weird environments...
  49990. e.target === e.currentTarget ||
  49991. // event is fired after handler attachment
  49992. e.timeStamp >= attachedTimestamp ||
  49993. // bail for environments that have buggy event.timeStamp implementations
  49994. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  49995. // #9681 QtWebEngine event.timeStamp is negative value
  49996. e.timeStamp <= 0 ||
  49997. // #9448 bail if event is fired in another document in a multi-page
  49998. // electron/nw.js app, since event.timeStamp will be using a different
  49999. // starting reference
  50000. e.target.ownerDocument !== document
  50001. ) {
  50002. return original.apply(this, arguments)
  50003. }
  50004. };
  50005. }
  50006. target$1.addEventListener(
  50007. name,
  50008. handler,
  50009. supportsPassive
  50010. ? { capture: capture, passive: passive }
  50011. : capture
  50012. );
  50013. }
  50014. function remove$2 (
  50015. name,
  50016. handler,
  50017. capture,
  50018. _target
  50019. ) {
  50020. (_target || target$1).removeEventListener(
  50021. name,
  50022. handler._wrapper || handler,
  50023. capture
  50024. );
  50025. }
  50026. function updateDOMListeners (oldVnode, vnode) {
  50027. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50028. return
  50029. }
  50030. var on = vnode.data.on || {};
  50031. var oldOn = oldVnode.data.on || {};
  50032. target$1 = vnode.elm;
  50033. normalizeEvents(on);
  50034. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50035. target$1 = undefined;
  50036. }
  50037. var events = {
  50038. create: updateDOMListeners,
  50039. update: updateDOMListeners
  50040. };
  50041. /* */
  50042. var svgContainer;
  50043. function updateDOMProps (oldVnode, vnode) {
  50044. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50045. return
  50046. }
  50047. var key, cur;
  50048. var elm = vnode.elm;
  50049. var oldProps = oldVnode.data.domProps || {};
  50050. var props = vnode.data.domProps || {};
  50051. // clone observed objects, as the user probably wants to mutate it
  50052. if (isDef(props.__ob__)) {
  50053. props = vnode.data.domProps = extend({}, props);
  50054. }
  50055. for (key in oldProps) {
  50056. if (!(key in props)) {
  50057. elm[key] = '';
  50058. }
  50059. }
  50060. for (key in props) {
  50061. cur = props[key];
  50062. // ignore children if the node has textContent or innerHTML,
  50063. // as these will throw away existing DOM nodes and cause removal errors
  50064. // on subsequent patches (#3360)
  50065. if (key === 'textContent' || key === 'innerHTML') {
  50066. if (vnode.children) { vnode.children.length = 0; }
  50067. if (cur === oldProps[key]) { continue }
  50068. // #6601 work around Chrome version <= 55 bug where single textNode
  50069. // replaced by innerHTML/textContent retains its parentNode property
  50070. if (elm.childNodes.length === 1) {
  50071. elm.removeChild(elm.childNodes[0]);
  50072. }
  50073. }
  50074. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50075. // store value as _value as well since
  50076. // non-string values will be stringified
  50077. elm._value = cur;
  50078. // avoid resetting cursor position when value is the same
  50079. var strCur = isUndef(cur) ? '' : String(cur);
  50080. if (shouldUpdateValue(elm, strCur)) {
  50081. elm.value = strCur;
  50082. }
  50083. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50084. // IE doesn't support innerHTML for SVG elements
  50085. svgContainer = svgContainer || document.createElement('div');
  50086. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50087. var svg = svgContainer.firstChild;
  50088. while (elm.firstChild) {
  50089. elm.removeChild(elm.firstChild);
  50090. }
  50091. while (svg.firstChild) {
  50092. elm.appendChild(svg.firstChild);
  50093. }
  50094. } else if (
  50095. // skip the update if old and new VDOM state is the same.
  50096. // `value` is handled separately because the DOM value may be temporarily
  50097. // out of sync with VDOM state due to focus, composition and modifiers.
  50098. // This #4521 by skipping the unnecesarry `checked` update.
  50099. cur !== oldProps[key]
  50100. ) {
  50101. // some property updates can throw
  50102. // e.g. `value` on <progress> w/ non-finite value
  50103. try {
  50104. elm[key] = cur;
  50105. } catch (e) {}
  50106. }
  50107. }
  50108. }
  50109. // check platforms/web/util/attrs.js acceptValue
  50110. function shouldUpdateValue (elm, checkVal) {
  50111. return (!elm.composing && (
  50112. elm.tagName === 'OPTION' ||
  50113. isNotInFocusAndDirty(elm, checkVal) ||
  50114. isDirtyWithModifiers(elm, checkVal)
  50115. ))
  50116. }
  50117. function isNotInFocusAndDirty (elm, checkVal) {
  50118. // return true when textbox (.number and .trim) loses focus and its value is
  50119. // not equal to the updated value
  50120. var notInFocus = true;
  50121. // #6157
  50122. // work around IE bug when accessing document.activeElement in an iframe
  50123. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50124. return notInFocus && elm.value !== checkVal
  50125. }
  50126. function isDirtyWithModifiers (elm, newVal) {
  50127. var value = elm.value;
  50128. var modifiers = elm._vModifiers; // injected by v-model runtime
  50129. if (isDef(modifiers)) {
  50130. if (modifiers.number) {
  50131. return toNumber(value) !== toNumber(newVal)
  50132. }
  50133. if (modifiers.trim) {
  50134. return value.trim() !== newVal.trim()
  50135. }
  50136. }
  50137. return value !== newVal
  50138. }
  50139. var domProps = {
  50140. create: updateDOMProps,
  50141. update: updateDOMProps
  50142. };
  50143. /* */
  50144. var parseStyleText = cached(function (cssText) {
  50145. var res = {};
  50146. var listDelimiter = /;(?![^(]*\))/g;
  50147. var propertyDelimiter = /:(.+)/;
  50148. cssText.split(listDelimiter).forEach(function (item) {
  50149. if (item) {
  50150. var tmp = item.split(propertyDelimiter);
  50151. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50152. }
  50153. });
  50154. return res
  50155. });
  50156. // merge static and dynamic style data on the same vnode
  50157. function normalizeStyleData (data) {
  50158. var style = normalizeStyleBinding(data.style);
  50159. // static style is pre-processed into an object during compilation
  50160. // and is always a fresh object, so it's safe to merge into it
  50161. return data.staticStyle
  50162. ? extend(data.staticStyle, style)
  50163. : style
  50164. }
  50165. // normalize possible array / string values into Object
  50166. function normalizeStyleBinding (bindingStyle) {
  50167. if (Array.isArray(bindingStyle)) {
  50168. return toObject(bindingStyle)
  50169. }
  50170. if (typeof bindingStyle === 'string') {
  50171. return parseStyleText(bindingStyle)
  50172. }
  50173. return bindingStyle
  50174. }
  50175. /**
  50176. * parent component style should be after child's
  50177. * so that parent component's style could override it
  50178. */
  50179. function getStyle (vnode, checkChild) {
  50180. var res = {};
  50181. var styleData;
  50182. if (checkChild) {
  50183. var childNode = vnode;
  50184. while (childNode.componentInstance) {
  50185. childNode = childNode.componentInstance._vnode;
  50186. if (
  50187. childNode && childNode.data &&
  50188. (styleData = normalizeStyleData(childNode.data))
  50189. ) {
  50190. extend(res, styleData);
  50191. }
  50192. }
  50193. }
  50194. if ((styleData = normalizeStyleData(vnode.data))) {
  50195. extend(res, styleData);
  50196. }
  50197. var parentNode = vnode;
  50198. while ((parentNode = parentNode.parent)) {
  50199. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  50200. extend(res, styleData);
  50201. }
  50202. }
  50203. return res
  50204. }
  50205. /* */
  50206. var cssVarRE = /^--/;
  50207. var importantRE = /\s*!important$/;
  50208. var setProp = function (el, name, val) {
  50209. /* istanbul ignore if */
  50210. if (cssVarRE.test(name)) {
  50211. el.style.setProperty(name, val);
  50212. } else if (importantRE.test(val)) {
  50213. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  50214. } else {
  50215. var normalizedName = normalize(name);
  50216. if (Array.isArray(val)) {
  50217. // Support values array created by autoprefixer, e.g.
  50218. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  50219. // Set them one by one, and the browser will only set those it can recognize
  50220. for (var i = 0, len = val.length; i < len; i++) {
  50221. el.style[normalizedName] = val[i];
  50222. }
  50223. } else {
  50224. el.style[normalizedName] = val;
  50225. }
  50226. }
  50227. };
  50228. var vendorNames = ['Webkit', 'Moz', 'ms'];
  50229. var emptyStyle;
  50230. var normalize = cached(function (prop) {
  50231. emptyStyle = emptyStyle || document.createElement('div').style;
  50232. prop = camelize(prop);
  50233. if (prop !== 'filter' && (prop in emptyStyle)) {
  50234. return prop
  50235. }
  50236. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  50237. for (var i = 0; i < vendorNames.length; i++) {
  50238. var name = vendorNames[i] + capName;
  50239. if (name in emptyStyle) {
  50240. return name
  50241. }
  50242. }
  50243. });
  50244. function updateStyle (oldVnode, vnode) {
  50245. var data = vnode.data;
  50246. var oldData = oldVnode.data;
  50247. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  50248. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  50249. ) {
  50250. return
  50251. }
  50252. var cur, name;
  50253. var el = vnode.elm;
  50254. var oldStaticStyle = oldData.staticStyle;
  50255. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  50256. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  50257. var oldStyle = oldStaticStyle || oldStyleBinding;
  50258. var style = normalizeStyleBinding(vnode.data.style) || {};
  50259. // store normalized style under a different key for next diff
  50260. // make sure to clone it if it's reactive, since the user likely wants
  50261. // to mutate it.
  50262. vnode.data.normalizedStyle = isDef(style.__ob__)
  50263. ? extend({}, style)
  50264. : style;
  50265. var newStyle = getStyle(vnode, true);
  50266. for (name in oldStyle) {
  50267. if (isUndef(newStyle[name])) {
  50268. setProp(el, name, '');
  50269. }
  50270. }
  50271. for (name in newStyle) {
  50272. cur = newStyle[name];
  50273. if (cur !== oldStyle[name]) {
  50274. // ie9 setting to null has no effect, must use empty string
  50275. setProp(el, name, cur == null ? '' : cur);
  50276. }
  50277. }
  50278. }
  50279. var style = {
  50280. create: updateStyle,
  50281. update: updateStyle
  50282. };
  50283. /* */
  50284. var whitespaceRE = /\s+/;
  50285. /**
  50286. * Add class with compatibility for SVG since classList is not supported on
  50287. * SVG elements in IE
  50288. */
  50289. function addClass (el, cls) {
  50290. /* istanbul ignore if */
  50291. if (!cls || !(cls = cls.trim())) {
  50292. return
  50293. }
  50294. /* istanbul ignore else */
  50295. if (el.classList) {
  50296. if (cls.indexOf(' ') > -1) {
  50297. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  50298. } else {
  50299. el.classList.add(cls);
  50300. }
  50301. } else {
  50302. var cur = " " + (el.getAttribute('class') || '') + " ";
  50303. if (cur.indexOf(' ' + cls + ' ') < 0) {
  50304. el.setAttribute('class', (cur + cls).trim());
  50305. }
  50306. }
  50307. }
  50308. /**
  50309. * Remove class with compatibility for SVG since classList is not supported on
  50310. * SVG elements in IE
  50311. */
  50312. function removeClass (el, cls) {
  50313. /* istanbul ignore if */
  50314. if (!cls || !(cls = cls.trim())) {
  50315. return
  50316. }
  50317. /* istanbul ignore else */
  50318. if (el.classList) {
  50319. if (cls.indexOf(' ') > -1) {
  50320. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  50321. } else {
  50322. el.classList.remove(cls);
  50323. }
  50324. if (!el.classList.length) {
  50325. el.removeAttribute('class');
  50326. }
  50327. } else {
  50328. var cur = " " + (el.getAttribute('class') || '') + " ";
  50329. var tar = ' ' + cls + ' ';
  50330. while (cur.indexOf(tar) >= 0) {
  50331. cur = cur.replace(tar, ' ');
  50332. }
  50333. cur = cur.trim();
  50334. if (cur) {
  50335. el.setAttribute('class', cur);
  50336. } else {
  50337. el.removeAttribute('class');
  50338. }
  50339. }
  50340. }
  50341. /* */
  50342. function resolveTransition (def$$1) {
  50343. if (!def$$1) {
  50344. return
  50345. }
  50346. /* istanbul ignore else */
  50347. if (typeof def$$1 === 'object') {
  50348. var res = {};
  50349. if (def$$1.css !== false) {
  50350. extend(res, autoCssTransition(def$$1.name || 'v'));
  50351. }
  50352. extend(res, def$$1);
  50353. return res
  50354. } else if (typeof def$$1 === 'string') {
  50355. return autoCssTransition(def$$1)
  50356. }
  50357. }
  50358. var autoCssTransition = cached(function (name) {
  50359. return {
  50360. enterClass: (name + "-enter"),
  50361. enterToClass: (name + "-enter-to"),
  50362. enterActiveClass: (name + "-enter-active"),
  50363. leaveClass: (name + "-leave"),
  50364. leaveToClass: (name + "-leave-to"),
  50365. leaveActiveClass: (name + "-leave-active")
  50366. }
  50367. });
  50368. var hasTransition = inBrowser && !isIE9;
  50369. var TRANSITION = 'transition';
  50370. var ANIMATION = 'animation';
  50371. // Transition property/event sniffing
  50372. var transitionProp = 'transition';
  50373. var transitionEndEvent = 'transitionend';
  50374. var animationProp = 'animation';
  50375. var animationEndEvent = 'animationend';
  50376. if (hasTransition) {
  50377. /* istanbul ignore if */
  50378. if (window.ontransitionend === undefined &&
  50379. window.onwebkittransitionend !== undefined
  50380. ) {
  50381. transitionProp = 'WebkitTransition';
  50382. transitionEndEvent = 'webkitTransitionEnd';
  50383. }
  50384. if (window.onanimationend === undefined &&
  50385. window.onwebkitanimationend !== undefined
  50386. ) {
  50387. animationProp = 'WebkitAnimation';
  50388. animationEndEvent = 'webkitAnimationEnd';
  50389. }
  50390. }
  50391. // binding to window is necessary to make hot reload work in IE in strict mode
  50392. var raf = inBrowser
  50393. ? window.requestAnimationFrame
  50394. ? window.requestAnimationFrame.bind(window)
  50395. : setTimeout
  50396. : /* istanbul ignore next */ function (fn) { return fn(); };
  50397. function nextFrame (fn) {
  50398. raf(function () {
  50399. raf(fn);
  50400. });
  50401. }
  50402. function addTransitionClass (el, cls) {
  50403. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50404. if (transitionClasses.indexOf(cls) < 0) {
  50405. transitionClasses.push(cls);
  50406. addClass(el, cls);
  50407. }
  50408. }
  50409. function removeTransitionClass (el, cls) {
  50410. if (el._transitionClasses) {
  50411. remove(el._transitionClasses, cls);
  50412. }
  50413. removeClass(el, cls);
  50414. }
  50415. function whenTransitionEnds (
  50416. el,
  50417. expectedType,
  50418. cb
  50419. ) {
  50420. var ref = getTransitionInfo(el, expectedType);
  50421. var type = ref.type;
  50422. var timeout = ref.timeout;
  50423. var propCount = ref.propCount;
  50424. if (!type) { return cb() }
  50425. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  50426. var ended = 0;
  50427. var end = function () {
  50428. el.removeEventListener(event, onEnd);
  50429. cb();
  50430. };
  50431. var onEnd = function (e) {
  50432. if (e.target === el) {
  50433. if (++ended >= propCount) {
  50434. end();
  50435. }
  50436. }
  50437. };
  50438. setTimeout(function () {
  50439. if (ended < propCount) {
  50440. end();
  50441. }
  50442. }, timeout + 1);
  50443. el.addEventListener(event, onEnd);
  50444. }
  50445. var transformRE = /\b(transform|all)(,|$)/;
  50446. function getTransitionInfo (el, expectedType) {
  50447. var styles = window.getComputedStyle(el);
  50448. // JSDOM may return undefined for transition properties
  50449. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  50450. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  50451. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  50452. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  50453. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  50454. var animationTimeout = getTimeout(animationDelays, animationDurations);
  50455. var type;
  50456. var timeout = 0;
  50457. var propCount = 0;
  50458. /* istanbul ignore if */
  50459. if (expectedType === TRANSITION) {
  50460. if (transitionTimeout > 0) {
  50461. type = TRANSITION;
  50462. timeout = transitionTimeout;
  50463. propCount = transitionDurations.length;
  50464. }
  50465. } else if (expectedType === ANIMATION) {
  50466. if (animationTimeout > 0) {
  50467. type = ANIMATION;
  50468. timeout = animationTimeout;
  50469. propCount = animationDurations.length;
  50470. }
  50471. } else {
  50472. timeout = Math.max(transitionTimeout, animationTimeout);
  50473. type = timeout > 0
  50474. ? transitionTimeout > animationTimeout
  50475. ? TRANSITION
  50476. : ANIMATION
  50477. : null;
  50478. propCount = type
  50479. ? type === TRANSITION
  50480. ? transitionDurations.length
  50481. : animationDurations.length
  50482. : 0;
  50483. }
  50484. var hasTransform =
  50485. type === TRANSITION &&
  50486. transformRE.test(styles[transitionProp + 'Property']);
  50487. return {
  50488. type: type,
  50489. timeout: timeout,
  50490. propCount: propCount,
  50491. hasTransform: hasTransform
  50492. }
  50493. }
  50494. function getTimeout (delays, durations) {
  50495. /* istanbul ignore next */
  50496. while (delays.length < durations.length) {
  50497. delays = delays.concat(delays);
  50498. }
  50499. return Math.max.apply(null, durations.map(function (d, i) {
  50500. return toMs(d) + toMs(delays[i])
  50501. }))
  50502. }
  50503. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  50504. // in a locale-dependent way, using a comma instead of a dot.
  50505. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  50506. // as a floor function) causing unexpected behaviors
  50507. function toMs (s) {
  50508. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  50509. }
  50510. /* */
  50511. function enter (vnode, toggleDisplay) {
  50512. var el = vnode.elm;
  50513. // call leave callback now
  50514. if (isDef(el._leaveCb)) {
  50515. el._leaveCb.cancelled = true;
  50516. el._leaveCb();
  50517. }
  50518. var data = resolveTransition(vnode.data.transition);
  50519. if (isUndef(data)) {
  50520. return
  50521. }
  50522. /* istanbul ignore if */
  50523. if (isDef(el._enterCb) || el.nodeType !== 1) {
  50524. return
  50525. }
  50526. var css = data.css;
  50527. var type = data.type;
  50528. var enterClass = data.enterClass;
  50529. var enterToClass = data.enterToClass;
  50530. var enterActiveClass = data.enterActiveClass;
  50531. var appearClass = data.appearClass;
  50532. var appearToClass = data.appearToClass;
  50533. var appearActiveClass = data.appearActiveClass;
  50534. var beforeEnter = data.beforeEnter;
  50535. var enter = data.enter;
  50536. var afterEnter = data.afterEnter;
  50537. var enterCancelled = data.enterCancelled;
  50538. var beforeAppear = data.beforeAppear;
  50539. var appear = data.appear;
  50540. var afterAppear = data.afterAppear;
  50541. var appearCancelled = data.appearCancelled;
  50542. var duration = data.duration;
  50543. // activeInstance will always be the <transition> component managing this
  50544. // transition. One edge case to check is when the <transition> is placed
  50545. // as the root node of a child component. In that case we need to check
  50546. // <transition>'s parent for appear check.
  50547. var context = activeInstance;
  50548. var transitionNode = activeInstance.$vnode;
  50549. while (transitionNode && transitionNode.parent) {
  50550. context = transitionNode.context;
  50551. transitionNode = transitionNode.parent;
  50552. }
  50553. var isAppear = !context._isMounted || !vnode.isRootInsert;
  50554. if (isAppear && !appear && appear !== '') {
  50555. return
  50556. }
  50557. var startClass = isAppear && appearClass
  50558. ? appearClass
  50559. : enterClass;
  50560. var activeClass = isAppear && appearActiveClass
  50561. ? appearActiveClass
  50562. : enterActiveClass;
  50563. var toClass = isAppear && appearToClass
  50564. ? appearToClass
  50565. : enterToClass;
  50566. var beforeEnterHook = isAppear
  50567. ? (beforeAppear || beforeEnter)
  50568. : beforeEnter;
  50569. var enterHook = isAppear
  50570. ? (typeof appear === 'function' ? appear : enter)
  50571. : enter;
  50572. var afterEnterHook = isAppear
  50573. ? (afterAppear || afterEnter)
  50574. : afterEnter;
  50575. var enterCancelledHook = isAppear
  50576. ? (appearCancelled || enterCancelled)
  50577. : enterCancelled;
  50578. var explicitEnterDuration = toNumber(
  50579. isObject(duration)
  50580. ? duration.enter
  50581. : duration
  50582. );
  50583. if (explicitEnterDuration != null) {
  50584. checkDuration(explicitEnterDuration, 'enter', vnode);
  50585. }
  50586. var expectsCSS = css !== false && !isIE9;
  50587. var userWantsControl = getHookArgumentsLength(enterHook);
  50588. var cb = el._enterCb = once(function () {
  50589. if (expectsCSS) {
  50590. removeTransitionClass(el, toClass);
  50591. removeTransitionClass(el, activeClass);
  50592. }
  50593. if (cb.cancelled) {
  50594. if (expectsCSS) {
  50595. removeTransitionClass(el, startClass);
  50596. }
  50597. enterCancelledHook && enterCancelledHook(el);
  50598. } else {
  50599. afterEnterHook && afterEnterHook(el);
  50600. }
  50601. el._enterCb = null;
  50602. });
  50603. if (!vnode.data.show) {
  50604. // remove pending leave element on enter by injecting an insert hook
  50605. mergeVNodeHook(vnode, 'insert', function () {
  50606. var parent = el.parentNode;
  50607. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  50608. if (pendingNode &&
  50609. pendingNode.tag === vnode.tag &&
  50610. pendingNode.elm._leaveCb
  50611. ) {
  50612. pendingNode.elm._leaveCb();
  50613. }
  50614. enterHook && enterHook(el, cb);
  50615. });
  50616. }
  50617. // start enter transition
  50618. beforeEnterHook && beforeEnterHook(el);
  50619. if (expectsCSS) {
  50620. addTransitionClass(el, startClass);
  50621. addTransitionClass(el, activeClass);
  50622. nextFrame(function () {
  50623. removeTransitionClass(el, startClass);
  50624. if (!cb.cancelled) {
  50625. addTransitionClass(el, toClass);
  50626. if (!userWantsControl) {
  50627. if (isValidDuration(explicitEnterDuration)) {
  50628. setTimeout(cb, explicitEnterDuration);
  50629. } else {
  50630. whenTransitionEnds(el, type, cb);
  50631. }
  50632. }
  50633. }
  50634. });
  50635. }
  50636. if (vnode.data.show) {
  50637. toggleDisplay && toggleDisplay();
  50638. enterHook && enterHook(el, cb);
  50639. }
  50640. if (!expectsCSS && !userWantsControl) {
  50641. cb();
  50642. }
  50643. }
  50644. function leave (vnode, rm) {
  50645. var el = vnode.elm;
  50646. // call enter callback now
  50647. if (isDef(el._enterCb)) {
  50648. el._enterCb.cancelled = true;
  50649. el._enterCb();
  50650. }
  50651. var data = resolveTransition(vnode.data.transition);
  50652. if (isUndef(data) || el.nodeType !== 1) {
  50653. return rm()
  50654. }
  50655. /* istanbul ignore if */
  50656. if (isDef(el._leaveCb)) {
  50657. return
  50658. }
  50659. var css = data.css;
  50660. var type = data.type;
  50661. var leaveClass = data.leaveClass;
  50662. var leaveToClass = data.leaveToClass;
  50663. var leaveActiveClass = data.leaveActiveClass;
  50664. var beforeLeave = data.beforeLeave;
  50665. var leave = data.leave;
  50666. var afterLeave = data.afterLeave;
  50667. var leaveCancelled = data.leaveCancelled;
  50668. var delayLeave = data.delayLeave;
  50669. var duration = data.duration;
  50670. var expectsCSS = css !== false && !isIE9;
  50671. var userWantsControl = getHookArgumentsLength(leave);
  50672. var explicitLeaveDuration = toNumber(
  50673. isObject(duration)
  50674. ? duration.leave
  50675. : duration
  50676. );
  50677. if (isDef(explicitLeaveDuration)) {
  50678. checkDuration(explicitLeaveDuration, 'leave', vnode);
  50679. }
  50680. var cb = el._leaveCb = once(function () {
  50681. if (el.parentNode && el.parentNode._pending) {
  50682. el.parentNode._pending[vnode.key] = null;
  50683. }
  50684. if (expectsCSS) {
  50685. removeTransitionClass(el, leaveToClass);
  50686. removeTransitionClass(el, leaveActiveClass);
  50687. }
  50688. if (cb.cancelled) {
  50689. if (expectsCSS) {
  50690. removeTransitionClass(el, leaveClass);
  50691. }
  50692. leaveCancelled && leaveCancelled(el);
  50693. } else {
  50694. rm();
  50695. afterLeave && afterLeave(el);
  50696. }
  50697. el._leaveCb = null;
  50698. });
  50699. if (delayLeave) {
  50700. delayLeave(performLeave);
  50701. } else {
  50702. performLeave();
  50703. }
  50704. function performLeave () {
  50705. // the delayed leave may have already been cancelled
  50706. if (cb.cancelled) {
  50707. return
  50708. }
  50709. // record leaving element
  50710. if (!vnode.data.show && el.parentNode) {
  50711. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  50712. }
  50713. beforeLeave && beforeLeave(el);
  50714. if (expectsCSS) {
  50715. addTransitionClass(el, leaveClass);
  50716. addTransitionClass(el, leaveActiveClass);
  50717. nextFrame(function () {
  50718. removeTransitionClass(el, leaveClass);
  50719. if (!cb.cancelled) {
  50720. addTransitionClass(el, leaveToClass);
  50721. if (!userWantsControl) {
  50722. if (isValidDuration(explicitLeaveDuration)) {
  50723. setTimeout(cb, explicitLeaveDuration);
  50724. } else {
  50725. whenTransitionEnds(el, type, cb);
  50726. }
  50727. }
  50728. }
  50729. });
  50730. }
  50731. leave && leave(el, cb);
  50732. if (!expectsCSS && !userWantsControl) {
  50733. cb();
  50734. }
  50735. }
  50736. }
  50737. // only used in dev mode
  50738. function checkDuration (val, name, vnode) {
  50739. if (typeof val !== 'number') {
  50740. warn(
  50741. "<transition> explicit " + name + " duration is not a valid number - " +
  50742. "got " + (JSON.stringify(val)) + ".",
  50743. vnode.context
  50744. );
  50745. } else if (isNaN(val)) {
  50746. warn(
  50747. "<transition> explicit " + name + " duration is NaN - " +
  50748. 'the duration expression might be incorrect.',
  50749. vnode.context
  50750. );
  50751. }
  50752. }
  50753. function isValidDuration (val) {
  50754. return typeof val === 'number' && !isNaN(val)
  50755. }
  50756. /**
  50757. * Normalize a transition hook's argument length. The hook may be:
  50758. * - a merged hook (invoker) with the original in .fns
  50759. * - a wrapped component method (check ._length)
  50760. * - a plain function (.length)
  50761. */
  50762. function getHookArgumentsLength (fn) {
  50763. if (isUndef(fn)) {
  50764. return false
  50765. }
  50766. var invokerFns = fn.fns;
  50767. if (isDef(invokerFns)) {
  50768. // invoker
  50769. return getHookArgumentsLength(
  50770. Array.isArray(invokerFns)
  50771. ? invokerFns[0]
  50772. : invokerFns
  50773. )
  50774. } else {
  50775. return (fn._length || fn.length) > 1
  50776. }
  50777. }
  50778. function _enter (_, vnode) {
  50779. if (vnode.data.show !== true) {
  50780. enter(vnode);
  50781. }
  50782. }
  50783. var transition = inBrowser ? {
  50784. create: _enter,
  50785. activate: _enter,
  50786. remove: function remove$$1 (vnode, rm) {
  50787. /* istanbul ignore else */
  50788. if (vnode.data.show !== true) {
  50789. leave(vnode, rm);
  50790. } else {
  50791. rm();
  50792. }
  50793. }
  50794. } : {};
  50795. var platformModules = [
  50796. attrs,
  50797. klass,
  50798. events,
  50799. domProps,
  50800. style,
  50801. transition
  50802. ];
  50803. /* */
  50804. // the directive module should be applied last, after all
  50805. // built-in modules have been applied.
  50806. var modules = platformModules.concat(baseModules);
  50807. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  50808. /**
  50809. * Not type checking this file because flow doesn't like attaching
  50810. * properties to Elements.
  50811. */
  50812. /* istanbul ignore if */
  50813. if (isIE9) {
  50814. // http://www.matts411.com/post/internet-explorer-9-oninput/
  50815. document.addEventListener('selectionchange', function () {
  50816. var el = document.activeElement;
  50817. if (el && el.vmodel) {
  50818. trigger(el, 'input');
  50819. }
  50820. });
  50821. }
  50822. var directive = {
  50823. inserted: function inserted (el, binding, vnode, oldVnode) {
  50824. if (vnode.tag === 'select') {
  50825. // #6903
  50826. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  50827. mergeVNodeHook(vnode, 'postpatch', function () {
  50828. directive.componentUpdated(el, binding, vnode);
  50829. });
  50830. } else {
  50831. setSelected(el, binding, vnode.context);
  50832. }
  50833. el._vOptions = [].map.call(el.options, getValue);
  50834. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  50835. el._vModifiers = binding.modifiers;
  50836. if (!binding.modifiers.lazy) {
  50837. el.addEventListener('compositionstart', onCompositionStart);
  50838. el.addEventListener('compositionend', onCompositionEnd);
  50839. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  50840. // switching focus before confirming composition choice
  50841. // this also fixes the issue where some browsers e.g. iOS Chrome
  50842. // fires "change" instead of "input" on autocomplete.
  50843. el.addEventListener('change', onCompositionEnd);
  50844. /* istanbul ignore if */
  50845. if (isIE9) {
  50846. el.vmodel = true;
  50847. }
  50848. }
  50849. }
  50850. },
  50851. componentUpdated: function componentUpdated (el, binding, vnode) {
  50852. if (vnode.tag === 'select') {
  50853. setSelected(el, binding, vnode.context);
  50854. // in case the options rendered by v-for have changed,
  50855. // it's possible that the value is out-of-sync with the rendered options.
  50856. // detect such cases and filter out values that no longer has a matching
  50857. // option in the DOM.
  50858. var prevOptions = el._vOptions;
  50859. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  50860. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  50861. // trigger change event if
  50862. // no matching option found for at least one value
  50863. var needReset = el.multiple
  50864. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  50865. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  50866. if (needReset) {
  50867. trigger(el, 'change');
  50868. }
  50869. }
  50870. }
  50871. }
  50872. };
  50873. function setSelected (el, binding, vm) {
  50874. actuallySetSelected(el, binding, vm);
  50875. /* istanbul ignore if */
  50876. if (isIE || isEdge) {
  50877. setTimeout(function () {
  50878. actuallySetSelected(el, binding, vm);
  50879. }, 0);
  50880. }
  50881. }
  50882. function actuallySetSelected (el, binding, vm) {
  50883. var value = binding.value;
  50884. var isMultiple = el.multiple;
  50885. if (isMultiple && !Array.isArray(value)) {
  50886. warn(
  50887. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  50888. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  50889. vm
  50890. );
  50891. return
  50892. }
  50893. var selected, option;
  50894. for (var i = 0, l = el.options.length; i < l; i++) {
  50895. option = el.options[i];
  50896. if (isMultiple) {
  50897. selected = looseIndexOf(value, getValue(option)) > -1;
  50898. if (option.selected !== selected) {
  50899. option.selected = selected;
  50900. }
  50901. } else {
  50902. if (looseEqual(getValue(option), value)) {
  50903. if (el.selectedIndex !== i) {
  50904. el.selectedIndex = i;
  50905. }
  50906. return
  50907. }
  50908. }
  50909. }
  50910. if (!isMultiple) {
  50911. el.selectedIndex = -1;
  50912. }
  50913. }
  50914. function hasNoMatchingOption (value, options) {
  50915. return options.every(function (o) { return !looseEqual(o, value); })
  50916. }
  50917. function getValue (option) {
  50918. return '_value' in option
  50919. ? option._value
  50920. : option.value
  50921. }
  50922. function onCompositionStart (e) {
  50923. e.target.composing = true;
  50924. }
  50925. function onCompositionEnd (e) {
  50926. // prevent triggering an input event for no reason
  50927. if (!e.target.composing) { return }
  50928. e.target.composing = false;
  50929. trigger(e.target, 'input');
  50930. }
  50931. function trigger (el, type) {
  50932. var e = document.createEvent('HTMLEvents');
  50933. e.initEvent(type, true, true);
  50934. el.dispatchEvent(e);
  50935. }
  50936. /* */
  50937. // recursively search for possible transition defined inside the component root
  50938. function locateNode (vnode) {
  50939. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  50940. ? locateNode(vnode.componentInstance._vnode)
  50941. : vnode
  50942. }
  50943. var show = {
  50944. bind: function bind (el, ref, vnode) {
  50945. var value = ref.value;
  50946. vnode = locateNode(vnode);
  50947. var transition$$1 = vnode.data && vnode.data.transition;
  50948. var originalDisplay = el.__vOriginalDisplay =
  50949. el.style.display === 'none' ? '' : el.style.display;
  50950. if (value && transition$$1) {
  50951. vnode.data.show = true;
  50952. enter(vnode, function () {
  50953. el.style.display = originalDisplay;
  50954. });
  50955. } else {
  50956. el.style.display = value ? originalDisplay : 'none';
  50957. }
  50958. },
  50959. update: function update (el, ref, vnode) {
  50960. var value = ref.value;
  50961. var oldValue = ref.oldValue;
  50962. /* istanbul ignore if */
  50963. if (!value === !oldValue) { return }
  50964. vnode = locateNode(vnode);
  50965. var transition$$1 = vnode.data && vnode.data.transition;
  50966. if (transition$$1) {
  50967. vnode.data.show = true;
  50968. if (value) {
  50969. enter(vnode, function () {
  50970. el.style.display = el.__vOriginalDisplay;
  50971. });
  50972. } else {
  50973. leave(vnode, function () {
  50974. el.style.display = 'none';
  50975. });
  50976. }
  50977. } else {
  50978. el.style.display = value ? el.__vOriginalDisplay : 'none';
  50979. }
  50980. },
  50981. unbind: function unbind (
  50982. el,
  50983. binding,
  50984. vnode,
  50985. oldVnode,
  50986. isDestroy
  50987. ) {
  50988. if (!isDestroy) {
  50989. el.style.display = el.__vOriginalDisplay;
  50990. }
  50991. }
  50992. };
  50993. var platformDirectives = {
  50994. model: directive,
  50995. show: show
  50996. };
  50997. /* */
  50998. var transitionProps = {
  50999. name: String,
  51000. appear: Boolean,
  51001. css: Boolean,
  51002. mode: String,
  51003. type: String,
  51004. enterClass: String,
  51005. leaveClass: String,
  51006. enterToClass: String,
  51007. leaveToClass: String,
  51008. enterActiveClass: String,
  51009. leaveActiveClass: String,
  51010. appearClass: String,
  51011. appearActiveClass: String,
  51012. appearToClass: String,
  51013. duration: [Number, String, Object]
  51014. };
  51015. // in case the child is also an abstract component, e.g. <keep-alive>
  51016. // we want to recursively retrieve the real component to be rendered
  51017. function getRealChild (vnode) {
  51018. var compOptions = vnode && vnode.componentOptions;
  51019. if (compOptions && compOptions.Ctor.options.abstract) {
  51020. return getRealChild(getFirstComponentChild(compOptions.children))
  51021. } else {
  51022. return vnode
  51023. }
  51024. }
  51025. function extractTransitionData (comp) {
  51026. var data = {};
  51027. var options = comp.$options;
  51028. // props
  51029. for (var key in options.propsData) {
  51030. data[key] = comp[key];
  51031. }
  51032. // events.
  51033. // extract listeners and pass them directly to the transition methods
  51034. var listeners = options._parentListeners;
  51035. for (var key$1 in listeners) {
  51036. data[camelize(key$1)] = listeners[key$1];
  51037. }
  51038. return data
  51039. }
  51040. function placeholder (h, rawChild) {
  51041. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51042. return h('keep-alive', {
  51043. props: rawChild.componentOptions.propsData
  51044. })
  51045. }
  51046. }
  51047. function hasParentTransition (vnode) {
  51048. while ((vnode = vnode.parent)) {
  51049. if (vnode.data.transition) {
  51050. return true
  51051. }
  51052. }
  51053. }
  51054. function isSameChild (child, oldChild) {
  51055. return oldChild.key === child.key && oldChild.tag === child.tag
  51056. }
  51057. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51058. var isVShowDirective = function (d) { return d.name === 'show'; };
  51059. var Transition = {
  51060. name: 'transition',
  51061. props: transitionProps,
  51062. abstract: true,
  51063. render: function render (h) {
  51064. var this$1 = this;
  51065. var children = this.$slots.default;
  51066. if (!children) {
  51067. return
  51068. }
  51069. // filter out text nodes (possible whitespaces)
  51070. children = children.filter(isNotTextNode);
  51071. /* istanbul ignore if */
  51072. if (!children.length) {
  51073. return
  51074. }
  51075. // warn multiple elements
  51076. if (children.length > 1) {
  51077. warn(
  51078. '<transition> can only be used on a single element. Use ' +
  51079. '<transition-group> for lists.',
  51080. this.$parent
  51081. );
  51082. }
  51083. var mode = this.mode;
  51084. // warn invalid mode
  51085. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51086. ) {
  51087. warn(
  51088. 'invalid <transition> mode: ' + mode,
  51089. this.$parent
  51090. );
  51091. }
  51092. var rawChild = children[0];
  51093. // if this is a component root node and the component's
  51094. // parent container node also has transition, skip.
  51095. if (hasParentTransition(this.$vnode)) {
  51096. return rawChild
  51097. }
  51098. // apply transition data to child
  51099. // use getRealChild() to ignore abstract components e.g. keep-alive
  51100. var child = getRealChild(rawChild);
  51101. /* istanbul ignore if */
  51102. if (!child) {
  51103. return rawChild
  51104. }
  51105. if (this._leaving) {
  51106. return placeholder(h, rawChild)
  51107. }
  51108. // ensure a key that is unique to the vnode type and to this transition
  51109. // component instance. This key will be used to remove pending leaving nodes
  51110. // during entering.
  51111. var id = "__transition-" + (this._uid) + "-";
  51112. child.key = child.key == null
  51113. ? child.isComment
  51114. ? id + 'comment'
  51115. : id + child.tag
  51116. : isPrimitive(child.key)
  51117. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51118. : child.key;
  51119. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51120. var oldRawChild = this._vnode;
  51121. var oldChild = getRealChild(oldRawChild);
  51122. // mark v-show
  51123. // so that the transition module can hand over the control to the directive
  51124. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51125. child.data.show = true;
  51126. }
  51127. if (
  51128. oldChild &&
  51129. oldChild.data &&
  51130. !isSameChild(child, oldChild) &&
  51131. !isAsyncPlaceholder(oldChild) &&
  51132. // #6687 component root is a comment node
  51133. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51134. ) {
  51135. // replace old child transition data with fresh one
  51136. // important for dynamic transitions!
  51137. var oldData = oldChild.data.transition = extend({}, data);
  51138. // handle transition mode
  51139. if (mode === 'out-in') {
  51140. // return placeholder node and queue update when leave finishes
  51141. this._leaving = true;
  51142. mergeVNodeHook(oldData, 'afterLeave', function () {
  51143. this$1._leaving = false;
  51144. this$1.$forceUpdate();
  51145. });
  51146. return placeholder(h, rawChild)
  51147. } else if (mode === 'in-out') {
  51148. if (isAsyncPlaceholder(child)) {
  51149. return oldRawChild
  51150. }
  51151. var delayedLeave;
  51152. var performLeave = function () { delayedLeave(); };
  51153. mergeVNodeHook(data, 'afterEnter', performLeave);
  51154. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51155. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51156. }
  51157. }
  51158. return rawChild
  51159. }
  51160. };
  51161. /* */
  51162. var props = extend({
  51163. tag: String,
  51164. moveClass: String
  51165. }, transitionProps);
  51166. delete props.mode;
  51167. var TransitionGroup = {
  51168. props: props,
  51169. beforeMount: function beforeMount () {
  51170. var this$1 = this;
  51171. var update = this._update;
  51172. this._update = function (vnode, hydrating) {
  51173. var restoreActiveInstance = setActiveInstance(this$1);
  51174. // force removing pass
  51175. this$1.__patch__(
  51176. this$1._vnode,
  51177. this$1.kept,
  51178. false, // hydrating
  51179. true // removeOnly (!important, avoids unnecessary moves)
  51180. );
  51181. this$1._vnode = this$1.kept;
  51182. restoreActiveInstance();
  51183. update.call(this$1, vnode, hydrating);
  51184. };
  51185. },
  51186. render: function render (h) {
  51187. var tag = this.tag || this.$vnode.data.tag || 'span';
  51188. var map = Object.create(null);
  51189. var prevChildren = this.prevChildren = this.children;
  51190. var rawChildren = this.$slots.default || [];
  51191. var children = this.children = [];
  51192. var transitionData = extractTransitionData(this);
  51193. for (var i = 0; i < rawChildren.length; i++) {
  51194. var c = rawChildren[i];
  51195. if (c.tag) {
  51196. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  51197. children.push(c);
  51198. map[c.key] = c
  51199. ;(c.data || (c.data = {})).transition = transitionData;
  51200. } else {
  51201. var opts = c.componentOptions;
  51202. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  51203. warn(("<transition-group> children must be keyed: <" + name + ">"));
  51204. }
  51205. }
  51206. }
  51207. if (prevChildren) {
  51208. var kept = [];
  51209. var removed = [];
  51210. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  51211. var c$1 = prevChildren[i$1];
  51212. c$1.data.transition = transitionData;
  51213. c$1.data.pos = c$1.elm.getBoundingClientRect();
  51214. if (map[c$1.key]) {
  51215. kept.push(c$1);
  51216. } else {
  51217. removed.push(c$1);
  51218. }
  51219. }
  51220. this.kept = h(tag, null, kept);
  51221. this.removed = removed;
  51222. }
  51223. return h(tag, null, children)
  51224. },
  51225. updated: function updated () {
  51226. var children = this.prevChildren;
  51227. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  51228. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  51229. return
  51230. }
  51231. // we divide the work into three loops to avoid mixing DOM reads and writes
  51232. // in each iteration - which helps prevent layout thrashing.
  51233. children.forEach(callPendingCbs);
  51234. children.forEach(recordPosition);
  51235. children.forEach(applyTranslation);
  51236. // force reflow to put everything in position
  51237. // assign to this to avoid being removed in tree-shaking
  51238. // $flow-disable-line
  51239. this._reflow = document.body.offsetHeight;
  51240. children.forEach(function (c) {
  51241. if (c.data.moved) {
  51242. var el = c.elm;
  51243. var s = el.style;
  51244. addTransitionClass(el, moveClass);
  51245. s.transform = s.WebkitTransform = s.transitionDuration = '';
  51246. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  51247. if (e && e.target !== el) {
  51248. return
  51249. }
  51250. if (!e || /transform$/.test(e.propertyName)) {
  51251. el.removeEventListener(transitionEndEvent, cb);
  51252. el._moveCb = null;
  51253. removeTransitionClass(el, moveClass);
  51254. }
  51255. });
  51256. }
  51257. });
  51258. },
  51259. methods: {
  51260. hasMove: function hasMove (el, moveClass) {
  51261. /* istanbul ignore if */
  51262. if (!hasTransition) {
  51263. return false
  51264. }
  51265. /* istanbul ignore if */
  51266. if (this._hasMove) {
  51267. return this._hasMove
  51268. }
  51269. // Detect whether an element with the move class applied has
  51270. // CSS transitions. Since the element may be inside an entering
  51271. // transition at this very moment, we make a clone of it and remove
  51272. // all other transition classes applied to ensure only the move class
  51273. // is applied.
  51274. var clone = el.cloneNode();
  51275. if (el._transitionClasses) {
  51276. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  51277. }
  51278. addClass(clone, moveClass);
  51279. clone.style.display = 'none';
  51280. this.$el.appendChild(clone);
  51281. var info = getTransitionInfo(clone);
  51282. this.$el.removeChild(clone);
  51283. return (this._hasMove = info.hasTransform)
  51284. }
  51285. }
  51286. };
  51287. function callPendingCbs (c) {
  51288. /* istanbul ignore if */
  51289. if (c.elm._moveCb) {
  51290. c.elm._moveCb();
  51291. }
  51292. /* istanbul ignore if */
  51293. if (c.elm._enterCb) {
  51294. c.elm._enterCb();
  51295. }
  51296. }
  51297. function recordPosition (c) {
  51298. c.data.newPos = c.elm.getBoundingClientRect();
  51299. }
  51300. function applyTranslation (c) {
  51301. var oldPos = c.data.pos;
  51302. var newPos = c.data.newPos;
  51303. var dx = oldPos.left - newPos.left;
  51304. var dy = oldPos.top - newPos.top;
  51305. if (dx || dy) {
  51306. c.data.moved = true;
  51307. var s = c.elm.style;
  51308. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  51309. s.transitionDuration = '0s';
  51310. }
  51311. }
  51312. var platformComponents = {
  51313. Transition: Transition,
  51314. TransitionGroup: TransitionGroup
  51315. };
  51316. /* */
  51317. // install platform specific utils
  51318. Vue.config.mustUseProp = mustUseProp;
  51319. Vue.config.isReservedTag = isReservedTag;
  51320. Vue.config.isReservedAttr = isReservedAttr;
  51321. Vue.config.getTagNamespace = getTagNamespace;
  51322. Vue.config.isUnknownElement = isUnknownElement;
  51323. // install platform runtime directives & components
  51324. extend(Vue.options.directives, platformDirectives);
  51325. extend(Vue.options.components, platformComponents);
  51326. // install platform patch function
  51327. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  51328. // public mount method
  51329. Vue.prototype.$mount = function (
  51330. el,
  51331. hydrating
  51332. ) {
  51333. el = el && inBrowser ? query(el) : undefined;
  51334. return mountComponent(this, el, hydrating)
  51335. };
  51336. // devtools global hook
  51337. /* istanbul ignore next */
  51338. if (inBrowser) {
  51339. setTimeout(function () {
  51340. if (config.devtools) {
  51341. if (devtools) {
  51342. devtools.emit('init', Vue);
  51343. } else {
  51344. console[console.info ? 'info' : 'log'](
  51345. 'Download the Vue Devtools extension for a better development experience:\n' +
  51346. 'https://github.com/vuejs/vue-devtools'
  51347. );
  51348. }
  51349. }
  51350. if (config.productionTip !== false &&
  51351. typeof console !== 'undefined'
  51352. ) {
  51353. console[console.info ? 'info' : 'log'](
  51354. "You are running Vue in development mode.\n" +
  51355. "Make sure to turn on production mode when deploying for production.\n" +
  51356. "See more tips at https://vuejs.org/guide/deployment.html"
  51357. );
  51358. }
  51359. }, 0);
  51360. }
  51361. /* */
  51362. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51363. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51364. var buildRegex = cached(function (delimiters) {
  51365. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51366. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51367. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51368. });
  51369. function parseText (
  51370. text,
  51371. delimiters
  51372. ) {
  51373. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51374. if (!tagRE.test(text)) {
  51375. return
  51376. }
  51377. var tokens = [];
  51378. var rawTokens = [];
  51379. var lastIndex = tagRE.lastIndex = 0;
  51380. var match, index, tokenValue;
  51381. while ((match = tagRE.exec(text))) {
  51382. index = match.index;
  51383. // push text token
  51384. if (index > lastIndex) {
  51385. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51386. tokens.push(JSON.stringify(tokenValue));
  51387. }
  51388. // tag token
  51389. var exp = parseFilters(match[1].trim());
  51390. tokens.push(("_s(" + exp + ")"));
  51391. rawTokens.push({ '@binding': exp });
  51392. lastIndex = index + match[0].length;
  51393. }
  51394. if (lastIndex < text.length) {
  51395. rawTokens.push(tokenValue = text.slice(lastIndex));
  51396. tokens.push(JSON.stringify(tokenValue));
  51397. }
  51398. return {
  51399. expression: tokens.join('+'),
  51400. tokens: rawTokens
  51401. }
  51402. }
  51403. /* */
  51404. function transformNode (el, options) {
  51405. var warn = options.warn || baseWarn;
  51406. var staticClass = getAndRemoveAttr(el, 'class');
  51407. if (staticClass) {
  51408. var res = parseText(staticClass, options.delimiters);
  51409. if (res) {
  51410. warn(
  51411. "class=\"" + staticClass + "\": " +
  51412. 'Interpolation inside attributes has been removed. ' +
  51413. 'Use v-bind or the colon shorthand instead. For example, ' +
  51414. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  51415. el.rawAttrsMap['class']
  51416. );
  51417. }
  51418. }
  51419. if (staticClass) {
  51420. el.staticClass = JSON.stringify(staticClass);
  51421. }
  51422. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  51423. if (classBinding) {
  51424. el.classBinding = classBinding;
  51425. }
  51426. }
  51427. function genData (el) {
  51428. var data = '';
  51429. if (el.staticClass) {
  51430. data += "staticClass:" + (el.staticClass) + ",";
  51431. }
  51432. if (el.classBinding) {
  51433. data += "class:" + (el.classBinding) + ",";
  51434. }
  51435. return data
  51436. }
  51437. var klass$1 = {
  51438. staticKeys: ['staticClass'],
  51439. transformNode: transformNode,
  51440. genData: genData
  51441. };
  51442. /* */
  51443. function transformNode$1 (el, options) {
  51444. var warn = options.warn || baseWarn;
  51445. var staticStyle = getAndRemoveAttr(el, 'style');
  51446. if (staticStyle) {
  51447. /* istanbul ignore if */
  51448. {
  51449. var res = parseText(staticStyle, options.delimiters);
  51450. if (res) {
  51451. warn(
  51452. "style=\"" + staticStyle + "\": " +
  51453. 'Interpolation inside attributes has been removed. ' +
  51454. 'Use v-bind or the colon shorthand instead. For example, ' +
  51455. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  51456. el.rawAttrsMap['style']
  51457. );
  51458. }
  51459. }
  51460. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  51461. }
  51462. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  51463. if (styleBinding) {
  51464. el.styleBinding = styleBinding;
  51465. }
  51466. }
  51467. function genData$1 (el) {
  51468. var data = '';
  51469. if (el.staticStyle) {
  51470. data += "staticStyle:" + (el.staticStyle) + ",";
  51471. }
  51472. if (el.styleBinding) {
  51473. data += "style:(" + (el.styleBinding) + "),";
  51474. }
  51475. return data
  51476. }
  51477. var style$1 = {
  51478. staticKeys: ['staticStyle'],
  51479. transformNode: transformNode$1,
  51480. genData: genData$1
  51481. };
  51482. /* */
  51483. var decoder;
  51484. var he = {
  51485. decode: function decode (html) {
  51486. decoder = decoder || document.createElement('div');
  51487. decoder.innerHTML = html;
  51488. return decoder.textContent
  51489. }
  51490. };
  51491. /* */
  51492. var isUnaryTag = makeMap(
  51493. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  51494. 'link,meta,param,source,track,wbr'
  51495. );
  51496. // Elements that you can, intentionally, leave open
  51497. // (and which close themselves)
  51498. var canBeLeftOpenTag = makeMap(
  51499. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  51500. );
  51501. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  51502. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  51503. var isNonPhrasingTag = makeMap(
  51504. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  51505. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  51506. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  51507. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  51508. 'title,tr,track'
  51509. );
  51510. /**
  51511. * Not type-checking this file because it's mostly vendor code.
  51512. */
  51513. // Regular Expressions for parsing tags and attributes
  51514. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51515. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51516. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  51517. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  51518. var startTagOpen = new RegExp(("^<" + qnameCapture));
  51519. var startTagClose = /^\s*(\/?)>/;
  51520. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  51521. var doctype = /^<!DOCTYPE [^>]+>/i;
  51522. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  51523. var comment = /^<!\--/;
  51524. var conditionalComment = /^<!\[/;
  51525. // Special Elements (can contain anything)
  51526. var isPlainTextElement = makeMap('script,style,textarea', true);
  51527. var reCache = {};
  51528. var decodingMap = {
  51529. '&lt;': '<',
  51530. '&gt;': '>',
  51531. '&quot;': '"',
  51532. '&amp;': '&',
  51533. '&#10;': '\n',
  51534. '&#9;': '\t',
  51535. '&#39;': "'"
  51536. };
  51537. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  51538. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  51539. // #5992
  51540. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  51541. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  51542. function decodeAttr (value, shouldDecodeNewlines) {
  51543. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  51544. return value.replace(re, function (match) { return decodingMap[match]; })
  51545. }
  51546. function parseHTML (html, options) {
  51547. var stack = [];
  51548. var expectHTML = options.expectHTML;
  51549. var isUnaryTag$$1 = options.isUnaryTag || no;
  51550. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  51551. var index = 0;
  51552. var last, lastTag;
  51553. while (html) {
  51554. last = html;
  51555. // Make sure we're not in a plaintext content element like script/style
  51556. if (!lastTag || !isPlainTextElement(lastTag)) {
  51557. var textEnd = html.indexOf('<');
  51558. if (textEnd === 0) {
  51559. // Comment:
  51560. if (comment.test(html)) {
  51561. var commentEnd = html.indexOf('-->');
  51562. if (commentEnd >= 0) {
  51563. if (options.shouldKeepComment) {
  51564. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  51565. }
  51566. advance(commentEnd + 3);
  51567. continue
  51568. }
  51569. }
  51570. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  51571. if (conditionalComment.test(html)) {
  51572. var conditionalEnd = html.indexOf(']>');
  51573. if (conditionalEnd >= 0) {
  51574. advance(conditionalEnd + 2);
  51575. continue
  51576. }
  51577. }
  51578. // Doctype:
  51579. var doctypeMatch = html.match(doctype);
  51580. if (doctypeMatch) {
  51581. advance(doctypeMatch[0].length);
  51582. continue
  51583. }
  51584. // End tag:
  51585. var endTagMatch = html.match(endTag);
  51586. if (endTagMatch) {
  51587. var curIndex = index;
  51588. advance(endTagMatch[0].length);
  51589. parseEndTag(endTagMatch[1], curIndex, index);
  51590. continue
  51591. }
  51592. // Start tag:
  51593. var startTagMatch = parseStartTag();
  51594. if (startTagMatch) {
  51595. handleStartTag(startTagMatch);
  51596. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  51597. advance(1);
  51598. }
  51599. continue
  51600. }
  51601. }
  51602. var text = (void 0), rest = (void 0), next = (void 0);
  51603. if (textEnd >= 0) {
  51604. rest = html.slice(textEnd);
  51605. while (
  51606. !endTag.test(rest) &&
  51607. !startTagOpen.test(rest) &&
  51608. !comment.test(rest) &&
  51609. !conditionalComment.test(rest)
  51610. ) {
  51611. // < in plain text, be forgiving and treat it as text
  51612. next = rest.indexOf('<', 1);
  51613. if (next < 0) { break }
  51614. textEnd += next;
  51615. rest = html.slice(textEnd);
  51616. }
  51617. text = html.substring(0, textEnd);
  51618. }
  51619. if (textEnd < 0) {
  51620. text = html;
  51621. }
  51622. if (text) {
  51623. advance(text.length);
  51624. }
  51625. if (options.chars && text) {
  51626. options.chars(text, index - text.length, index);
  51627. }
  51628. } else {
  51629. var endTagLength = 0;
  51630. var stackedTag = lastTag.toLowerCase();
  51631. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  51632. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  51633. endTagLength = endTag.length;
  51634. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  51635. text = text
  51636. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  51637. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  51638. }
  51639. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  51640. text = text.slice(1);
  51641. }
  51642. if (options.chars) {
  51643. options.chars(text);
  51644. }
  51645. return ''
  51646. });
  51647. index += html.length - rest$1.length;
  51648. html = rest$1;
  51649. parseEndTag(stackedTag, index - endTagLength, index);
  51650. }
  51651. if (html === last) {
  51652. options.chars && options.chars(html);
  51653. if (!stack.length && options.warn) {
  51654. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  51655. }
  51656. break
  51657. }
  51658. }
  51659. // Clean up any remaining tags
  51660. parseEndTag();
  51661. function advance (n) {
  51662. index += n;
  51663. html = html.substring(n);
  51664. }
  51665. function parseStartTag () {
  51666. var start = html.match(startTagOpen);
  51667. if (start) {
  51668. var match = {
  51669. tagName: start[1],
  51670. attrs: [],
  51671. start: index
  51672. };
  51673. advance(start[0].length);
  51674. var end, attr;
  51675. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  51676. attr.start = index;
  51677. advance(attr[0].length);
  51678. attr.end = index;
  51679. match.attrs.push(attr);
  51680. }
  51681. if (end) {
  51682. match.unarySlash = end[1];
  51683. advance(end[0].length);
  51684. match.end = index;
  51685. return match
  51686. }
  51687. }
  51688. }
  51689. function handleStartTag (match) {
  51690. var tagName = match.tagName;
  51691. var unarySlash = match.unarySlash;
  51692. if (expectHTML) {
  51693. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  51694. parseEndTag(lastTag);
  51695. }
  51696. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  51697. parseEndTag(tagName);
  51698. }
  51699. }
  51700. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  51701. var l = match.attrs.length;
  51702. var attrs = new Array(l);
  51703. for (var i = 0; i < l; i++) {
  51704. var args = match.attrs[i];
  51705. var value = args[3] || args[4] || args[5] || '';
  51706. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  51707. ? options.shouldDecodeNewlinesForHref
  51708. : options.shouldDecodeNewlines;
  51709. attrs[i] = {
  51710. name: args[1],
  51711. value: decodeAttr(value, shouldDecodeNewlines)
  51712. };
  51713. if (options.outputSourceRange) {
  51714. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  51715. attrs[i].end = args.end;
  51716. }
  51717. }
  51718. if (!unary) {
  51719. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  51720. lastTag = tagName;
  51721. }
  51722. if (options.start) {
  51723. options.start(tagName, attrs, unary, match.start, match.end);
  51724. }
  51725. }
  51726. function parseEndTag (tagName, start, end) {
  51727. var pos, lowerCasedTagName;
  51728. if (start == null) { start = index; }
  51729. if (end == null) { end = index; }
  51730. // Find the closest opened tag of the same type
  51731. if (tagName) {
  51732. lowerCasedTagName = tagName.toLowerCase();
  51733. for (pos = stack.length - 1; pos >= 0; pos--) {
  51734. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  51735. break
  51736. }
  51737. }
  51738. } else {
  51739. // If no tag name is provided, clean shop
  51740. pos = 0;
  51741. }
  51742. if (pos >= 0) {
  51743. // Close all the open elements, up the stack
  51744. for (var i = stack.length - 1; i >= pos; i--) {
  51745. if (i > pos || !tagName &&
  51746. options.warn
  51747. ) {
  51748. options.warn(
  51749. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  51750. { start: stack[i].start, end: stack[i].end }
  51751. );
  51752. }
  51753. if (options.end) {
  51754. options.end(stack[i].tag, start, end);
  51755. }
  51756. }
  51757. // Remove the open elements from the stack
  51758. stack.length = pos;
  51759. lastTag = pos && stack[pos - 1].tag;
  51760. } else if (lowerCasedTagName === 'br') {
  51761. if (options.start) {
  51762. options.start(tagName, [], true, start, end);
  51763. }
  51764. } else if (lowerCasedTagName === 'p') {
  51765. if (options.start) {
  51766. options.start(tagName, [], false, start, end);
  51767. }
  51768. if (options.end) {
  51769. options.end(tagName, start, end);
  51770. }
  51771. }
  51772. }
  51773. }
  51774. /* */
  51775. var onRE = /^@|^v-on:/;
  51776. var dirRE = /^v-|^@|^:|^#/;
  51777. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  51778. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  51779. var stripParensRE = /^\(|\)$/g;
  51780. var dynamicArgRE = /^\[.*\]$/;
  51781. var argRE = /:(.*)$/;
  51782. var bindRE = /^:|^\.|^v-bind:/;
  51783. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  51784. var slotRE = /^v-slot(:|$)|^#/;
  51785. var lineBreakRE = /[\r\n]/;
  51786. var whitespaceRE$1 = /\s+/g;
  51787. var invalidAttributeRE = /[\s"'<>\/=]/;
  51788. var decodeHTMLCached = cached(he.decode);
  51789. var emptySlotScopeToken = "_empty_";
  51790. // configurable state
  51791. var warn$2;
  51792. var delimiters;
  51793. var transforms;
  51794. var preTransforms;
  51795. var postTransforms;
  51796. var platformIsPreTag;
  51797. var platformMustUseProp;
  51798. var platformGetTagNamespace;
  51799. var maybeComponent;
  51800. function createASTElement (
  51801. tag,
  51802. attrs,
  51803. parent
  51804. ) {
  51805. return {
  51806. type: 1,
  51807. tag: tag,
  51808. attrsList: attrs,
  51809. attrsMap: makeAttrsMap(attrs),
  51810. rawAttrsMap: {},
  51811. parent: parent,
  51812. children: []
  51813. }
  51814. }
  51815. /**
  51816. * Convert HTML string to AST.
  51817. */
  51818. function parse (
  51819. template,
  51820. options
  51821. ) {
  51822. warn$2 = options.warn || baseWarn;
  51823. platformIsPreTag = options.isPreTag || no;
  51824. platformMustUseProp = options.mustUseProp || no;
  51825. platformGetTagNamespace = options.getTagNamespace || no;
  51826. var isReservedTag = options.isReservedTag || no;
  51827. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  51828. transforms = pluckModuleFunction(options.modules, 'transformNode');
  51829. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  51830. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  51831. delimiters = options.delimiters;
  51832. var stack = [];
  51833. var preserveWhitespace = options.preserveWhitespace !== false;
  51834. var whitespaceOption = options.whitespace;
  51835. var root;
  51836. var currentParent;
  51837. var inVPre = false;
  51838. var inPre = false;
  51839. var warned = false;
  51840. function warnOnce (msg, range) {
  51841. if (!warned) {
  51842. warned = true;
  51843. warn$2(msg, range);
  51844. }
  51845. }
  51846. function closeElement (element) {
  51847. trimEndingWhitespace(element);
  51848. if (!inVPre && !element.processed) {
  51849. element = processElement(element, options);
  51850. }
  51851. // tree management
  51852. if (!stack.length && element !== root) {
  51853. // allow root elements with v-if, v-else-if and v-else
  51854. if (root.if && (element.elseif || element.else)) {
  51855. {
  51856. checkRootConstraints(element);
  51857. }
  51858. addIfCondition(root, {
  51859. exp: element.elseif,
  51860. block: element
  51861. });
  51862. } else {
  51863. warnOnce(
  51864. "Component template should contain exactly one root element. " +
  51865. "If you are using v-if on multiple elements, " +
  51866. "use v-else-if to chain them instead.",
  51867. { start: element.start }
  51868. );
  51869. }
  51870. }
  51871. if (currentParent && !element.forbidden) {
  51872. if (element.elseif || element.else) {
  51873. processIfConditions(element, currentParent);
  51874. } else {
  51875. if (element.slotScope) {
  51876. // scoped slot
  51877. // keep it in the children list so that v-else(-if) conditions can
  51878. // find it as the prev node.
  51879. var name = element.slotTarget || '"default"'
  51880. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  51881. }
  51882. currentParent.children.push(element);
  51883. element.parent = currentParent;
  51884. }
  51885. }
  51886. // final children cleanup
  51887. // filter out scoped slots
  51888. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  51889. // remove trailing whitespace node again
  51890. trimEndingWhitespace(element);
  51891. // check pre state
  51892. if (element.pre) {
  51893. inVPre = false;
  51894. }
  51895. if (platformIsPreTag(element.tag)) {
  51896. inPre = false;
  51897. }
  51898. // apply post-transforms
  51899. for (var i = 0; i < postTransforms.length; i++) {
  51900. postTransforms[i](element, options);
  51901. }
  51902. }
  51903. function trimEndingWhitespace (el) {
  51904. // remove trailing whitespace node
  51905. if (!inPre) {
  51906. var lastNode;
  51907. while (
  51908. (lastNode = el.children[el.children.length - 1]) &&
  51909. lastNode.type === 3 &&
  51910. lastNode.text === ' '
  51911. ) {
  51912. el.children.pop();
  51913. }
  51914. }
  51915. }
  51916. function checkRootConstraints (el) {
  51917. if (el.tag === 'slot' || el.tag === 'template') {
  51918. warnOnce(
  51919. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  51920. 'contain multiple nodes.',
  51921. { start: el.start }
  51922. );
  51923. }
  51924. if (el.attrsMap.hasOwnProperty('v-for')) {
  51925. warnOnce(
  51926. 'Cannot use v-for on stateful component root element because ' +
  51927. 'it renders multiple elements.',
  51928. el.rawAttrsMap['v-for']
  51929. );
  51930. }
  51931. }
  51932. parseHTML(template, {
  51933. warn: warn$2,
  51934. expectHTML: options.expectHTML,
  51935. isUnaryTag: options.isUnaryTag,
  51936. canBeLeftOpenTag: options.canBeLeftOpenTag,
  51937. shouldDecodeNewlines: options.shouldDecodeNewlines,
  51938. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  51939. shouldKeepComment: options.comments,
  51940. outputSourceRange: options.outputSourceRange,
  51941. start: function start (tag, attrs, unary, start$1, end) {
  51942. // check namespace.
  51943. // inherit parent ns if there is one
  51944. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  51945. // handle IE svg bug
  51946. /* istanbul ignore if */
  51947. if (isIE && ns === 'svg') {
  51948. attrs = guardIESVGBug(attrs);
  51949. }
  51950. var element = createASTElement(tag, attrs, currentParent);
  51951. if (ns) {
  51952. element.ns = ns;
  51953. }
  51954. {
  51955. if (options.outputSourceRange) {
  51956. element.start = start$1;
  51957. element.end = end;
  51958. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  51959. cumulated[attr.name] = attr;
  51960. return cumulated
  51961. }, {});
  51962. }
  51963. attrs.forEach(function (attr) {
  51964. if (invalidAttributeRE.test(attr.name)) {
  51965. warn$2(
  51966. "Invalid dynamic argument expression: attribute names cannot contain " +
  51967. "spaces, quotes, <, >, / or =.",
  51968. {
  51969. start: attr.start + attr.name.indexOf("["),
  51970. end: attr.start + attr.name.length
  51971. }
  51972. );
  51973. }
  51974. });
  51975. }
  51976. if (isForbiddenTag(element) && !isServerRendering()) {
  51977. element.forbidden = true;
  51978. warn$2(
  51979. 'Templates should only be responsible for mapping the state to the ' +
  51980. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  51981. "<" + tag + ">" + ', as they will not be parsed.',
  51982. { start: element.start }
  51983. );
  51984. }
  51985. // apply pre-transforms
  51986. for (var i = 0; i < preTransforms.length; i++) {
  51987. element = preTransforms[i](element, options) || element;
  51988. }
  51989. if (!inVPre) {
  51990. processPre(element);
  51991. if (element.pre) {
  51992. inVPre = true;
  51993. }
  51994. }
  51995. if (platformIsPreTag(element.tag)) {
  51996. inPre = true;
  51997. }
  51998. if (inVPre) {
  51999. processRawAttrs(element);
  52000. } else if (!element.processed) {
  52001. // structural directives
  52002. processFor(element);
  52003. processIf(element);
  52004. processOnce(element);
  52005. }
  52006. if (!root) {
  52007. root = element;
  52008. {
  52009. checkRootConstraints(root);
  52010. }
  52011. }
  52012. if (!unary) {
  52013. currentParent = element;
  52014. stack.push(element);
  52015. } else {
  52016. closeElement(element);
  52017. }
  52018. },
  52019. end: function end (tag, start, end$1) {
  52020. var element = stack[stack.length - 1];
  52021. // pop stack
  52022. stack.length -= 1;
  52023. currentParent = stack[stack.length - 1];
  52024. if (options.outputSourceRange) {
  52025. element.end = end$1;
  52026. }
  52027. closeElement(element);
  52028. },
  52029. chars: function chars (text, start, end) {
  52030. if (!currentParent) {
  52031. {
  52032. if (text === template) {
  52033. warnOnce(
  52034. 'Component template requires a root element, rather than just text.',
  52035. { start: start }
  52036. );
  52037. } else if ((text = text.trim())) {
  52038. warnOnce(
  52039. ("text \"" + text + "\" outside root element will be ignored."),
  52040. { start: start }
  52041. );
  52042. }
  52043. }
  52044. return
  52045. }
  52046. // IE textarea placeholder bug
  52047. /* istanbul ignore if */
  52048. if (isIE &&
  52049. currentParent.tag === 'textarea' &&
  52050. currentParent.attrsMap.placeholder === text
  52051. ) {
  52052. return
  52053. }
  52054. var children = currentParent.children;
  52055. if (inPre || text.trim()) {
  52056. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52057. } else if (!children.length) {
  52058. // remove the whitespace-only node right after an opening tag
  52059. text = '';
  52060. } else if (whitespaceOption) {
  52061. if (whitespaceOption === 'condense') {
  52062. // in condense mode, remove the whitespace node if it contains
  52063. // line break, otherwise condense to a single space
  52064. text = lineBreakRE.test(text) ? '' : ' ';
  52065. } else {
  52066. text = ' ';
  52067. }
  52068. } else {
  52069. text = preserveWhitespace ? ' ' : '';
  52070. }
  52071. if (text) {
  52072. if (!inPre && whitespaceOption === 'condense') {
  52073. // condense consecutive whitespaces into single space
  52074. text = text.replace(whitespaceRE$1, ' ');
  52075. }
  52076. var res;
  52077. var child;
  52078. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52079. child = {
  52080. type: 2,
  52081. expression: res.expression,
  52082. tokens: res.tokens,
  52083. text: text
  52084. };
  52085. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52086. child = {
  52087. type: 3,
  52088. text: text
  52089. };
  52090. }
  52091. if (child) {
  52092. if (options.outputSourceRange) {
  52093. child.start = start;
  52094. child.end = end;
  52095. }
  52096. children.push(child);
  52097. }
  52098. }
  52099. },
  52100. comment: function comment (text, start, end) {
  52101. // adding anyting as a sibling to the root node is forbidden
  52102. // comments should still be allowed, but ignored
  52103. if (currentParent) {
  52104. var child = {
  52105. type: 3,
  52106. text: text,
  52107. isComment: true
  52108. };
  52109. if (options.outputSourceRange) {
  52110. child.start = start;
  52111. child.end = end;
  52112. }
  52113. currentParent.children.push(child);
  52114. }
  52115. }
  52116. });
  52117. return root
  52118. }
  52119. function processPre (el) {
  52120. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52121. el.pre = true;
  52122. }
  52123. }
  52124. function processRawAttrs (el) {
  52125. var list = el.attrsList;
  52126. var len = list.length;
  52127. if (len) {
  52128. var attrs = el.attrs = new Array(len);
  52129. for (var i = 0; i < len; i++) {
  52130. attrs[i] = {
  52131. name: list[i].name,
  52132. value: JSON.stringify(list[i].value)
  52133. };
  52134. if (list[i].start != null) {
  52135. attrs[i].start = list[i].start;
  52136. attrs[i].end = list[i].end;
  52137. }
  52138. }
  52139. } else if (!el.pre) {
  52140. // non root node in pre blocks with no attributes
  52141. el.plain = true;
  52142. }
  52143. }
  52144. function processElement (
  52145. element,
  52146. options
  52147. ) {
  52148. processKey(element);
  52149. // determine whether this is a plain element after
  52150. // removing structural attributes
  52151. element.plain = (
  52152. !element.key &&
  52153. !element.scopedSlots &&
  52154. !element.attrsList.length
  52155. );
  52156. processRef(element);
  52157. processSlotContent(element);
  52158. processSlotOutlet(element);
  52159. processComponent(element);
  52160. for (var i = 0; i < transforms.length; i++) {
  52161. element = transforms[i](element, options) || element;
  52162. }
  52163. processAttrs(element);
  52164. return element
  52165. }
  52166. function processKey (el) {
  52167. var exp = getBindingAttr(el, 'key');
  52168. if (exp) {
  52169. {
  52170. if (el.tag === 'template') {
  52171. warn$2(
  52172. "<template> cannot be keyed. Place the key on real elements instead.",
  52173. getRawBindingAttr(el, 'key')
  52174. );
  52175. }
  52176. if (el.for) {
  52177. var iterator = el.iterator2 || el.iterator1;
  52178. var parent = el.parent;
  52179. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  52180. warn$2(
  52181. "Do not use v-for index as key on <transition-group> children, " +
  52182. "this is the same as not using keys.",
  52183. getRawBindingAttr(el, 'key'),
  52184. true /* tip */
  52185. );
  52186. }
  52187. }
  52188. }
  52189. el.key = exp;
  52190. }
  52191. }
  52192. function processRef (el) {
  52193. var ref = getBindingAttr(el, 'ref');
  52194. if (ref) {
  52195. el.ref = ref;
  52196. el.refInFor = checkInFor(el);
  52197. }
  52198. }
  52199. function processFor (el) {
  52200. var exp;
  52201. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  52202. var res = parseFor(exp);
  52203. if (res) {
  52204. extend(el, res);
  52205. } else {
  52206. warn$2(
  52207. ("Invalid v-for expression: " + exp),
  52208. el.rawAttrsMap['v-for']
  52209. );
  52210. }
  52211. }
  52212. }
  52213. function parseFor (exp) {
  52214. var inMatch = exp.match(forAliasRE);
  52215. if (!inMatch) { return }
  52216. var res = {};
  52217. res.for = inMatch[2].trim();
  52218. var alias = inMatch[1].trim().replace(stripParensRE, '');
  52219. var iteratorMatch = alias.match(forIteratorRE);
  52220. if (iteratorMatch) {
  52221. res.alias = alias.replace(forIteratorRE, '').trim();
  52222. res.iterator1 = iteratorMatch[1].trim();
  52223. if (iteratorMatch[2]) {
  52224. res.iterator2 = iteratorMatch[2].trim();
  52225. }
  52226. } else {
  52227. res.alias = alias;
  52228. }
  52229. return res
  52230. }
  52231. function processIf (el) {
  52232. var exp = getAndRemoveAttr(el, 'v-if');
  52233. if (exp) {
  52234. el.if = exp;
  52235. addIfCondition(el, {
  52236. exp: exp,
  52237. block: el
  52238. });
  52239. } else {
  52240. if (getAndRemoveAttr(el, 'v-else') != null) {
  52241. el.else = true;
  52242. }
  52243. var elseif = getAndRemoveAttr(el, 'v-else-if');
  52244. if (elseif) {
  52245. el.elseif = elseif;
  52246. }
  52247. }
  52248. }
  52249. function processIfConditions (el, parent) {
  52250. var prev = findPrevElement(parent.children);
  52251. if (prev && prev.if) {
  52252. addIfCondition(prev, {
  52253. exp: el.elseif,
  52254. block: el
  52255. });
  52256. } else {
  52257. warn$2(
  52258. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  52259. "used on element <" + (el.tag) + "> without corresponding v-if.",
  52260. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  52261. );
  52262. }
  52263. }
  52264. function findPrevElement (children) {
  52265. var i = children.length;
  52266. while (i--) {
  52267. if (children[i].type === 1) {
  52268. return children[i]
  52269. } else {
  52270. if (children[i].text !== ' ') {
  52271. warn$2(
  52272. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  52273. "will be ignored.",
  52274. children[i]
  52275. );
  52276. }
  52277. children.pop();
  52278. }
  52279. }
  52280. }
  52281. function addIfCondition (el, condition) {
  52282. if (!el.ifConditions) {
  52283. el.ifConditions = [];
  52284. }
  52285. el.ifConditions.push(condition);
  52286. }
  52287. function processOnce (el) {
  52288. var once$$1 = getAndRemoveAttr(el, 'v-once');
  52289. if (once$$1 != null) {
  52290. el.once = true;
  52291. }
  52292. }
  52293. // handle content being passed to a component as slot,
  52294. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  52295. function processSlotContent (el) {
  52296. var slotScope;
  52297. if (el.tag === 'template') {
  52298. slotScope = getAndRemoveAttr(el, 'scope');
  52299. /* istanbul ignore if */
  52300. if (slotScope) {
  52301. warn$2(
  52302. "the \"scope\" attribute for scoped slots have been deprecated and " +
  52303. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  52304. "can also be used on plain elements in addition to <template> to " +
  52305. "denote scoped slots.",
  52306. el.rawAttrsMap['scope'],
  52307. true
  52308. );
  52309. }
  52310. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  52311. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  52312. /* istanbul ignore if */
  52313. if (el.attrsMap['v-for']) {
  52314. warn$2(
  52315. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  52316. "(v-for takes higher priority). Use a wrapper <template> for the " +
  52317. "scoped slot to make it clearer.",
  52318. el.rawAttrsMap['slot-scope'],
  52319. true
  52320. );
  52321. }
  52322. el.slotScope = slotScope;
  52323. }
  52324. // slot="xxx"
  52325. var slotTarget = getBindingAttr(el, 'slot');
  52326. if (slotTarget) {
  52327. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  52328. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  52329. // preserve slot as an attribute for native shadow DOM compat
  52330. // only for non-scoped slots.
  52331. if (el.tag !== 'template' && !el.slotScope) {
  52332. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  52333. }
  52334. }
  52335. // 2.6 v-slot syntax
  52336. {
  52337. if (el.tag === 'template') {
  52338. // v-slot on <template>
  52339. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  52340. if (slotBinding) {
  52341. {
  52342. if (el.slotTarget || el.slotScope) {
  52343. warn$2(
  52344. "Unexpected mixed usage of different slot syntaxes.",
  52345. el
  52346. );
  52347. }
  52348. if (el.parent && !maybeComponent(el.parent)) {
  52349. warn$2(
  52350. "<template v-slot> can only appear at the root level inside " +
  52351. "the receiving component",
  52352. el
  52353. );
  52354. }
  52355. }
  52356. var ref = getSlotName(slotBinding);
  52357. var name = ref.name;
  52358. var dynamic = ref.dynamic;
  52359. el.slotTarget = name;
  52360. el.slotTargetDynamic = dynamic;
  52361. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52362. }
  52363. } else {
  52364. // v-slot on component, denotes default slot
  52365. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52366. if (slotBinding$1) {
  52367. {
  52368. if (!maybeComponent(el)) {
  52369. warn$2(
  52370. "v-slot can only be used on components or <template>.",
  52371. slotBinding$1
  52372. );
  52373. }
  52374. if (el.slotScope || el.slotTarget) {
  52375. warn$2(
  52376. "Unexpected mixed usage of different slot syntaxes.",
  52377. el
  52378. );
  52379. }
  52380. if (el.scopedSlots) {
  52381. warn$2(
  52382. "To avoid scope ambiguity, the default slot should also use " +
  52383. "<template> syntax when there are other named slots.",
  52384. slotBinding$1
  52385. );
  52386. }
  52387. }
  52388. // add the component's children to its default slot
  52389. var slots = el.scopedSlots || (el.scopedSlots = {});
  52390. var ref$1 = getSlotName(slotBinding$1);
  52391. var name$1 = ref$1.name;
  52392. var dynamic$1 = ref$1.dynamic;
  52393. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52394. slotContainer.slotTarget = name$1;
  52395. slotContainer.slotTargetDynamic = dynamic$1;
  52396. slotContainer.children = el.children.filter(function (c) {
  52397. if (!c.slotScope) {
  52398. c.parent = slotContainer;
  52399. return true
  52400. }
  52401. });
  52402. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52403. // remove children as they are returned from scopedSlots now
  52404. el.children = [];
  52405. // mark el non-plain so data gets generated
  52406. el.plain = false;
  52407. }
  52408. }
  52409. }
  52410. }
  52411. function getSlotName (binding) {
  52412. var name = binding.name.replace(slotRE, '');
  52413. if (!name) {
  52414. if (binding.name[0] !== '#') {
  52415. name = 'default';
  52416. } else {
  52417. warn$2(
  52418. "v-slot shorthand syntax requires a slot name.",
  52419. binding
  52420. );
  52421. }
  52422. }
  52423. return dynamicArgRE.test(name)
  52424. // dynamic [name]
  52425. ? { name: name.slice(1, -1), dynamic: true }
  52426. // static name
  52427. : { name: ("\"" + name + "\""), dynamic: false }
  52428. }
  52429. // handle <slot/> outlets
  52430. function processSlotOutlet (el) {
  52431. if (el.tag === 'slot') {
  52432. el.slotName = getBindingAttr(el, 'name');
  52433. if (el.key) {
  52434. warn$2(
  52435. "`key` does not work on <slot> because slots are abstract outlets " +
  52436. "and can possibly expand into multiple elements. " +
  52437. "Use the key on a wrapping element instead.",
  52438. getRawBindingAttr(el, 'key')
  52439. );
  52440. }
  52441. }
  52442. }
  52443. function processComponent (el) {
  52444. var binding;
  52445. if ((binding = getBindingAttr(el, 'is'))) {
  52446. el.component = binding;
  52447. }
  52448. if (getAndRemoveAttr(el, 'inline-template') != null) {
  52449. el.inlineTemplate = true;
  52450. }
  52451. }
  52452. function processAttrs (el) {
  52453. var list = el.attrsList;
  52454. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  52455. for (i = 0, l = list.length; i < l; i++) {
  52456. name = rawName = list[i].name;
  52457. value = list[i].value;
  52458. if (dirRE.test(name)) {
  52459. // mark element as dynamic
  52460. el.hasBindings = true;
  52461. // modifiers
  52462. modifiers = parseModifiers(name.replace(dirRE, ''));
  52463. // support .foo shorthand syntax for the .prop modifier
  52464. if (modifiers) {
  52465. name = name.replace(modifierRE, '');
  52466. }
  52467. if (bindRE.test(name)) { // v-bind
  52468. name = name.replace(bindRE, '');
  52469. value = parseFilters(value);
  52470. isDynamic = dynamicArgRE.test(name);
  52471. if (isDynamic) {
  52472. name = name.slice(1, -1);
  52473. }
  52474. if (
  52475. value.trim().length === 0
  52476. ) {
  52477. warn$2(
  52478. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  52479. );
  52480. }
  52481. if (modifiers) {
  52482. if (modifiers.prop && !isDynamic) {
  52483. name = camelize(name);
  52484. if (name === 'innerHtml') { name = 'innerHTML'; }
  52485. }
  52486. if (modifiers.camel && !isDynamic) {
  52487. name = camelize(name);
  52488. }
  52489. if (modifiers.sync) {
  52490. syncGen = genAssignmentCode(value, "$event");
  52491. if (!isDynamic) {
  52492. addHandler(
  52493. el,
  52494. ("update:" + (camelize(name))),
  52495. syncGen,
  52496. null,
  52497. false,
  52498. warn$2,
  52499. list[i]
  52500. );
  52501. if (hyphenate(name) !== camelize(name)) {
  52502. addHandler(
  52503. el,
  52504. ("update:" + (hyphenate(name))),
  52505. syncGen,
  52506. null,
  52507. false,
  52508. warn$2,
  52509. list[i]
  52510. );
  52511. }
  52512. } else {
  52513. // handler w/ dynamic event name
  52514. addHandler(
  52515. el,
  52516. ("\"update:\"+(" + name + ")"),
  52517. syncGen,
  52518. null,
  52519. false,
  52520. warn$2,
  52521. list[i],
  52522. true // dynamic
  52523. );
  52524. }
  52525. }
  52526. }
  52527. if ((modifiers && modifiers.prop) || (
  52528. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  52529. )) {
  52530. addProp(el, name, value, list[i], isDynamic);
  52531. } else {
  52532. addAttr(el, name, value, list[i], isDynamic);
  52533. }
  52534. } else if (onRE.test(name)) { // v-on
  52535. name = name.replace(onRE, '');
  52536. isDynamic = dynamicArgRE.test(name);
  52537. if (isDynamic) {
  52538. name = name.slice(1, -1);
  52539. }
  52540. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  52541. } else { // normal directives
  52542. name = name.replace(dirRE, '');
  52543. // parse arg
  52544. var argMatch = name.match(argRE);
  52545. var arg = argMatch && argMatch[1];
  52546. isDynamic = false;
  52547. if (arg) {
  52548. name = name.slice(0, -(arg.length + 1));
  52549. if (dynamicArgRE.test(arg)) {
  52550. arg = arg.slice(1, -1);
  52551. isDynamic = true;
  52552. }
  52553. }
  52554. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  52555. if (name === 'model') {
  52556. checkForAliasModel(el, value);
  52557. }
  52558. }
  52559. } else {
  52560. // literal attribute
  52561. {
  52562. var res = parseText(value, delimiters);
  52563. if (res) {
  52564. warn$2(
  52565. name + "=\"" + value + "\": " +
  52566. 'Interpolation inside attributes has been removed. ' +
  52567. 'Use v-bind or the colon shorthand instead. For example, ' +
  52568. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  52569. list[i]
  52570. );
  52571. }
  52572. }
  52573. addAttr(el, name, JSON.stringify(value), list[i]);
  52574. // #6887 firefox doesn't update muted state if set via attribute
  52575. // even immediately after element creation
  52576. if (!el.component &&
  52577. name === 'muted' &&
  52578. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  52579. addProp(el, name, 'true', list[i]);
  52580. }
  52581. }
  52582. }
  52583. }
  52584. function checkInFor (el) {
  52585. var parent = el;
  52586. while (parent) {
  52587. if (parent.for !== undefined) {
  52588. return true
  52589. }
  52590. parent = parent.parent;
  52591. }
  52592. return false
  52593. }
  52594. function parseModifiers (name) {
  52595. var match = name.match(modifierRE);
  52596. if (match) {
  52597. var ret = {};
  52598. match.forEach(function (m) { ret[m.slice(1)] = true; });
  52599. return ret
  52600. }
  52601. }
  52602. function makeAttrsMap (attrs) {
  52603. var map = {};
  52604. for (var i = 0, l = attrs.length; i < l; i++) {
  52605. if (
  52606. map[attrs[i].name] && !isIE && !isEdge
  52607. ) {
  52608. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  52609. }
  52610. map[attrs[i].name] = attrs[i].value;
  52611. }
  52612. return map
  52613. }
  52614. // for script (e.g. type="x/template") or style, do not decode content
  52615. function isTextTag (el) {
  52616. return el.tag === 'script' || el.tag === 'style'
  52617. }
  52618. function isForbiddenTag (el) {
  52619. return (
  52620. el.tag === 'style' ||
  52621. (el.tag === 'script' && (
  52622. !el.attrsMap.type ||
  52623. el.attrsMap.type === 'text/javascript'
  52624. ))
  52625. )
  52626. }
  52627. var ieNSBug = /^xmlns:NS\d+/;
  52628. var ieNSPrefix = /^NS\d+:/;
  52629. /* istanbul ignore next */
  52630. function guardIESVGBug (attrs) {
  52631. var res = [];
  52632. for (var i = 0; i < attrs.length; i++) {
  52633. var attr = attrs[i];
  52634. if (!ieNSBug.test(attr.name)) {
  52635. attr.name = attr.name.replace(ieNSPrefix, '');
  52636. res.push(attr);
  52637. }
  52638. }
  52639. return res
  52640. }
  52641. function checkForAliasModel (el, value) {
  52642. var _el = el;
  52643. while (_el) {
  52644. if (_el.for && _el.alias === value) {
  52645. warn$2(
  52646. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  52647. "You are binding v-model directly to a v-for iteration alias. " +
  52648. "This will not be able to modify the v-for source array because " +
  52649. "writing to the alias is like modifying a function local variable. " +
  52650. "Consider using an array of objects and use v-model on an object property instead.",
  52651. el.rawAttrsMap['v-model']
  52652. );
  52653. }
  52654. _el = _el.parent;
  52655. }
  52656. }
  52657. /* */
  52658. function preTransformNode (el, options) {
  52659. if (el.tag === 'input') {
  52660. var map = el.attrsMap;
  52661. if (!map['v-model']) {
  52662. return
  52663. }
  52664. var typeBinding;
  52665. if (map[':type'] || map['v-bind:type']) {
  52666. typeBinding = getBindingAttr(el, 'type');
  52667. }
  52668. if (!map.type && !typeBinding && map['v-bind']) {
  52669. typeBinding = "(" + (map['v-bind']) + ").type";
  52670. }
  52671. if (typeBinding) {
  52672. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  52673. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  52674. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  52675. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  52676. // 1. checkbox
  52677. var branch0 = cloneASTElement(el);
  52678. // process for on the main node
  52679. processFor(branch0);
  52680. addRawAttr(branch0, 'type', 'checkbox');
  52681. processElement(branch0, options);
  52682. branch0.processed = true; // prevent it from double-processed
  52683. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  52684. addIfCondition(branch0, {
  52685. exp: branch0.if,
  52686. block: branch0
  52687. });
  52688. // 2. add radio else-if condition
  52689. var branch1 = cloneASTElement(el);
  52690. getAndRemoveAttr(branch1, 'v-for', true);
  52691. addRawAttr(branch1, 'type', 'radio');
  52692. processElement(branch1, options);
  52693. addIfCondition(branch0, {
  52694. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  52695. block: branch1
  52696. });
  52697. // 3. other
  52698. var branch2 = cloneASTElement(el);
  52699. getAndRemoveAttr(branch2, 'v-for', true);
  52700. addRawAttr(branch2, ':type', typeBinding);
  52701. processElement(branch2, options);
  52702. addIfCondition(branch0, {
  52703. exp: ifCondition,
  52704. block: branch2
  52705. });
  52706. if (hasElse) {
  52707. branch0.else = true;
  52708. } else if (elseIfCondition) {
  52709. branch0.elseif = elseIfCondition;
  52710. }
  52711. return branch0
  52712. }
  52713. }
  52714. }
  52715. function cloneASTElement (el) {
  52716. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  52717. }
  52718. var model$1 = {
  52719. preTransformNode: preTransformNode
  52720. };
  52721. var modules$1 = [
  52722. klass$1,
  52723. style$1,
  52724. model$1
  52725. ];
  52726. /* */
  52727. function text (el, dir) {
  52728. if (dir.value) {
  52729. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  52730. }
  52731. }
  52732. /* */
  52733. function html (el, dir) {
  52734. if (dir.value) {
  52735. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  52736. }
  52737. }
  52738. var directives$1 = {
  52739. model: model,
  52740. text: text,
  52741. html: html
  52742. };
  52743. /* */
  52744. var baseOptions = {
  52745. expectHTML: true,
  52746. modules: modules$1,
  52747. directives: directives$1,
  52748. isPreTag: isPreTag,
  52749. isUnaryTag: isUnaryTag,
  52750. mustUseProp: mustUseProp,
  52751. canBeLeftOpenTag: canBeLeftOpenTag,
  52752. isReservedTag: isReservedTag,
  52753. getTagNamespace: getTagNamespace,
  52754. staticKeys: genStaticKeys(modules$1)
  52755. };
  52756. /* */
  52757. var isStaticKey;
  52758. var isPlatformReservedTag;
  52759. var genStaticKeysCached = cached(genStaticKeys$1);
  52760. /**
  52761. * Goal of the optimizer: walk the generated template AST tree
  52762. * and detect sub-trees that are purely static, i.e. parts of
  52763. * the DOM that never needs to change.
  52764. *
  52765. * Once we detect these sub-trees, we can:
  52766. *
  52767. * 1. Hoist them into constants, so that we no longer need to
  52768. * create fresh nodes for them on each re-render;
  52769. * 2. Completely skip them in the patching process.
  52770. */
  52771. function optimize (root, options) {
  52772. if (!root) { return }
  52773. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  52774. isPlatformReservedTag = options.isReservedTag || no;
  52775. // first pass: mark all non-static nodes.
  52776. markStatic$1(root);
  52777. // second pass: mark static roots.
  52778. markStaticRoots(root, false);
  52779. }
  52780. function genStaticKeys$1 (keys) {
  52781. return makeMap(
  52782. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  52783. (keys ? ',' + keys : '')
  52784. )
  52785. }
  52786. function markStatic$1 (node) {
  52787. node.static = isStatic(node);
  52788. if (node.type === 1) {
  52789. // do not make component slot content static. this avoids
  52790. // 1. components not able to mutate slot nodes
  52791. // 2. static slot content fails for hot-reloading
  52792. if (
  52793. !isPlatformReservedTag(node.tag) &&
  52794. node.tag !== 'slot' &&
  52795. node.attrsMap['inline-template'] == null
  52796. ) {
  52797. return
  52798. }
  52799. for (var i = 0, l = node.children.length; i < l; i++) {
  52800. var child = node.children[i];
  52801. markStatic$1(child);
  52802. if (!child.static) {
  52803. node.static = false;
  52804. }
  52805. }
  52806. if (node.ifConditions) {
  52807. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52808. var block = node.ifConditions[i$1].block;
  52809. markStatic$1(block);
  52810. if (!block.static) {
  52811. node.static = false;
  52812. }
  52813. }
  52814. }
  52815. }
  52816. }
  52817. function markStaticRoots (node, isInFor) {
  52818. if (node.type === 1) {
  52819. if (node.static || node.once) {
  52820. node.staticInFor = isInFor;
  52821. }
  52822. // For a node to qualify as a static root, it should have children that
  52823. // are not just static text. Otherwise the cost of hoisting out will
  52824. // outweigh the benefits and it's better off to just always render it fresh.
  52825. if (node.static && node.children.length && !(
  52826. node.children.length === 1 &&
  52827. node.children[0].type === 3
  52828. )) {
  52829. node.staticRoot = true;
  52830. return
  52831. } else {
  52832. node.staticRoot = false;
  52833. }
  52834. if (node.children) {
  52835. for (var i = 0, l = node.children.length; i < l; i++) {
  52836. markStaticRoots(node.children[i], isInFor || !!node.for);
  52837. }
  52838. }
  52839. if (node.ifConditions) {
  52840. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52841. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  52842. }
  52843. }
  52844. }
  52845. }
  52846. function isStatic (node) {
  52847. if (node.type === 2) { // expression
  52848. return false
  52849. }
  52850. if (node.type === 3) { // text
  52851. return true
  52852. }
  52853. return !!(node.pre || (
  52854. !node.hasBindings && // no dynamic bindings
  52855. !node.if && !node.for && // not v-if or v-for or v-else
  52856. !isBuiltInTag(node.tag) && // not a built-in
  52857. isPlatformReservedTag(node.tag) && // not a component
  52858. !isDirectChildOfTemplateFor(node) &&
  52859. Object.keys(node).every(isStaticKey)
  52860. ))
  52861. }
  52862. function isDirectChildOfTemplateFor (node) {
  52863. while (node.parent) {
  52864. node = node.parent;
  52865. if (node.tag !== 'template') {
  52866. return false
  52867. }
  52868. if (node.for) {
  52869. return true
  52870. }
  52871. }
  52872. return false
  52873. }
  52874. /* */
  52875. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  52876. var fnInvokeRE = /\([^)]*?\);*$/;
  52877. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  52878. // KeyboardEvent.keyCode aliases
  52879. var keyCodes = {
  52880. esc: 27,
  52881. tab: 9,
  52882. enter: 13,
  52883. space: 32,
  52884. up: 38,
  52885. left: 37,
  52886. right: 39,
  52887. down: 40,
  52888. 'delete': [8, 46]
  52889. };
  52890. // KeyboardEvent.key aliases
  52891. var keyNames = {
  52892. // #7880: IE11 and Edge use `Esc` for Escape key name.
  52893. esc: ['Esc', 'Escape'],
  52894. tab: 'Tab',
  52895. enter: 'Enter',
  52896. // #9112: IE11 uses `Spacebar` for Space key name.
  52897. space: [' ', 'Spacebar'],
  52898. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  52899. up: ['Up', 'ArrowUp'],
  52900. left: ['Left', 'ArrowLeft'],
  52901. right: ['Right', 'ArrowRight'],
  52902. down: ['Down', 'ArrowDown'],
  52903. // #9112: IE11 uses `Del` for Delete key name.
  52904. 'delete': ['Backspace', 'Delete', 'Del']
  52905. };
  52906. // #4868: modifiers that prevent the execution of the listener
  52907. // need to explicitly return null so that we can determine whether to remove
  52908. // the listener for .once
  52909. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  52910. var modifierCode = {
  52911. stop: '$event.stopPropagation();',
  52912. prevent: '$event.preventDefault();',
  52913. self: genGuard("$event.target !== $event.currentTarget"),
  52914. ctrl: genGuard("!$event.ctrlKey"),
  52915. shift: genGuard("!$event.shiftKey"),
  52916. alt: genGuard("!$event.altKey"),
  52917. meta: genGuard("!$event.metaKey"),
  52918. left: genGuard("'button' in $event && $event.button !== 0"),
  52919. middle: genGuard("'button' in $event && $event.button !== 1"),
  52920. right: genGuard("'button' in $event && $event.button !== 2")
  52921. };
  52922. function genHandlers (
  52923. events,
  52924. isNative
  52925. ) {
  52926. var prefix = isNative ? 'nativeOn:' : 'on:';
  52927. var staticHandlers = "";
  52928. var dynamicHandlers = "";
  52929. for (var name in events) {
  52930. var handlerCode = genHandler(events[name]);
  52931. if (events[name] && events[name].dynamic) {
  52932. dynamicHandlers += name + "," + handlerCode + ",";
  52933. } else {
  52934. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  52935. }
  52936. }
  52937. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  52938. if (dynamicHandlers) {
  52939. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  52940. } else {
  52941. return prefix + staticHandlers
  52942. }
  52943. }
  52944. function genHandler (handler) {
  52945. if (!handler) {
  52946. return 'function(){}'
  52947. }
  52948. if (Array.isArray(handler)) {
  52949. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  52950. }
  52951. var isMethodPath = simplePathRE.test(handler.value);
  52952. var isFunctionExpression = fnExpRE.test(handler.value);
  52953. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  52954. if (!handler.modifiers) {
  52955. if (isMethodPath || isFunctionExpression) {
  52956. return handler.value
  52957. }
  52958. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  52959. } else {
  52960. var code = '';
  52961. var genModifierCode = '';
  52962. var keys = [];
  52963. for (var key in handler.modifiers) {
  52964. if (modifierCode[key]) {
  52965. genModifierCode += modifierCode[key];
  52966. // left/right
  52967. if (keyCodes[key]) {
  52968. keys.push(key);
  52969. }
  52970. } else if (key === 'exact') {
  52971. var modifiers = (handler.modifiers);
  52972. genModifierCode += genGuard(
  52973. ['ctrl', 'shift', 'alt', 'meta']
  52974. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  52975. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  52976. .join('||')
  52977. );
  52978. } else {
  52979. keys.push(key);
  52980. }
  52981. }
  52982. if (keys.length) {
  52983. code += genKeyFilter(keys);
  52984. }
  52985. // Make sure modifiers like prevent and stop get executed after key filtering
  52986. if (genModifierCode) {
  52987. code += genModifierCode;
  52988. }
  52989. var handlerCode = isMethodPath
  52990. ? ("return " + (handler.value) + "($event)")
  52991. : isFunctionExpression
  52992. ? ("return (" + (handler.value) + ")($event)")
  52993. : isFunctionInvocation
  52994. ? ("return " + (handler.value))
  52995. : handler.value;
  52996. return ("function($event){" + code + handlerCode + "}")
  52997. }
  52998. }
  52999. function genKeyFilter (keys) {
  53000. return (
  53001. // make sure the key filters only apply to KeyboardEvents
  53002. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53003. // key events that do not have keyCode property...
  53004. "if(!$event.type.indexOf('key')&&" +
  53005. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53006. )
  53007. }
  53008. function genFilterCode (key) {
  53009. var keyVal = parseInt(key, 10);
  53010. if (keyVal) {
  53011. return ("$event.keyCode!==" + keyVal)
  53012. }
  53013. var keyCode = keyCodes[key];
  53014. var keyName = keyNames[key];
  53015. return (
  53016. "_k($event.keyCode," +
  53017. (JSON.stringify(key)) + "," +
  53018. (JSON.stringify(keyCode)) + "," +
  53019. "$event.key," +
  53020. "" + (JSON.stringify(keyName)) +
  53021. ")"
  53022. )
  53023. }
  53024. /* */
  53025. function on (el, dir) {
  53026. if (dir.modifiers) {
  53027. warn("v-on without argument does not support modifiers.");
  53028. }
  53029. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53030. }
  53031. /* */
  53032. function bind$1 (el, dir) {
  53033. el.wrapData = function (code) {
  53034. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53035. };
  53036. }
  53037. /* */
  53038. var baseDirectives = {
  53039. on: on,
  53040. bind: bind$1,
  53041. cloak: noop
  53042. };
  53043. /* */
  53044. var CodegenState = function CodegenState (options) {
  53045. this.options = options;
  53046. this.warn = options.warn || baseWarn;
  53047. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53048. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53049. this.directives = extend(extend({}, baseDirectives), options.directives);
  53050. var isReservedTag = options.isReservedTag || no;
  53051. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53052. this.onceId = 0;
  53053. this.staticRenderFns = [];
  53054. this.pre = false;
  53055. };
  53056. function generate (
  53057. ast,
  53058. options
  53059. ) {
  53060. var state = new CodegenState(options);
  53061. var code = ast ? genElement(ast, state) : '_c("div")';
  53062. return {
  53063. render: ("with(this){return " + code + "}"),
  53064. staticRenderFns: state.staticRenderFns
  53065. }
  53066. }
  53067. function genElement (el, state) {
  53068. if (el.parent) {
  53069. el.pre = el.pre || el.parent.pre;
  53070. }
  53071. if (el.staticRoot && !el.staticProcessed) {
  53072. return genStatic(el, state)
  53073. } else if (el.once && !el.onceProcessed) {
  53074. return genOnce(el, state)
  53075. } else if (el.for && !el.forProcessed) {
  53076. return genFor(el, state)
  53077. } else if (el.if && !el.ifProcessed) {
  53078. return genIf(el, state)
  53079. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53080. return genChildren(el, state) || 'void 0'
  53081. } else if (el.tag === 'slot') {
  53082. return genSlot(el, state)
  53083. } else {
  53084. // component or element
  53085. var code;
  53086. if (el.component) {
  53087. code = genComponent(el.component, el, state);
  53088. } else {
  53089. var data;
  53090. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53091. data = genData$2(el, state);
  53092. }
  53093. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53094. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53095. }
  53096. // module transforms
  53097. for (var i = 0; i < state.transforms.length; i++) {
  53098. code = state.transforms[i](el, code);
  53099. }
  53100. return code
  53101. }
  53102. }
  53103. // hoist static sub-trees out
  53104. function genStatic (el, state) {
  53105. el.staticProcessed = true;
  53106. // Some elements (templates) need to behave differently inside of a v-pre
  53107. // node. All pre nodes are static roots, so we can use this as a location to
  53108. // wrap a state change and reset it upon exiting the pre node.
  53109. var originalPreState = state.pre;
  53110. if (el.pre) {
  53111. state.pre = el.pre;
  53112. }
  53113. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53114. state.pre = originalPreState;
  53115. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53116. }
  53117. // v-once
  53118. function genOnce (el, state) {
  53119. el.onceProcessed = true;
  53120. if (el.if && !el.ifProcessed) {
  53121. return genIf(el, state)
  53122. } else if (el.staticInFor) {
  53123. var key = '';
  53124. var parent = el.parent;
  53125. while (parent) {
  53126. if (parent.for) {
  53127. key = parent.key;
  53128. break
  53129. }
  53130. parent = parent.parent;
  53131. }
  53132. if (!key) {
  53133. state.warn(
  53134. "v-once can only be used inside v-for that is keyed. ",
  53135. el.rawAttrsMap['v-once']
  53136. );
  53137. return genElement(el, state)
  53138. }
  53139. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53140. } else {
  53141. return genStatic(el, state)
  53142. }
  53143. }
  53144. function genIf (
  53145. el,
  53146. state,
  53147. altGen,
  53148. altEmpty
  53149. ) {
  53150. el.ifProcessed = true; // avoid recursion
  53151. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53152. }
  53153. function genIfConditions (
  53154. conditions,
  53155. state,
  53156. altGen,
  53157. altEmpty
  53158. ) {
  53159. if (!conditions.length) {
  53160. return altEmpty || '_e()'
  53161. }
  53162. var condition = conditions.shift();
  53163. if (condition.exp) {
  53164. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53165. } else {
  53166. return ("" + (genTernaryExp(condition.block)))
  53167. }
  53168. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53169. function genTernaryExp (el) {
  53170. return altGen
  53171. ? altGen(el, state)
  53172. : el.once
  53173. ? genOnce(el, state)
  53174. : genElement(el, state)
  53175. }
  53176. }
  53177. function genFor (
  53178. el,
  53179. state,
  53180. altGen,
  53181. altHelper
  53182. ) {
  53183. var exp = el.for;
  53184. var alias = el.alias;
  53185. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  53186. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  53187. if (state.maybeComponent(el) &&
  53188. el.tag !== 'slot' &&
  53189. el.tag !== 'template' &&
  53190. !el.key
  53191. ) {
  53192. state.warn(
  53193. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  53194. "v-for should have explicit keys. " +
  53195. "See https://vuejs.org/guide/list.html#key for more info.",
  53196. el.rawAttrsMap['v-for'],
  53197. true /* tip */
  53198. );
  53199. }
  53200. el.forProcessed = true; // avoid recursion
  53201. return (altHelper || '_l') + "((" + exp + ")," +
  53202. "function(" + alias + iterator1 + iterator2 + "){" +
  53203. "return " + ((altGen || genElement)(el, state)) +
  53204. '})'
  53205. }
  53206. function genData$2 (el, state) {
  53207. var data = '{';
  53208. // directives first.
  53209. // directives may mutate the el's other properties before they are generated.
  53210. var dirs = genDirectives(el, state);
  53211. if (dirs) { data += dirs + ','; }
  53212. // key
  53213. if (el.key) {
  53214. data += "key:" + (el.key) + ",";
  53215. }
  53216. // ref
  53217. if (el.ref) {
  53218. data += "ref:" + (el.ref) + ",";
  53219. }
  53220. if (el.refInFor) {
  53221. data += "refInFor:true,";
  53222. }
  53223. // pre
  53224. if (el.pre) {
  53225. data += "pre:true,";
  53226. }
  53227. // record original tag name for components using "is" attribute
  53228. if (el.component) {
  53229. data += "tag:\"" + (el.tag) + "\",";
  53230. }
  53231. // module data generation functions
  53232. for (var i = 0; i < state.dataGenFns.length; i++) {
  53233. data += state.dataGenFns[i](el);
  53234. }
  53235. // attributes
  53236. if (el.attrs) {
  53237. data += "attrs:" + (genProps(el.attrs)) + ",";
  53238. }
  53239. // DOM props
  53240. if (el.props) {
  53241. data += "domProps:" + (genProps(el.props)) + ",";
  53242. }
  53243. // event handlers
  53244. if (el.events) {
  53245. data += (genHandlers(el.events, false)) + ",";
  53246. }
  53247. if (el.nativeEvents) {
  53248. data += (genHandlers(el.nativeEvents, true)) + ",";
  53249. }
  53250. // slot target
  53251. // only for non-scoped slots
  53252. if (el.slotTarget && !el.slotScope) {
  53253. data += "slot:" + (el.slotTarget) + ",";
  53254. }
  53255. // scoped slots
  53256. if (el.scopedSlots) {
  53257. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  53258. }
  53259. // component v-model
  53260. if (el.model) {
  53261. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  53262. }
  53263. // inline-template
  53264. if (el.inlineTemplate) {
  53265. var inlineTemplate = genInlineTemplate(el, state);
  53266. if (inlineTemplate) {
  53267. data += inlineTemplate + ",";
  53268. }
  53269. }
  53270. data = data.replace(/,$/, '') + '}';
  53271. // v-bind dynamic argument wrap
  53272. // v-bind with dynamic arguments must be applied using the same v-bind object
  53273. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  53274. if (el.dynamicAttrs) {
  53275. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  53276. }
  53277. // v-bind data wrap
  53278. if (el.wrapData) {
  53279. data = el.wrapData(data);
  53280. }
  53281. // v-on data wrap
  53282. if (el.wrapListeners) {
  53283. data = el.wrapListeners(data);
  53284. }
  53285. return data
  53286. }
  53287. function genDirectives (el, state) {
  53288. var dirs = el.directives;
  53289. if (!dirs) { return }
  53290. var res = 'directives:[';
  53291. var hasRuntime = false;
  53292. var i, l, dir, needRuntime;
  53293. for (i = 0, l = dirs.length; i < l; i++) {
  53294. dir = dirs[i];
  53295. needRuntime = true;
  53296. var gen = state.directives[dir.name];
  53297. if (gen) {
  53298. // compile-time directive that manipulates AST.
  53299. // returns true if it also needs a runtime counterpart.
  53300. needRuntime = !!gen(el, dir, state.warn);
  53301. }
  53302. if (needRuntime) {
  53303. hasRuntime = true;
  53304. 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))) : '') + "},";
  53305. }
  53306. }
  53307. if (hasRuntime) {
  53308. return res.slice(0, -1) + ']'
  53309. }
  53310. }
  53311. function genInlineTemplate (el, state) {
  53312. var ast = el.children[0];
  53313. if (el.children.length !== 1 || ast.type !== 1) {
  53314. state.warn(
  53315. 'Inline-template components must have exactly one child element.',
  53316. { start: el.start }
  53317. );
  53318. }
  53319. if (ast && ast.type === 1) {
  53320. var inlineRenderFns = generate(ast, state.options);
  53321. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  53322. }
  53323. }
  53324. function genScopedSlots (
  53325. el,
  53326. slots,
  53327. state
  53328. ) {
  53329. // by default scoped slots are considered "stable", this allows child
  53330. // components with only scoped slots to skip forced updates from parent.
  53331. // but in some cases we have to bail-out of this optimization
  53332. // for example if the slot contains dynamic names, has v-if or v-for on them...
  53333. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  53334. var slot = slots[key];
  53335. return (
  53336. slot.slotTargetDynamic ||
  53337. slot.if ||
  53338. slot.for ||
  53339. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  53340. )
  53341. });
  53342. // #9534: if a component with scoped slots is inside a conditional branch,
  53343. // it's possible for the same component to be reused but with different
  53344. // compiled slot content. To avoid that, we generate a unique key based on
  53345. // the generated code of all the slot contents.
  53346. var needsKey = !!el.if;
  53347. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53348. // disconnected due to the intermediate scope variable)
  53349. // #9438, #9506
  53350. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53351. // and skip force updating ones that do not actually use scope variables.
  53352. if (!needsForceUpdate) {
  53353. var parent = el.parent;
  53354. while (parent) {
  53355. if (
  53356. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53357. parent.for
  53358. ) {
  53359. needsForceUpdate = true;
  53360. break
  53361. }
  53362. if (parent.if) {
  53363. needsKey = true;
  53364. }
  53365. parent = parent.parent;
  53366. }
  53367. }
  53368. var generatedSlots = Object.keys(slots)
  53369. .map(function (key) { return genScopedSlot(slots[key], state); })
  53370. .join(',');
  53371. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53372. }
  53373. function hash(str) {
  53374. var hash = 5381;
  53375. var i = str.length;
  53376. while(i) {
  53377. hash = (hash * 33) ^ str.charCodeAt(--i);
  53378. }
  53379. return hash >>> 0
  53380. }
  53381. function containsSlotChild (el) {
  53382. if (el.type === 1) {
  53383. if (el.tag === 'slot') {
  53384. return true
  53385. }
  53386. return el.children.some(containsSlotChild)
  53387. }
  53388. return false
  53389. }
  53390. function genScopedSlot (
  53391. el,
  53392. state
  53393. ) {
  53394. var isLegacySyntax = el.attrsMap['slot-scope'];
  53395. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53396. return genIf(el, state, genScopedSlot, "null")
  53397. }
  53398. if (el.for && !el.forProcessed) {
  53399. return genFor(el, state, genScopedSlot)
  53400. }
  53401. var slotScope = el.slotScope === emptySlotScopeToken
  53402. ? ""
  53403. : String(el.slotScope);
  53404. var fn = "function(" + slotScope + "){" +
  53405. "return " + (el.tag === 'template'
  53406. ? el.if && isLegacySyntax
  53407. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  53408. : genChildren(el, state) || 'undefined'
  53409. : genElement(el, state)) + "}";
  53410. // reverse proxy v-slot without scope on this.$slots
  53411. var reverseProxy = slotScope ? "" : ",proxy:true";
  53412. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  53413. }
  53414. function genChildren (
  53415. el,
  53416. state,
  53417. checkSkip,
  53418. altGenElement,
  53419. altGenNode
  53420. ) {
  53421. var children = el.children;
  53422. if (children.length) {
  53423. var el$1 = children[0];
  53424. // optimize single v-for
  53425. if (children.length === 1 &&
  53426. el$1.for &&
  53427. el$1.tag !== 'template' &&
  53428. el$1.tag !== 'slot'
  53429. ) {
  53430. var normalizationType = checkSkip
  53431. ? state.maybeComponent(el$1) ? ",1" : ",0"
  53432. : "";
  53433. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  53434. }
  53435. var normalizationType$1 = checkSkip
  53436. ? getNormalizationType(children, state.maybeComponent)
  53437. : 0;
  53438. var gen = altGenNode || genNode;
  53439. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  53440. }
  53441. }
  53442. // determine the normalization needed for the children array.
  53443. // 0: no normalization needed
  53444. // 1: simple normalization needed (possible 1-level deep nested array)
  53445. // 2: full normalization needed
  53446. function getNormalizationType (
  53447. children,
  53448. maybeComponent
  53449. ) {
  53450. var res = 0;
  53451. for (var i = 0; i < children.length; i++) {
  53452. var el = children[i];
  53453. if (el.type !== 1) {
  53454. continue
  53455. }
  53456. if (needsNormalization(el) ||
  53457. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  53458. res = 2;
  53459. break
  53460. }
  53461. if (maybeComponent(el) ||
  53462. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  53463. res = 1;
  53464. }
  53465. }
  53466. return res
  53467. }
  53468. function needsNormalization (el) {
  53469. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  53470. }
  53471. function genNode (node, state) {
  53472. if (node.type === 1) {
  53473. return genElement(node, state)
  53474. } else if (node.type === 3 && node.isComment) {
  53475. return genComment(node)
  53476. } else {
  53477. return genText(node)
  53478. }
  53479. }
  53480. function genText (text) {
  53481. return ("_v(" + (text.type === 2
  53482. ? text.expression // no need for () because already wrapped in _s()
  53483. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  53484. }
  53485. function genComment (comment) {
  53486. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  53487. }
  53488. function genSlot (el, state) {
  53489. var slotName = el.slotName || '"default"';
  53490. var children = genChildren(el, state);
  53491. var res = "_t(" + slotName + (children ? ("," + children) : '');
  53492. var attrs = el.attrs || el.dynamicAttrs
  53493. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  53494. // slot props are camelized
  53495. name: camelize(attr.name),
  53496. value: attr.value,
  53497. dynamic: attr.dynamic
  53498. }); }))
  53499. : null;
  53500. var bind$$1 = el.attrsMap['v-bind'];
  53501. if ((attrs || bind$$1) && !children) {
  53502. res += ",null";
  53503. }
  53504. if (attrs) {
  53505. res += "," + attrs;
  53506. }
  53507. if (bind$$1) {
  53508. res += (attrs ? '' : ',null') + "," + bind$$1;
  53509. }
  53510. return res + ')'
  53511. }
  53512. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  53513. function genComponent (
  53514. componentName,
  53515. el,
  53516. state
  53517. ) {
  53518. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53519. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  53520. }
  53521. function genProps (props) {
  53522. var staticProps = "";
  53523. var dynamicProps = "";
  53524. for (var i = 0; i < props.length; i++) {
  53525. var prop = props[i];
  53526. var value = transformSpecialNewlines(prop.value);
  53527. if (prop.dynamic) {
  53528. dynamicProps += (prop.name) + "," + value + ",";
  53529. } else {
  53530. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  53531. }
  53532. }
  53533. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  53534. if (dynamicProps) {
  53535. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  53536. } else {
  53537. return staticProps
  53538. }
  53539. }
  53540. // #3895, #4268
  53541. function transformSpecialNewlines (text) {
  53542. return text
  53543. .replace(/\u2028/g, '\\u2028')
  53544. .replace(/\u2029/g, '\\u2029')
  53545. }
  53546. /* */
  53547. // these keywords should not appear inside expressions, but operators like
  53548. // typeof, instanceof and in are allowed
  53549. var prohibitedKeywordRE = new RegExp('\\b' + (
  53550. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  53551. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  53552. 'extends,finally,continue,debugger,function,arguments'
  53553. ).split(',').join('\\b|\\b') + '\\b');
  53554. // these unary operators should not be used as property/method names
  53555. var unaryOperatorsRE = new RegExp('\\b' + (
  53556. 'delete,typeof,void'
  53557. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  53558. // strip strings in expressions
  53559. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  53560. // detect problematic expressions in a template
  53561. function detectErrors (ast, warn) {
  53562. if (ast) {
  53563. checkNode(ast, warn);
  53564. }
  53565. }
  53566. function checkNode (node, warn) {
  53567. if (node.type === 1) {
  53568. for (var name in node.attrsMap) {
  53569. if (dirRE.test(name)) {
  53570. var value = node.attrsMap[name];
  53571. if (value) {
  53572. var range = node.rawAttrsMap[name];
  53573. if (name === 'v-for') {
  53574. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  53575. } else if (name === 'v-slot' || name[0] === '#') {
  53576. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  53577. } else if (onRE.test(name)) {
  53578. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  53579. } else {
  53580. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  53581. }
  53582. }
  53583. }
  53584. }
  53585. if (node.children) {
  53586. for (var i = 0; i < node.children.length; i++) {
  53587. checkNode(node.children[i], warn);
  53588. }
  53589. }
  53590. } else if (node.type === 2) {
  53591. checkExpression(node.expression, node.text, warn, node);
  53592. }
  53593. }
  53594. function checkEvent (exp, text, warn, range) {
  53595. var stripped = exp.replace(stripStringRE, '');
  53596. var keywordMatch = stripped.match(unaryOperatorsRE);
  53597. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  53598. warn(
  53599. "avoid using JavaScript unary operator as property name: " +
  53600. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  53601. range
  53602. );
  53603. }
  53604. checkExpression(exp, text, warn, range);
  53605. }
  53606. function checkFor (node, text, warn, range) {
  53607. checkExpression(node.for || '', text, warn, range);
  53608. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  53609. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  53610. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  53611. }
  53612. function checkIdentifier (
  53613. ident,
  53614. type,
  53615. text,
  53616. warn,
  53617. range
  53618. ) {
  53619. if (typeof ident === 'string') {
  53620. try {
  53621. new Function(("var " + ident + "=_"));
  53622. } catch (e) {
  53623. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  53624. }
  53625. }
  53626. }
  53627. function checkExpression (exp, text, warn, range) {
  53628. try {
  53629. new Function(("return " + exp));
  53630. } catch (e) {
  53631. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  53632. if (keywordMatch) {
  53633. warn(
  53634. "avoid using JavaScript keyword as property name: " +
  53635. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  53636. range
  53637. );
  53638. } else {
  53639. warn(
  53640. "invalid expression: " + (e.message) + " in\n\n" +
  53641. " " + exp + "\n\n" +
  53642. " Raw expression: " + (text.trim()) + "\n",
  53643. range
  53644. );
  53645. }
  53646. }
  53647. }
  53648. function checkFunctionParameterExpression (exp, text, warn, range) {
  53649. try {
  53650. new Function(exp, '');
  53651. } catch (e) {
  53652. warn(
  53653. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  53654. " " + exp + "\n\n" +
  53655. " Raw expression: " + (text.trim()) + "\n",
  53656. range
  53657. );
  53658. }
  53659. }
  53660. /* */
  53661. var range = 2;
  53662. function generateCodeFrame (
  53663. source,
  53664. start,
  53665. end
  53666. ) {
  53667. if ( start === void 0 ) start = 0;
  53668. if ( end === void 0 ) end = source.length;
  53669. var lines = source.split(/\r?\n/);
  53670. var count = 0;
  53671. var res = [];
  53672. for (var i = 0; i < lines.length; i++) {
  53673. count += lines[i].length + 1;
  53674. if (count >= start) {
  53675. for (var j = i - range; j <= i + range || end > count; j++) {
  53676. if (j < 0 || j >= lines.length) { continue }
  53677. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  53678. var lineLength = lines[j].length;
  53679. if (j === i) {
  53680. // push underline
  53681. var pad = start - (count - lineLength) + 1;
  53682. var length = end > count ? lineLength - pad : end - start;
  53683. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  53684. } else if (j > i) {
  53685. if (end > count) {
  53686. var length$1 = Math.min(end - count, lineLength);
  53687. res.push(" | " + repeat$1("^", length$1));
  53688. }
  53689. count += lineLength + 1;
  53690. }
  53691. }
  53692. break
  53693. }
  53694. }
  53695. return res.join('\n')
  53696. }
  53697. function repeat$1 (str, n) {
  53698. var result = '';
  53699. if (n > 0) {
  53700. while (true) { // eslint-disable-line
  53701. if (n & 1) { result += str; }
  53702. n >>>= 1;
  53703. if (n <= 0) { break }
  53704. str += str;
  53705. }
  53706. }
  53707. return result
  53708. }
  53709. /* */
  53710. function createFunction (code, errors) {
  53711. try {
  53712. return new Function(code)
  53713. } catch (err) {
  53714. errors.push({ err: err, code: code });
  53715. return noop
  53716. }
  53717. }
  53718. function createCompileToFunctionFn (compile) {
  53719. var cache = Object.create(null);
  53720. return function compileToFunctions (
  53721. template,
  53722. options,
  53723. vm
  53724. ) {
  53725. options = extend({}, options);
  53726. var warn$$1 = options.warn || warn;
  53727. delete options.warn;
  53728. /* istanbul ignore if */
  53729. {
  53730. // detect possible CSP restriction
  53731. try {
  53732. new Function('return 1');
  53733. } catch (e) {
  53734. if (e.toString().match(/unsafe-eval|CSP/)) {
  53735. warn$$1(
  53736. 'It seems you are using the standalone build of Vue.js in an ' +
  53737. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  53738. 'The template compiler cannot work in this environment. Consider ' +
  53739. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  53740. 'templates into render functions.'
  53741. );
  53742. }
  53743. }
  53744. }
  53745. // check cache
  53746. var key = options.delimiters
  53747. ? String(options.delimiters) + template
  53748. : template;
  53749. if (cache[key]) {
  53750. return cache[key]
  53751. }
  53752. // compile
  53753. var compiled = compile(template, options);
  53754. // check compilation errors/tips
  53755. {
  53756. if (compiled.errors && compiled.errors.length) {
  53757. if (options.outputSourceRange) {
  53758. compiled.errors.forEach(function (e) {
  53759. warn$$1(
  53760. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  53761. generateCodeFrame(template, e.start, e.end),
  53762. vm
  53763. );
  53764. });
  53765. } else {
  53766. warn$$1(
  53767. "Error compiling template:\n\n" + template + "\n\n" +
  53768. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  53769. vm
  53770. );
  53771. }
  53772. }
  53773. if (compiled.tips && compiled.tips.length) {
  53774. if (options.outputSourceRange) {
  53775. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  53776. } else {
  53777. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  53778. }
  53779. }
  53780. }
  53781. // turn code into functions
  53782. var res = {};
  53783. var fnGenErrors = [];
  53784. res.render = createFunction(compiled.render, fnGenErrors);
  53785. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  53786. return createFunction(code, fnGenErrors)
  53787. });
  53788. // check function generation errors.
  53789. // this should only happen if there is a bug in the compiler itself.
  53790. // mostly for codegen development use
  53791. /* istanbul ignore if */
  53792. {
  53793. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  53794. warn$$1(
  53795. "Failed to generate render function:\n\n" +
  53796. fnGenErrors.map(function (ref) {
  53797. var err = ref.err;
  53798. var code = ref.code;
  53799. return ((err.toString()) + " in\n\n" + code + "\n");
  53800. }).join('\n'),
  53801. vm
  53802. );
  53803. }
  53804. }
  53805. return (cache[key] = res)
  53806. }
  53807. }
  53808. /* */
  53809. function createCompilerCreator (baseCompile) {
  53810. return function createCompiler (baseOptions) {
  53811. function compile (
  53812. template,
  53813. options
  53814. ) {
  53815. var finalOptions = Object.create(baseOptions);
  53816. var errors = [];
  53817. var tips = [];
  53818. var warn = function (msg, range, tip) {
  53819. (tip ? tips : errors).push(msg);
  53820. };
  53821. if (options) {
  53822. if (options.outputSourceRange) {
  53823. // $flow-disable-line
  53824. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  53825. warn = function (msg, range, tip) {
  53826. var data = { msg: msg };
  53827. if (range) {
  53828. if (range.start != null) {
  53829. data.start = range.start + leadingSpaceLength;
  53830. }
  53831. if (range.end != null) {
  53832. data.end = range.end + leadingSpaceLength;
  53833. }
  53834. }
  53835. (tip ? tips : errors).push(data);
  53836. };
  53837. }
  53838. // merge custom modules
  53839. if (options.modules) {
  53840. finalOptions.modules =
  53841. (baseOptions.modules || []).concat(options.modules);
  53842. }
  53843. // merge custom directives
  53844. if (options.directives) {
  53845. finalOptions.directives = extend(
  53846. Object.create(baseOptions.directives || null),
  53847. options.directives
  53848. );
  53849. }
  53850. // copy other options
  53851. for (var key in options) {
  53852. if (key !== 'modules' && key !== 'directives') {
  53853. finalOptions[key] = options[key];
  53854. }
  53855. }
  53856. }
  53857. finalOptions.warn = warn;
  53858. var compiled = baseCompile(template.trim(), finalOptions);
  53859. {
  53860. detectErrors(compiled.ast, warn);
  53861. }
  53862. compiled.errors = errors;
  53863. compiled.tips = tips;
  53864. return compiled
  53865. }
  53866. return {
  53867. compile: compile,
  53868. compileToFunctions: createCompileToFunctionFn(compile)
  53869. }
  53870. }
  53871. }
  53872. /* */
  53873. // `createCompilerCreator` allows creating compilers that use alternative
  53874. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  53875. // Here we just export a default compiler using the default parts.
  53876. var createCompiler = createCompilerCreator(function baseCompile (
  53877. template,
  53878. options
  53879. ) {
  53880. var ast = parse(template.trim(), options);
  53881. if (options.optimize !== false) {
  53882. optimize(ast, options);
  53883. }
  53884. var code = generate(ast, options);
  53885. return {
  53886. ast: ast,
  53887. render: code.render,
  53888. staticRenderFns: code.staticRenderFns
  53889. }
  53890. });
  53891. /* */
  53892. var ref$1 = createCompiler(baseOptions);
  53893. var compile = ref$1.compile;
  53894. var compileToFunctions = ref$1.compileToFunctions;
  53895. /* */
  53896. // check whether current browser encodes a char inside attribute values
  53897. var div;
  53898. function getShouldDecode (href) {
  53899. div = div || document.createElement('div');
  53900. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  53901. return div.innerHTML.indexOf('&#10;') > 0
  53902. }
  53903. // #3663: IE encodes newlines inside attribute values while other browsers don't
  53904. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  53905. // #6828: chrome encodes content in a[href]
  53906. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  53907. /* */
  53908. var idToTemplate = cached(function (id) {
  53909. var el = query(id);
  53910. return el && el.innerHTML
  53911. });
  53912. var mount = Vue.prototype.$mount;
  53913. Vue.prototype.$mount = function (
  53914. el,
  53915. hydrating
  53916. ) {
  53917. el = el && query(el);
  53918. /* istanbul ignore if */
  53919. if (el === document.body || el === document.documentElement) {
  53920. warn(
  53921. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  53922. );
  53923. return this
  53924. }
  53925. var options = this.$options;
  53926. // resolve template/el and convert to render function
  53927. if (!options.render) {
  53928. var template = options.template;
  53929. if (template) {
  53930. if (typeof template === 'string') {
  53931. if (template.charAt(0) === '#') {
  53932. template = idToTemplate(template);
  53933. /* istanbul ignore if */
  53934. if (!template) {
  53935. warn(
  53936. ("Template element not found or is empty: " + (options.template)),
  53937. this
  53938. );
  53939. }
  53940. }
  53941. } else if (template.nodeType) {
  53942. template = template.innerHTML;
  53943. } else {
  53944. {
  53945. warn('invalid template option:' + template, this);
  53946. }
  53947. return this
  53948. }
  53949. } else if (el) {
  53950. template = getOuterHTML(el);
  53951. }
  53952. if (template) {
  53953. /* istanbul ignore if */
  53954. if (config.performance && mark) {
  53955. mark('compile');
  53956. }
  53957. var ref = compileToFunctions(template, {
  53958. outputSourceRange: "development" !== 'production',
  53959. shouldDecodeNewlines: shouldDecodeNewlines,
  53960. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  53961. delimiters: options.delimiters,
  53962. comments: options.comments
  53963. }, this);
  53964. var render = ref.render;
  53965. var staticRenderFns = ref.staticRenderFns;
  53966. options.render = render;
  53967. options.staticRenderFns = staticRenderFns;
  53968. /* istanbul ignore if */
  53969. if (config.performance && mark) {
  53970. mark('compile end');
  53971. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  53972. }
  53973. }
  53974. }
  53975. return mount.call(this, el, hydrating)
  53976. };
  53977. /**
  53978. * Get outerHTML of elements, taking care
  53979. * of SVG elements in IE as well.
  53980. */
  53981. function getOuterHTML (el) {
  53982. if (el.outerHTML) {
  53983. return el.outerHTML
  53984. } else {
  53985. var container = document.createElement('div');
  53986. container.appendChild(el.cloneNode(true));
  53987. return container.innerHTML
  53988. }
  53989. }
  53990. Vue.compile = compileToFunctions;
  53991. module.exports = Vue;
  53992. /* 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))
  53993. /***/ }),
  53994. /***/ "./node_modules/vue/dist/vue.common.js":
  53995. /*!*********************************************!*\
  53996. !*** ./node_modules/vue/dist/vue.common.js ***!
  53997. \*********************************************/
  53998. /*! no static exports found */
  53999. /***/ (function(module, exports, __webpack_require__) {
  54000. if (false) {} else {
  54001. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54002. }
  54003. /***/ }),
  54004. /***/ "./node_modules/webpack/buildin/global.js":
  54005. /*!***********************************!*\
  54006. !*** (webpack)/buildin/global.js ***!
  54007. \***********************************/
  54008. /*! no static exports found */
  54009. /***/ (function(module, exports) {
  54010. var g;
  54011. // This works in non-strict mode
  54012. g = (function() {
  54013. return this;
  54014. })();
  54015. try {
  54016. // This works if eval is allowed (see CSP)
  54017. g = g || new Function("return this")();
  54018. } catch (e) {
  54019. // This works if the window reference is available
  54020. if (typeof window === "object") g = window;
  54021. }
  54022. // g can still be undefined, but nothing to do about it...
  54023. // We return undefined, instead of nothing here, so it's
  54024. // easier to handle this case. if(!global) { ...}
  54025. module.exports = g;
  54026. /***/ }),
  54027. /***/ "./node_modules/webpack/buildin/module.js":
  54028. /*!***********************************!*\
  54029. !*** (webpack)/buildin/module.js ***!
  54030. \***********************************/
  54031. /*! no static exports found */
  54032. /***/ (function(module, exports) {
  54033. module.exports = function(module) {
  54034. if (!module.webpackPolyfill) {
  54035. module.deprecate = function() {};
  54036. module.paths = [];
  54037. // module.parent = undefined by default
  54038. if (!module.children) module.children = [];
  54039. Object.defineProperty(module, "loaded", {
  54040. enumerable: true,
  54041. get: function() {
  54042. return module.l;
  54043. }
  54044. });
  54045. Object.defineProperty(module, "id", {
  54046. enumerable: true,
  54047. get: function() {
  54048. return module.i;
  54049. }
  54050. });
  54051. module.webpackPolyfill = 1;
  54052. }
  54053. return module;
  54054. };
  54055. /***/ }),
  54056. /***/ "./resources/js/app.js":
  54057. /*!*****************************!*\
  54058. !*** ./resources/js/app.js ***!
  54059. \*****************************/
  54060. /*! no static exports found */
  54061. /***/ (function(module, exports, __webpack_require__) {
  54062. /**
  54063. * First we will load all of this project's JavaScript dependencies which
  54064. * includes Vue and other libraries. It is a great starting point when
  54065. * building robust, powerful web applications using Vue and Laravel.
  54066. */
  54067. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54068. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54069. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54070. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54071. /**
  54072. * The following block of code may be used to automatically register your
  54073. * Vue components. It will recursively scan this directory for the Vue
  54074. * components and automatically register them with their "basename".
  54075. *
  54076. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54077. */
  54078. // const files = require.context('./', true, /\.vue$/i)
  54079. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54080. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54081. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54082. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54083. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54084. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54085. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54086. /**
  54087. * Next, we will create a fresh Vue application instance and attach it to
  54088. * the page. Then, you may begin adding components to this application
  54089. * or customize the JavaScript scaffolding to fit your unique needs.
  54090. */
  54091. var app = new Vue({
  54092. el: '#app'
  54093. });
  54094. $(function () {
  54095. $('[data-toggle="tooltip"]').tooltip();
  54096. });
  54097. var clipboard = new Clipboard('.btn-clip');
  54098. clipboard.on('success', function (e) {
  54099. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54100. position: "right",
  54101. className: 'success'
  54102. });
  54103. e.clearSelection();
  54104. });
  54105. /***/ }),
  54106. /***/ "./resources/js/bootstrap.js":
  54107. /*!***********************************!*\
  54108. !*** ./resources/js/bootstrap.js ***!
  54109. \***********************************/
  54110. /*! no exports provided */
  54111. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54112. "use strict";
  54113. __webpack_require__.r(__webpack_exports__);
  54114. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54115. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54116. /**
  54117. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54118. * for JavaScript based Bootstrap features such as modals and tabs. This
  54119. * code may be modified to fit the specific needs of your application.
  54120. */
  54121. try {
  54122. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54123. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54124. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54125. } catch (e) {}
  54126. /**
  54127. * We'll load the axios HTTP library which allows us to easily issue requests
  54128. * to our Laravel back-end. This library automatically handles sending the
  54129. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54130. */
  54131. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54132. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54133. /**
  54134. * Echo exposes an expressive API for subscribing to channels and listening
  54135. * for events that are broadcast by Laravel. Echo and event broadcasting
  54136. * allows your team to easily build robust real-time web applications.
  54137. */
  54138. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54139. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54140. broadcaster: 'pusher',
  54141. key: "upccrt",
  54142. wsHost: window.location.hostname,
  54143. wsPort: 6001,
  54144. disableStats: true
  54145. });
  54146. /***/ }),
  54147. /***/ "./resources/js/components/ExampleComponent.vue":
  54148. /*!******************************************************!*\
  54149. !*** ./resources/js/components/ExampleComponent.vue ***!
  54150. \******************************************************/
  54151. /*! exports provided: default */
  54152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54153. "use strict";
  54154. __webpack_require__.r(__webpack_exports__);
  54155. /* 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&");
  54156. /* 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&");
  54157. /* 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");
  54158. /* normalize component */
  54159. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54160. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54161. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54162. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54163. false,
  54164. null,
  54165. null,
  54166. null
  54167. )
  54168. /* hot reload */
  54169. if (false) { var api; }
  54170. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54171. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54172. /***/ }),
  54173. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54174. /*!*******************************************************************************!*\
  54175. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  54176. \*******************************************************************************/
  54177. /*! exports provided: default */
  54178. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54179. "use strict";
  54180. __webpack_require__.r(__webpack_exports__);
  54181. /* 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&");
  54182. /* 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"]);
  54183. /***/ }),
  54184. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  54185. /*!*************************************************************************************!*\
  54186. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  54187. \*************************************************************************************/
  54188. /*! exports provided: render, staticRenderFns */
  54189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54190. "use strict";
  54191. __webpack_require__.r(__webpack_exports__);
  54192. /* 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&");
  54193. /* 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"]; });
  54194. /* 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"]; });
  54195. /***/ }),
  54196. /***/ "./resources/js/components/assetinfo.vue":
  54197. /*!***********************************************!*\
  54198. !*** ./resources/js/components/assetinfo.vue ***!
  54199. \***********************************************/
  54200. /*! exports provided: default */
  54201. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54202. "use strict";
  54203. __webpack_require__.r(__webpack_exports__);
  54204. /* 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&");
  54205. /* 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&");
  54206. /* 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");
  54207. /* normalize component */
  54208. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54209. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54210. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  54211. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54212. false,
  54213. null,
  54214. null,
  54215. null
  54216. )
  54217. /* hot reload */
  54218. if (false) { var api; }
  54219. component.options.__file = "resources/js/components/assetinfo.vue"
  54220. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54221. /***/ }),
  54222. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  54223. /*!************************************************************************!*\
  54224. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  54225. \************************************************************************/
  54226. /*! exports provided: default */
  54227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54228. "use strict";
  54229. __webpack_require__.r(__webpack_exports__);
  54230. /* 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&");
  54231. /* 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"]);
  54232. /***/ }),
  54233. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  54234. /*!******************************************************************************!*\
  54235. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  54236. \******************************************************************************/
  54237. /*! exports provided: render, staticRenderFns */
  54238. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54239. "use strict";
  54240. __webpack_require__.r(__webpack_exports__);
  54241. /* 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&");
  54242. /* 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"]; });
  54243. /* 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"]; });
  54244. /***/ }),
  54245. /***/ "./resources/js/components/credential.vue":
  54246. /*!************************************************!*\
  54247. !*** ./resources/js/components/credential.vue ***!
  54248. \************************************************/
  54249. /*! exports provided: default */
  54250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54251. "use strict";
  54252. __webpack_require__.r(__webpack_exports__);
  54253. /* 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&");
  54254. /* 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&");
  54255. /* 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");
  54256. /* normalize component */
  54257. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54258. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54259. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  54260. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54261. false,
  54262. null,
  54263. null,
  54264. null
  54265. )
  54266. /* hot reload */
  54267. if (false) { var api; }
  54268. component.options.__file = "resources/js/components/credential.vue"
  54269. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54270. /***/ }),
  54271. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  54272. /*!*************************************************************************!*\
  54273. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  54274. \*************************************************************************/
  54275. /*! exports provided: default */
  54276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54277. "use strict";
  54278. __webpack_require__.r(__webpack_exports__);
  54279. /* 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&");
  54280. /* 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"]);
  54281. /***/ }),
  54282. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  54283. /*!*******************************************************************************!*\
  54284. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  54285. \*******************************************************************************/
  54286. /*! exports provided: render, staticRenderFns */
  54287. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54288. "use strict";
  54289. __webpack_require__.r(__webpack_exports__);
  54290. /* 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&");
  54291. /* 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"]; });
  54292. /* 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"]; });
  54293. /***/ }),
  54294. /***/ "./resources/js/components/modal.vue":
  54295. /*!*******************************************!*\
  54296. !*** ./resources/js/components/modal.vue ***!
  54297. \*******************************************/
  54298. /*! exports provided: default */
  54299. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54300. "use strict";
  54301. __webpack_require__.r(__webpack_exports__);
  54302. /* harmony import */ var _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal.vue?vue&type=template&id=478d961c& */ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  54303. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54304. var script = {}
  54305. /* normalize component */
  54306. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  54307. script,
  54308. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  54309. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54310. false,
  54311. null,
  54312. null,
  54313. null
  54314. )
  54315. /* hot reload */
  54316. if (false) { var api; }
  54317. component.options.__file = "resources/js/components/modal.vue"
  54318. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54319. /***/ }),
  54320. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  54321. /*!**************************************************************************!*\
  54322. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  54323. \**************************************************************************/
  54324. /*! exports provided: render, staticRenderFns */
  54325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54326. "use strict";
  54327. __webpack_require__.r(__webpack_exports__);
  54328. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___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!./modal.vue?vue&type=template&id=478d961c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  54329. /* 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_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54330. /* 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_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54331. /***/ }),
  54332. /***/ "./resources/js/components/notes.vue":
  54333. /*!*******************************************!*\
  54334. !*** ./resources/js/components/notes.vue ***!
  54335. \*******************************************/
  54336. /*! exports provided: default */
  54337. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54338. "use strict";
  54339. __webpack_require__.r(__webpack_exports__);
  54340. /* harmony import */ var _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notes.vue?vue&type=template&id=73d141f4& */ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  54341. /* harmony import */ var _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./notes.vue?vue&type=script&lang=js& */ "./resources/js/components/notes.vue?vue&type=script&lang=js&");
  54342. /* 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");
  54343. /* normalize component */
  54344. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54345. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54346. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  54347. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54348. false,
  54349. null,
  54350. null,
  54351. null
  54352. )
  54353. /* hot reload */
  54354. if (false) { var api; }
  54355. component.options.__file = "resources/js/components/notes.vue"
  54356. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54357. /***/ }),
  54358. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  54359. /*!********************************************************************!*\
  54360. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  54361. \********************************************************************/
  54362. /*! exports provided: default */
  54363. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54364. "use strict";
  54365. __webpack_require__.r(__webpack_exports__);
  54366. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_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!./notes.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&");
  54367. /* 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_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54368. /***/ }),
  54369. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  54370. /*!**************************************************************************!*\
  54371. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  54372. \**************************************************************************/
  54373. /*! exports provided: render, staticRenderFns */
  54374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54375. "use strict";
  54376. __webpack_require__.r(__webpack_exports__);
  54377. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___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!./notes.vue?vue&type=template&id=73d141f4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  54378. /* 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_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54379. /* 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_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54380. /***/ }),
  54381. /***/ "./resources/js/components/woinfo.vue":
  54382. /*!********************************************!*\
  54383. !*** ./resources/js/components/woinfo.vue ***!
  54384. \********************************************/
  54385. /*! exports provided: default */
  54386. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54387. "use strict";
  54388. __webpack_require__.r(__webpack_exports__);
  54389. /* 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&");
  54390. /* 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&");
  54391. /* 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");
  54392. /* normalize component */
  54393. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54394. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54395. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  54396. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54397. false,
  54398. null,
  54399. null,
  54400. null
  54401. )
  54402. /* hot reload */
  54403. if (false) { var api; }
  54404. component.options.__file = "resources/js/components/woinfo.vue"
  54405. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54406. /***/ }),
  54407. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  54408. /*!*********************************************************************!*\
  54409. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  54410. \*********************************************************************/
  54411. /*! exports provided: default */
  54412. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54413. "use strict";
  54414. __webpack_require__.r(__webpack_exports__);
  54415. /* 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&");
  54416. /* 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"]);
  54417. /***/ }),
  54418. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  54419. /*!***************************************************************************!*\
  54420. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  54421. \***************************************************************************/
  54422. /*! exports provided: render, staticRenderFns */
  54423. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54424. "use strict";
  54425. __webpack_require__.r(__webpack_exports__);
  54426. /* 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&");
  54427. /* 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"]; });
  54428. /* 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"]; });
  54429. /***/ }),
  54430. /***/ "./resources/js/mixins/dateMixin.js":
  54431. /*!******************************************!*\
  54432. !*** ./resources/js/mixins/dateMixin.js ***!
  54433. \******************************************/
  54434. /*! exports provided: default */
  54435. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54436. "use strict";
  54437. __webpack_require__.r(__webpack_exports__);
  54438. /* harmony default export */ __webpack_exports__["default"] = ({
  54439. methods: {
  54440. treatAsUTC: function treatAsUTC(date) {
  54441. var result = new Date(date);
  54442. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  54443. return result;
  54444. },
  54445. daysSinceToday: function daysSinceToday(date) {
  54446. var currentDate = new Date();
  54447. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  54448. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  54449. },
  54450. getHRDate: function getHRDate(dateString) {
  54451. var date = new Date(dateString);
  54452. return date.toLocaleString('default', {
  54453. month: 'short',
  54454. day: 'numeric',
  54455. year: 'numeric',
  54456. hour: 'numeric',
  54457. minute: 'numeric'
  54458. });
  54459. },
  54460. isZero: function isZero(dateString) {
  54461. return dateString === '0000-00-00 00:00:00';
  54462. }
  54463. }
  54464. });
  54465. /***/ }),
  54466. /***/ "./resources/js/notify.min.js":
  54467. /*!************************************!*\
  54468. !*** ./resources/js/notify.min.js ***!
  54469. \************************************/
  54470. /*! no static exports found */
  54471. /***/ (function(module, exports, __webpack_require__) {
  54472. 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); }
  54473. (function (e) {
  54474. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  54475. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  54476. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  54477. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  54478. })(function (e) {
  54479. function A(t, n, i) {
  54480. typeof i == "string" && (i = {
  54481. className: i
  54482. }), 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);
  54483. }
  54484. var t = [].indexOf || function (e) {
  54485. for (var t = 0, n = this.length; t < n; t++) {
  54486. if (t in this && this[t] === e) return t;
  54487. }
  54488. return -1;
  54489. },
  54490. n = "notify",
  54491. r = n + "js",
  54492. i = n + "!blank",
  54493. s = {
  54494. t: "top",
  54495. m: "middle",
  54496. b: "bottom",
  54497. l: "left",
  54498. c: "center",
  54499. r: "right"
  54500. },
  54501. o = ["l", "c", "r"],
  54502. u = ["t", "m", "b"],
  54503. a = ["t", "b", "l", "r"],
  54504. f = {
  54505. t: "b",
  54506. m: null,
  54507. b: "t",
  54508. l: "r",
  54509. c: null,
  54510. r: "l"
  54511. },
  54512. l = function l(t) {
  54513. var n;
  54514. return n = [], e.each(t.split(/\W+/), function (e, t) {
  54515. var r;
  54516. r = t.toLowerCase().charAt(0);
  54517. if (s[r]) return n.push(r);
  54518. }), n;
  54519. },
  54520. c = {},
  54521. h = {
  54522. name: "core",
  54523. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  54524. 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}"
  54525. },
  54526. p = {
  54527. "border-radius": ["-webkit-", "-moz-"]
  54528. },
  54529. d = function d(e) {
  54530. return c[e];
  54531. },
  54532. v = function v(e) {
  54533. if (!e) throw "Missing Style name";
  54534. c[e] && delete c[e];
  54535. },
  54536. m = function m(t, i) {
  54537. if (!t) throw "Missing Style name";
  54538. if (!i) throw "Missing Style definition";
  54539. if (!i.html) throw "Missing Style HTML";
  54540. var s = c[t];
  54541. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  54542. var o = "";
  54543. i.classes && e.each(i.classes, function (t, n) {
  54544. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  54545. return p[t] && e.each(p[t], function (e, r) {
  54546. return o += " " + r + t + ": " + n + ";\n";
  54547. }), o += " " + t + ": " + n + ";\n";
  54548. }), o += "}\n";
  54549. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  54550. var u = {},
  54551. a = e(i.html);
  54552. y("html", a, u), y("text", a, u), i.fields = u;
  54553. },
  54554. g = function g(t) {
  54555. var n, r, i;
  54556. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  54557. try {
  54558. r.html(t);
  54559. } catch (s) {
  54560. r[0].styleSheet.cssText = t;
  54561. }
  54562. return r;
  54563. },
  54564. y = function y(t, n, r) {
  54565. var s;
  54566. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  54567. var n;
  54568. n = e(this).attr(s), n || (n = i), r[n] = t;
  54569. });
  54570. },
  54571. b = function b(e, t) {
  54572. return e.is(t) ? e : e.find(t);
  54573. },
  54574. w = {
  54575. clickToHide: !0,
  54576. autoHide: !0,
  54577. autoHideDelay: 5e3,
  54578. arrowShow: !0,
  54579. arrowSize: 5,
  54580. breakNewLines: !0,
  54581. elementPosition: "bottom",
  54582. globalPosition: "top right",
  54583. style: "bootstrap",
  54584. className: "error",
  54585. showAnimation: "slideDown",
  54586. showDuration: 400,
  54587. hideAnimation: "slideUp",
  54588. hideDuration: 200,
  54589. gap: 5
  54590. },
  54591. E = function E(t, n) {
  54592. var r;
  54593. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  54594. },
  54595. S = function S(t) {
  54596. return e.extend(w, t);
  54597. },
  54598. x = function x(t) {
  54599. return e("<" + t + "></" + t + ">");
  54600. },
  54601. T = {},
  54602. N = function N(t) {
  54603. var n;
  54604. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  54605. return e(r).attr("name") === t.attr("name");
  54606. }), t = n.first()), t;
  54607. },
  54608. C = function C(e, t, n) {
  54609. var r, i;
  54610. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  54611. if (isNaN(n)) return;
  54612. 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;
  54613. },
  54614. k = function k(e, t, n) {
  54615. if (e === "l" || e === "t") return 0;
  54616. if (e === "c" || e === "m") return n / 2 - t / 2;
  54617. if (e === "r" || e === "b") return n - t;
  54618. throw "Invalid alignment";
  54619. },
  54620. L = function L(e) {
  54621. return L.e = L.e || x("div"), L.e.text(e).html();
  54622. };
  54623. A.prototype.loadHTML = function () {
  54624. var t;
  54625. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  54626. }, A.prototype.show = function (e, t) {
  54627. var n, r, i, s, o;
  54628. r = function (n) {
  54629. return function () {
  54630. !e && !n.elem && n.destroy();
  54631. if (t) return t();
  54632. };
  54633. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  54634. 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 {
  54635. if (!!o || !!e) return r();
  54636. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  54637. }
  54638. return n.push(r), i[s].apply(i, n);
  54639. }, A.prototype.setGlobalPosition = function () {
  54640. var t = this.getPosition(),
  54641. n = t[0],
  54642. i = t[1],
  54643. o = s[n],
  54644. u = s[i],
  54645. a = n + "|" + i,
  54646. f = T[a];
  54647. if (!f || !document.body.contains(f[0])) {
  54648. f = T[a] = x("div");
  54649. var l = {};
  54650. 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);
  54651. }
  54652. return f.prepend(this.wrapper);
  54653. }, A.prototype.setElementPosition = function () {
  54654. 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;
  54655. 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"];
  54656. for (w = 0, S = B.length; w < S; w++) {
  54657. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  54658. }
  54659. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  54660. if (!this.options.arrowShow) this.arrow.hide();else {
  54661. 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";
  54662. for (E = 0, x = a.length; E < x; E++) {
  54663. D = a[E], P = s[D];
  54664. if (D === L) continue;
  54665. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  54666. }
  54667. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  54668. }
  54669. 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);
  54670. if (r) return this.arrow.removeAttr("style").css(r);
  54671. }, A.prototype.getPosition = function () {
  54672. var e, n, r, i, s, f, c, h;
  54673. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  54674. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  54675. 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";
  54676. return e.length === 2 && (e[2] = e[1]), e;
  54677. }, A.prototype.getStyle = function (e) {
  54678. var t;
  54679. e || (e = this.options.style), e || (e = "default"), t = c[e];
  54680. if (!t) throw "Missing style: " + e;
  54681. return t;
  54682. }, A.prototype.updateClasses = function () {
  54683. var t, n;
  54684. 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) {
  54685. return r + "-" + n.name + "-" + e;
  54686. }).join(" "), this.userContainer.attr("class", t);
  54687. }, A.prototype.run = function (t, n) {
  54688. var r, s, o, u, a;
  54689. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  54690. if (this.container && !t) {
  54691. this.show(!1);
  54692. return;
  54693. }
  54694. if (!this.container && !t) return;
  54695. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  54696. for (o in s) {
  54697. r = s[o], u = this.userFields[o];
  54698. if (!u) continue;
  54699. 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);
  54700. }
  54701. 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));
  54702. }, A.prototype.destroy = function () {
  54703. this.wrapper.data(r, null), this.wrapper.remove();
  54704. }, e[n] = function (t, r, i) {
  54705. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  54706. }, e.fn[n] = function (t, n) {
  54707. return e(this).each(function () {
  54708. var i = N(e(this)).data(r);
  54709. i && i.destroy();
  54710. var s = new A(e(this), t, n);
  54711. }), this;
  54712. }, e.extend(e[n], {
  54713. defaults: S,
  54714. addStyle: m,
  54715. removeStyle: v,
  54716. pluginOptions: w,
  54717. getStyle: d,
  54718. insertCSS: g
  54719. }), m("bootstrap", {
  54720. html: "<div>\n<span data-notify-text></span>\n</div>",
  54721. classes: {
  54722. base: {
  54723. "font-weight": "bold",
  54724. padding: "8px 15px 8px 14px",
  54725. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  54726. "background-color": "#fcf8e3",
  54727. border: "1px solid #fbeed5",
  54728. "border-radius": "4px",
  54729. "white-space": "nowrap",
  54730. "padding-left": "25px",
  54731. "background-repeat": "no-repeat",
  54732. "background-position": "3px 7px"
  54733. },
  54734. error: {
  54735. color: "#B94A48",
  54736. "background-color": "#F2DEDE",
  54737. "border-color": "#EED3D7",
  54738. "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=)"
  54739. },
  54740. success: {
  54741. color: "#468847",
  54742. "background-color": "#DFF0D8",
  54743. "border-color": "#D6E9C6",
  54744. "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==)"
  54745. },
  54746. info: {
  54747. color: "#3A87AD",
  54748. "background-color": "#D9EDF7",
  54749. "border-color": "#BCE8F1",
  54750. "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=)"
  54751. },
  54752. warn: {
  54753. color: "#C09853",
  54754. "background-color": "#FCF8E3",
  54755. "border-color": "#FBEED5",
  54756. "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)"
  54757. }
  54758. }
  54759. }), e(function () {
  54760. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  54761. e(this).trigger("notify-hide");
  54762. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  54763. var n = e(this).data(r);
  54764. n && n.show(!1);
  54765. });
  54766. });
  54767. });
  54768. /***/ }),
  54769. /***/ "./resources/sass/app.scss":
  54770. /*!*********************************!*\
  54771. !*** ./resources/sass/app.scss ***!
  54772. \*********************************/
  54773. /*! no static exports found */
  54774. /***/ (function(module, exports) {
  54775. // removed by extract-text-webpack-plugin
  54776. /***/ }),
  54777. /***/ 0:
  54778. /*!*************************************************************!*\
  54779. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  54780. \*************************************************************/
  54781. /*! no static exports found */
  54782. /***/ (function(module, exports, __webpack_require__) {
  54783. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  54784. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  54785. /***/ })
  54786. /******/ });