app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435
  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. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/asset/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1692. /*!*********************************************************************************************************************************************************************!*\
  1693. !*** ./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& ***!
  1694. \*********************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. /* harmony default export */ __webpack_exports__["default"] = ({
  1730. props: ['credential'],
  1731. data: function data() {
  1732. return {
  1733. data: JSON.parse(this.credential)
  1734. };
  1735. },
  1736. mounted: function mounted() {
  1737. var _this = this;
  1738. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1739. _this.data = JSON.parse(e.data);
  1740. });
  1741. }
  1742. });
  1743. /***/ }),
  1744. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1745. /*!****************************************************************************************************************************************************************!*\
  1746. !*** ./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& ***!
  1747. \****************************************************************************************************************************************************************/
  1748. /*! exports provided: default */
  1749. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1750. "use strict";
  1751. __webpack_require__.r(__webpack_exports__);
  1752. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1778. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1779. props: ['initialnotes', 'authusername'],
  1780. data: function data() {
  1781. return {
  1782. notes: this.initialnotes
  1783. };
  1784. }
  1785. });
  1786. /***/ }),
  1787. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1788. /*!*****************************************************************************************************************************************************************!*\
  1789. !*** ./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& ***!
  1790. \*****************************************************************************************************************************************************************/
  1791. /*! exports provided: default */
  1792. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1793. "use strict";
  1794. __webpack_require__.r(__webpack_exports__);
  1795. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1796. //
  1797. //
  1798. //
  1799. //
  1800. //
  1801. //
  1802. //
  1803. //
  1804. //
  1805. //
  1806. //
  1807. //
  1808. //
  1809. //
  1810. //
  1811. //
  1812. //
  1813. //
  1814. //
  1815. //
  1816. //
  1817. //
  1818. //
  1819. //
  1820. //
  1821. //
  1822. //
  1823. //
  1824. //
  1825. //
  1826. //
  1827. //
  1828. //
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. /* harmony default export */ __webpack_exports__["default"] = ({
  1844. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1845. props: ['workOrder'],
  1846. data: function data() {
  1847. return {
  1848. data: JSON.parse(this.workOrder),
  1849. storeName: null,
  1850. storeList: null
  1851. };
  1852. },
  1853. mounted: function mounted() {
  1854. var _this = this;
  1855. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1856. _this.data = JSON.parse(e.data);
  1857. _this.storeName = _this.getStoreName();
  1858. });
  1859. axios.get('/api/stores').then(function (response) {
  1860. _this.storeList = response.data;
  1861. })["catch"](function (error) {
  1862. console.error(error);
  1863. });
  1864. this.storeList = this.getStoreName();
  1865. },
  1866. methods: {
  1867. updateWorkOrder: function updateWorkOrder() {
  1868. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {})["catch"](function (error) {});
  1869. $('#workordereditModal').modal('hide');
  1870. },
  1871. getStoreName: function getStoreName() {
  1872. var _this2 = this;
  1873. axios.get('/api/stores/' + this.data.storeid).then(function (response) {
  1874. _this2.storeName = response.data.storesname;
  1875. })["catch"](function (error) {
  1876. console.error(error);
  1877. });
  1878. }
  1879. }
  1880. });
  1881. /***/ }),
  1882. /***/ "./node_modules/base64-js/index.js":
  1883. /*!*****************************************!*\
  1884. !*** ./node_modules/base64-js/index.js ***!
  1885. \*****************************************/
  1886. /*! no static exports found */
  1887. /***/ (function(module, exports, __webpack_require__) {
  1888. "use strict";
  1889. exports.byteLength = byteLength
  1890. exports.toByteArray = toByteArray
  1891. exports.fromByteArray = fromByteArray
  1892. var lookup = []
  1893. var revLookup = []
  1894. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1895. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1896. for (var i = 0, len = code.length; i < len; ++i) {
  1897. lookup[i] = code[i]
  1898. revLookup[code.charCodeAt(i)] = i
  1899. }
  1900. // Support decoding URL-safe base64 strings, as Node.js does.
  1901. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1902. revLookup['-'.charCodeAt(0)] = 62
  1903. revLookup['_'.charCodeAt(0)] = 63
  1904. function getLens (b64) {
  1905. var len = b64.length
  1906. if (len % 4 > 0) {
  1907. throw new Error('Invalid string. Length must be a multiple of 4')
  1908. }
  1909. // Trim off extra bytes after placeholder bytes are found
  1910. // See: https://github.com/beatgammit/base64-js/issues/42
  1911. var validLen = b64.indexOf('=')
  1912. if (validLen === -1) validLen = len
  1913. var placeHoldersLen = validLen === len
  1914. ? 0
  1915. : 4 - (validLen % 4)
  1916. return [validLen, placeHoldersLen]
  1917. }
  1918. // base64 is 4/3 + up to two characters of the original data
  1919. function byteLength (b64) {
  1920. var lens = getLens(b64)
  1921. var validLen = lens[0]
  1922. var placeHoldersLen = lens[1]
  1923. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1924. }
  1925. function _byteLength (b64, validLen, placeHoldersLen) {
  1926. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1927. }
  1928. function toByteArray (b64) {
  1929. var tmp
  1930. var lens = getLens(b64)
  1931. var validLen = lens[0]
  1932. var placeHoldersLen = lens[1]
  1933. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1934. var curByte = 0
  1935. // if there are placeholders, only get up to the last complete 4 chars
  1936. var len = placeHoldersLen > 0
  1937. ? validLen - 4
  1938. : validLen
  1939. var i
  1940. for (i = 0; i < len; i += 4) {
  1941. tmp =
  1942. (revLookup[b64.charCodeAt(i)] << 18) |
  1943. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1944. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1945. revLookup[b64.charCodeAt(i + 3)]
  1946. arr[curByte++] = (tmp >> 16) & 0xFF
  1947. arr[curByte++] = (tmp >> 8) & 0xFF
  1948. arr[curByte++] = tmp & 0xFF
  1949. }
  1950. if (placeHoldersLen === 2) {
  1951. tmp =
  1952. (revLookup[b64.charCodeAt(i)] << 2) |
  1953. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1954. arr[curByte++] = tmp & 0xFF
  1955. }
  1956. if (placeHoldersLen === 1) {
  1957. tmp =
  1958. (revLookup[b64.charCodeAt(i)] << 10) |
  1959. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1960. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1961. arr[curByte++] = (tmp >> 8) & 0xFF
  1962. arr[curByte++] = tmp & 0xFF
  1963. }
  1964. return arr
  1965. }
  1966. function tripletToBase64 (num) {
  1967. return lookup[num >> 18 & 0x3F] +
  1968. lookup[num >> 12 & 0x3F] +
  1969. lookup[num >> 6 & 0x3F] +
  1970. lookup[num & 0x3F]
  1971. }
  1972. function encodeChunk (uint8, start, end) {
  1973. var tmp
  1974. var output = []
  1975. for (var i = start; i < end; i += 3) {
  1976. tmp =
  1977. ((uint8[i] << 16) & 0xFF0000) +
  1978. ((uint8[i + 1] << 8) & 0xFF00) +
  1979. (uint8[i + 2] & 0xFF)
  1980. output.push(tripletToBase64(tmp))
  1981. }
  1982. return output.join('')
  1983. }
  1984. function fromByteArray (uint8) {
  1985. var tmp
  1986. var len = uint8.length
  1987. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1988. var parts = []
  1989. var maxChunkLength = 16383 // must be multiple of 3
  1990. // go through the array every three bytes, we'll deal with trailing stuff later
  1991. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1992. parts.push(encodeChunk(
  1993. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1994. ))
  1995. }
  1996. // pad the end with zeros, but make sure to not forget the extra bytes
  1997. if (extraBytes === 1) {
  1998. tmp = uint8[len - 1]
  1999. parts.push(
  2000. lookup[tmp >> 2] +
  2001. lookup[(tmp << 4) & 0x3F] +
  2002. '=='
  2003. )
  2004. } else if (extraBytes === 2) {
  2005. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2006. parts.push(
  2007. lookup[tmp >> 10] +
  2008. lookup[(tmp >> 4) & 0x3F] +
  2009. lookup[(tmp << 2) & 0x3F] +
  2010. '='
  2011. )
  2012. }
  2013. return parts.join('')
  2014. }
  2015. /***/ }),
  2016. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2017. /*!*****************************************************!*\
  2018. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2019. \*****************************************************/
  2020. /*! no static exports found */
  2021. /***/ (function(module, exports, __webpack_require__) {
  2022. /*!
  2023. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2024. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2025. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2026. */
  2027. (function (global, factory) {
  2028. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2029. undefined;
  2030. }(this, (function (exports, $, Popper) { 'use strict';
  2031. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2032. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2033. function _defineProperties(target, props) {
  2034. for (var i = 0; i < props.length; i++) {
  2035. var descriptor = props[i];
  2036. descriptor.enumerable = descriptor.enumerable || false;
  2037. descriptor.configurable = true;
  2038. if ("value" in descriptor) descriptor.writable = true;
  2039. Object.defineProperty(target, descriptor.key, descriptor);
  2040. }
  2041. }
  2042. function _createClass(Constructor, protoProps, staticProps) {
  2043. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2044. if (staticProps) _defineProperties(Constructor, staticProps);
  2045. return Constructor;
  2046. }
  2047. function _defineProperty(obj, key, value) {
  2048. if (key in obj) {
  2049. Object.defineProperty(obj, key, {
  2050. value: value,
  2051. enumerable: true,
  2052. configurable: true,
  2053. writable: true
  2054. });
  2055. } else {
  2056. obj[key] = value;
  2057. }
  2058. return obj;
  2059. }
  2060. function ownKeys(object, enumerableOnly) {
  2061. var keys = Object.keys(object);
  2062. if (Object.getOwnPropertySymbols) {
  2063. var symbols = Object.getOwnPropertySymbols(object);
  2064. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2065. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2066. });
  2067. keys.push.apply(keys, symbols);
  2068. }
  2069. return keys;
  2070. }
  2071. function _objectSpread2(target) {
  2072. for (var i = 1; i < arguments.length; i++) {
  2073. var source = arguments[i] != null ? arguments[i] : {};
  2074. if (i % 2) {
  2075. ownKeys(Object(source), true).forEach(function (key) {
  2076. _defineProperty(target, key, source[key]);
  2077. });
  2078. } else if (Object.getOwnPropertyDescriptors) {
  2079. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2080. } else {
  2081. ownKeys(Object(source)).forEach(function (key) {
  2082. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2083. });
  2084. }
  2085. }
  2086. return target;
  2087. }
  2088. function _inheritsLoose(subClass, superClass) {
  2089. subClass.prototype = Object.create(superClass.prototype);
  2090. subClass.prototype.constructor = subClass;
  2091. subClass.__proto__ = superClass;
  2092. }
  2093. /**
  2094. * --------------------------------------------------------------------------
  2095. * Bootstrap (v4.4.1): util.js
  2096. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2097. * --------------------------------------------------------------------------
  2098. */
  2099. /**
  2100. * ------------------------------------------------------------------------
  2101. * Private TransitionEnd Helpers
  2102. * ------------------------------------------------------------------------
  2103. */
  2104. var TRANSITION_END = 'transitionend';
  2105. var MAX_UID = 1000000;
  2106. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2107. function toType(obj) {
  2108. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2109. }
  2110. function getSpecialTransitionEndEvent() {
  2111. return {
  2112. bindType: TRANSITION_END,
  2113. delegateType: TRANSITION_END,
  2114. handle: function handle(event) {
  2115. if ($(event.target).is(this)) {
  2116. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2117. }
  2118. return undefined; // eslint-disable-line no-undefined
  2119. }
  2120. };
  2121. }
  2122. function transitionEndEmulator(duration) {
  2123. var _this = this;
  2124. var called = false;
  2125. $(this).one(Util.TRANSITION_END, function () {
  2126. called = true;
  2127. });
  2128. setTimeout(function () {
  2129. if (!called) {
  2130. Util.triggerTransitionEnd(_this);
  2131. }
  2132. }, duration);
  2133. return this;
  2134. }
  2135. function setTransitionEndSupport() {
  2136. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2137. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2138. }
  2139. /**
  2140. * --------------------------------------------------------------------------
  2141. * Public Util Api
  2142. * --------------------------------------------------------------------------
  2143. */
  2144. var Util = {
  2145. TRANSITION_END: 'bsTransitionEnd',
  2146. getUID: function getUID(prefix) {
  2147. do {
  2148. // eslint-disable-next-line no-bitwise
  2149. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2150. } while (document.getElementById(prefix));
  2151. return prefix;
  2152. },
  2153. getSelectorFromElement: function getSelectorFromElement(element) {
  2154. var selector = element.getAttribute('data-target');
  2155. if (!selector || selector === '#') {
  2156. var hrefAttr = element.getAttribute('href');
  2157. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2158. }
  2159. try {
  2160. return document.querySelector(selector) ? selector : null;
  2161. } catch (err) {
  2162. return null;
  2163. }
  2164. },
  2165. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2166. if (!element) {
  2167. return 0;
  2168. } // Get transition-duration of the element
  2169. var transitionDuration = $(element).css('transition-duration');
  2170. var transitionDelay = $(element).css('transition-delay');
  2171. var floatTransitionDuration = parseFloat(transitionDuration);
  2172. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2173. if (!floatTransitionDuration && !floatTransitionDelay) {
  2174. return 0;
  2175. } // If multiple durations are defined, take the first
  2176. transitionDuration = transitionDuration.split(',')[0];
  2177. transitionDelay = transitionDelay.split(',')[0];
  2178. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2179. },
  2180. reflow: function reflow(element) {
  2181. return element.offsetHeight;
  2182. },
  2183. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2184. $(element).trigger(TRANSITION_END);
  2185. },
  2186. // TODO: Remove in v5
  2187. supportsTransitionEnd: function supportsTransitionEnd() {
  2188. return Boolean(TRANSITION_END);
  2189. },
  2190. isElement: function isElement(obj) {
  2191. return (obj[0] || obj).nodeType;
  2192. },
  2193. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2194. for (var property in configTypes) {
  2195. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2196. var expectedTypes = configTypes[property];
  2197. var value = config[property];
  2198. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2199. if (!new RegExp(expectedTypes).test(valueType)) {
  2200. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2201. }
  2202. }
  2203. }
  2204. },
  2205. findShadowRoot: function findShadowRoot(element) {
  2206. if (!document.documentElement.attachShadow) {
  2207. return null;
  2208. } // Can find the shadow root otherwise it'll return the document
  2209. if (typeof element.getRootNode === 'function') {
  2210. var root = element.getRootNode();
  2211. return root instanceof ShadowRoot ? root : null;
  2212. }
  2213. if (element instanceof ShadowRoot) {
  2214. return element;
  2215. } // when we don't find a shadow root
  2216. if (!element.parentNode) {
  2217. return null;
  2218. }
  2219. return Util.findShadowRoot(element.parentNode);
  2220. },
  2221. jQueryDetection: function jQueryDetection() {
  2222. if (typeof $ === 'undefined') {
  2223. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2224. }
  2225. var version = $.fn.jquery.split(' ')[0].split('.');
  2226. var minMajor = 1;
  2227. var ltMajor = 2;
  2228. var minMinor = 9;
  2229. var minPatch = 1;
  2230. var maxMajor = 4;
  2231. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2232. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2233. }
  2234. }
  2235. };
  2236. Util.jQueryDetection();
  2237. setTransitionEndSupport();
  2238. /**
  2239. * ------------------------------------------------------------------------
  2240. * Constants
  2241. * ------------------------------------------------------------------------
  2242. */
  2243. var NAME = 'alert';
  2244. var VERSION = '4.4.1';
  2245. var DATA_KEY = 'bs.alert';
  2246. var EVENT_KEY = "." + DATA_KEY;
  2247. var DATA_API_KEY = '.data-api';
  2248. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2249. var Selector = {
  2250. DISMISS: '[data-dismiss="alert"]'
  2251. };
  2252. var Event = {
  2253. CLOSE: "close" + EVENT_KEY,
  2254. CLOSED: "closed" + EVENT_KEY,
  2255. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2256. };
  2257. var ClassName = {
  2258. ALERT: 'alert',
  2259. FADE: 'fade',
  2260. SHOW: 'show'
  2261. };
  2262. /**
  2263. * ------------------------------------------------------------------------
  2264. * Class Definition
  2265. * ------------------------------------------------------------------------
  2266. */
  2267. var Alert =
  2268. /*#__PURE__*/
  2269. function () {
  2270. function Alert(element) {
  2271. this._element = element;
  2272. } // Getters
  2273. var _proto = Alert.prototype;
  2274. // Public
  2275. _proto.close = function close(element) {
  2276. var rootElement = this._element;
  2277. if (element) {
  2278. rootElement = this._getRootElement(element);
  2279. }
  2280. var customEvent = this._triggerCloseEvent(rootElement);
  2281. if (customEvent.isDefaultPrevented()) {
  2282. return;
  2283. }
  2284. this._removeElement(rootElement);
  2285. };
  2286. _proto.dispose = function dispose() {
  2287. $.removeData(this._element, DATA_KEY);
  2288. this._element = null;
  2289. } // Private
  2290. ;
  2291. _proto._getRootElement = function _getRootElement(element) {
  2292. var selector = Util.getSelectorFromElement(element);
  2293. var parent = false;
  2294. if (selector) {
  2295. parent = document.querySelector(selector);
  2296. }
  2297. if (!parent) {
  2298. parent = $(element).closest("." + ClassName.ALERT)[0];
  2299. }
  2300. return parent;
  2301. };
  2302. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2303. var closeEvent = $.Event(Event.CLOSE);
  2304. $(element).trigger(closeEvent);
  2305. return closeEvent;
  2306. };
  2307. _proto._removeElement = function _removeElement(element) {
  2308. var _this = this;
  2309. $(element).removeClass(ClassName.SHOW);
  2310. if (!$(element).hasClass(ClassName.FADE)) {
  2311. this._destroyElement(element);
  2312. return;
  2313. }
  2314. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2315. $(element).one(Util.TRANSITION_END, function (event) {
  2316. return _this._destroyElement(element, event);
  2317. }).emulateTransitionEnd(transitionDuration);
  2318. };
  2319. _proto._destroyElement = function _destroyElement(element) {
  2320. $(element).detach().trigger(Event.CLOSED).remove();
  2321. } // Static
  2322. ;
  2323. Alert._jQueryInterface = function _jQueryInterface(config) {
  2324. return this.each(function () {
  2325. var $element = $(this);
  2326. var data = $element.data(DATA_KEY);
  2327. if (!data) {
  2328. data = new Alert(this);
  2329. $element.data(DATA_KEY, data);
  2330. }
  2331. if (config === 'close') {
  2332. data[config](this);
  2333. }
  2334. });
  2335. };
  2336. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2337. return function (event) {
  2338. if (event) {
  2339. event.preventDefault();
  2340. }
  2341. alertInstance.close(this);
  2342. };
  2343. };
  2344. _createClass(Alert, null, [{
  2345. key: "VERSION",
  2346. get: function get() {
  2347. return VERSION;
  2348. }
  2349. }]);
  2350. return Alert;
  2351. }();
  2352. /**
  2353. * ------------------------------------------------------------------------
  2354. * Data Api implementation
  2355. * ------------------------------------------------------------------------
  2356. */
  2357. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2358. /**
  2359. * ------------------------------------------------------------------------
  2360. * jQuery
  2361. * ------------------------------------------------------------------------
  2362. */
  2363. $.fn[NAME] = Alert._jQueryInterface;
  2364. $.fn[NAME].Constructor = Alert;
  2365. $.fn[NAME].noConflict = function () {
  2366. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2367. return Alert._jQueryInterface;
  2368. };
  2369. /**
  2370. * ------------------------------------------------------------------------
  2371. * Constants
  2372. * ------------------------------------------------------------------------
  2373. */
  2374. var NAME$1 = 'button';
  2375. var VERSION$1 = '4.4.1';
  2376. var DATA_KEY$1 = 'bs.button';
  2377. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2378. var DATA_API_KEY$1 = '.data-api';
  2379. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2380. var ClassName$1 = {
  2381. ACTIVE: 'active',
  2382. BUTTON: 'btn',
  2383. FOCUS: 'focus'
  2384. };
  2385. var Selector$1 = {
  2386. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2387. DATA_TOGGLES: '[data-toggle="buttons"]',
  2388. DATA_TOGGLE: '[data-toggle="button"]',
  2389. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2390. INPUT: 'input:not([type="hidden"])',
  2391. ACTIVE: '.active',
  2392. BUTTON: '.btn'
  2393. };
  2394. var Event$1 = {
  2395. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2396. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2397. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2398. };
  2399. /**
  2400. * ------------------------------------------------------------------------
  2401. * Class Definition
  2402. * ------------------------------------------------------------------------
  2403. */
  2404. var Button =
  2405. /*#__PURE__*/
  2406. function () {
  2407. function Button(element) {
  2408. this._element = element;
  2409. } // Getters
  2410. var _proto = Button.prototype;
  2411. // Public
  2412. _proto.toggle = function toggle() {
  2413. var triggerChangeEvent = true;
  2414. var addAriaPressed = true;
  2415. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2416. if (rootElement) {
  2417. var input = this._element.querySelector(Selector$1.INPUT);
  2418. if (input) {
  2419. if (input.type === 'radio') {
  2420. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2421. triggerChangeEvent = false;
  2422. } else {
  2423. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2424. if (activeElement) {
  2425. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2426. }
  2427. }
  2428. } else if (input.type === 'checkbox') {
  2429. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2430. triggerChangeEvent = false;
  2431. }
  2432. } else {
  2433. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2434. triggerChangeEvent = false;
  2435. }
  2436. if (triggerChangeEvent) {
  2437. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2438. $(input).trigger('change');
  2439. }
  2440. input.focus();
  2441. addAriaPressed = false;
  2442. }
  2443. }
  2444. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2445. if (addAriaPressed) {
  2446. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2447. }
  2448. if (triggerChangeEvent) {
  2449. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2450. }
  2451. }
  2452. };
  2453. _proto.dispose = function dispose() {
  2454. $.removeData(this._element, DATA_KEY$1);
  2455. this._element = null;
  2456. } // Static
  2457. ;
  2458. Button._jQueryInterface = function _jQueryInterface(config) {
  2459. return this.each(function () {
  2460. var data = $(this).data(DATA_KEY$1);
  2461. if (!data) {
  2462. data = new Button(this);
  2463. $(this).data(DATA_KEY$1, data);
  2464. }
  2465. if (config === 'toggle') {
  2466. data[config]();
  2467. }
  2468. });
  2469. };
  2470. _createClass(Button, null, [{
  2471. key: "VERSION",
  2472. get: function get() {
  2473. return VERSION$1;
  2474. }
  2475. }]);
  2476. return Button;
  2477. }();
  2478. /**
  2479. * ------------------------------------------------------------------------
  2480. * Data Api implementation
  2481. * ------------------------------------------------------------------------
  2482. */
  2483. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2484. var button = event.target;
  2485. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2486. button = $(button).closest(Selector$1.BUTTON)[0];
  2487. }
  2488. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2489. event.preventDefault(); // work around Firefox bug #1540995
  2490. } else {
  2491. var inputBtn = button.querySelector(Selector$1.INPUT);
  2492. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2493. event.preventDefault(); // work around Firefox bug #1540995
  2494. return;
  2495. }
  2496. Button._jQueryInterface.call($(button), 'toggle');
  2497. }
  2498. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2499. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2500. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2501. });
  2502. $(window).on(Event$1.LOAD_DATA_API, function () {
  2503. // ensure correct active class is set to match the controls' actual values/states
  2504. // find all checkboxes/readio buttons inside data-toggle groups
  2505. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2506. for (var i = 0, len = buttons.length; i < len; i++) {
  2507. var button = buttons[i];
  2508. var input = button.querySelector(Selector$1.INPUT);
  2509. if (input.checked || input.hasAttribute('checked')) {
  2510. button.classList.add(ClassName$1.ACTIVE);
  2511. } else {
  2512. button.classList.remove(ClassName$1.ACTIVE);
  2513. }
  2514. } // find all button toggles
  2515. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2516. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2517. var _button = buttons[_i];
  2518. if (_button.getAttribute('aria-pressed') === 'true') {
  2519. _button.classList.add(ClassName$1.ACTIVE);
  2520. } else {
  2521. _button.classList.remove(ClassName$1.ACTIVE);
  2522. }
  2523. }
  2524. });
  2525. /**
  2526. * ------------------------------------------------------------------------
  2527. * jQuery
  2528. * ------------------------------------------------------------------------
  2529. */
  2530. $.fn[NAME$1] = Button._jQueryInterface;
  2531. $.fn[NAME$1].Constructor = Button;
  2532. $.fn[NAME$1].noConflict = function () {
  2533. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2534. return Button._jQueryInterface;
  2535. };
  2536. /**
  2537. * ------------------------------------------------------------------------
  2538. * Constants
  2539. * ------------------------------------------------------------------------
  2540. */
  2541. var NAME$2 = 'carousel';
  2542. var VERSION$2 = '4.4.1';
  2543. var DATA_KEY$2 = 'bs.carousel';
  2544. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2545. var DATA_API_KEY$2 = '.data-api';
  2546. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2547. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2548. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2549. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2550. var SWIPE_THRESHOLD = 40;
  2551. var Default = {
  2552. interval: 5000,
  2553. keyboard: true,
  2554. slide: false,
  2555. pause: 'hover',
  2556. wrap: true,
  2557. touch: true
  2558. };
  2559. var DefaultType = {
  2560. interval: '(number|boolean)',
  2561. keyboard: 'boolean',
  2562. slide: '(boolean|string)',
  2563. pause: '(string|boolean)',
  2564. wrap: 'boolean',
  2565. touch: 'boolean'
  2566. };
  2567. var Direction = {
  2568. NEXT: 'next',
  2569. PREV: 'prev',
  2570. LEFT: 'left',
  2571. RIGHT: 'right'
  2572. };
  2573. var Event$2 = {
  2574. SLIDE: "slide" + EVENT_KEY$2,
  2575. SLID: "slid" + EVENT_KEY$2,
  2576. KEYDOWN: "keydown" + EVENT_KEY$2,
  2577. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2578. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2579. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2580. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2581. TOUCHEND: "touchend" + EVENT_KEY$2,
  2582. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2583. POINTERUP: "pointerup" + EVENT_KEY$2,
  2584. DRAG_START: "dragstart" + EVENT_KEY$2,
  2585. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2586. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2587. };
  2588. var ClassName$2 = {
  2589. CAROUSEL: 'carousel',
  2590. ACTIVE: 'active',
  2591. SLIDE: 'slide',
  2592. RIGHT: 'carousel-item-right',
  2593. LEFT: 'carousel-item-left',
  2594. NEXT: 'carousel-item-next',
  2595. PREV: 'carousel-item-prev',
  2596. ITEM: 'carousel-item',
  2597. POINTER_EVENT: 'pointer-event'
  2598. };
  2599. var Selector$2 = {
  2600. ACTIVE: '.active',
  2601. ACTIVE_ITEM: '.active.carousel-item',
  2602. ITEM: '.carousel-item',
  2603. ITEM_IMG: '.carousel-item img',
  2604. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2605. INDICATORS: '.carousel-indicators',
  2606. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2607. DATA_RIDE: '[data-ride="carousel"]'
  2608. };
  2609. var PointerType = {
  2610. TOUCH: 'touch',
  2611. PEN: 'pen'
  2612. };
  2613. /**
  2614. * ------------------------------------------------------------------------
  2615. * Class Definition
  2616. * ------------------------------------------------------------------------
  2617. */
  2618. var Carousel =
  2619. /*#__PURE__*/
  2620. function () {
  2621. function Carousel(element, config) {
  2622. this._items = null;
  2623. this._interval = null;
  2624. this._activeElement = null;
  2625. this._isPaused = false;
  2626. this._isSliding = false;
  2627. this.touchTimeout = null;
  2628. this.touchStartX = 0;
  2629. this.touchDeltaX = 0;
  2630. this._config = this._getConfig(config);
  2631. this._element = element;
  2632. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2633. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2634. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2635. this._addEventListeners();
  2636. } // Getters
  2637. var _proto = Carousel.prototype;
  2638. // Public
  2639. _proto.next = function next() {
  2640. if (!this._isSliding) {
  2641. this._slide(Direction.NEXT);
  2642. }
  2643. };
  2644. _proto.nextWhenVisible = function nextWhenVisible() {
  2645. // Don't call next when the page isn't visible
  2646. // or the carousel or its parent isn't visible
  2647. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2648. this.next();
  2649. }
  2650. };
  2651. _proto.prev = function prev() {
  2652. if (!this._isSliding) {
  2653. this._slide(Direction.PREV);
  2654. }
  2655. };
  2656. _proto.pause = function pause(event) {
  2657. if (!event) {
  2658. this._isPaused = true;
  2659. }
  2660. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2661. Util.triggerTransitionEnd(this._element);
  2662. this.cycle(true);
  2663. }
  2664. clearInterval(this._interval);
  2665. this._interval = null;
  2666. };
  2667. _proto.cycle = function cycle(event) {
  2668. if (!event) {
  2669. this._isPaused = false;
  2670. }
  2671. if (this._interval) {
  2672. clearInterval(this._interval);
  2673. this._interval = null;
  2674. }
  2675. if (this._config.interval && !this._isPaused) {
  2676. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2677. }
  2678. };
  2679. _proto.to = function to(index) {
  2680. var _this = this;
  2681. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2682. var activeIndex = this._getItemIndex(this._activeElement);
  2683. if (index > this._items.length - 1 || index < 0) {
  2684. return;
  2685. }
  2686. if (this._isSliding) {
  2687. $(this._element).one(Event$2.SLID, function () {
  2688. return _this.to(index);
  2689. });
  2690. return;
  2691. }
  2692. if (activeIndex === index) {
  2693. this.pause();
  2694. this.cycle();
  2695. return;
  2696. }
  2697. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2698. this._slide(direction, this._items[index]);
  2699. };
  2700. _proto.dispose = function dispose() {
  2701. $(this._element).off(EVENT_KEY$2);
  2702. $.removeData(this._element, DATA_KEY$2);
  2703. this._items = null;
  2704. this._config = null;
  2705. this._element = null;
  2706. this._interval = null;
  2707. this._isPaused = null;
  2708. this._isSliding = null;
  2709. this._activeElement = null;
  2710. this._indicatorsElement = null;
  2711. } // Private
  2712. ;
  2713. _proto._getConfig = function _getConfig(config) {
  2714. config = _objectSpread2({}, Default, {}, config);
  2715. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2716. return config;
  2717. };
  2718. _proto._handleSwipe = function _handleSwipe() {
  2719. var absDeltax = Math.abs(this.touchDeltaX);
  2720. if (absDeltax <= SWIPE_THRESHOLD) {
  2721. return;
  2722. }
  2723. var direction = absDeltax / this.touchDeltaX;
  2724. this.touchDeltaX = 0; // swipe left
  2725. if (direction > 0) {
  2726. this.prev();
  2727. } // swipe right
  2728. if (direction < 0) {
  2729. this.next();
  2730. }
  2731. };
  2732. _proto._addEventListeners = function _addEventListeners() {
  2733. var _this2 = this;
  2734. if (this._config.keyboard) {
  2735. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2736. return _this2._keydown(event);
  2737. });
  2738. }
  2739. if (this._config.pause === 'hover') {
  2740. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2741. return _this2.pause(event);
  2742. }).on(Event$2.MOUSELEAVE, function (event) {
  2743. return _this2.cycle(event);
  2744. });
  2745. }
  2746. if (this._config.touch) {
  2747. this._addTouchEventListeners();
  2748. }
  2749. };
  2750. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2751. var _this3 = this;
  2752. if (!this._touchSupported) {
  2753. return;
  2754. }
  2755. var start = function start(event) {
  2756. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2757. _this3.touchStartX = event.originalEvent.clientX;
  2758. } else if (!_this3._pointerEvent) {
  2759. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2760. }
  2761. };
  2762. var move = function move(event) {
  2763. // ensure swiping with one touch and not pinching
  2764. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2765. _this3.touchDeltaX = 0;
  2766. } else {
  2767. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2768. }
  2769. };
  2770. var end = function end(event) {
  2771. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2772. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2773. }
  2774. _this3._handleSwipe();
  2775. if (_this3._config.pause === 'hover') {
  2776. // If it's a touch-enabled device, mouseenter/leave are fired as
  2777. // part of the mouse compatibility events on first tap - the carousel
  2778. // would stop cycling until user tapped out of it;
  2779. // here, we listen for touchend, explicitly pause the carousel
  2780. // (as if it's the second time we tap on it, mouseenter compat event
  2781. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2782. // events to fire) we explicitly restart cycling
  2783. _this3.pause();
  2784. if (_this3.touchTimeout) {
  2785. clearTimeout(_this3.touchTimeout);
  2786. }
  2787. _this3.touchTimeout = setTimeout(function (event) {
  2788. return _this3.cycle(event);
  2789. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2790. }
  2791. };
  2792. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2793. return e.preventDefault();
  2794. });
  2795. if (this._pointerEvent) {
  2796. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2797. return start(event);
  2798. });
  2799. $(this._element).on(Event$2.POINTERUP, function (event) {
  2800. return end(event);
  2801. });
  2802. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2803. } else {
  2804. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2805. return start(event);
  2806. });
  2807. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2808. return move(event);
  2809. });
  2810. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2811. return end(event);
  2812. });
  2813. }
  2814. };
  2815. _proto._keydown = function _keydown(event) {
  2816. if (/input|textarea/i.test(event.target.tagName)) {
  2817. return;
  2818. }
  2819. switch (event.which) {
  2820. case ARROW_LEFT_KEYCODE:
  2821. event.preventDefault();
  2822. this.prev();
  2823. break;
  2824. case ARROW_RIGHT_KEYCODE:
  2825. event.preventDefault();
  2826. this.next();
  2827. break;
  2828. }
  2829. };
  2830. _proto._getItemIndex = function _getItemIndex(element) {
  2831. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2832. return this._items.indexOf(element);
  2833. };
  2834. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2835. var isNextDirection = direction === Direction.NEXT;
  2836. var isPrevDirection = direction === Direction.PREV;
  2837. var activeIndex = this._getItemIndex(activeElement);
  2838. var lastItemIndex = this._items.length - 1;
  2839. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2840. if (isGoingToWrap && !this._config.wrap) {
  2841. return activeElement;
  2842. }
  2843. var delta = direction === Direction.PREV ? -1 : 1;
  2844. var itemIndex = (activeIndex + delta) % this._items.length;
  2845. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2846. };
  2847. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2848. var targetIndex = this._getItemIndex(relatedTarget);
  2849. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2850. var slideEvent = $.Event(Event$2.SLIDE, {
  2851. relatedTarget: relatedTarget,
  2852. direction: eventDirectionName,
  2853. from: fromIndex,
  2854. to: targetIndex
  2855. });
  2856. $(this._element).trigger(slideEvent);
  2857. return slideEvent;
  2858. };
  2859. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2860. if (this._indicatorsElement) {
  2861. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2862. $(indicators).removeClass(ClassName$2.ACTIVE);
  2863. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2864. if (nextIndicator) {
  2865. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2866. }
  2867. }
  2868. };
  2869. _proto._slide = function _slide(direction, element) {
  2870. var _this4 = this;
  2871. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2872. var activeElementIndex = this._getItemIndex(activeElement);
  2873. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2874. var nextElementIndex = this._getItemIndex(nextElement);
  2875. var isCycling = Boolean(this._interval);
  2876. var directionalClassName;
  2877. var orderClassName;
  2878. var eventDirectionName;
  2879. if (direction === Direction.NEXT) {
  2880. directionalClassName = ClassName$2.LEFT;
  2881. orderClassName = ClassName$2.NEXT;
  2882. eventDirectionName = Direction.LEFT;
  2883. } else {
  2884. directionalClassName = ClassName$2.RIGHT;
  2885. orderClassName = ClassName$2.PREV;
  2886. eventDirectionName = Direction.RIGHT;
  2887. }
  2888. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2889. this._isSliding = false;
  2890. return;
  2891. }
  2892. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2893. if (slideEvent.isDefaultPrevented()) {
  2894. return;
  2895. }
  2896. if (!activeElement || !nextElement) {
  2897. // Some weirdness is happening, so we bail
  2898. return;
  2899. }
  2900. this._isSliding = true;
  2901. if (isCycling) {
  2902. this.pause();
  2903. }
  2904. this._setActiveIndicatorElement(nextElement);
  2905. var slidEvent = $.Event(Event$2.SLID, {
  2906. relatedTarget: nextElement,
  2907. direction: eventDirectionName,
  2908. from: activeElementIndex,
  2909. to: nextElementIndex
  2910. });
  2911. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2912. $(nextElement).addClass(orderClassName);
  2913. Util.reflow(nextElement);
  2914. $(activeElement).addClass(directionalClassName);
  2915. $(nextElement).addClass(directionalClassName);
  2916. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2917. if (nextElementInterval) {
  2918. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2919. this._config.interval = nextElementInterval;
  2920. } else {
  2921. this._config.interval = this._config.defaultInterval || this._config.interval;
  2922. }
  2923. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2924. $(activeElement).one(Util.TRANSITION_END, function () {
  2925. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2926. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2927. _this4._isSliding = false;
  2928. setTimeout(function () {
  2929. return $(_this4._element).trigger(slidEvent);
  2930. }, 0);
  2931. }).emulateTransitionEnd(transitionDuration);
  2932. } else {
  2933. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2934. $(nextElement).addClass(ClassName$2.ACTIVE);
  2935. this._isSliding = false;
  2936. $(this._element).trigger(slidEvent);
  2937. }
  2938. if (isCycling) {
  2939. this.cycle();
  2940. }
  2941. } // Static
  2942. ;
  2943. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2944. return this.each(function () {
  2945. var data = $(this).data(DATA_KEY$2);
  2946. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2947. if (typeof config === 'object') {
  2948. _config = _objectSpread2({}, _config, {}, config);
  2949. }
  2950. var action = typeof config === 'string' ? config : _config.slide;
  2951. if (!data) {
  2952. data = new Carousel(this, _config);
  2953. $(this).data(DATA_KEY$2, data);
  2954. }
  2955. if (typeof config === 'number') {
  2956. data.to(config);
  2957. } else if (typeof action === 'string') {
  2958. if (typeof data[action] === 'undefined') {
  2959. throw new TypeError("No method named \"" + action + "\"");
  2960. }
  2961. data[action]();
  2962. } else if (_config.interval && _config.ride) {
  2963. data.pause();
  2964. data.cycle();
  2965. }
  2966. });
  2967. };
  2968. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2969. var selector = Util.getSelectorFromElement(this);
  2970. if (!selector) {
  2971. return;
  2972. }
  2973. var target = $(selector)[0];
  2974. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2975. return;
  2976. }
  2977. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2978. var slideIndex = this.getAttribute('data-slide-to');
  2979. if (slideIndex) {
  2980. config.interval = false;
  2981. }
  2982. Carousel._jQueryInterface.call($(target), config);
  2983. if (slideIndex) {
  2984. $(target).data(DATA_KEY$2).to(slideIndex);
  2985. }
  2986. event.preventDefault();
  2987. };
  2988. _createClass(Carousel, null, [{
  2989. key: "VERSION",
  2990. get: function get() {
  2991. return VERSION$2;
  2992. }
  2993. }, {
  2994. key: "Default",
  2995. get: function get() {
  2996. return Default;
  2997. }
  2998. }]);
  2999. return Carousel;
  3000. }();
  3001. /**
  3002. * ------------------------------------------------------------------------
  3003. * Data Api implementation
  3004. * ------------------------------------------------------------------------
  3005. */
  3006. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3007. $(window).on(Event$2.LOAD_DATA_API, function () {
  3008. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3009. for (var i = 0, len = carousels.length; i < len; i++) {
  3010. var $carousel = $(carousels[i]);
  3011. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3012. }
  3013. });
  3014. /**
  3015. * ------------------------------------------------------------------------
  3016. * jQuery
  3017. * ------------------------------------------------------------------------
  3018. */
  3019. $.fn[NAME$2] = Carousel._jQueryInterface;
  3020. $.fn[NAME$2].Constructor = Carousel;
  3021. $.fn[NAME$2].noConflict = function () {
  3022. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3023. return Carousel._jQueryInterface;
  3024. };
  3025. /**
  3026. * ------------------------------------------------------------------------
  3027. * Constants
  3028. * ------------------------------------------------------------------------
  3029. */
  3030. var NAME$3 = 'collapse';
  3031. var VERSION$3 = '4.4.1';
  3032. var DATA_KEY$3 = 'bs.collapse';
  3033. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3034. var DATA_API_KEY$3 = '.data-api';
  3035. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3036. var Default$1 = {
  3037. toggle: true,
  3038. parent: ''
  3039. };
  3040. var DefaultType$1 = {
  3041. toggle: 'boolean',
  3042. parent: '(string|element)'
  3043. };
  3044. var Event$3 = {
  3045. SHOW: "show" + EVENT_KEY$3,
  3046. SHOWN: "shown" + EVENT_KEY$3,
  3047. HIDE: "hide" + EVENT_KEY$3,
  3048. HIDDEN: "hidden" + EVENT_KEY$3,
  3049. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3050. };
  3051. var ClassName$3 = {
  3052. SHOW: 'show',
  3053. COLLAPSE: 'collapse',
  3054. COLLAPSING: 'collapsing',
  3055. COLLAPSED: 'collapsed'
  3056. };
  3057. var Dimension = {
  3058. WIDTH: 'width',
  3059. HEIGHT: 'height'
  3060. };
  3061. var Selector$3 = {
  3062. ACTIVES: '.show, .collapsing',
  3063. DATA_TOGGLE: '[data-toggle="collapse"]'
  3064. };
  3065. /**
  3066. * ------------------------------------------------------------------------
  3067. * Class Definition
  3068. * ------------------------------------------------------------------------
  3069. */
  3070. var Collapse =
  3071. /*#__PURE__*/
  3072. function () {
  3073. function Collapse(element, config) {
  3074. this._isTransitioning = false;
  3075. this._element = element;
  3076. this._config = this._getConfig(config);
  3077. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3078. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3079. for (var i = 0, len = toggleList.length; i < len; i++) {
  3080. var elem = toggleList[i];
  3081. var selector = Util.getSelectorFromElement(elem);
  3082. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3083. return foundElem === element;
  3084. });
  3085. if (selector !== null && filterElement.length > 0) {
  3086. this._selector = selector;
  3087. this._triggerArray.push(elem);
  3088. }
  3089. }
  3090. this._parent = this._config.parent ? this._getParent() : null;
  3091. if (!this._config.parent) {
  3092. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3093. }
  3094. if (this._config.toggle) {
  3095. this.toggle();
  3096. }
  3097. } // Getters
  3098. var _proto = Collapse.prototype;
  3099. // Public
  3100. _proto.toggle = function toggle() {
  3101. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3102. this.hide();
  3103. } else {
  3104. this.show();
  3105. }
  3106. };
  3107. _proto.show = function show() {
  3108. var _this = this;
  3109. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3110. return;
  3111. }
  3112. var actives;
  3113. var activesData;
  3114. if (this._parent) {
  3115. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3116. if (typeof _this._config.parent === 'string') {
  3117. return elem.getAttribute('data-parent') === _this._config.parent;
  3118. }
  3119. return elem.classList.contains(ClassName$3.COLLAPSE);
  3120. });
  3121. if (actives.length === 0) {
  3122. actives = null;
  3123. }
  3124. }
  3125. if (actives) {
  3126. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3127. if (activesData && activesData._isTransitioning) {
  3128. return;
  3129. }
  3130. }
  3131. var startEvent = $.Event(Event$3.SHOW);
  3132. $(this._element).trigger(startEvent);
  3133. if (startEvent.isDefaultPrevented()) {
  3134. return;
  3135. }
  3136. if (actives) {
  3137. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3138. if (!activesData) {
  3139. $(actives).data(DATA_KEY$3, null);
  3140. }
  3141. }
  3142. var dimension = this._getDimension();
  3143. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3144. this._element.style[dimension] = 0;
  3145. if (this._triggerArray.length) {
  3146. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3147. }
  3148. this.setTransitioning(true);
  3149. var complete = function complete() {
  3150. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3151. _this._element.style[dimension] = '';
  3152. _this.setTransitioning(false);
  3153. $(_this._element).trigger(Event$3.SHOWN);
  3154. };
  3155. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3156. var scrollSize = "scroll" + capitalizedDimension;
  3157. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3158. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3159. this._element.style[dimension] = this._element[scrollSize] + "px";
  3160. };
  3161. _proto.hide = function hide() {
  3162. var _this2 = this;
  3163. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3164. return;
  3165. }
  3166. var startEvent = $.Event(Event$3.HIDE);
  3167. $(this._element).trigger(startEvent);
  3168. if (startEvent.isDefaultPrevented()) {
  3169. return;
  3170. }
  3171. var dimension = this._getDimension();
  3172. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3173. Util.reflow(this._element);
  3174. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3175. var triggerArrayLength = this._triggerArray.length;
  3176. if (triggerArrayLength > 0) {
  3177. for (var i = 0; i < triggerArrayLength; i++) {
  3178. var trigger = this._triggerArray[i];
  3179. var selector = Util.getSelectorFromElement(trigger);
  3180. if (selector !== null) {
  3181. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3182. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3183. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3184. }
  3185. }
  3186. }
  3187. }
  3188. this.setTransitioning(true);
  3189. var complete = function complete() {
  3190. _this2.setTransitioning(false);
  3191. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3192. };
  3193. this._element.style[dimension] = '';
  3194. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3195. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3196. };
  3197. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3198. this._isTransitioning = isTransitioning;
  3199. };
  3200. _proto.dispose = function dispose() {
  3201. $.removeData(this._element, DATA_KEY$3);
  3202. this._config = null;
  3203. this._parent = null;
  3204. this._element = null;
  3205. this._triggerArray = null;
  3206. this._isTransitioning = null;
  3207. } // Private
  3208. ;
  3209. _proto._getConfig = function _getConfig(config) {
  3210. config = _objectSpread2({}, Default$1, {}, config);
  3211. config.toggle = Boolean(config.toggle); // Coerce string values
  3212. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3213. return config;
  3214. };
  3215. _proto._getDimension = function _getDimension() {
  3216. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3217. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3218. };
  3219. _proto._getParent = function _getParent() {
  3220. var _this3 = this;
  3221. var parent;
  3222. if (Util.isElement(this._config.parent)) {
  3223. parent = this._config.parent; // It's a jQuery object
  3224. if (typeof this._config.parent.jquery !== 'undefined') {
  3225. parent = this._config.parent[0];
  3226. }
  3227. } else {
  3228. parent = document.querySelector(this._config.parent);
  3229. }
  3230. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3231. var children = [].slice.call(parent.querySelectorAll(selector));
  3232. $(children).each(function (i, element) {
  3233. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3234. });
  3235. return parent;
  3236. };
  3237. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3238. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3239. if (triggerArray.length) {
  3240. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3241. }
  3242. } // Static
  3243. ;
  3244. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3245. var selector = Util.getSelectorFromElement(element);
  3246. return selector ? document.querySelector(selector) : null;
  3247. };
  3248. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3249. return this.each(function () {
  3250. var $this = $(this);
  3251. var data = $this.data(DATA_KEY$3);
  3252. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3253. if (!data && _config.toggle && /show|hide/.test(config)) {
  3254. _config.toggle = false;
  3255. }
  3256. if (!data) {
  3257. data = new Collapse(this, _config);
  3258. $this.data(DATA_KEY$3, data);
  3259. }
  3260. if (typeof config === 'string') {
  3261. if (typeof data[config] === 'undefined') {
  3262. throw new TypeError("No method named \"" + config + "\"");
  3263. }
  3264. data[config]();
  3265. }
  3266. });
  3267. };
  3268. _createClass(Collapse, null, [{
  3269. key: "VERSION",
  3270. get: function get() {
  3271. return VERSION$3;
  3272. }
  3273. }, {
  3274. key: "Default",
  3275. get: function get() {
  3276. return Default$1;
  3277. }
  3278. }]);
  3279. return Collapse;
  3280. }();
  3281. /**
  3282. * ------------------------------------------------------------------------
  3283. * Data Api implementation
  3284. * ------------------------------------------------------------------------
  3285. */
  3286. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3287. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3288. if (event.currentTarget.tagName === 'A') {
  3289. event.preventDefault();
  3290. }
  3291. var $trigger = $(this);
  3292. var selector = Util.getSelectorFromElement(this);
  3293. var selectors = [].slice.call(document.querySelectorAll(selector));
  3294. $(selectors).each(function () {
  3295. var $target = $(this);
  3296. var data = $target.data(DATA_KEY$3);
  3297. var config = data ? 'toggle' : $trigger.data();
  3298. Collapse._jQueryInterface.call($target, config);
  3299. });
  3300. });
  3301. /**
  3302. * ------------------------------------------------------------------------
  3303. * jQuery
  3304. * ------------------------------------------------------------------------
  3305. */
  3306. $.fn[NAME$3] = Collapse._jQueryInterface;
  3307. $.fn[NAME$3].Constructor = Collapse;
  3308. $.fn[NAME$3].noConflict = function () {
  3309. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3310. return Collapse._jQueryInterface;
  3311. };
  3312. /**
  3313. * ------------------------------------------------------------------------
  3314. * Constants
  3315. * ------------------------------------------------------------------------
  3316. */
  3317. var NAME$4 = 'dropdown';
  3318. var VERSION$4 = '4.4.1';
  3319. var DATA_KEY$4 = 'bs.dropdown';
  3320. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3321. var DATA_API_KEY$4 = '.data-api';
  3322. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3323. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3324. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3325. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3326. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3327. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3328. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3329. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3330. var Event$4 = {
  3331. HIDE: "hide" + EVENT_KEY$4,
  3332. HIDDEN: "hidden" + EVENT_KEY$4,
  3333. SHOW: "show" + EVENT_KEY$4,
  3334. SHOWN: "shown" + EVENT_KEY$4,
  3335. CLICK: "click" + EVENT_KEY$4,
  3336. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3337. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3338. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3339. };
  3340. var ClassName$4 = {
  3341. DISABLED: 'disabled',
  3342. SHOW: 'show',
  3343. DROPUP: 'dropup',
  3344. DROPRIGHT: 'dropright',
  3345. DROPLEFT: 'dropleft',
  3346. MENURIGHT: 'dropdown-menu-right',
  3347. MENULEFT: 'dropdown-menu-left',
  3348. POSITION_STATIC: 'position-static'
  3349. };
  3350. var Selector$4 = {
  3351. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3352. FORM_CHILD: '.dropdown form',
  3353. MENU: '.dropdown-menu',
  3354. NAVBAR_NAV: '.navbar-nav',
  3355. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3356. };
  3357. var AttachmentMap = {
  3358. TOP: 'top-start',
  3359. TOPEND: 'top-end',
  3360. BOTTOM: 'bottom-start',
  3361. BOTTOMEND: 'bottom-end',
  3362. RIGHT: 'right-start',
  3363. RIGHTEND: 'right-end',
  3364. LEFT: 'left-start',
  3365. LEFTEND: 'left-end'
  3366. };
  3367. var Default$2 = {
  3368. offset: 0,
  3369. flip: true,
  3370. boundary: 'scrollParent',
  3371. reference: 'toggle',
  3372. display: 'dynamic',
  3373. popperConfig: null
  3374. };
  3375. var DefaultType$2 = {
  3376. offset: '(number|string|function)',
  3377. flip: 'boolean',
  3378. boundary: '(string|element)',
  3379. reference: '(string|element)',
  3380. display: 'string',
  3381. popperConfig: '(null|object)'
  3382. };
  3383. /**
  3384. * ------------------------------------------------------------------------
  3385. * Class Definition
  3386. * ------------------------------------------------------------------------
  3387. */
  3388. var Dropdown =
  3389. /*#__PURE__*/
  3390. function () {
  3391. function Dropdown(element, config) {
  3392. this._element = element;
  3393. this._popper = null;
  3394. this._config = this._getConfig(config);
  3395. this._menu = this._getMenuElement();
  3396. this._inNavbar = this._detectNavbar();
  3397. this._addEventListeners();
  3398. } // Getters
  3399. var _proto = Dropdown.prototype;
  3400. // Public
  3401. _proto.toggle = function toggle() {
  3402. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3403. return;
  3404. }
  3405. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3406. Dropdown._clearMenus();
  3407. if (isActive) {
  3408. return;
  3409. }
  3410. this.show(true);
  3411. };
  3412. _proto.show = function show(usePopper) {
  3413. if (usePopper === void 0) {
  3414. usePopper = false;
  3415. }
  3416. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3417. return;
  3418. }
  3419. var relatedTarget = {
  3420. relatedTarget: this._element
  3421. };
  3422. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3423. var parent = Dropdown._getParentFromElement(this._element);
  3424. $(parent).trigger(showEvent);
  3425. if (showEvent.isDefaultPrevented()) {
  3426. return;
  3427. } // Disable totally Popper.js for Dropdown in Navbar
  3428. if (!this._inNavbar && usePopper) {
  3429. /**
  3430. * Check for Popper dependency
  3431. * Popper - https://popper.js.org
  3432. */
  3433. if (typeof Popper === 'undefined') {
  3434. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3435. }
  3436. var referenceElement = this._element;
  3437. if (this._config.reference === 'parent') {
  3438. referenceElement = parent;
  3439. } else if (Util.isElement(this._config.reference)) {
  3440. referenceElement = this._config.reference; // Check if it's jQuery element
  3441. if (typeof this._config.reference.jquery !== 'undefined') {
  3442. referenceElement = this._config.reference[0];
  3443. }
  3444. } // If boundary is not `scrollParent`, then set position to `static`
  3445. // to allow the menu to "escape" the scroll parent's boundaries
  3446. // https://github.com/twbs/bootstrap/issues/24251
  3447. if (this._config.boundary !== 'scrollParent') {
  3448. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3449. }
  3450. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3451. } // If this is a touch-enabled device we add extra
  3452. // empty mouseover listeners to the body's immediate children;
  3453. // only needed because of broken event delegation on iOS
  3454. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3455. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3456. $(document.body).children().on('mouseover', null, $.noop);
  3457. }
  3458. this._element.focus();
  3459. this._element.setAttribute('aria-expanded', true);
  3460. $(this._menu).toggleClass(ClassName$4.SHOW);
  3461. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3462. };
  3463. _proto.hide = function hide() {
  3464. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3465. return;
  3466. }
  3467. var relatedTarget = {
  3468. relatedTarget: this._element
  3469. };
  3470. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3471. var parent = Dropdown._getParentFromElement(this._element);
  3472. $(parent).trigger(hideEvent);
  3473. if (hideEvent.isDefaultPrevented()) {
  3474. return;
  3475. }
  3476. if (this._popper) {
  3477. this._popper.destroy();
  3478. }
  3479. $(this._menu).toggleClass(ClassName$4.SHOW);
  3480. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3481. };
  3482. _proto.dispose = function dispose() {
  3483. $.removeData(this._element, DATA_KEY$4);
  3484. $(this._element).off(EVENT_KEY$4);
  3485. this._element = null;
  3486. this._menu = null;
  3487. if (this._popper !== null) {
  3488. this._popper.destroy();
  3489. this._popper = null;
  3490. }
  3491. };
  3492. _proto.update = function update() {
  3493. this._inNavbar = this._detectNavbar();
  3494. if (this._popper !== null) {
  3495. this._popper.scheduleUpdate();
  3496. }
  3497. } // Private
  3498. ;
  3499. _proto._addEventListeners = function _addEventListeners() {
  3500. var _this = this;
  3501. $(this._element).on(Event$4.CLICK, function (event) {
  3502. event.preventDefault();
  3503. event.stopPropagation();
  3504. _this.toggle();
  3505. });
  3506. };
  3507. _proto._getConfig = function _getConfig(config) {
  3508. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3509. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3510. return config;
  3511. };
  3512. _proto._getMenuElement = function _getMenuElement() {
  3513. if (!this._menu) {
  3514. var parent = Dropdown._getParentFromElement(this._element);
  3515. if (parent) {
  3516. this._menu = parent.querySelector(Selector$4.MENU);
  3517. }
  3518. }
  3519. return this._menu;
  3520. };
  3521. _proto._getPlacement = function _getPlacement() {
  3522. var $parentDropdown = $(this._element.parentNode);
  3523. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3524. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3525. placement = AttachmentMap.TOP;
  3526. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3527. placement = AttachmentMap.TOPEND;
  3528. }
  3529. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3530. placement = AttachmentMap.RIGHT;
  3531. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3532. placement = AttachmentMap.LEFT;
  3533. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3534. placement = AttachmentMap.BOTTOMEND;
  3535. }
  3536. return placement;
  3537. };
  3538. _proto._detectNavbar = function _detectNavbar() {
  3539. return $(this._element).closest('.navbar').length > 0;
  3540. };
  3541. _proto._getOffset = function _getOffset() {
  3542. var _this2 = this;
  3543. var offset = {};
  3544. if (typeof this._config.offset === 'function') {
  3545. offset.fn = function (data) {
  3546. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3547. return data;
  3548. };
  3549. } else {
  3550. offset.offset = this._config.offset;
  3551. }
  3552. return offset;
  3553. };
  3554. _proto._getPopperConfig = function _getPopperConfig() {
  3555. var popperConfig = {
  3556. placement: this._getPlacement(),
  3557. modifiers: {
  3558. offset: this._getOffset(),
  3559. flip: {
  3560. enabled: this._config.flip
  3561. },
  3562. preventOverflow: {
  3563. boundariesElement: this._config.boundary
  3564. }
  3565. }
  3566. }; // Disable Popper.js if we have a static display
  3567. if (this._config.display === 'static') {
  3568. popperConfig.modifiers.applyStyle = {
  3569. enabled: false
  3570. };
  3571. }
  3572. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3573. } // Static
  3574. ;
  3575. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3576. return this.each(function () {
  3577. var data = $(this).data(DATA_KEY$4);
  3578. var _config = typeof config === 'object' ? config : null;
  3579. if (!data) {
  3580. data = new Dropdown(this, _config);
  3581. $(this).data(DATA_KEY$4, data);
  3582. }
  3583. if (typeof config === 'string') {
  3584. if (typeof data[config] === 'undefined') {
  3585. throw new TypeError("No method named \"" + config + "\"");
  3586. }
  3587. data[config]();
  3588. }
  3589. });
  3590. };
  3591. Dropdown._clearMenus = function _clearMenus(event) {
  3592. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3593. return;
  3594. }
  3595. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3596. for (var i = 0, len = toggles.length; i < len; i++) {
  3597. var parent = Dropdown._getParentFromElement(toggles[i]);
  3598. var context = $(toggles[i]).data(DATA_KEY$4);
  3599. var relatedTarget = {
  3600. relatedTarget: toggles[i]
  3601. };
  3602. if (event && event.type === 'click') {
  3603. relatedTarget.clickEvent = event;
  3604. }
  3605. if (!context) {
  3606. continue;
  3607. }
  3608. var dropdownMenu = context._menu;
  3609. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3610. continue;
  3611. }
  3612. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3613. continue;
  3614. }
  3615. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3616. $(parent).trigger(hideEvent);
  3617. if (hideEvent.isDefaultPrevented()) {
  3618. continue;
  3619. } // If this is a touch-enabled device we remove the extra
  3620. // empty mouseover listeners we added for iOS support
  3621. if ('ontouchstart' in document.documentElement) {
  3622. $(document.body).children().off('mouseover', null, $.noop);
  3623. }
  3624. toggles[i].setAttribute('aria-expanded', 'false');
  3625. if (context._popper) {
  3626. context._popper.destroy();
  3627. }
  3628. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3629. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3630. }
  3631. };
  3632. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3633. var parent;
  3634. var selector = Util.getSelectorFromElement(element);
  3635. if (selector) {
  3636. parent = document.querySelector(selector);
  3637. }
  3638. return parent || element.parentNode;
  3639. } // eslint-disable-next-line complexity
  3640. ;
  3641. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3642. // If not input/textarea:
  3643. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3644. // If input/textarea:
  3645. // - If space key => not a dropdown command
  3646. // - If key is other than escape
  3647. // - If key is not up or down => not a dropdown command
  3648. // - If trigger inside the menu => not a dropdown command
  3649. 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)) {
  3650. return;
  3651. }
  3652. event.preventDefault();
  3653. event.stopPropagation();
  3654. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3655. return;
  3656. }
  3657. var parent = Dropdown._getParentFromElement(this);
  3658. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3659. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3660. return;
  3661. }
  3662. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3663. if (event.which === ESCAPE_KEYCODE) {
  3664. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3665. $(toggle).trigger('focus');
  3666. }
  3667. $(this).trigger('click');
  3668. return;
  3669. }
  3670. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3671. return $(item).is(':visible');
  3672. });
  3673. if (items.length === 0) {
  3674. return;
  3675. }
  3676. var index = items.indexOf(event.target);
  3677. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3678. // Up
  3679. index--;
  3680. }
  3681. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3682. // Down
  3683. index++;
  3684. }
  3685. if (index < 0) {
  3686. index = 0;
  3687. }
  3688. items[index].focus();
  3689. };
  3690. _createClass(Dropdown, null, [{
  3691. key: "VERSION",
  3692. get: function get() {
  3693. return VERSION$4;
  3694. }
  3695. }, {
  3696. key: "Default",
  3697. get: function get() {
  3698. return Default$2;
  3699. }
  3700. }, {
  3701. key: "DefaultType",
  3702. get: function get() {
  3703. return DefaultType$2;
  3704. }
  3705. }]);
  3706. return Dropdown;
  3707. }();
  3708. /**
  3709. * ------------------------------------------------------------------------
  3710. * Data Api implementation
  3711. * ------------------------------------------------------------------------
  3712. */
  3713. $(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) {
  3714. event.preventDefault();
  3715. event.stopPropagation();
  3716. Dropdown._jQueryInterface.call($(this), 'toggle');
  3717. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3718. e.stopPropagation();
  3719. });
  3720. /**
  3721. * ------------------------------------------------------------------------
  3722. * jQuery
  3723. * ------------------------------------------------------------------------
  3724. */
  3725. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3726. $.fn[NAME$4].Constructor = Dropdown;
  3727. $.fn[NAME$4].noConflict = function () {
  3728. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3729. return Dropdown._jQueryInterface;
  3730. };
  3731. /**
  3732. * ------------------------------------------------------------------------
  3733. * Constants
  3734. * ------------------------------------------------------------------------
  3735. */
  3736. var NAME$5 = 'modal';
  3737. var VERSION$5 = '4.4.1';
  3738. var DATA_KEY$5 = 'bs.modal';
  3739. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3740. var DATA_API_KEY$5 = '.data-api';
  3741. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3742. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3743. var Default$3 = {
  3744. backdrop: true,
  3745. keyboard: true,
  3746. focus: true,
  3747. show: true
  3748. };
  3749. var DefaultType$3 = {
  3750. backdrop: '(boolean|string)',
  3751. keyboard: 'boolean',
  3752. focus: 'boolean',
  3753. show: 'boolean'
  3754. };
  3755. var Event$5 = {
  3756. HIDE: "hide" + EVENT_KEY$5,
  3757. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3758. HIDDEN: "hidden" + EVENT_KEY$5,
  3759. SHOW: "show" + EVENT_KEY$5,
  3760. SHOWN: "shown" + EVENT_KEY$5,
  3761. FOCUSIN: "focusin" + EVENT_KEY$5,
  3762. RESIZE: "resize" + EVENT_KEY$5,
  3763. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3764. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3765. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3766. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3767. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3768. };
  3769. var ClassName$5 = {
  3770. SCROLLABLE: 'modal-dialog-scrollable',
  3771. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3772. BACKDROP: 'modal-backdrop',
  3773. OPEN: 'modal-open',
  3774. FADE: 'fade',
  3775. SHOW: 'show',
  3776. STATIC: 'modal-static'
  3777. };
  3778. var Selector$5 = {
  3779. DIALOG: '.modal-dialog',
  3780. MODAL_BODY: '.modal-body',
  3781. DATA_TOGGLE: '[data-toggle="modal"]',
  3782. DATA_DISMISS: '[data-dismiss="modal"]',
  3783. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3784. STICKY_CONTENT: '.sticky-top'
  3785. };
  3786. /**
  3787. * ------------------------------------------------------------------------
  3788. * Class Definition
  3789. * ------------------------------------------------------------------------
  3790. */
  3791. var Modal =
  3792. /*#__PURE__*/
  3793. function () {
  3794. function Modal(element, config) {
  3795. this._config = this._getConfig(config);
  3796. this._element = element;
  3797. this._dialog = element.querySelector(Selector$5.DIALOG);
  3798. this._backdrop = null;
  3799. this._isShown = false;
  3800. this._isBodyOverflowing = false;
  3801. this._ignoreBackdropClick = false;
  3802. this._isTransitioning = false;
  3803. this._scrollbarWidth = 0;
  3804. } // Getters
  3805. var _proto = Modal.prototype;
  3806. // Public
  3807. _proto.toggle = function toggle(relatedTarget) {
  3808. return this._isShown ? this.hide() : this.show(relatedTarget);
  3809. };
  3810. _proto.show = function show(relatedTarget) {
  3811. var _this = this;
  3812. if (this._isShown || this._isTransitioning) {
  3813. return;
  3814. }
  3815. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3816. this._isTransitioning = true;
  3817. }
  3818. var showEvent = $.Event(Event$5.SHOW, {
  3819. relatedTarget: relatedTarget
  3820. });
  3821. $(this._element).trigger(showEvent);
  3822. if (this._isShown || showEvent.isDefaultPrevented()) {
  3823. return;
  3824. }
  3825. this._isShown = true;
  3826. this._checkScrollbar();
  3827. this._setScrollbar();
  3828. this._adjustDialog();
  3829. this._setEscapeEvent();
  3830. this._setResizeEvent();
  3831. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3832. return _this.hide(event);
  3833. });
  3834. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3835. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3836. if ($(event.target).is(_this._element)) {
  3837. _this._ignoreBackdropClick = true;
  3838. }
  3839. });
  3840. });
  3841. this._showBackdrop(function () {
  3842. return _this._showElement(relatedTarget);
  3843. });
  3844. };
  3845. _proto.hide = function hide(event) {
  3846. var _this2 = this;
  3847. if (event) {
  3848. event.preventDefault();
  3849. }
  3850. if (!this._isShown || this._isTransitioning) {
  3851. return;
  3852. }
  3853. var hideEvent = $.Event(Event$5.HIDE);
  3854. $(this._element).trigger(hideEvent);
  3855. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3856. return;
  3857. }
  3858. this._isShown = false;
  3859. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3860. if (transition) {
  3861. this._isTransitioning = true;
  3862. }
  3863. this._setEscapeEvent();
  3864. this._setResizeEvent();
  3865. $(document).off(Event$5.FOCUSIN);
  3866. $(this._element).removeClass(ClassName$5.SHOW);
  3867. $(this._element).off(Event$5.CLICK_DISMISS);
  3868. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3869. if (transition) {
  3870. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3871. $(this._element).one(Util.TRANSITION_END, function (event) {
  3872. return _this2._hideModal(event);
  3873. }).emulateTransitionEnd(transitionDuration);
  3874. } else {
  3875. this._hideModal();
  3876. }
  3877. };
  3878. _proto.dispose = function dispose() {
  3879. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3880. return $(htmlElement).off(EVENT_KEY$5);
  3881. });
  3882. /**
  3883. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3884. * Do not move `document` in `htmlElements` array
  3885. * It will remove `Event.CLICK_DATA_API` event that should remain
  3886. */
  3887. $(document).off(Event$5.FOCUSIN);
  3888. $.removeData(this._element, DATA_KEY$5);
  3889. this._config = null;
  3890. this._element = null;
  3891. this._dialog = null;
  3892. this._backdrop = null;
  3893. this._isShown = null;
  3894. this._isBodyOverflowing = null;
  3895. this._ignoreBackdropClick = null;
  3896. this._isTransitioning = null;
  3897. this._scrollbarWidth = null;
  3898. };
  3899. _proto.handleUpdate = function handleUpdate() {
  3900. this._adjustDialog();
  3901. } // Private
  3902. ;
  3903. _proto._getConfig = function _getConfig(config) {
  3904. config = _objectSpread2({}, Default$3, {}, config);
  3905. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3906. return config;
  3907. };
  3908. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3909. var _this3 = this;
  3910. if (this._config.backdrop === 'static') {
  3911. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3912. $(this._element).trigger(hideEventPrevented);
  3913. if (hideEventPrevented.defaultPrevented) {
  3914. return;
  3915. }
  3916. this._element.classList.add(ClassName$5.STATIC);
  3917. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3918. $(this._element).one(Util.TRANSITION_END, function () {
  3919. _this3._element.classList.remove(ClassName$5.STATIC);
  3920. }).emulateTransitionEnd(modalTransitionDuration);
  3921. this._element.focus();
  3922. } else {
  3923. this.hide();
  3924. }
  3925. };
  3926. _proto._showElement = function _showElement(relatedTarget) {
  3927. var _this4 = this;
  3928. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3929. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3930. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3931. // Don't move modal's DOM position
  3932. document.body.appendChild(this._element);
  3933. }
  3934. this._element.style.display = 'block';
  3935. this._element.removeAttribute('aria-hidden');
  3936. this._element.setAttribute('aria-modal', true);
  3937. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3938. modalBody.scrollTop = 0;
  3939. } else {
  3940. this._element.scrollTop = 0;
  3941. }
  3942. if (transition) {
  3943. Util.reflow(this._element);
  3944. }
  3945. $(this._element).addClass(ClassName$5.SHOW);
  3946. if (this._config.focus) {
  3947. this._enforceFocus();
  3948. }
  3949. var shownEvent = $.Event(Event$5.SHOWN, {
  3950. relatedTarget: relatedTarget
  3951. });
  3952. var transitionComplete = function transitionComplete() {
  3953. if (_this4._config.focus) {
  3954. _this4._element.focus();
  3955. }
  3956. _this4._isTransitioning = false;
  3957. $(_this4._element).trigger(shownEvent);
  3958. };
  3959. if (transition) {
  3960. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3961. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3962. } else {
  3963. transitionComplete();
  3964. }
  3965. };
  3966. _proto._enforceFocus = function _enforceFocus() {
  3967. var _this5 = this;
  3968. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3969. .on(Event$5.FOCUSIN, function (event) {
  3970. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3971. _this5._element.focus();
  3972. }
  3973. });
  3974. };
  3975. _proto._setEscapeEvent = function _setEscapeEvent() {
  3976. var _this6 = this;
  3977. if (this._isShown && this._config.keyboard) {
  3978. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3979. if (event.which === ESCAPE_KEYCODE$1) {
  3980. _this6._triggerBackdropTransition();
  3981. }
  3982. });
  3983. } else if (!this._isShown) {
  3984. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3985. }
  3986. };
  3987. _proto._setResizeEvent = function _setResizeEvent() {
  3988. var _this7 = this;
  3989. if (this._isShown) {
  3990. $(window).on(Event$5.RESIZE, function (event) {
  3991. return _this7.handleUpdate(event);
  3992. });
  3993. } else {
  3994. $(window).off(Event$5.RESIZE);
  3995. }
  3996. };
  3997. _proto._hideModal = function _hideModal() {
  3998. var _this8 = this;
  3999. this._element.style.display = 'none';
  4000. this._element.setAttribute('aria-hidden', true);
  4001. this._element.removeAttribute('aria-modal');
  4002. this._isTransitioning = false;
  4003. this._showBackdrop(function () {
  4004. $(document.body).removeClass(ClassName$5.OPEN);
  4005. _this8._resetAdjustments();
  4006. _this8._resetScrollbar();
  4007. $(_this8._element).trigger(Event$5.HIDDEN);
  4008. });
  4009. };
  4010. _proto._removeBackdrop = function _removeBackdrop() {
  4011. if (this._backdrop) {
  4012. $(this._backdrop).remove();
  4013. this._backdrop = null;
  4014. }
  4015. };
  4016. _proto._showBackdrop = function _showBackdrop(callback) {
  4017. var _this9 = this;
  4018. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4019. if (this._isShown && this._config.backdrop) {
  4020. this._backdrop = document.createElement('div');
  4021. this._backdrop.className = ClassName$5.BACKDROP;
  4022. if (animate) {
  4023. this._backdrop.classList.add(animate);
  4024. }
  4025. $(this._backdrop).appendTo(document.body);
  4026. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4027. if (_this9._ignoreBackdropClick) {
  4028. _this9._ignoreBackdropClick = false;
  4029. return;
  4030. }
  4031. if (event.target !== event.currentTarget) {
  4032. return;
  4033. }
  4034. _this9._triggerBackdropTransition();
  4035. });
  4036. if (animate) {
  4037. Util.reflow(this._backdrop);
  4038. }
  4039. $(this._backdrop).addClass(ClassName$5.SHOW);
  4040. if (!callback) {
  4041. return;
  4042. }
  4043. if (!animate) {
  4044. callback();
  4045. return;
  4046. }
  4047. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4048. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4049. } else if (!this._isShown && this._backdrop) {
  4050. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4051. var callbackRemove = function callbackRemove() {
  4052. _this9._removeBackdrop();
  4053. if (callback) {
  4054. callback();
  4055. }
  4056. };
  4057. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4058. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4059. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4060. } else {
  4061. callbackRemove();
  4062. }
  4063. } else if (callback) {
  4064. callback();
  4065. }
  4066. } // ----------------------------------------------------------------------
  4067. // the following methods are used to handle overflowing modals
  4068. // todo (fat): these should probably be refactored out of modal.js
  4069. // ----------------------------------------------------------------------
  4070. ;
  4071. _proto._adjustDialog = function _adjustDialog() {
  4072. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4073. if (!this._isBodyOverflowing && isModalOverflowing) {
  4074. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4075. }
  4076. if (this._isBodyOverflowing && !isModalOverflowing) {
  4077. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4078. }
  4079. };
  4080. _proto._resetAdjustments = function _resetAdjustments() {
  4081. this._element.style.paddingLeft = '';
  4082. this._element.style.paddingRight = '';
  4083. };
  4084. _proto._checkScrollbar = function _checkScrollbar() {
  4085. var rect = document.body.getBoundingClientRect();
  4086. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4087. this._scrollbarWidth = this._getScrollbarWidth();
  4088. };
  4089. _proto._setScrollbar = function _setScrollbar() {
  4090. var _this10 = this;
  4091. if (this._isBodyOverflowing) {
  4092. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4093. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4094. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4095. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4096. $(fixedContent).each(function (index, element) {
  4097. var actualPadding = element.style.paddingRight;
  4098. var calculatedPadding = $(element).css('padding-right');
  4099. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4100. }); // Adjust sticky content margin
  4101. $(stickyContent).each(function (index, element) {
  4102. var actualMargin = element.style.marginRight;
  4103. var calculatedMargin = $(element).css('margin-right');
  4104. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4105. }); // Adjust body padding
  4106. var actualPadding = document.body.style.paddingRight;
  4107. var calculatedPadding = $(document.body).css('padding-right');
  4108. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4109. }
  4110. $(document.body).addClass(ClassName$5.OPEN);
  4111. };
  4112. _proto._resetScrollbar = function _resetScrollbar() {
  4113. // Restore fixed content padding
  4114. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4115. $(fixedContent).each(function (index, element) {
  4116. var padding = $(element).data('padding-right');
  4117. $(element).removeData('padding-right');
  4118. element.style.paddingRight = padding ? padding : '';
  4119. }); // Restore sticky content
  4120. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4121. $(elements).each(function (index, element) {
  4122. var margin = $(element).data('margin-right');
  4123. if (typeof margin !== 'undefined') {
  4124. $(element).css('margin-right', margin).removeData('margin-right');
  4125. }
  4126. }); // Restore body padding
  4127. var padding = $(document.body).data('padding-right');
  4128. $(document.body).removeData('padding-right');
  4129. document.body.style.paddingRight = padding ? padding : '';
  4130. };
  4131. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4132. // thx d.walsh
  4133. var scrollDiv = document.createElement('div');
  4134. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4135. document.body.appendChild(scrollDiv);
  4136. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4137. document.body.removeChild(scrollDiv);
  4138. return scrollbarWidth;
  4139. } // Static
  4140. ;
  4141. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4142. return this.each(function () {
  4143. var data = $(this).data(DATA_KEY$5);
  4144. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4145. if (!data) {
  4146. data = new Modal(this, _config);
  4147. $(this).data(DATA_KEY$5, data);
  4148. }
  4149. if (typeof config === 'string') {
  4150. if (typeof data[config] === 'undefined') {
  4151. throw new TypeError("No method named \"" + config + "\"");
  4152. }
  4153. data[config](relatedTarget);
  4154. } else if (_config.show) {
  4155. data.show(relatedTarget);
  4156. }
  4157. });
  4158. };
  4159. _createClass(Modal, null, [{
  4160. key: "VERSION",
  4161. get: function get() {
  4162. return VERSION$5;
  4163. }
  4164. }, {
  4165. key: "Default",
  4166. get: function get() {
  4167. return Default$3;
  4168. }
  4169. }]);
  4170. return Modal;
  4171. }();
  4172. /**
  4173. * ------------------------------------------------------------------------
  4174. * Data Api implementation
  4175. * ------------------------------------------------------------------------
  4176. */
  4177. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4178. var _this11 = this;
  4179. var target;
  4180. var selector = Util.getSelectorFromElement(this);
  4181. if (selector) {
  4182. target = document.querySelector(selector);
  4183. }
  4184. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4185. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4186. event.preventDefault();
  4187. }
  4188. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4189. if (showEvent.isDefaultPrevented()) {
  4190. // Only register focus restorer if modal will actually get shown
  4191. return;
  4192. }
  4193. $target.one(Event$5.HIDDEN, function () {
  4194. if ($(_this11).is(':visible')) {
  4195. _this11.focus();
  4196. }
  4197. });
  4198. });
  4199. Modal._jQueryInterface.call($(target), config, this);
  4200. });
  4201. /**
  4202. * ------------------------------------------------------------------------
  4203. * jQuery
  4204. * ------------------------------------------------------------------------
  4205. */
  4206. $.fn[NAME$5] = Modal._jQueryInterface;
  4207. $.fn[NAME$5].Constructor = Modal;
  4208. $.fn[NAME$5].noConflict = function () {
  4209. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4210. return Modal._jQueryInterface;
  4211. };
  4212. /**
  4213. * --------------------------------------------------------------------------
  4214. * Bootstrap (v4.4.1): tools/sanitizer.js
  4215. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4216. * --------------------------------------------------------------------------
  4217. */
  4218. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4219. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4220. var DefaultWhitelist = {
  4221. // Global attributes allowed on any supplied element below.
  4222. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4223. a: ['target', 'href', 'title', 'rel'],
  4224. area: [],
  4225. b: [],
  4226. br: [],
  4227. col: [],
  4228. code: [],
  4229. div: [],
  4230. em: [],
  4231. hr: [],
  4232. h1: [],
  4233. h2: [],
  4234. h3: [],
  4235. h4: [],
  4236. h5: [],
  4237. h6: [],
  4238. i: [],
  4239. img: ['src', 'alt', 'title', 'width', 'height'],
  4240. li: [],
  4241. ol: [],
  4242. p: [],
  4243. pre: [],
  4244. s: [],
  4245. small: [],
  4246. span: [],
  4247. sub: [],
  4248. sup: [],
  4249. strong: [],
  4250. u: [],
  4251. ul: []
  4252. };
  4253. /**
  4254. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4255. *
  4256. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4257. */
  4258. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4259. /**
  4260. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4261. *
  4262. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4263. */
  4264. 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;
  4265. function allowedAttribute(attr, allowedAttributeList) {
  4266. var attrName = attr.nodeName.toLowerCase();
  4267. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4268. if (uriAttrs.indexOf(attrName) !== -1) {
  4269. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4270. }
  4271. return true;
  4272. }
  4273. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4274. return attrRegex instanceof RegExp;
  4275. }); // Check if a regular expression validates the attribute.
  4276. for (var i = 0, l = regExp.length; i < l; i++) {
  4277. if (attrName.match(regExp[i])) {
  4278. return true;
  4279. }
  4280. }
  4281. return false;
  4282. }
  4283. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4284. if (unsafeHtml.length === 0) {
  4285. return unsafeHtml;
  4286. }
  4287. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4288. return sanitizeFn(unsafeHtml);
  4289. }
  4290. var domParser = new window.DOMParser();
  4291. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4292. var whitelistKeys = Object.keys(whiteList);
  4293. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4294. var _loop = function _loop(i, len) {
  4295. var el = elements[i];
  4296. var elName = el.nodeName.toLowerCase();
  4297. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4298. el.parentNode.removeChild(el);
  4299. return "continue";
  4300. }
  4301. var attributeList = [].slice.call(el.attributes);
  4302. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4303. attributeList.forEach(function (attr) {
  4304. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4305. el.removeAttribute(attr.nodeName);
  4306. }
  4307. });
  4308. };
  4309. for (var i = 0, len = elements.length; i < len; i++) {
  4310. var _ret = _loop(i);
  4311. if (_ret === "continue") continue;
  4312. }
  4313. return createdDocument.body.innerHTML;
  4314. }
  4315. /**
  4316. * ------------------------------------------------------------------------
  4317. * Constants
  4318. * ------------------------------------------------------------------------
  4319. */
  4320. var NAME$6 = 'tooltip';
  4321. var VERSION$6 = '4.4.1';
  4322. var DATA_KEY$6 = 'bs.tooltip';
  4323. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4324. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4325. var CLASS_PREFIX = 'bs-tooltip';
  4326. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4327. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4328. var DefaultType$4 = {
  4329. animation: 'boolean',
  4330. template: 'string',
  4331. title: '(string|element|function)',
  4332. trigger: 'string',
  4333. delay: '(number|object)',
  4334. html: 'boolean',
  4335. selector: '(string|boolean)',
  4336. placement: '(string|function)',
  4337. offset: '(number|string|function)',
  4338. container: '(string|element|boolean)',
  4339. fallbackPlacement: '(string|array)',
  4340. boundary: '(string|element)',
  4341. sanitize: 'boolean',
  4342. sanitizeFn: '(null|function)',
  4343. whiteList: 'object',
  4344. popperConfig: '(null|object)'
  4345. };
  4346. var AttachmentMap$1 = {
  4347. AUTO: 'auto',
  4348. TOP: 'top',
  4349. RIGHT: 'right',
  4350. BOTTOM: 'bottom',
  4351. LEFT: 'left'
  4352. };
  4353. var Default$4 = {
  4354. animation: true,
  4355. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4356. trigger: 'hover focus',
  4357. title: '',
  4358. delay: 0,
  4359. html: false,
  4360. selector: false,
  4361. placement: 'top',
  4362. offset: 0,
  4363. container: false,
  4364. fallbackPlacement: 'flip',
  4365. boundary: 'scrollParent',
  4366. sanitize: true,
  4367. sanitizeFn: null,
  4368. whiteList: DefaultWhitelist,
  4369. popperConfig: null
  4370. };
  4371. var HoverState = {
  4372. SHOW: 'show',
  4373. OUT: 'out'
  4374. };
  4375. var Event$6 = {
  4376. HIDE: "hide" + EVENT_KEY$6,
  4377. HIDDEN: "hidden" + EVENT_KEY$6,
  4378. SHOW: "show" + EVENT_KEY$6,
  4379. SHOWN: "shown" + EVENT_KEY$6,
  4380. INSERTED: "inserted" + EVENT_KEY$6,
  4381. CLICK: "click" + EVENT_KEY$6,
  4382. FOCUSIN: "focusin" + EVENT_KEY$6,
  4383. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4384. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4385. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4386. };
  4387. var ClassName$6 = {
  4388. FADE: 'fade',
  4389. SHOW: 'show'
  4390. };
  4391. var Selector$6 = {
  4392. TOOLTIP: '.tooltip',
  4393. TOOLTIP_INNER: '.tooltip-inner',
  4394. ARROW: '.arrow'
  4395. };
  4396. var Trigger = {
  4397. HOVER: 'hover',
  4398. FOCUS: 'focus',
  4399. CLICK: 'click',
  4400. MANUAL: 'manual'
  4401. };
  4402. /**
  4403. * ------------------------------------------------------------------------
  4404. * Class Definition
  4405. * ------------------------------------------------------------------------
  4406. */
  4407. var Tooltip =
  4408. /*#__PURE__*/
  4409. function () {
  4410. function Tooltip(element, config) {
  4411. if (typeof Popper === 'undefined') {
  4412. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4413. } // private
  4414. this._isEnabled = true;
  4415. this._timeout = 0;
  4416. this._hoverState = '';
  4417. this._activeTrigger = {};
  4418. this._popper = null; // Protected
  4419. this.element = element;
  4420. this.config = this._getConfig(config);
  4421. this.tip = null;
  4422. this._setListeners();
  4423. } // Getters
  4424. var _proto = Tooltip.prototype;
  4425. // Public
  4426. _proto.enable = function enable() {
  4427. this._isEnabled = true;
  4428. };
  4429. _proto.disable = function disable() {
  4430. this._isEnabled = false;
  4431. };
  4432. _proto.toggleEnabled = function toggleEnabled() {
  4433. this._isEnabled = !this._isEnabled;
  4434. };
  4435. _proto.toggle = function toggle(event) {
  4436. if (!this._isEnabled) {
  4437. return;
  4438. }
  4439. if (event) {
  4440. var dataKey = this.constructor.DATA_KEY;
  4441. var context = $(event.currentTarget).data(dataKey);
  4442. if (!context) {
  4443. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4444. $(event.currentTarget).data(dataKey, context);
  4445. }
  4446. context._activeTrigger.click = !context._activeTrigger.click;
  4447. if (context._isWithActiveTrigger()) {
  4448. context._enter(null, context);
  4449. } else {
  4450. context._leave(null, context);
  4451. }
  4452. } else {
  4453. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4454. this._leave(null, this);
  4455. return;
  4456. }
  4457. this._enter(null, this);
  4458. }
  4459. };
  4460. _proto.dispose = function dispose() {
  4461. clearTimeout(this._timeout);
  4462. $.removeData(this.element, this.constructor.DATA_KEY);
  4463. $(this.element).off(this.constructor.EVENT_KEY);
  4464. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4465. if (this.tip) {
  4466. $(this.tip).remove();
  4467. }
  4468. this._isEnabled = null;
  4469. this._timeout = null;
  4470. this._hoverState = null;
  4471. this._activeTrigger = null;
  4472. if (this._popper) {
  4473. this._popper.destroy();
  4474. }
  4475. this._popper = null;
  4476. this.element = null;
  4477. this.config = null;
  4478. this.tip = null;
  4479. };
  4480. _proto.show = function show() {
  4481. var _this = this;
  4482. if ($(this.element).css('display') === 'none') {
  4483. throw new Error('Please use show on visible elements');
  4484. }
  4485. var showEvent = $.Event(this.constructor.Event.SHOW);
  4486. if (this.isWithContent() && this._isEnabled) {
  4487. $(this.element).trigger(showEvent);
  4488. var shadowRoot = Util.findShadowRoot(this.element);
  4489. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4490. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4491. return;
  4492. }
  4493. var tip = this.getTipElement();
  4494. var tipId = Util.getUID(this.constructor.NAME);
  4495. tip.setAttribute('id', tipId);
  4496. this.element.setAttribute('aria-describedby', tipId);
  4497. this.setContent();
  4498. if (this.config.animation) {
  4499. $(tip).addClass(ClassName$6.FADE);
  4500. }
  4501. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4502. var attachment = this._getAttachment(placement);
  4503. this.addAttachmentClass(attachment);
  4504. var container = this._getContainer();
  4505. $(tip).data(this.constructor.DATA_KEY, this);
  4506. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4507. $(tip).appendTo(container);
  4508. }
  4509. $(this.element).trigger(this.constructor.Event.INSERTED);
  4510. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4511. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4512. // empty mouseover listeners to the body's immediate children;
  4513. // only needed because of broken event delegation on iOS
  4514. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4515. if ('ontouchstart' in document.documentElement) {
  4516. $(document.body).children().on('mouseover', null, $.noop);
  4517. }
  4518. var complete = function complete() {
  4519. if (_this.config.animation) {
  4520. _this._fixTransition();
  4521. }
  4522. var prevHoverState = _this._hoverState;
  4523. _this._hoverState = null;
  4524. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4525. if (prevHoverState === HoverState.OUT) {
  4526. _this._leave(null, _this);
  4527. }
  4528. };
  4529. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4530. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4531. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4532. } else {
  4533. complete();
  4534. }
  4535. }
  4536. };
  4537. _proto.hide = function hide(callback) {
  4538. var _this2 = this;
  4539. var tip = this.getTipElement();
  4540. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4541. var complete = function complete() {
  4542. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4543. tip.parentNode.removeChild(tip);
  4544. }
  4545. _this2._cleanTipClass();
  4546. _this2.element.removeAttribute('aria-describedby');
  4547. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4548. if (_this2._popper !== null) {
  4549. _this2._popper.destroy();
  4550. }
  4551. if (callback) {
  4552. callback();
  4553. }
  4554. };
  4555. $(this.element).trigger(hideEvent);
  4556. if (hideEvent.isDefaultPrevented()) {
  4557. return;
  4558. }
  4559. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4560. // empty mouseover listeners we added for iOS support
  4561. if ('ontouchstart' in document.documentElement) {
  4562. $(document.body).children().off('mouseover', null, $.noop);
  4563. }
  4564. this._activeTrigger[Trigger.CLICK] = false;
  4565. this._activeTrigger[Trigger.FOCUS] = false;
  4566. this._activeTrigger[Trigger.HOVER] = false;
  4567. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4568. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4569. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4570. } else {
  4571. complete();
  4572. }
  4573. this._hoverState = '';
  4574. };
  4575. _proto.update = function update() {
  4576. if (this._popper !== null) {
  4577. this._popper.scheduleUpdate();
  4578. }
  4579. } // Protected
  4580. ;
  4581. _proto.isWithContent = function isWithContent() {
  4582. return Boolean(this.getTitle());
  4583. };
  4584. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4585. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4586. };
  4587. _proto.getTipElement = function getTipElement() {
  4588. this.tip = this.tip || $(this.config.template)[0];
  4589. return this.tip;
  4590. };
  4591. _proto.setContent = function setContent() {
  4592. var tip = this.getTipElement();
  4593. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4594. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4595. };
  4596. _proto.setElementContent = function setElementContent($element, content) {
  4597. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4598. // Content is a DOM node or a jQuery
  4599. if (this.config.html) {
  4600. if (!$(content).parent().is($element)) {
  4601. $element.empty().append(content);
  4602. }
  4603. } else {
  4604. $element.text($(content).text());
  4605. }
  4606. return;
  4607. }
  4608. if (this.config.html) {
  4609. if (this.config.sanitize) {
  4610. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4611. }
  4612. $element.html(content);
  4613. } else {
  4614. $element.text(content);
  4615. }
  4616. };
  4617. _proto.getTitle = function getTitle() {
  4618. var title = this.element.getAttribute('data-original-title');
  4619. if (!title) {
  4620. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4621. }
  4622. return title;
  4623. } // Private
  4624. ;
  4625. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4626. var _this3 = this;
  4627. var defaultBsConfig = {
  4628. placement: attachment,
  4629. modifiers: {
  4630. offset: this._getOffset(),
  4631. flip: {
  4632. behavior: this.config.fallbackPlacement
  4633. },
  4634. arrow: {
  4635. element: Selector$6.ARROW
  4636. },
  4637. preventOverflow: {
  4638. boundariesElement: this.config.boundary
  4639. }
  4640. },
  4641. onCreate: function onCreate(data) {
  4642. if (data.originalPlacement !== data.placement) {
  4643. _this3._handlePopperPlacementChange(data);
  4644. }
  4645. },
  4646. onUpdate: function onUpdate(data) {
  4647. return _this3._handlePopperPlacementChange(data);
  4648. }
  4649. };
  4650. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4651. };
  4652. _proto._getOffset = function _getOffset() {
  4653. var _this4 = this;
  4654. var offset = {};
  4655. if (typeof this.config.offset === 'function') {
  4656. offset.fn = function (data) {
  4657. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4658. return data;
  4659. };
  4660. } else {
  4661. offset.offset = this.config.offset;
  4662. }
  4663. return offset;
  4664. };
  4665. _proto._getContainer = function _getContainer() {
  4666. if (this.config.container === false) {
  4667. return document.body;
  4668. }
  4669. if (Util.isElement(this.config.container)) {
  4670. return $(this.config.container);
  4671. }
  4672. return $(document).find(this.config.container);
  4673. };
  4674. _proto._getAttachment = function _getAttachment(placement) {
  4675. return AttachmentMap$1[placement.toUpperCase()];
  4676. };
  4677. _proto._setListeners = function _setListeners() {
  4678. var _this5 = this;
  4679. var triggers = this.config.trigger.split(' ');
  4680. triggers.forEach(function (trigger) {
  4681. if (trigger === 'click') {
  4682. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4683. return _this5.toggle(event);
  4684. });
  4685. } else if (trigger !== Trigger.MANUAL) {
  4686. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4687. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4688. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4689. return _this5._enter(event);
  4690. }).on(eventOut, _this5.config.selector, function (event) {
  4691. return _this5._leave(event);
  4692. });
  4693. }
  4694. });
  4695. this._hideModalHandler = function () {
  4696. if (_this5.element) {
  4697. _this5.hide();
  4698. }
  4699. };
  4700. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4701. if (this.config.selector) {
  4702. this.config = _objectSpread2({}, this.config, {
  4703. trigger: 'manual',
  4704. selector: ''
  4705. });
  4706. } else {
  4707. this._fixTitle();
  4708. }
  4709. };
  4710. _proto._fixTitle = function _fixTitle() {
  4711. var titleType = typeof this.element.getAttribute('data-original-title');
  4712. if (this.element.getAttribute('title') || titleType !== 'string') {
  4713. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4714. this.element.setAttribute('title', '');
  4715. }
  4716. };
  4717. _proto._enter = function _enter(event, context) {
  4718. var dataKey = this.constructor.DATA_KEY;
  4719. context = context || $(event.currentTarget).data(dataKey);
  4720. if (!context) {
  4721. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4722. $(event.currentTarget).data(dataKey, context);
  4723. }
  4724. if (event) {
  4725. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4726. }
  4727. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4728. context._hoverState = HoverState.SHOW;
  4729. return;
  4730. }
  4731. clearTimeout(context._timeout);
  4732. context._hoverState = HoverState.SHOW;
  4733. if (!context.config.delay || !context.config.delay.show) {
  4734. context.show();
  4735. return;
  4736. }
  4737. context._timeout = setTimeout(function () {
  4738. if (context._hoverState === HoverState.SHOW) {
  4739. context.show();
  4740. }
  4741. }, context.config.delay.show);
  4742. };
  4743. _proto._leave = function _leave(event, context) {
  4744. var dataKey = this.constructor.DATA_KEY;
  4745. context = context || $(event.currentTarget).data(dataKey);
  4746. if (!context) {
  4747. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4748. $(event.currentTarget).data(dataKey, context);
  4749. }
  4750. if (event) {
  4751. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4752. }
  4753. if (context._isWithActiveTrigger()) {
  4754. return;
  4755. }
  4756. clearTimeout(context._timeout);
  4757. context._hoverState = HoverState.OUT;
  4758. if (!context.config.delay || !context.config.delay.hide) {
  4759. context.hide();
  4760. return;
  4761. }
  4762. context._timeout = setTimeout(function () {
  4763. if (context._hoverState === HoverState.OUT) {
  4764. context.hide();
  4765. }
  4766. }, context.config.delay.hide);
  4767. };
  4768. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4769. for (var trigger in this._activeTrigger) {
  4770. if (this._activeTrigger[trigger]) {
  4771. return true;
  4772. }
  4773. }
  4774. return false;
  4775. };
  4776. _proto._getConfig = function _getConfig(config) {
  4777. var dataAttributes = $(this.element).data();
  4778. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4779. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4780. delete dataAttributes[dataAttr];
  4781. }
  4782. });
  4783. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4784. if (typeof config.delay === 'number') {
  4785. config.delay = {
  4786. show: config.delay,
  4787. hide: config.delay
  4788. };
  4789. }
  4790. if (typeof config.title === 'number') {
  4791. config.title = config.title.toString();
  4792. }
  4793. if (typeof config.content === 'number') {
  4794. config.content = config.content.toString();
  4795. }
  4796. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4797. if (config.sanitize) {
  4798. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4799. }
  4800. return config;
  4801. };
  4802. _proto._getDelegateConfig = function _getDelegateConfig() {
  4803. var config = {};
  4804. if (this.config) {
  4805. for (var key in this.config) {
  4806. if (this.constructor.Default[key] !== this.config[key]) {
  4807. config[key] = this.config[key];
  4808. }
  4809. }
  4810. }
  4811. return config;
  4812. };
  4813. _proto._cleanTipClass = function _cleanTipClass() {
  4814. var $tip = $(this.getTipElement());
  4815. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4816. if (tabClass !== null && tabClass.length) {
  4817. $tip.removeClass(tabClass.join(''));
  4818. }
  4819. };
  4820. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4821. var popperInstance = popperData.instance;
  4822. this.tip = popperInstance.popper;
  4823. this._cleanTipClass();
  4824. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4825. };
  4826. _proto._fixTransition = function _fixTransition() {
  4827. var tip = this.getTipElement();
  4828. var initConfigAnimation = this.config.animation;
  4829. if (tip.getAttribute('x-placement') !== null) {
  4830. return;
  4831. }
  4832. $(tip).removeClass(ClassName$6.FADE);
  4833. this.config.animation = false;
  4834. this.hide();
  4835. this.show();
  4836. this.config.animation = initConfigAnimation;
  4837. } // Static
  4838. ;
  4839. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4840. return this.each(function () {
  4841. var data = $(this).data(DATA_KEY$6);
  4842. var _config = typeof config === 'object' && config;
  4843. if (!data && /dispose|hide/.test(config)) {
  4844. return;
  4845. }
  4846. if (!data) {
  4847. data = new Tooltip(this, _config);
  4848. $(this).data(DATA_KEY$6, data);
  4849. }
  4850. if (typeof config === 'string') {
  4851. if (typeof data[config] === 'undefined') {
  4852. throw new TypeError("No method named \"" + config + "\"");
  4853. }
  4854. data[config]();
  4855. }
  4856. });
  4857. };
  4858. _createClass(Tooltip, null, [{
  4859. key: "VERSION",
  4860. get: function get() {
  4861. return VERSION$6;
  4862. }
  4863. }, {
  4864. key: "Default",
  4865. get: function get() {
  4866. return Default$4;
  4867. }
  4868. }, {
  4869. key: "NAME",
  4870. get: function get() {
  4871. return NAME$6;
  4872. }
  4873. }, {
  4874. key: "DATA_KEY",
  4875. get: function get() {
  4876. return DATA_KEY$6;
  4877. }
  4878. }, {
  4879. key: "Event",
  4880. get: function get() {
  4881. return Event$6;
  4882. }
  4883. }, {
  4884. key: "EVENT_KEY",
  4885. get: function get() {
  4886. return EVENT_KEY$6;
  4887. }
  4888. }, {
  4889. key: "DefaultType",
  4890. get: function get() {
  4891. return DefaultType$4;
  4892. }
  4893. }]);
  4894. return Tooltip;
  4895. }();
  4896. /**
  4897. * ------------------------------------------------------------------------
  4898. * jQuery
  4899. * ------------------------------------------------------------------------
  4900. */
  4901. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4902. $.fn[NAME$6].Constructor = Tooltip;
  4903. $.fn[NAME$6].noConflict = function () {
  4904. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4905. return Tooltip._jQueryInterface;
  4906. };
  4907. /**
  4908. * ------------------------------------------------------------------------
  4909. * Constants
  4910. * ------------------------------------------------------------------------
  4911. */
  4912. var NAME$7 = 'popover';
  4913. var VERSION$7 = '4.4.1';
  4914. var DATA_KEY$7 = 'bs.popover';
  4915. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4916. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4917. var CLASS_PREFIX$1 = 'bs-popover';
  4918. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4919. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4920. placement: 'right',
  4921. trigger: 'click',
  4922. content: '',
  4923. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4924. });
  4925. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4926. content: '(string|element|function)'
  4927. });
  4928. var ClassName$7 = {
  4929. FADE: 'fade',
  4930. SHOW: 'show'
  4931. };
  4932. var Selector$7 = {
  4933. TITLE: '.popover-header',
  4934. CONTENT: '.popover-body'
  4935. };
  4936. var Event$7 = {
  4937. HIDE: "hide" + EVENT_KEY$7,
  4938. HIDDEN: "hidden" + EVENT_KEY$7,
  4939. SHOW: "show" + EVENT_KEY$7,
  4940. SHOWN: "shown" + EVENT_KEY$7,
  4941. INSERTED: "inserted" + EVENT_KEY$7,
  4942. CLICK: "click" + EVENT_KEY$7,
  4943. FOCUSIN: "focusin" + EVENT_KEY$7,
  4944. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4945. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4946. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4947. };
  4948. /**
  4949. * ------------------------------------------------------------------------
  4950. * Class Definition
  4951. * ------------------------------------------------------------------------
  4952. */
  4953. var Popover =
  4954. /*#__PURE__*/
  4955. function (_Tooltip) {
  4956. _inheritsLoose(Popover, _Tooltip);
  4957. function Popover() {
  4958. return _Tooltip.apply(this, arguments) || this;
  4959. }
  4960. var _proto = Popover.prototype;
  4961. // Overrides
  4962. _proto.isWithContent = function isWithContent() {
  4963. return this.getTitle() || this._getContent();
  4964. };
  4965. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4966. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4967. };
  4968. _proto.getTipElement = function getTipElement() {
  4969. this.tip = this.tip || $(this.config.template)[0];
  4970. return this.tip;
  4971. };
  4972. _proto.setContent = function setContent() {
  4973. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4974. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4975. var content = this._getContent();
  4976. if (typeof content === 'function') {
  4977. content = content.call(this.element);
  4978. }
  4979. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4980. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4981. } // Private
  4982. ;
  4983. _proto._getContent = function _getContent() {
  4984. return this.element.getAttribute('data-content') || this.config.content;
  4985. };
  4986. _proto._cleanTipClass = function _cleanTipClass() {
  4987. var $tip = $(this.getTipElement());
  4988. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4989. if (tabClass !== null && tabClass.length > 0) {
  4990. $tip.removeClass(tabClass.join(''));
  4991. }
  4992. } // Static
  4993. ;
  4994. Popover._jQueryInterface = function _jQueryInterface(config) {
  4995. return this.each(function () {
  4996. var data = $(this).data(DATA_KEY$7);
  4997. var _config = typeof config === 'object' ? config : null;
  4998. if (!data && /dispose|hide/.test(config)) {
  4999. return;
  5000. }
  5001. if (!data) {
  5002. data = new Popover(this, _config);
  5003. $(this).data(DATA_KEY$7, data);
  5004. }
  5005. if (typeof config === 'string') {
  5006. if (typeof data[config] === 'undefined') {
  5007. throw new TypeError("No method named \"" + config + "\"");
  5008. }
  5009. data[config]();
  5010. }
  5011. });
  5012. };
  5013. _createClass(Popover, null, [{
  5014. key: "VERSION",
  5015. // Getters
  5016. get: function get() {
  5017. return VERSION$7;
  5018. }
  5019. }, {
  5020. key: "Default",
  5021. get: function get() {
  5022. return Default$5;
  5023. }
  5024. }, {
  5025. key: "NAME",
  5026. get: function get() {
  5027. return NAME$7;
  5028. }
  5029. }, {
  5030. key: "DATA_KEY",
  5031. get: function get() {
  5032. return DATA_KEY$7;
  5033. }
  5034. }, {
  5035. key: "Event",
  5036. get: function get() {
  5037. return Event$7;
  5038. }
  5039. }, {
  5040. key: "EVENT_KEY",
  5041. get: function get() {
  5042. return EVENT_KEY$7;
  5043. }
  5044. }, {
  5045. key: "DefaultType",
  5046. get: function get() {
  5047. return DefaultType$5;
  5048. }
  5049. }]);
  5050. return Popover;
  5051. }(Tooltip);
  5052. /**
  5053. * ------------------------------------------------------------------------
  5054. * jQuery
  5055. * ------------------------------------------------------------------------
  5056. */
  5057. $.fn[NAME$7] = Popover._jQueryInterface;
  5058. $.fn[NAME$7].Constructor = Popover;
  5059. $.fn[NAME$7].noConflict = function () {
  5060. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5061. return Popover._jQueryInterface;
  5062. };
  5063. /**
  5064. * ------------------------------------------------------------------------
  5065. * Constants
  5066. * ------------------------------------------------------------------------
  5067. */
  5068. var NAME$8 = 'scrollspy';
  5069. var VERSION$8 = '4.4.1';
  5070. var DATA_KEY$8 = 'bs.scrollspy';
  5071. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5072. var DATA_API_KEY$6 = '.data-api';
  5073. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5074. var Default$6 = {
  5075. offset: 10,
  5076. method: 'auto',
  5077. target: ''
  5078. };
  5079. var DefaultType$6 = {
  5080. offset: 'number',
  5081. method: 'string',
  5082. target: '(string|element)'
  5083. };
  5084. var Event$8 = {
  5085. ACTIVATE: "activate" + EVENT_KEY$8,
  5086. SCROLL: "scroll" + EVENT_KEY$8,
  5087. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5088. };
  5089. var ClassName$8 = {
  5090. DROPDOWN_ITEM: 'dropdown-item',
  5091. DROPDOWN_MENU: 'dropdown-menu',
  5092. ACTIVE: 'active'
  5093. };
  5094. var Selector$8 = {
  5095. DATA_SPY: '[data-spy="scroll"]',
  5096. ACTIVE: '.active',
  5097. NAV_LIST_GROUP: '.nav, .list-group',
  5098. NAV_LINKS: '.nav-link',
  5099. NAV_ITEMS: '.nav-item',
  5100. LIST_ITEMS: '.list-group-item',
  5101. DROPDOWN: '.dropdown',
  5102. DROPDOWN_ITEMS: '.dropdown-item',
  5103. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5104. };
  5105. var OffsetMethod = {
  5106. OFFSET: 'offset',
  5107. POSITION: 'position'
  5108. };
  5109. /**
  5110. * ------------------------------------------------------------------------
  5111. * Class Definition
  5112. * ------------------------------------------------------------------------
  5113. */
  5114. var ScrollSpy =
  5115. /*#__PURE__*/
  5116. function () {
  5117. function ScrollSpy(element, config) {
  5118. var _this = this;
  5119. this._element = element;
  5120. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5121. this._config = this._getConfig(config);
  5122. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5123. this._offsets = [];
  5124. this._targets = [];
  5125. this._activeTarget = null;
  5126. this._scrollHeight = 0;
  5127. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5128. return _this._process(event);
  5129. });
  5130. this.refresh();
  5131. this._process();
  5132. } // Getters
  5133. var _proto = ScrollSpy.prototype;
  5134. // Public
  5135. _proto.refresh = function refresh() {
  5136. var _this2 = this;
  5137. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5138. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5139. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5140. this._offsets = [];
  5141. this._targets = [];
  5142. this._scrollHeight = this._getScrollHeight();
  5143. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5144. targets.map(function (element) {
  5145. var target;
  5146. var targetSelector = Util.getSelectorFromElement(element);
  5147. if (targetSelector) {
  5148. target = document.querySelector(targetSelector);
  5149. }
  5150. if (target) {
  5151. var targetBCR = target.getBoundingClientRect();
  5152. if (targetBCR.width || targetBCR.height) {
  5153. // TODO (fat): remove sketch reliance on jQuery position/offset
  5154. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5155. }
  5156. }
  5157. return null;
  5158. }).filter(function (item) {
  5159. return item;
  5160. }).sort(function (a, b) {
  5161. return a[0] - b[0];
  5162. }).forEach(function (item) {
  5163. _this2._offsets.push(item[0]);
  5164. _this2._targets.push(item[1]);
  5165. });
  5166. };
  5167. _proto.dispose = function dispose() {
  5168. $.removeData(this._element, DATA_KEY$8);
  5169. $(this._scrollElement).off(EVENT_KEY$8);
  5170. this._element = null;
  5171. this._scrollElement = null;
  5172. this._config = null;
  5173. this._selector = null;
  5174. this._offsets = null;
  5175. this._targets = null;
  5176. this._activeTarget = null;
  5177. this._scrollHeight = null;
  5178. } // Private
  5179. ;
  5180. _proto._getConfig = function _getConfig(config) {
  5181. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5182. if (typeof config.target !== 'string') {
  5183. var id = $(config.target).attr('id');
  5184. if (!id) {
  5185. id = Util.getUID(NAME$8);
  5186. $(config.target).attr('id', id);
  5187. }
  5188. config.target = "#" + id;
  5189. }
  5190. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5191. return config;
  5192. };
  5193. _proto._getScrollTop = function _getScrollTop() {
  5194. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5195. };
  5196. _proto._getScrollHeight = function _getScrollHeight() {
  5197. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5198. };
  5199. _proto._getOffsetHeight = function _getOffsetHeight() {
  5200. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5201. };
  5202. _proto._process = function _process() {
  5203. var scrollTop = this._getScrollTop() + this._config.offset;
  5204. var scrollHeight = this._getScrollHeight();
  5205. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5206. if (this._scrollHeight !== scrollHeight) {
  5207. this.refresh();
  5208. }
  5209. if (scrollTop >= maxScroll) {
  5210. var target = this._targets[this._targets.length - 1];
  5211. if (this._activeTarget !== target) {
  5212. this._activate(target);
  5213. }
  5214. return;
  5215. }
  5216. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5217. this._activeTarget = null;
  5218. this._clear();
  5219. return;
  5220. }
  5221. var offsetLength = this._offsets.length;
  5222. for (var i = offsetLength; i--;) {
  5223. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5224. if (isActiveTarget) {
  5225. this._activate(this._targets[i]);
  5226. }
  5227. }
  5228. };
  5229. _proto._activate = function _activate(target) {
  5230. this._activeTarget = target;
  5231. this._clear();
  5232. var queries = this._selector.split(',').map(function (selector) {
  5233. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5234. });
  5235. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5236. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5237. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5238. $link.addClass(ClassName$8.ACTIVE);
  5239. } else {
  5240. // Set triggered link as active
  5241. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5242. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5243. $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
  5244. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5245. }
  5246. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5247. relatedTarget: target
  5248. });
  5249. };
  5250. _proto._clear = function _clear() {
  5251. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5252. return node.classList.contains(ClassName$8.ACTIVE);
  5253. }).forEach(function (node) {
  5254. return node.classList.remove(ClassName$8.ACTIVE);
  5255. });
  5256. } // Static
  5257. ;
  5258. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5259. return this.each(function () {
  5260. var data = $(this).data(DATA_KEY$8);
  5261. var _config = typeof config === 'object' && config;
  5262. if (!data) {
  5263. data = new ScrollSpy(this, _config);
  5264. $(this).data(DATA_KEY$8, data);
  5265. }
  5266. if (typeof config === 'string') {
  5267. if (typeof data[config] === 'undefined') {
  5268. throw new TypeError("No method named \"" + config + "\"");
  5269. }
  5270. data[config]();
  5271. }
  5272. });
  5273. };
  5274. _createClass(ScrollSpy, null, [{
  5275. key: "VERSION",
  5276. get: function get() {
  5277. return VERSION$8;
  5278. }
  5279. }, {
  5280. key: "Default",
  5281. get: function get() {
  5282. return Default$6;
  5283. }
  5284. }]);
  5285. return ScrollSpy;
  5286. }();
  5287. /**
  5288. * ------------------------------------------------------------------------
  5289. * Data Api implementation
  5290. * ------------------------------------------------------------------------
  5291. */
  5292. $(window).on(Event$8.LOAD_DATA_API, function () {
  5293. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5294. var scrollSpysLength = scrollSpys.length;
  5295. for (var i = scrollSpysLength; i--;) {
  5296. var $spy = $(scrollSpys[i]);
  5297. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5298. }
  5299. });
  5300. /**
  5301. * ------------------------------------------------------------------------
  5302. * jQuery
  5303. * ------------------------------------------------------------------------
  5304. */
  5305. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5306. $.fn[NAME$8].Constructor = ScrollSpy;
  5307. $.fn[NAME$8].noConflict = function () {
  5308. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5309. return ScrollSpy._jQueryInterface;
  5310. };
  5311. /**
  5312. * ------------------------------------------------------------------------
  5313. * Constants
  5314. * ------------------------------------------------------------------------
  5315. */
  5316. var NAME$9 = 'tab';
  5317. var VERSION$9 = '4.4.1';
  5318. var DATA_KEY$9 = 'bs.tab';
  5319. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5320. var DATA_API_KEY$7 = '.data-api';
  5321. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5322. var Event$9 = {
  5323. HIDE: "hide" + EVENT_KEY$9,
  5324. HIDDEN: "hidden" + EVENT_KEY$9,
  5325. SHOW: "show" + EVENT_KEY$9,
  5326. SHOWN: "shown" + EVENT_KEY$9,
  5327. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5328. };
  5329. var ClassName$9 = {
  5330. DROPDOWN_MENU: 'dropdown-menu',
  5331. ACTIVE: 'active',
  5332. DISABLED: 'disabled',
  5333. FADE: 'fade',
  5334. SHOW: 'show'
  5335. };
  5336. var Selector$9 = {
  5337. DROPDOWN: '.dropdown',
  5338. NAV_LIST_GROUP: '.nav, .list-group',
  5339. ACTIVE: '.active',
  5340. ACTIVE_UL: '> li > .active',
  5341. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5342. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5343. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5344. };
  5345. /**
  5346. * ------------------------------------------------------------------------
  5347. * Class Definition
  5348. * ------------------------------------------------------------------------
  5349. */
  5350. var Tab =
  5351. /*#__PURE__*/
  5352. function () {
  5353. function Tab(element) {
  5354. this._element = element;
  5355. } // Getters
  5356. var _proto = Tab.prototype;
  5357. // Public
  5358. _proto.show = function show() {
  5359. var _this = this;
  5360. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5361. return;
  5362. }
  5363. var target;
  5364. var previous;
  5365. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5366. var selector = Util.getSelectorFromElement(this._element);
  5367. if (listElement) {
  5368. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5369. previous = $.makeArray($(listElement).find(itemSelector));
  5370. previous = previous[previous.length - 1];
  5371. }
  5372. var hideEvent = $.Event(Event$9.HIDE, {
  5373. relatedTarget: this._element
  5374. });
  5375. var showEvent = $.Event(Event$9.SHOW, {
  5376. relatedTarget: previous
  5377. });
  5378. if (previous) {
  5379. $(previous).trigger(hideEvent);
  5380. }
  5381. $(this._element).trigger(showEvent);
  5382. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5383. return;
  5384. }
  5385. if (selector) {
  5386. target = document.querySelector(selector);
  5387. }
  5388. this._activate(this._element, listElement);
  5389. var complete = function complete() {
  5390. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5391. relatedTarget: _this._element
  5392. });
  5393. var shownEvent = $.Event(Event$9.SHOWN, {
  5394. relatedTarget: previous
  5395. });
  5396. $(previous).trigger(hiddenEvent);
  5397. $(_this._element).trigger(shownEvent);
  5398. };
  5399. if (target) {
  5400. this._activate(target, target.parentNode, complete);
  5401. } else {
  5402. complete();
  5403. }
  5404. };
  5405. _proto.dispose = function dispose() {
  5406. $.removeData(this._element, DATA_KEY$9);
  5407. this._element = null;
  5408. } // Private
  5409. ;
  5410. _proto._activate = function _activate(element, container, callback) {
  5411. var _this2 = this;
  5412. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5413. var active = activeElements[0];
  5414. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5415. var complete = function complete() {
  5416. return _this2._transitionComplete(element, active, callback);
  5417. };
  5418. if (active && isTransitioning) {
  5419. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5420. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5421. } else {
  5422. complete();
  5423. }
  5424. };
  5425. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5426. if (active) {
  5427. $(active).removeClass(ClassName$9.ACTIVE);
  5428. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5429. if (dropdownChild) {
  5430. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5431. }
  5432. if (active.getAttribute('role') === 'tab') {
  5433. active.setAttribute('aria-selected', false);
  5434. }
  5435. }
  5436. $(element).addClass(ClassName$9.ACTIVE);
  5437. if (element.getAttribute('role') === 'tab') {
  5438. element.setAttribute('aria-selected', true);
  5439. }
  5440. Util.reflow(element);
  5441. if (element.classList.contains(ClassName$9.FADE)) {
  5442. element.classList.add(ClassName$9.SHOW);
  5443. }
  5444. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5445. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5446. if (dropdownElement) {
  5447. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5448. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5449. }
  5450. element.setAttribute('aria-expanded', true);
  5451. }
  5452. if (callback) {
  5453. callback();
  5454. }
  5455. } // Static
  5456. ;
  5457. Tab._jQueryInterface = function _jQueryInterface(config) {
  5458. return this.each(function () {
  5459. var $this = $(this);
  5460. var data = $this.data(DATA_KEY$9);
  5461. if (!data) {
  5462. data = new Tab(this);
  5463. $this.data(DATA_KEY$9, data);
  5464. }
  5465. if (typeof config === 'string') {
  5466. if (typeof data[config] === 'undefined') {
  5467. throw new TypeError("No method named \"" + config + "\"");
  5468. }
  5469. data[config]();
  5470. }
  5471. });
  5472. };
  5473. _createClass(Tab, null, [{
  5474. key: "VERSION",
  5475. get: function get() {
  5476. return VERSION$9;
  5477. }
  5478. }]);
  5479. return Tab;
  5480. }();
  5481. /**
  5482. * ------------------------------------------------------------------------
  5483. * Data Api implementation
  5484. * ------------------------------------------------------------------------
  5485. */
  5486. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5487. event.preventDefault();
  5488. Tab._jQueryInterface.call($(this), 'show');
  5489. });
  5490. /**
  5491. * ------------------------------------------------------------------------
  5492. * jQuery
  5493. * ------------------------------------------------------------------------
  5494. */
  5495. $.fn[NAME$9] = Tab._jQueryInterface;
  5496. $.fn[NAME$9].Constructor = Tab;
  5497. $.fn[NAME$9].noConflict = function () {
  5498. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5499. return Tab._jQueryInterface;
  5500. };
  5501. /**
  5502. * ------------------------------------------------------------------------
  5503. * Constants
  5504. * ------------------------------------------------------------------------
  5505. */
  5506. var NAME$a = 'toast';
  5507. var VERSION$a = '4.4.1';
  5508. var DATA_KEY$a = 'bs.toast';
  5509. var EVENT_KEY$a = "." + DATA_KEY$a;
  5510. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5511. var Event$a = {
  5512. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5513. HIDE: "hide" + EVENT_KEY$a,
  5514. HIDDEN: "hidden" + EVENT_KEY$a,
  5515. SHOW: "show" + EVENT_KEY$a,
  5516. SHOWN: "shown" + EVENT_KEY$a
  5517. };
  5518. var ClassName$a = {
  5519. FADE: 'fade',
  5520. HIDE: 'hide',
  5521. SHOW: 'show',
  5522. SHOWING: 'showing'
  5523. };
  5524. var DefaultType$7 = {
  5525. animation: 'boolean',
  5526. autohide: 'boolean',
  5527. delay: 'number'
  5528. };
  5529. var Default$7 = {
  5530. animation: true,
  5531. autohide: true,
  5532. delay: 500
  5533. };
  5534. var Selector$a = {
  5535. DATA_DISMISS: '[data-dismiss="toast"]'
  5536. };
  5537. /**
  5538. * ------------------------------------------------------------------------
  5539. * Class Definition
  5540. * ------------------------------------------------------------------------
  5541. */
  5542. var Toast =
  5543. /*#__PURE__*/
  5544. function () {
  5545. function Toast(element, config) {
  5546. this._element = element;
  5547. this._config = this._getConfig(config);
  5548. this._timeout = null;
  5549. this._setListeners();
  5550. } // Getters
  5551. var _proto = Toast.prototype;
  5552. // Public
  5553. _proto.show = function show() {
  5554. var _this = this;
  5555. var showEvent = $.Event(Event$a.SHOW);
  5556. $(this._element).trigger(showEvent);
  5557. if (showEvent.isDefaultPrevented()) {
  5558. return;
  5559. }
  5560. if (this._config.animation) {
  5561. this._element.classList.add(ClassName$a.FADE);
  5562. }
  5563. var complete = function complete() {
  5564. _this._element.classList.remove(ClassName$a.SHOWING);
  5565. _this._element.classList.add(ClassName$a.SHOW);
  5566. $(_this._element).trigger(Event$a.SHOWN);
  5567. if (_this._config.autohide) {
  5568. _this._timeout = setTimeout(function () {
  5569. _this.hide();
  5570. }, _this._config.delay);
  5571. }
  5572. };
  5573. this._element.classList.remove(ClassName$a.HIDE);
  5574. Util.reflow(this._element);
  5575. this._element.classList.add(ClassName$a.SHOWING);
  5576. if (this._config.animation) {
  5577. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5578. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5579. } else {
  5580. complete();
  5581. }
  5582. };
  5583. _proto.hide = function hide() {
  5584. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5585. return;
  5586. }
  5587. var hideEvent = $.Event(Event$a.HIDE);
  5588. $(this._element).trigger(hideEvent);
  5589. if (hideEvent.isDefaultPrevented()) {
  5590. return;
  5591. }
  5592. this._close();
  5593. };
  5594. _proto.dispose = function dispose() {
  5595. clearTimeout(this._timeout);
  5596. this._timeout = null;
  5597. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5598. this._element.classList.remove(ClassName$a.SHOW);
  5599. }
  5600. $(this._element).off(Event$a.CLICK_DISMISS);
  5601. $.removeData(this._element, DATA_KEY$a);
  5602. this._element = null;
  5603. this._config = null;
  5604. } // Private
  5605. ;
  5606. _proto._getConfig = function _getConfig(config) {
  5607. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5608. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5609. return config;
  5610. };
  5611. _proto._setListeners = function _setListeners() {
  5612. var _this2 = this;
  5613. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5614. return _this2.hide();
  5615. });
  5616. };
  5617. _proto._close = function _close() {
  5618. var _this3 = this;
  5619. var complete = function complete() {
  5620. _this3._element.classList.add(ClassName$a.HIDE);
  5621. $(_this3._element).trigger(Event$a.HIDDEN);
  5622. };
  5623. this._element.classList.remove(ClassName$a.SHOW);
  5624. if (this._config.animation) {
  5625. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5626. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5627. } else {
  5628. complete();
  5629. }
  5630. } // Static
  5631. ;
  5632. Toast._jQueryInterface = function _jQueryInterface(config) {
  5633. return this.each(function () {
  5634. var $element = $(this);
  5635. var data = $element.data(DATA_KEY$a);
  5636. var _config = typeof config === 'object' && config;
  5637. if (!data) {
  5638. data = new Toast(this, _config);
  5639. $element.data(DATA_KEY$a, data);
  5640. }
  5641. if (typeof config === 'string') {
  5642. if (typeof data[config] === 'undefined') {
  5643. throw new TypeError("No method named \"" + config + "\"");
  5644. }
  5645. data[config](this);
  5646. }
  5647. });
  5648. };
  5649. _createClass(Toast, null, [{
  5650. key: "VERSION",
  5651. get: function get() {
  5652. return VERSION$a;
  5653. }
  5654. }, {
  5655. key: "DefaultType",
  5656. get: function get() {
  5657. return DefaultType$7;
  5658. }
  5659. }, {
  5660. key: "Default",
  5661. get: function get() {
  5662. return Default$7;
  5663. }
  5664. }]);
  5665. return Toast;
  5666. }();
  5667. /**
  5668. * ------------------------------------------------------------------------
  5669. * jQuery
  5670. * ------------------------------------------------------------------------
  5671. */
  5672. $.fn[NAME$a] = Toast._jQueryInterface;
  5673. $.fn[NAME$a].Constructor = Toast;
  5674. $.fn[NAME$a].noConflict = function () {
  5675. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5676. return Toast._jQueryInterface;
  5677. };
  5678. exports.Alert = Alert;
  5679. exports.Button = Button;
  5680. exports.Carousel = Carousel;
  5681. exports.Collapse = Collapse;
  5682. exports.Dropdown = Dropdown;
  5683. exports.Modal = Modal;
  5684. exports.Popover = Popover;
  5685. exports.Scrollspy = ScrollSpy;
  5686. exports.Tab = Tab;
  5687. exports.Toast = Toast;
  5688. exports.Tooltip = Tooltip;
  5689. exports.Util = Util;
  5690. Object.defineProperty(exports, '__esModule', { value: true });
  5691. })));
  5692. //# sourceMappingURL=bootstrap.js.map
  5693. /***/ }),
  5694. /***/ "./node_modules/buffer/index.js":
  5695. /*!**************************************!*\
  5696. !*** ./node_modules/buffer/index.js ***!
  5697. \**************************************/
  5698. /*! no static exports found */
  5699. /***/ (function(module, exports, __webpack_require__) {
  5700. "use strict";
  5701. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5702. * The buffer module from node.js, for the browser.
  5703. *
  5704. * @author Feross Aboukhadijeh <http://feross.org>
  5705. * @license MIT
  5706. */
  5707. /* eslint-disable no-proto */
  5708. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5709. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5710. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5711. exports.Buffer = Buffer
  5712. exports.SlowBuffer = SlowBuffer
  5713. exports.INSPECT_MAX_BYTES = 50
  5714. /**
  5715. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5716. * === true Use Uint8Array implementation (fastest)
  5717. * === false Use Object implementation (most compatible, even IE6)
  5718. *
  5719. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5720. * Opera 11.6+, iOS 4.2+.
  5721. *
  5722. * Due to various browser bugs, sometimes the Object implementation will be used even
  5723. * when the browser supports typed arrays.
  5724. *
  5725. * Note:
  5726. *
  5727. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5728. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5729. *
  5730. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5731. *
  5732. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5733. * incorrect length in some situations.
  5734. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5735. * get the Object implementation, which is slower but behaves correctly.
  5736. */
  5737. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5738. ? global.TYPED_ARRAY_SUPPORT
  5739. : typedArraySupport()
  5740. /*
  5741. * Export kMaxLength after typed array support is determined.
  5742. */
  5743. exports.kMaxLength = kMaxLength()
  5744. function typedArraySupport () {
  5745. try {
  5746. var arr = new Uint8Array(1)
  5747. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5748. return arr.foo() === 42 && // typed array instances can be augmented
  5749. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5750. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5751. } catch (e) {
  5752. return false
  5753. }
  5754. }
  5755. function kMaxLength () {
  5756. return Buffer.TYPED_ARRAY_SUPPORT
  5757. ? 0x7fffffff
  5758. : 0x3fffffff
  5759. }
  5760. function createBuffer (that, length) {
  5761. if (kMaxLength() < length) {
  5762. throw new RangeError('Invalid typed array length')
  5763. }
  5764. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5765. // Return an augmented `Uint8Array` instance, for best performance
  5766. that = new Uint8Array(length)
  5767. that.__proto__ = Buffer.prototype
  5768. } else {
  5769. // Fallback: Return an object instance of the Buffer class
  5770. if (that === null) {
  5771. that = new Buffer(length)
  5772. }
  5773. that.length = length
  5774. }
  5775. return that
  5776. }
  5777. /**
  5778. * The Buffer constructor returns instances of `Uint8Array` that have their
  5779. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5780. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5781. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5782. * returns a single octet.
  5783. *
  5784. * The `Uint8Array` prototype remains unmodified.
  5785. */
  5786. function Buffer (arg, encodingOrOffset, length) {
  5787. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5788. return new Buffer(arg, encodingOrOffset, length)
  5789. }
  5790. // Common case.
  5791. if (typeof arg === 'number') {
  5792. if (typeof encodingOrOffset === 'string') {
  5793. throw new Error(
  5794. 'If encoding is specified then the first argument must be a string'
  5795. )
  5796. }
  5797. return allocUnsafe(this, arg)
  5798. }
  5799. return from(this, arg, encodingOrOffset, length)
  5800. }
  5801. Buffer.poolSize = 8192 // not used by this implementation
  5802. // TODO: Legacy, not needed anymore. Remove in next major version.
  5803. Buffer._augment = function (arr) {
  5804. arr.__proto__ = Buffer.prototype
  5805. return arr
  5806. }
  5807. function from (that, value, encodingOrOffset, length) {
  5808. if (typeof value === 'number') {
  5809. throw new TypeError('"value" argument must not be a number')
  5810. }
  5811. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5812. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5813. }
  5814. if (typeof value === 'string') {
  5815. return fromString(that, value, encodingOrOffset)
  5816. }
  5817. return fromObject(that, value)
  5818. }
  5819. /**
  5820. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5821. * if value is a number.
  5822. * Buffer.from(str[, encoding])
  5823. * Buffer.from(array)
  5824. * Buffer.from(buffer)
  5825. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5826. **/
  5827. Buffer.from = function (value, encodingOrOffset, length) {
  5828. return from(null, value, encodingOrOffset, length)
  5829. }
  5830. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5831. Buffer.prototype.__proto__ = Uint8Array.prototype
  5832. Buffer.__proto__ = Uint8Array
  5833. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5834. Buffer[Symbol.species] === Buffer) {
  5835. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5836. Object.defineProperty(Buffer, Symbol.species, {
  5837. value: null,
  5838. configurable: true
  5839. })
  5840. }
  5841. }
  5842. function assertSize (size) {
  5843. if (typeof size !== 'number') {
  5844. throw new TypeError('"size" argument must be a number')
  5845. } else if (size < 0) {
  5846. throw new RangeError('"size" argument must not be negative')
  5847. }
  5848. }
  5849. function alloc (that, size, fill, encoding) {
  5850. assertSize(size)
  5851. if (size <= 0) {
  5852. return createBuffer(that, size)
  5853. }
  5854. if (fill !== undefined) {
  5855. // Only pay attention to encoding if it's a string. This
  5856. // prevents accidentally sending in a number that would
  5857. // be interpretted as a start offset.
  5858. return typeof encoding === 'string'
  5859. ? createBuffer(that, size).fill(fill, encoding)
  5860. : createBuffer(that, size).fill(fill)
  5861. }
  5862. return createBuffer(that, size)
  5863. }
  5864. /**
  5865. * Creates a new filled Buffer instance.
  5866. * alloc(size[, fill[, encoding]])
  5867. **/
  5868. Buffer.alloc = function (size, fill, encoding) {
  5869. return alloc(null, size, fill, encoding)
  5870. }
  5871. function allocUnsafe (that, size) {
  5872. assertSize(size)
  5873. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5874. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5875. for (var i = 0; i < size; ++i) {
  5876. that[i] = 0
  5877. }
  5878. }
  5879. return that
  5880. }
  5881. /**
  5882. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5883. * */
  5884. Buffer.allocUnsafe = function (size) {
  5885. return allocUnsafe(null, size)
  5886. }
  5887. /**
  5888. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5889. */
  5890. Buffer.allocUnsafeSlow = function (size) {
  5891. return allocUnsafe(null, size)
  5892. }
  5893. function fromString (that, string, encoding) {
  5894. if (typeof encoding !== 'string' || encoding === '') {
  5895. encoding = 'utf8'
  5896. }
  5897. if (!Buffer.isEncoding(encoding)) {
  5898. throw new TypeError('"encoding" must be a valid string encoding')
  5899. }
  5900. var length = byteLength(string, encoding) | 0
  5901. that = createBuffer(that, length)
  5902. var actual = that.write(string, encoding)
  5903. if (actual !== length) {
  5904. // Writing a hex string, for example, that contains invalid characters will
  5905. // cause everything after the first invalid character to be ignored. (e.g.
  5906. // 'abxxcd' will be treated as 'ab')
  5907. that = that.slice(0, actual)
  5908. }
  5909. return that
  5910. }
  5911. function fromArrayLike (that, array) {
  5912. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5913. that = createBuffer(that, length)
  5914. for (var i = 0; i < length; i += 1) {
  5915. that[i] = array[i] & 255
  5916. }
  5917. return that
  5918. }
  5919. function fromArrayBuffer (that, array, byteOffset, length) {
  5920. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5921. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5922. throw new RangeError('\'offset\' is out of bounds')
  5923. }
  5924. if (array.byteLength < byteOffset + (length || 0)) {
  5925. throw new RangeError('\'length\' is out of bounds')
  5926. }
  5927. if (byteOffset === undefined && length === undefined) {
  5928. array = new Uint8Array(array)
  5929. } else if (length === undefined) {
  5930. array = new Uint8Array(array, byteOffset)
  5931. } else {
  5932. array = new Uint8Array(array, byteOffset, length)
  5933. }
  5934. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5935. // Return an augmented `Uint8Array` instance, for best performance
  5936. that = array
  5937. that.__proto__ = Buffer.prototype
  5938. } else {
  5939. // Fallback: Return an object instance of the Buffer class
  5940. that = fromArrayLike(that, array)
  5941. }
  5942. return that
  5943. }
  5944. function fromObject (that, obj) {
  5945. if (Buffer.isBuffer(obj)) {
  5946. var len = checked(obj.length) | 0
  5947. that = createBuffer(that, len)
  5948. if (that.length === 0) {
  5949. return that
  5950. }
  5951. obj.copy(that, 0, 0, len)
  5952. return that
  5953. }
  5954. if (obj) {
  5955. if ((typeof ArrayBuffer !== 'undefined' &&
  5956. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5957. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5958. return createBuffer(that, 0)
  5959. }
  5960. return fromArrayLike(that, obj)
  5961. }
  5962. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5963. return fromArrayLike(that, obj.data)
  5964. }
  5965. }
  5966. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5967. }
  5968. function checked (length) {
  5969. // Note: cannot use `length < kMaxLength()` here because that fails when
  5970. // length is NaN (which is otherwise coerced to zero.)
  5971. if (length >= kMaxLength()) {
  5972. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5973. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5974. }
  5975. return length | 0
  5976. }
  5977. function SlowBuffer (length) {
  5978. if (+length != length) { // eslint-disable-line eqeqeq
  5979. length = 0
  5980. }
  5981. return Buffer.alloc(+length)
  5982. }
  5983. Buffer.isBuffer = function isBuffer (b) {
  5984. return !!(b != null && b._isBuffer)
  5985. }
  5986. Buffer.compare = function compare (a, b) {
  5987. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5988. throw new TypeError('Arguments must be Buffers')
  5989. }
  5990. if (a === b) return 0
  5991. var x = a.length
  5992. var y = b.length
  5993. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5994. if (a[i] !== b[i]) {
  5995. x = a[i]
  5996. y = b[i]
  5997. break
  5998. }
  5999. }
  6000. if (x < y) return -1
  6001. if (y < x) return 1
  6002. return 0
  6003. }
  6004. Buffer.isEncoding = function isEncoding (encoding) {
  6005. switch (String(encoding).toLowerCase()) {
  6006. case 'hex':
  6007. case 'utf8':
  6008. case 'utf-8':
  6009. case 'ascii':
  6010. case 'latin1':
  6011. case 'binary':
  6012. case 'base64':
  6013. case 'ucs2':
  6014. case 'ucs-2':
  6015. case 'utf16le':
  6016. case 'utf-16le':
  6017. return true
  6018. default:
  6019. return false
  6020. }
  6021. }
  6022. Buffer.concat = function concat (list, length) {
  6023. if (!isArray(list)) {
  6024. throw new TypeError('"list" argument must be an Array of Buffers')
  6025. }
  6026. if (list.length === 0) {
  6027. return Buffer.alloc(0)
  6028. }
  6029. var i
  6030. if (length === undefined) {
  6031. length = 0
  6032. for (i = 0; i < list.length; ++i) {
  6033. length += list[i].length
  6034. }
  6035. }
  6036. var buffer = Buffer.allocUnsafe(length)
  6037. var pos = 0
  6038. for (i = 0; i < list.length; ++i) {
  6039. var buf = list[i]
  6040. if (!Buffer.isBuffer(buf)) {
  6041. throw new TypeError('"list" argument must be an Array of Buffers')
  6042. }
  6043. buf.copy(buffer, pos)
  6044. pos += buf.length
  6045. }
  6046. return buffer
  6047. }
  6048. function byteLength (string, encoding) {
  6049. if (Buffer.isBuffer(string)) {
  6050. return string.length
  6051. }
  6052. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6053. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6054. return string.byteLength
  6055. }
  6056. if (typeof string !== 'string') {
  6057. string = '' + string
  6058. }
  6059. var len = string.length
  6060. if (len === 0) return 0
  6061. // Use a for loop to avoid recursion
  6062. var loweredCase = false
  6063. for (;;) {
  6064. switch (encoding) {
  6065. case 'ascii':
  6066. case 'latin1':
  6067. case 'binary':
  6068. return len
  6069. case 'utf8':
  6070. case 'utf-8':
  6071. case undefined:
  6072. return utf8ToBytes(string).length
  6073. case 'ucs2':
  6074. case 'ucs-2':
  6075. case 'utf16le':
  6076. case 'utf-16le':
  6077. return len * 2
  6078. case 'hex':
  6079. return len >>> 1
  6080. case 'base64':
  6081. return base64ToBytes(string).length
  6082. default:
  6083. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6084. encoding = ('' + encoding).toLowerCase()
  6085. loweredCase = true
  6086. }
  6087. }
  6088. }
  6089. Buffer.byteLength = byteLength
  6090. function slowToString (encoding, start, end) {
  6091. var loweredCase = false
  6092. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6093. // property of a typed array.
  6094. // This behaves neither like String nor Uint8Array in that we set start/end
  6095. // to their upper/lower bounds if the value passed is out of range.
  6096. // undefined is handled specially as per ECMA-262 6th Edition,
  6097. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6098. if (start === undefined || start < 0) {
  6099. start = 0
  6100. }
  6101. // Return early if start > this.length. Done here to prevent potential uint32
  6102. // coercion fail below.
  6103. if (start > this.length) {
  6104. return ''
  6105. }
  6106. if (end === undefined || end > this.length) {
  6107. end = this.length
  6108. }
  6109. if (end <= 0) {
  6110. return ''
  6111. }
  6112. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6113. end >>>= 0
  6114. start >>>= 0
  6115. if (end <= start) {
  6116. return ''
  6117. }
  6118. if (!encoding) encoding = 'utf8'
  6119. while (true) {
  6120. switch (encoding) {
  6121. case 'hex':
  6122. return hexSlice(this, start, end)
  6123. case 'utf8':
  6124. case 'utf-8':
  6125. return utf8Slice(this, start, end)
  6126. case 'ascii':
  6127. return asciiSlice(this, start, end)
  6128. case 'latin1':
  6129. case 'binary':
  6130. return latin1Slice(this, start, end)
  6131. case 'base64':
  6132. return base64Slice(this, start, end)
  6133. case 'ucs2':
  6134. case 'ucs-2':
  6135. case 'utf16le':
  6136. case 'utf-16le':
  6137. return utf16leSlice(this, start, end)
  6138. default:
  6139. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6140. encoding = (encoding + '').toLowerCase()
  6141. loweredCase = true
  6142. }
  6143. }
  6144. }
  6145. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6146. // Buffer instances.
  6147. Buffer.prototype._isBuffer = true
  6148. function swap (b, n, m) {
  6149. var i = b[n]
  6150. b[n] = b[m]
  6151. b[m] = i
  6152. }
  6153. Buffer.prototype.swap16 = function swap16 () {
  6154. var len = this.length
  6155. if (len % 2 !== 0) {
  6156. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6157. }
  6158. for (var i = 0; i < len; i += 2) {
  6159. swap(this, i, i + 1)
  6160. }
  6161. return this
  6162. }
  6163. Buffer.prototype.swap32 = function swap32 () {
  6164. var len = this.length
  6165. if (len % 4 !== 0) {
  6166. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6167. }
  6168. for (var i = 0; i < len; i += 4) {
  6169. swap(this, i, i + 3)
  6170. swap(this, i + 1, i + 2)
  6171. }
  6172. return this
  6173. }
  6174. Buffer.prototype.swap64 = function swap64 () {
  6175. var len = this.length
  6176. if (len % 8 !== 0) {
  6177. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6178. }
  6179. for (var i = 0; i < len; i += 8) {
  6180. swap(this, i, i + 7)
  6181. swap(this, i + 1, i + 6)
  6182. swap(this, i + 2, i + 5)
  6183. swap(this, i + 3, i + 4)
  6184. }
  6185. return this
  6186. }
  6187. Buffer.prototype.toString = function toString () {
  6188. var length = this.length | 0
  6189. if (length === 0) return ''
  6190. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6191. return slowToString.apply(this, arguments)
  6192. }
  6193. Buffer.prototype.equals = function equals (b) {
  6194. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6195. if (this === b) return true
  6196. return Buffer.compare(this, b) === 0
  6197. }
  6198. Buffer.prototype.inspect = function inspect () {
  6199. var str = ''
  6200. var max = exports.INSPECT_MAX_BYTES
  6201. if (this.length > 0) {
  6202. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6203. if (this.length > max) str += ' ... '
  6204. }
  6205. return '<Buffer ' + str + '>'
  6206. }
  6207. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6208. if (!Buffer.isBuffer(target)) {
  6209. throw new TypeError('Argument must be a Buffer')
  6210. }
  6211. if (start === undefined) {
  6212. start = 0
  6213. }
  6214. if (end === undefined) {
  6215. end = target ? target.length : 0
  6216. }
  6217. if (thisStart === undefined) {
  6218. thisStart = 0
  6219. }
  6220. if (thisEnd === undefined) {
  6221. thisEnd = this.length
  6222. }
  6223. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6224. throw new RangeError('out of range index')
  6225. }
  6226. if (thisStart >= thisEnd && start >= end) {
  6227. return 0
  6228. }
  6229. if (thisStart >= thisEnd) {
  6230. return -1
  6231. }
  6232. if (start >= end) {
  6233. return 1
  6234. }
  6235. start >>>= 0
  6236. end >>>= 0
  6237. thisStart >>>= 0
  6238. thisEnd >>>= 0
  6239. if (this === target) return 0
  6240. var x = thisEnd - thisStart
  6241. var y = end - start
  6242. var len = Math.min(x, y)
  6243. var thisCopy = this.slice(thisStart, thisEnd)
  6244. var targetCopy = target.slice(start, end)
  6245. for (var i = 0; i < len; ++i) {
  6246. if (thisCopy[i] !== targetCopy[i]) {
  6247. x = thisCopy[i]
  6248. y = targetCopy[i]
  6249. break
  6250. }
  6251. }
  6252. if (x < y) return -1
  6253. if (y < x) return 1
  6254. return 0
  6255. }
  6256. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6257. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6258. //
  6259. // Arguments:
  6260. // - buffer - a Buffer to search
  6261. // - val - a string, Buffer, or number
  6262. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6263. // - encoding - an optional encoding, relevant is val is a string
  6264. // - dir - true for indexOf, false for lastIndexOf
  6265. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6266. // Empty buffer means no match
  6267. if (buffer.length === 0) return -1
  6268. // Normalize byteOffset
  6269. if (typeof byteOffset === 'string') {
  6270. encoding = byteOffset
  6271. byteOffset = 0
  6272. } else if (byteOffset > 0x7fffffff) {
  6273. byteOffset = 0x7fffffff
  6274. } else if (byteOffset < -0x80000000) {
  6275. byteOffset = -0x80000000
  6276. }
  6277. byteOffset = +byteOffset // Coerce to Number.
  6278. if (isNaN(byteOffset)) {
  6279. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6280. byteOffset = dir ? 0 : (buffer.length - 1)
  6281. }
  6282. // Normalize byteOffset: negative offsets start from the end of the buffer
  6283. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6284. if (byteOffset >= buffer.length) {
  6285. if (dir) return -1
  6286. else byteOffset = buffer.length - 1
  6287. } else if (byteOffset < 0) {
  6288. if (dir) byteOffset = 0
  6289. else return -1
  6290. }
  6291. // Normalize val
  6292. if (typeof val === 'string') {
  6293. val = Buffer.from(val, encoding)
  6294. }
  6295. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6296. if (Buffer.isBuffer(val)) {
  6297. // Special case: looking for empty string/buffer always fails
  6298. if (val.length === 0) {
  6299. return -1
  6300. }
  6301. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6302. } else if (typeof val === 'number') {
  6303. val = val & 0xFF // Search for a byte value [0-255]
  6304. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6305. typeof Uint8Array.prototype.indexOf === 'function') {
  6306. if (dir) {
  6307. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6308. } else {
  6309. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6310. }
  6311. }
  6312. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6313. }
  6314. throw new TypeError('val must be string, number or Buffer')
  6315. }
  6316. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6317. var indexSize = 1
  6318. var arrLength = arr.length
  6319. var valLength = val.length
  6320. if (encoding !== undefined) {
  6321. encoding = String(encoding).toLowerCase()
  6322. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6323. encoding === 'utf16le' || encoding === 'utf-16le') {
  6324. if (arr.length < 2 || val.length < 2) {
  6325. return -1
  6326. }
  6327. indexSize = 2
  6328. arrLength /= 2
  6329. valLength /= 2
  6330. byteOffset /= 2
  6331. }
  6332. }
  6333. function read (buf, i) {
  6334. if (indexSize === 1) {
  6335. return buf[i]
  6336. } else {
  6337. return buf.readUInt16BE(i * indexSize)
  6338. }
  6339. }
  6340. var i
  6341. if (dir) {
  6342. var foundIndex = -1
  6343. for (i = byteOffset; i < arrLength; i++) {
  6344. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6345. if (foundIndex === -1) foundIndex = i
  6346. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6347. } else {
  6348. if (foundIndex !== -1) i -= i - foundIndex
  6349. foundIndex = -1
  6350. }
  6351. }
  6352. } else {
  6353. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6354. for (i = byteOffset; i >= 0; i--) {
  6355. var found = true
  6356. for (var j = 0; j < valLength; j++) {
  6357. if (read(arr, i + j) !== read(val, j)) {
  6358. found = false
  6359. break
  6360. }
  6361. }
  6362. if (found) return i
  6363. }
  6364. }
  6365. return -1
  6366. }
  6367. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6368. return this.indexOf(val, byteOffset, encoding) !== -1
  6369. }
  6370. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6371. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6372. }
  6373. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6374. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6375. }
  6376. function hexWrite (buf, string, offset, length) {
  6377. offset = Number(offset) || 0
  6378. var remaining = buf.length - offset
  6379. if (!length) {
  6380. length = remaining
  6381. } else {
  6382. length = Number(length)
  6383. if (length > remaining) {
  6384. length = remaining
  6385. }
  6386. }
  6387. // must be an even number of digits
  6388. var strLen = string.length
  6389. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6390. if (length > strLen / 2) {
  6391. length = strLen / 2
  6392. }
  6393. for (var i = 0; i < length; ++i) {
  6394. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6395. if (isNaN(parsed)) return i
  6396. buf[offset + i] = parsed
  6397. }
  6398. return i
  6399. }
  6400. function utf8Write (buf, string, offset, length) {
  6401. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6402. }
  6403. function asciiWrite (buf, string, offset, length) {
  6404. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6405. }
  6406. function latin1Write (buf, string, offset, length) {
  6407. return asciiWrite(buf, string, offset, length)
  6408. }
  6409. function base64Write (buf, string, offset, length) {
  6410. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6411. }
  6412. function ucs2Write (buf, string, offset, length) {
  6413. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6414. }
  6415. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6416. // Buffer#write(string)
  6417. if (offset === undefined) {
  6418. encoding = 'utf8'
  6419. length = this.length
  6420. offset = 0
  6421. // Buffer#write(string, encoding)
  6422. } else if (length === undefined && typeof offset === 'string') {
  6423. encoding = offset
  6424. length = this.length
  6425. offset = 0
  6426. // Buffer#write(string, offset[, length][, encoding])
  6427. } else if (isFinite(offset)) {
  6428. offset = offset | 0
  6429. if (isFinite(length)) {
  6430. length = length | 0
  6431. if (encoding === undefined) encoding = 'utf8'
  6432. } else {
  6433. encoding = length
  6434. length = undefined
  6435. }
  6436. // legacy write(string, encoding, offset, length) - remove in v0.13
  6437. } else {
  6438. throw new Error(
  6439. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6440. )
  6441. }
  6442. var remaining = this.length - offset
  6443. if (length === undefined || length > remaining) length = remaining
  6444. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6445. throw new RangeError('Attempt to write outside buffer bounds')
  6446. }
  6447. if (!encoding) encoding = 'utf8'
  6448. var loweredCase = false
  6449. for (;;) {
  6450. switch (encoding) {
  6451. case 'hex':
  6452. return hexWrite(this, string, offset, length)
  6453. case 'utf8':
  6454. case 'utf-8':
  6455. return utf8Write(this, string, offset, length)
  6456. case 'ascii':
  6457. return asciiWrite(this, string, offset, length)
  6458. case 'latin1':
  6459. case 'binary':
  6460. return latin1Write(this, string, offset, length)
  6461. case 'base64':
  6462. // Warning: maxLength not taken into account in base64Write
  6463. return base64Write(this, string, offset, length)
  6464. case 'ucs2':
  6465. case 'ucs-2':
  6466. case 'utf16le':
  6467. case 'utf-16le':
  6468. return ucs2Write(this, string, offset, length)
  6469. default:
  6470. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6471. encoding = ('' + encoding).toLowerCase()
  6472. loweredCase = true
  6473. }
  6474. }
  6475. }
  6476. Buffer.prototype.toJSON = function toJSON () {
  6477. return {
  6478. type: 'Buffer',
  6479. data: Array.prototype.slice.call(this._arr || this, 0)
  6480. }
  6481. }
  6482. function base64Slice (buf, start, end) {
  6483. if (start === 0 && end === buf.length) {
  6484. return base64.fromByteArray(buf)
  6485. } else {
  6486. return base64.fromByteArray(buf.slice(start, end))
  6487. }
  6488. }
  6489. function utf8Slice (buf, start, end) {
  6490. end = Math.min(buf.length, end)
  6491. var res = []
  6492. var i = start
  6493. while (i < end) {
  6494. var firstByte = buf[i]
  6495. var codePoint = null
  6496. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6497. : (firstByte > 0xDF) ? 3
  6498. : (firstByte > 0xBF) ? 2
  6499. : 1
  6500. if (i + bytesPerSequence <= end) {
  6501. var secondByte, thirdByte, fourthByte, tempCodePoint
  6502. switch (bytesPerSequence) {
  6503. case 1:
  6504. if (firstByte < 0x80) {
  6505. codePoint = firstByte
  6506. }
  6507. break
  6508. case 2:
  6509. secondByte = buf[i + 1]
  6510. if ((secondByte & 0xC0) === 0x80) {
  6511. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6512. if (tempCodePoint > 0x7F) {
  6513. codePoint = tempCodePoint
  6514. }
  6515. }
  6516. break
  6517. case 3:
  6518. secondByte = buf[i + 1]
  6519. thirdByte = buf[i + 2]
  6520. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6521. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6522. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6523. codePoint = tempCodePoint
  6524. }
  6525. }
  6526. break
  6527. case 4:
  6528. secondByte = buf[i + 1]
  6529. thirdByte = buf[i + 2]
  6530. fourthByte = buf[i + 3]
  6531. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6532. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6533. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6534. codePoint = tempCodePoint
  6535. }
  6536. }
  6537. }
  6538. }
  6539. if (codePoint === null) {
  6540. // we did not generate a valid codePoint so insert a
  6541. // replacement char (U+FFFD) and advance only 1 byte
  6542. codePoint = 0xFFFD
  6543. bytesPerSequence = 1
  6544. } else if (codePoint > 0xFFFF) {
  6545. // encode to utf16 (surrogate pair dance)
  6546. codePoint -= 0x10000
  6547. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6548. codePoint = 0xDC00 | codePoint & 0x3FF
  6549. }
  6550. res.push(codePoint)
  6551. i += bytesPerSequence
  6552. }
  6553. return decodeCodePointsArray(res)
  6554. }
  6555. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6556. // the lowest limit is Chrome, with 0x10000 args.
  6557. // We go 1 magnitude less, for safety
  6558. var MAX_ARGUMENTS_LENGTH = 0x1000
  6559. function decodeCodePointsArray (codePoints) {
  6560. var len = codePoints.length
  6561. if (len <= MAX_ARGUMENTS_LENGTH) {
  6562. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6563. }
  6564. // Decode in chunks to avoid "call stack size exceeded".
  6565. var res = ''
  6566. var i = 0
  6567. while (i < len) {
  6568. res += String.fromCharCode.apply(
  6569. String,
  6570. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6571. )
  6572. }
  6573. return res
  6574. }
  6575. function asciiSlice (buf, start, end) {
  6576. var ret = ''
  6577. end = Math.min(buf.length, end)
  6578. for (var i = start; i < end; ++i) {
  6579. ret += String.fromCharCode(buf[i] & 0x7F)
  6580. }
  6581. return ret
  6582. }
  6583. function latin1Slice (buf, start, end) {
  6584. var ret = ''
  6585. end = Math.min(buf.length, end)
  6586. for (var i = start; i < end; ++i) {
  6587. ret += String.fromCharCode(buf[i])
  6588. }
  6589. return ret
  6590. }
  6591. function hexSlice (buf, start, end) {
  6592. var len = buf.length
  6593. if (!start || start < 0) start = 0
  6594. if (!end || end < 0 || end > len) end = len
  6595. var out = ''
  6596. for (var i = start; i < end; ++i) {
  6597. out += toHex(buf[i])
  6598. }
  6599. return out
  6600. }
  6601. function utf16leSlice (buf, start, end) {
  6602. var bytes = buf.slice(start, end)
  6603. var res = ''
  6604. for (var i = 0; i < bytes.length; i += 2) {
  6605. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6606. }
  6607. return res
  6608. }
  6609. Buffer.prototype.slice = function slice (start, end) {
  6610. var len = this.length
  6611. start = ~~start
  6612. end = end === undefined ? len : ~~end
  6613. if (start < 0) {
  6614. start += len
  6615. if (start < 0) start = 0
  6616. } else if (start > len) {
  6617. start = len
  6618. }
  6619. if (end < 0) {
  6620. end += len
  6621. if (end < 0) end = 0
  6622. } else if (end > len) {
  6623. end = len
  6624. }
  6625. if (end < start) end = start
  6626. var newBuf
  6627. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6628. newBuf = this.subarray(start, end)
  6629. newBuf.__proto__ = Buffer.prototype
  6630. } else {
  6631. var sliceLen = end - start
  6632. newBuf = new Buffer(sliceLen, undefined)
  6633. for (var i = 0; i < sliceLen; ++i) {
  6634. newBuf[i] = this[i + start]
  6635. }
  6636. }
  6637. return newBuf
  6638. }
  6639. /*
  6640. * Need to make sure that buffer isn't trying to write out of bounds.
  6641. */
  6642. function checkOffset (offset, ext, length) {
  6643. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6644. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6645. }
  6646. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6647. offset = offset | 0
  6648. byteLength = byteLength | 0
  6649. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6650. var val = this[offset]
  6651. var mul = 1
  6652. var i = 0
  6653. while (++i < byteLength && (mul *= 0x100)) {
  6654. val += this[offset + i] * mul
  6655. }
  6656. return val
  6657. }
  6658. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6659. offset = offset | 0
  6660. byteLength = byteLength | 0
  6661. if (!noAssert) {
  6662. checkOffset(offset, byteLength, this.length)
  6663. }
  6664. var val = this[offset + --byteLength]
  6665. var mul = 1
  6666. while (byteLength > 0 && (mul *= 0x100)) {
  6667. val += this[offset + --byteLength] * mul
  6668. }
  6669. return val
  6670. }
  6671. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6672. if (!noAssert) checkOffset(offset, 1, this.length)
  6673. return this[offset]
  6674. }
  6675. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6676. if (!noAssert) checkOffset(offset, 2, this.length)
  6677. return this[offset] | (this[offset + 1] << 8)
  6678. }
  6679. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6680. if (!noAssert) checkOffset(offset, 2, this.length)
  6681. return (this[offset] << 8) | this[offset + 1]
  6682. }
  6683. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6684. if (!noAssert) checkOffset(offset, 4, this.length)
  6685. return ((this[offset]) |
  6686. (this[offset + 1] << 8) |
  6687. (this[offset + 2] << 16)) +
  6688. (this[offset + 3] * 0x1000000)
  6689. }
  6690. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6691. if (!noAssert) checkOffset(offset, 4, this.length)
  6692. return (this[offset] * 0x1000000) +
  6693. ((this[offset + 1] << 16) |
  6694. (this[offset + 2] << 8) |
  6695. this[offset + 3])
  6696. }
  6697. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6698. offset = offset | 0
  6699. byteLength = byteLength | 0
  6700. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6701. var val = this[offset]
  6702. var mul = 1
  6703. var i = 0
  6704. while (++i < byteLength && (mul *= 0x100)) {
  6705. val += this[offset + i] * mul
  6706. }
  6707. mul *= 0x80
  6708. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6709. return val
  6710. }
  6711. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6712. offset = offset | 0
  6713. byteLength = byteLength | 0
  6714. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6715. var i = byteLength
  6716. var mul = 1
  6717. var val = this[offset + --i]
  6718. while (i > 0 && (mul *= 0x100)) {
  6719. val += this[offset + --i] * mul
  6720. }
  6721. mul *= 0x80
  6722. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6723. return val
  6724. }
  6725. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6726. if (!noAssert) checkOffset(offset, 1, this.length)
  6727. if (!(this[offset] & 0x80)) return (this[offset])
  6728. return ((0xff - this[offset] + 1) * -1)
  6729. }
  6730. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6731. if (!noAssert) checkOffset(offset, 2, this.length)
  6732. var val = this[offset] | (this[offset + 1] << 8)
  6733. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6734. }
  6735. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6736. if (!noAssert) checkOffset(offset, 2, this.length)
  6737. var val = this[offset + 1] | (this[offset] << 8)
  6738. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6739. }
  6740. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6741. if (!noAssert) checkOffset(offset, 4, this.length)
  6742. return (this[offset]) |
  6743. (this[offset + 1] << 8) |
  6744. (this[offset + 2] << 16) |
  6745. (this[offset + 3] << 24)
  6746. }
  6747. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6748. if (!noAssert) checkOffset(offset, 4, this.length)
  6749. return (this[offset] << 24) |
  6750. (this[offset + 1] << 16) |
  6751. (this[offset + 2] << 8) |
  6752. (this[offset + 3])
  6753. }
  6754. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6755. if (!noAssert) checkOffset(offset, 4, this.length)
  6756. return ieee754.read(this, offset, true, 23, 4)
  6757. }
  6758. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6759. if (!noAssert) checkOffset(offset, 4, this.length)
  6760. return ieee754.read(this, offset, false, 23, 4)
  6761. }
  6762. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6763. if (!noAssert) checkOffset(offset, 8, this.length)
  6764. return ieee754.read(this, offset, true, 52, 8)
  6765. }
  6766. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6767. if (!noAssert) checkOffset(offset, 8, this.length)
  6768. return ieee754.read(this, offset, false, 52, 8)
  6769. }
  6770. function checkInt (buf, value, offset, ext, max, min) {
  6771. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6772. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6773. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6774. }
  6775. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6776. value = +value
  6777. offset = offset | 0
  6778. byteLength = byteLength | 0
  6779. if (!noAssert) {
  6780. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6781. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6782. }
  6783. var mul = 1
  6784. var i = 0
  6785. this[offset] = value & 0xFF
  6786. while (++i < byteLength && (mul *= 0x100)) {
  6787. this[offset + i] = (value / mul) & 0xFF
  6788. }
  6789. return offset + byteLength
  6790. }
  6791. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6792. value = +value
  6793. offset = offset | 0
  6794. byteLength = byteLength | 0
  6795. if (!noAssert) {
  6796. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6797. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6798. }
  6799. var i = byteLength - 1
  6800. var mul = 1
  6801. this[offset + i] = value & 0xFF
  6802. while (--i >= 0 && (mul *= 0x100)) {
  6803. this[offset + i] = (value / mul) & 0xFF
  6804. }
  6805. return offset + byteLength
  6806. }
  6807. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6808. value = +value
  6809. offset = offset | 0
  6810. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6811. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6812. this[offset] = (value & 0xff)
  6813. return offset + 1
  6814. }
  6815. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6816. if (value < 0) value = 0xffff + value + 1
  6817. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6818. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6819. (littleEndian ? i : 1 - i) * 8
  6820. }
  6821. }
  6822. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6823. value = +value
  6824. offset = offset | 0
  6825. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6826. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6827. this[offset] = (value & 0xff)
  6828. this[offset + 1] = (value >>> 8)
  6829. } else {
  6830. objectWriteUInt16(this, value, offset, true)
  6831. }
  6832. return offset + 2
  6833. }
  6834. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6835. value = +value
  6836. offset = offset | 0
  6837. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6838. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6839. this[offset] = (value >>> 8)
  6840. this[offset + 1] = (value & 0xff)
  6841. } else {
  6842. objectWriteUInt16(this, value, offset, false)
  6843. }
  6844. return offset + 2
  6845. }
  6846. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6847. if (value < 0) value = 0xffffffff + value + 1
  6848. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6849. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6850. }
  6851. }
  6852. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6853. value = +value
  6854. offset = offset | 0
  6855. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6856. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6857. this[offset + 3] = (value >>> 24)
  6858. this[offset + 2] = (value >>> 16)
  6859. this[offset + 1] = (value >>> 8)
  6860. this[offset] = (value & 0xff)
  6861. } else {
  6862. objectWriteUInt32(this, value, offset, true)
  6863. }
  6864. return offset + 4
  6865. }
  6866. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6867. value = +value
  6868. offset = offset | 0
  6869. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6870. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6871. this[offset] = (value >>> 24)
  6872. this[offset + 1] = (value >>> 16)
  6873. this[offset + 2] = (value >>> 8)
  6874. this[offset + 3] = (value & 0xff)
  6875. } else {
  6876. objectWriteUInt32(this, value, offset, false)
  6877. }
  6878. return offset + 4
  6879. }
  6880. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6881. value = +value
  6882. offset = offset | 0
  6883. if (!noAssert) {
  6884. var limit = Math.pow(2, 8 * byteLength - 1)
  6885. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6886. }
  6887. var i = 0
  6888. var mul = 1
  6889. var sub = 0
  6890. this[offset] = value & 0xFF
  6891. while (++i < byteLength && (mul *= 0x100)) {
  6892. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6893. sub = 1
  6894. }
  6895. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6896. }
  6897. return offset + byteLength
  6898. }
  6899. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6900. value = +value
  6901. offset = offset | 0
  6902. if (!noAssert) {
  6903. var limit = Math.pow(2, 8 * byteLength - 1)
  6904. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6905. }
  6906. var i = byteLength - 1
  6907. var mul = 1
  6908. var sub = 0
  6909. this[offset + i] = value & 0xFF
  6910. while (--i >= 0 && (mul *= 0x100)) {
  6911. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6912. sub = 1
  6913. }
  6914. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6915. }
  6916. return offset + byteLength
  6917. }
  6918. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6919. value = +value
  6920. offset = offset | 0
  6921. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6922. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6923. if (value < 0) value = 0xff + value + 1
  6924. this[offset] = (value & 0xff)
  6925. return offset + 1
  6926. }
  6927. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6928. value = +value
  6929. offset = offset | 0
  6930. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6931. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6932. this[offset] = (value & 0xff)
  6933. this[offset + 1] = (value >>> 8)
  6934. } else {
  6935. objectWriteUInt16(this, value, offset, true)
  6936. }
  6937. return offset + 2
  6938. }
  6939. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6940. value = +value
  6941. offset = offset | 0
  6942. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6943. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6944. this[offset] = (value >>> 8)
  6945. this[offset + 1] = (value & 0xff)
  6946. } else {
  6947. objectWriteUInt16(this, value, offset, false)
  6948. }
  6949. return offset + 2
  6950. }
  6951. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6952. value = +value
  6953. offset = offset | 0
  6954. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6955. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6956. this[offset] = (value & 0xff)
  6957. this[offset + 1] = (value >>> 8)
  6958. this[offset + 2] = (value >>> 16)
  6959. this[offset + 3] = (value >>> 24)
  6960. } else {
  6961. objectWriteUInt32(this, value, offset, true)
  6962. }
  6963. return offset + 4
  6964. }
  6965. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6966. value = +value
  6967. offset = offset | 0
  6968. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6969. if (value < 0) value = 0xffffffff + value + 1
  6970. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6971. this[offset] = (value >>> 24)
  6972. this[offset + 1] = (value >>> 16)
  6973. this[offset + 2] = (value >>> 8)
  6974. this[offset + 3] = (value & 0xff)
  6975. } else {
  6976. objectWriteUInt32(this, value, offset, false)
  6977. }
  6978. return offset + 4
  6979. }
  6980. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6981. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6982. if (offset < 0) throw new RangeError('Index out of range')
  6983. }
  6984. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6985. if (!noAssert) {
  6986. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6987. }
  6988. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6989. return offset + 4
  6990. }
  6991. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6992. return writeFloat(this, value, offset, true, noAssert)
  6993. }
  6994. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6995. return writeFloat(this, value, offset, false, noAssert)
  6996. }
  6997. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6998. if (!noAssert) {
  6999. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7000. }
  7001. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7002. return offset + 8
  7003. }
  7004. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7005. return writeDouble(this, value, offset, true, noAssert)
  7006. }
  7007. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7008. return writeDouble(this, value, offset, false, noAssert)
  7009. }
  7010. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7011. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7012. if (!start) start = 0
  7013. if (!end && end !== 0) end = this.length
  7014. if (targetStart >= target.length) targetStart = target.length
  7015. if (!targetStart) targetStart = 0
  7016. if (end > 0 && end < start) end = start
  7017. // Copy 0 bytes; we're done
  7018. if (end === start) return 0
  7019. if (target.length === 0 || this.length === 0) return 0
  7020. // Fatal error conditions
  7021. if (targetStart < 0) {
  7022. throw new RangeError('targetStart out of bounds')
  7023. }
  7024. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7025. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7026. // Are we oob?
  7027. if (end > this.length) end = this.length
  7028. if (target.length - targetStart < end - start) {
  7029. end = target.length - targetStart + start
  7030. }
  7031. var len = end - start
  7032. var i
  7033. if (this === target && start < targetStart && targetStart < end) {
  7034. // descending copy from end
  7035. for (i = len - 1; i >= 0; --i) {
  7036. target[i + targetStart] = this[i + start]
  7037. }
  7038. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7039. // ascending copy from start
  7040. for (i = 0; i < len; ++i) {
  7041. target[i + targetStart] = this[i + start]
  7042. }
  7043. } else {
  7044. Uint8Array.prototype.set.call(
  7045. target,
  7046. this.subarray(start, start + len),
  7047. targetStart
  7048. )
  7049. }
  7050. return len
  7051. }
  7052. // Usage:
  7053. // buffer.fill(number[, offset[, end]])
  7054. // buffer.fill(buffer[, offset[, end]])
  7055. // buffer.fill(string[, offset[, end]][, encoding])
  7056. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7057. // Handle string cases:
  7058. if (typeof val === 'string') {
  7059. if (typeof start === 'string') {
  7060. encoding = start
  7061. start = 0
  7062. end = this.length
  7063. } else if (typeof end === 'string') {
  7064. encoding = end
  7065. end = this.length
  7066. }
  7067. if (val.length === 1) {
  7068. var code = val.charCodeAt(0)
  7069. if (code < 256) {
  7070. val = code
  7071. }
  7072. }
  7073. if (encoding !== undefined && typeof encoding !== 'string') {
  7074. throw new TypeError('encoding must be a string')
  7075. }
  7076. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7077. throw new TypeError('Unknown encoding: ' + encoding)
  7078. }
  7079. } else if (typeof val === 'number') {
  7080. val = val & 255
  7081. }
  7082. // Invalid ranges are not set to a default, so can range check early.
  7083. if (start < 0 || this.length < start || this.length < end) {
  7084. throw new RangeError('Out of range index')
  7085. }
  7086. if (end <= start) {
  7087. return this
  7088. }
  7089. start = start >>> 0
  7090. end = end === undefined ? this.length : end >>> 0
  7091. if (!val) val = 0
  7092. var i
  7093. if (typeof val === 'number') {
  7094. for (i = start; i < end; ++i) {
  7095. this[i] = val
  7096. }
  7097. } else {
  7098. var bytes = Buffer.isBuffer(val)
  7099. ? val
  7100. : utf8ToBytes(new Buffer(val, encoding).toString())
  7101. var len = bytes.length
  7102. for (i = 0; i < end - start; ++i) {
  7103. this[i + start] = bytes[i % len]
  7104. }
  7105. }
  7106. return this
  7107. }
  7108. // HELPER FUNCTIONS
  7109. // ================
  7110. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7111. function base64clean (str) {
  7112. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7113. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7114. // Node converts strings with length < 2 to ''
  7115. if (str.length < 2) return ''
  7116. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7117. while (str.length % 4 !== 0) {
  7118. str = str + '='
  7119. }
  7120. return str
  7121. }
  7122. function stringtrim (str) {
  7123. if (str.trim) return str.trim()
  7124. return str.replace(/^\s+|\s+$/g, '')
  7125. }
  7126. function toHex (n) {
  7127. if (n < 16) return '0' + n.toString(16)
  7128. return n.toString(16)
  7129. }
  7130. function utf8ToBytes (string, units) {
  7131. units = units || Infinity
  7132. var codePoint
  7133. var length = string.length
  7134. var leadSurrogate = null
  7135. var bytes = []
  7136. for (var i = 0; i < length; ++i) {
  7137. codePoint = string.charCodeAt(i)
  7138. // is surrogate component
  7139. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7140. // last char was a lead
  7141. if (!leadSurrogate) {
  7142. // no lead yet
  7143. if (codePoint > 0xDBFF) {
  7144. // unexpected trail
  7145. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7146. continue
  7147. } else if (i + 1 === length) {
  7148. // unpaired lead
  7149. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7150. continue
  7151. }
  7152. // valid lead
  7153. leadSurrogate = codePoint
  7154. continue
  7155. }
  7156. // 2 leads in a row
  7157. if (codePoint < 0xDC00) {
  7158. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7159. leadSurrogate = codePoint
  7160. continue
  7161. }
  7162. // valid surrogate pair
  7163. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7164. } else if (leadSurrogate) {
  7165. // valid bmp char, but last char was a lead
  7166. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7167. }
  7168. leadSurrogate = null
  7169. // encode utf8
  7170. if (codePoint < 0x80) {
  7171. if ((units -= 1) < 0) break
  7172. bytes.push(codePoint)
  7173. } else if (codePoint < 0x800) {
  7174. if ((units -= 2) < 0) break
  7175. bytes.push(
  7176. codePoint >> 0x6 | 0xC0,
  7177. codePoint & 0x3F | 0x80
  7178. )
  7179. } else if (codePoint < 0x10000) {
  7180. if ((units -= 3) < 0) break
  7181. bytes.push(
  7182. codePoint >> 0xC | 0xE0,
  7183. codePoint >> 0x6 & 0x3F | 0x80,
  7184. codePoint & 0x3F | 0x80
  7185. )
  7186. } else if (codePoint < 0x110000) {
  7187. if ((units -= 4) < 0) break
  7188. bytes.push(
  7189. codePoint >> 0x12 | 0xF0,
  7190. codePoint >> 0xC & 0x3F | 0x80,
  7191. codePoint >> 0x6 & 0x3F | 0x80,
  7192. codePoint & 0x3F | 0x80
  7193. )
  7194. } else {
  7195. throw new Error('Invalid code point')
  7196. }
  7197. }
  7198. return bytes
  7199. }
  7200. function asciiToBytes (str) {
  7201. var byteArray = []
  7202. for (var i = 0; i < str.length; ++i) {
  7203. // Node's code seems to be doing this and not & 0x7F..
  7204. byteArray.push(str.charCodeAt(i) & 0xFF)
  7205. }
  7206. return byteArray
  7207. }
  7208. function utf16leToBytes (str, units) {
  7209. var c, hi, lo
  7210. var byteArray = []
  7211. for (var i = 0; i < str.length; ++i) {
  7212. if ((units -= 2) < 0) break
  7213. c = str.charCodeAt(i)
  7214. hi = c >> 8
  7215. lo = c % 256
  7216. byteArray.push(lo)
  7217. byteArray.push(hi)
  7218. }
  7219. return byteArray
  7220. }
  7221. function base64ToBytes (str) {
  7222. return base64.toByteArray(base64clean(str))
  7223. }
  7224. function blitBuffer (src, dst, offset, length) {
  7225. for (var i = 0; i < length; ++i) {
  7226. if ((i + offset >= dst.length) || (i >= src.length)) break
  7227. dst[i + offset] = src[i]
  7228. }
  7229. return i
  7230. }
  7231. function isnan (val) {
  7232. return val !== val // eslint-disable-line no-self-compare
  7233. }
  7234. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7235. /***/ }),
  7236. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7237. /*!**************************************************!*\
  7238. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7239. \**************************************************/
  7240. /*! no static exports found */
  7241. /***/ (function(module, exports, __webpack_require__) {
  7242. /*!
  7243. * clipboard.js v2.0.4
  7244. * https://zenorocha.github.io/clipboard.js
  7245. *
  7246. * Licensed MIT © Zeno Rocha
  7247. */
  7248. (function webpackUniversalModuleDefinition(root, factory) {
  7249. if(true)
  7250. module.exports = factory();
  7251. else {}
  7252. })(this, function() {
  7253. return /******/ (function(modules) { // webpackBootstrap
  7254. /******/ // The module cache
  7255. /******/ var installedModules = {};
  7256. /******/
  7257. /******/ // The require function
  7258. /******/ function __webpack_require__(moduleId) {
  7259. /******/
  7260. /******/ // Check if module is in cache
  7261. /******/ if(installedModules[moduleId]) {
  7262. /******/ return installedModules[moduleId].exports;
  7263. /******/ }
  7264. /******/ // Create a new module (and put it into the cache)
  7265. /******/ var module = installedModules[moduleId] = {
  7266. /******/ i: moduleId,
  7267. /******/ l: false,
  7268. /******/ exports: {}
  7269. /******/ };
  7270. /******/
  7271. /******/ // Execute the module function
  7272. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7273. /******/
  7274. /******/ // Flag the module as loaded
  7275. /******/ module.l = true;
  7276. /******/
  7277. /******/ // Return the exports of the module
  7278. /******/ return module.exports;
  7279. /******/ }
  7280. /******/
  7281. /******/
  7282. /******/ // expose the modules object (__webpack_modules__)
  7283. /******/ __webpack_require__.m = modules;
  7284. /******/
  7285. /******/ // expose the module cache
  7286. /******/ __webpack_require__.c = installedModules;
  7287. /******/
  7288. /******/ // define getter function for harmony exports
  7289. /******/ __webpack_require__.d = function(exports, name, getter) {
  7290. /******/ if(!__webpack_require__.o(exports, name)) {
  7291. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7292. /******/ }
  7293. /******/ };
  7294. /******/
  7295. /******/ // define __esModule on exports
  7296. /******/ __webpack_require__.r = function(exports) {
  7297. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7298. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7299. /******/ }
  7300. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7301. /******/ };
  7302. /******/
  7303. /******/ // create a fake namespace object
  7304. /******/ // mode & 1: value is a module id, require it
  7305. /******/ // mode & 2: merge all properties of value into the ns
  7306. /******/ // mode & 4: return value when already ns object
  7307. /******/ // mode & 8|1: behave like require
  7308. /******/ __webpack_require__.t = function(value, mode) {
  7309. /******/ if(mode & 1) value = __webpack_require__(value);
  7310. /******/ if(mode & 8) return value;
  7311. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7312. /******/ var ns = Object.create(null);
  7313. /******/ __webpack_require__.r(ns);
  7314. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7315. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7316. /******/ return ns;
  7317. /******/ };
  7318. /******/
  7319. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7320. /******/ __webpack_require__.n = function(module) {
  7321. /******/ var getter = module && module.__esModule ?
  7322. /******/ function getDefault() { return module['default']; } :
  7323. /******/ function getModuleExports() { return module; };
  7324. /******/ __webpack_require__.d(getter, 'a', getter);
  7325. /******/ return getter;
  7326. /******/ };
  7327. /******/
  7328. /******/ // Object.prototype.hasOwnProperty.call
  7329. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7330. /******/
  7331. /******/ // __webpack_public_path__
  7332. /******/ __webpack_require__.p = "";
  7333. /******/
  7334. /******/
  7335. /******/ // Load entry module and return exports
  7336. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7337. /******/ })
  7338. /************************************************************************/
  7339. /******/ ([
  7340. /* 0 */
  7341. /***/ (function(module, exports, __webpack_require__) {
  7342. "use strict";
  7343. 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; };
  7344. 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; }; }();
  7345. var _clipboardAction = __webpack_require__(1);
  7346. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7347. var _tinyEmitter = __webpack_require__(3);
  7348. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7349. var _goodListener = __webpack_require__(4);
  7350. var _goodListener2 = _interopRequireDefault(_goodListener);
  7351. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7352. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7353. 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; }
  7354. 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; }
  7355. /**
  7356. * Base class which takes one or more elements, adds event listeners to them,
  7357. * and instantiates a new `ClipboardAction` on each click.
  7358. */
  7359. var Clipboard = function (_Emitter) {
  7360. _inherits(Clipboard, _Emitter);
  7361. /**
  7362. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7363. * @param {Object} options
  7364. */
  7365. function Clipboard(trigger, options) {
  7366. _classCallCheck(this, Clipboard);
  7367. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7368. _this.resolveOptions(options);
  7369. _this.listenClick(trigger);
  7370. return _this;
  7371. }
  7372. /**
  7373. * Defines if attributes would be resolved using internal setter functions
  7374. * or custom functions that were passed in the constructor.
  7375. * @param {Object} options
  7376. */
  7377. _createClass(Clipboard, [{
  7378. key: 'resolveOptions',
  7379. value: function resolveOptions() {
  7380. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7381. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7382. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7383. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7384. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7385. }
  7386. /**
  7387. * Adds a click event listener to the passed trigger.
  7388. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7389. */
  7390. }, {
  7391. key: 'listenClick',
  7392. value: function listenClick(trigger) {
  7393. var _this2 = this;
  7394. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7395. return _this2.onClick(e);
  7396. });
  7397. }
  7398. /**
  7399. * Defines a new `ClipboardAction` on each click event.
  7400. * @param {Event} e
  7401. */
  7402. }, {
  7403. key: 'onClick',
  7404. value: function onClick(e) {
  7405. var trigger = e.delegateTarget || e.currentTarget;
  7406. if (this.clipboardAction) {
  7407. this.clipboardAction = null;
  7408. }
  7409. this.clipboardAction = new _clipboardAction2.default({
  7410. action: this.action(trigger),
  7411. target: this.target(trigger),
  7412. text: this.text(trigger),
  7413. container: this.container,
  7414. trigger: trigger,
  7415. emitter: this
  7416. });
  7417. }
  7418. /**
  7419. * Default `action` lookup function.
  7420. * @param {Element} trigger
  7421. */
  7422. }, {
  7423. key: 'defaultAction',
  7424. value: function defaultAction(trigger) {
  7425. return getAttributeValue('action', trigger);
  7426. }
  7427. /**
  7428. * Default `target` lookup function.
  7429. * @param {Element} trigger
  7430. */
  7431. }, {
  7432. key: 'defaultTarget',
  7433. value: function defaultTarget(trigger) {
  7434. var selector = getAttributeValue('target', trigger);
  7435. if (selector) {
  7436. return document.querySelector(selector);
  7437. }
  7438. }
  7439. /**
  7440. * Returns the support of the given action, or all actions if no action is
  7441. * given.
  7442. * @param {String} [action]
  7443. */
  7444. }, {
  7445. key: 'defaultText',
  7446. /**
  7447. * Default `text` lookup function.
  7448. * @param {Element} trigger
  7449. */
  7450. value: function defaultText(trigger) {
  7451. return getAttributeValue('text', trigger);
  7452. }
  7453. /**
  7454. * Destroy lifecycle.
  7455. */
  7456. }, {
  7457. key: 'destroy',
  7458. value: function destroy() {
  7459. this.listener.destroy();
  7460. if (this.clipboardAction) {
  7461. this.clipboardAction.destroy();
  7462. this.clipboardAction = null;
  7463. }
  7464. }
  7465. }], [{
  7466. key: 'isSupported',
  7467. value: function isSupported() {
  7468. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7469. var actions = typeof action === 'string' ? [action] : action;
  7470. var support = !!document.queryCommandSupported;
  7471. actions.forEach(function (action) {
  7472. support = support && !!document.queryCommandSupported(action);
  7473. });
  7474. return support;
  7475. }
  7476. }]);
  7477. return Clipboard;
  7478. }(_tinyEmitter2.default);
  7479. /**
  7480. * Helper function to retrieve attribute value.
  7481. * @param {String} suffix
  7482. * @param {Element} element
  7483. */
  7484. function getAttributeValue(suffix, element) {
  7485. var attribute = 'data-clipboard-' + suffix;
  7486. if (!element.hasAttribute(attribute)) {
  7487. return;
  7488. }
  7489. return element.getAttribute(attribute);
  7490. }
  7491. module.exports = Clipboard;
  7492. /***/ }),
  7493. /* 1 */
  7494. /***/ (function(module, exports, __webpack_require__) {
  7495. "use strict";
  7496. 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; };
  7497. 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; }; }();
  7498. var _select = __webpack_require__(2);
  7499. var _select2 = _interopRequireDefault(_select);
  7500. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7501. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7502. /**
  7503. * Inner class which performs selection from either `text` or `target`
  7504. * properties and then executes copy or cut operations.
  7505. */
  7506. var ClipboardAction = function () {
  7507. /**
  7508. * @param {Object} options
  7509. */
  7510. function ClipboardAction(options) {
  7511. _classCallCheck(this, ClipboardAction);
  7512. this.resolveOptions(options);
  7513. this.initSelection();
  7514. }
  7515. /**
  7516. * Defines base properties passed from constructor.
  7517. * @param {Object} options
  7518. */
  7519. _createClass(ClipboardAction, [{
  7520. key: 'resolveOptions',
  7521. value: function resolveOptions() {
  7522. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7523. this.action = options.action;
  7524. this.container = options.container;
  7525. this.emitter = options.emitter;
  7526. this.target = options.target;
  7527. this.text = options.text;
  7528. this.trigger = options.trigger;
  7529. this.selectedText = '';
  7530. }
  7531. /**
  7532. * Decides which selection strategy is going to be applied based
  7533. * on the existence of `text` and `target` properties.
  7534. */
  7535. }, {
  7536. key: 'initSelection',
  7537. value: function initSelection() {
  7538. if (this.text) {
  7539. this.selectFake();
  7540. } else if (this.target) {
  7541. this.selectTarget();
  7542. }
  7543. }
  7544. /**
  7545. * Creates a fake textarea element, sets its value from `text` property,
  7546. * and makes a selection on it.
  7547. */
  7548. }, {
  7549. key: 'selectFake',
  7550. value: function selectFake() {
  7551. var _this = this;
  7552. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7553. this.removeFake();
  7554. this.fakeHandlerCallback = function () {
  7555. return _this.removeFake();
  7556. };
  7557. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7558. this.fakeElem = document.createElement('textarea');
  7559. // Prevent zooming on iOS
  7560. this.fakeElem.style.fontSize = '12pt';
  7561. // Reset box model
  7562. this.fakeElem.style.border = '0';
  7563. this.fakeElem.style.padding = '0';
  7564. this.fakeElem.style.margin = '0';
  7565. // Move element out of screen horizontally
  7566. this.fakeElem.style.position = 'absolute';
  7567. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7568. // Move element to the same position vertically
  7569. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7570. this.fakeElem.style.top = yPosition + 'px';
  7571. this.fakeElem.setAttribute('readonly', '');
  7572. this.fakeElem.value = this.text;
  7573. this.container.appendChild(this.fakeElem);
  7574. this.selectedText = (0, _select2.default)(this.fakeElem);
  7575. this.copyText();
  7576. }
  7577. /**
  7578. * Only removes the fake element after another click event, that way
  7579. * a user can hit `Ctrl+C` to copy because selection still exists.
  7580. */
  7581. }, {
  7582. key: 'removeFake',
  7583. value: function removeFake() {
  7584. if (this.fakeHandler) {
  7585. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7586. this.fakeHandler = null;
  7587. this.fakeHandlerCallback = null;
  7588. }
  7589. if (this.fakeElem) {
  7590. this.container.removeChild(this.fakeElem);
  7591. this.fakeElem = null;
  7592. }
  7593. }
  7594. /**
  7595. * Selects the content from element passed on `target` property.
  7596. */
  7597. }, {
  7598. key: 'selectTarget',
  7599. value: function selectTarget() {
  7600. this.selectedText = (0, _select2.default)(this.target);
  7601. this.copyText();
  7602. }
  7603. /**
  7604. * Executes the copy operation based on the current selection.
  7605. */
  7606. }, {
  7607. key: 'copyText',
  7608. value: function copyText() {
  7609. var succeeded = void 0;
  7610. try {
  7611. succeeded = document.execCommand(this.action);
  7612. } catch (err) {
  7613. succeeded = false;
  7614. }
  7615. this.handleResult(succeeded);
  7616. }
  7617. /**
  7618. * Fires an event based on the copy operation result.
  7619. * @param {Boolean} succeeded
  7620. */
  7621. }, {
  7622. key: 'handleResult',
  7623. value: function handleResult(succeeded) {
  7624. this.emitter.emit(succeeded ? 'success' : 'error', {
  7625. action: this.action,
  7626. text: this.selectedText,
  7627. trigger: this.trigger,
  7628. clearSelection: this.clearSelection.bind(this)
  7629. });
  7630. }
  7631. /**
  7632. * Moves focus away from `target` and back to the trigger, removes current selection.
  7633. */
  7634. }, {
  7635. key: 'clearSelection',
  7636. value: function clearSelection() {
  7637. if (this.trigger) {
  7638. this.trigger.focus();
  7639. }
  7640. window.getSelection().removeAllRanges();
  7641. }
  7642. /**
  7643. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7644. * @param {String} action
  7645. */
  7646. }, {
  7647. key: 'destroy',
  7648. /**
  7649. * Destroy lifecycle.
  7650. */
  7651. value: function destroy() {
  7652. this.removeFake();
  7653. }
  7654. }, {
  7655. key: 'action',
  7656. set: function set() {
  7657. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7658. this._action = action;
  7659. if (this._action !== 'copy' && this._action !== 'cut') {
  7660. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7661. }
  7662. }
  7663. /**
  7664. * Gets the `action` property.
  7665. * @return {String}
  7666. */
  7667. ,
  7668. get: function get() {
  7669. return this._action;
  7670. }
  7671. /**
  7672. * Sets the `target` property using an element
  7673. * that will be have its content copied.
  7674. * @param {Element} target
  7675. */
  7676. }, {
  7677. key: 'target',
  7678. set: function set(target) {
  7679. if (target !== undefined) {
  7680. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7681. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7682. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7683. }
  7684. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7685. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7686. }
  7687. this._target = target;
  7688. } else {
  7689. throw new Error('Invalid "target" value, use a valid Element');
  7690. }
  7691. }
  7692. }
  7693. /**
  7694. * Gets the `target` property.
  7695. * @return {String|HTMLElement}
  7696. */
  7697. ,
  7698. get: function get() {
  7699. return this._target;
  7700. }
  7701. }]);
  7702. return ClipboardAction;
  7703. }();
  7704. module.exports = ClipboardAction;
  7705. /***/ }),
  7706. /* 2 */
  7707. /***/ (function(module, exports) {
  7708. function select(element) {
  7709. var selectedText;
  7710. if (element.nodeName === 'SELECT') {
  7711. element.focus();
  7712. selectedText = element.value;
  7713. }
  7714. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7715. var isReadOnly = element.hasAttribute('readonly');
  7716. if (!isReadOnly) {
  7717. element.setAttribute('readonly', '');
  7718. }
  7719. element.select();
  7720. element.setSelectionRange(0, element.value.length);
  7721. if (!isReadOnly) {
  7722. element.removeAttribute('readonly');
  7723. }
  7724. selectedText = element.value;
  7725. }
  7726. else {
  7727. if (element.hasAttribute('contenteditable')) {
  7728. element.focus();
  7729. }
  7730. var selection = window.getSelection();
  7731. var range = document.createRange();
  7732. range.selectNodeContents(element);
  7733. selection.removeAllRanges();
  7734. selection.addRange(range);
  7735. selectedText = selection.toString();
  7736. }
  7737. return selectedText;
  7738. }
  7739. module.exports = select;
  7740. /***/ }),
  7741. /* 3 */
  7742. /***/ (function(module, exports) {
  7743. function E () {
  7744. // Keep this empty so it's easier to inherit from
  7745. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7746. }
  7747. E.prototype = {
  7748. on: function (name, callback, ctx) {
  7749. var e = this.e || (this.e = {});
  7750. (e[name] || (e[name] = [])).push({
  7751. fn: callback,
  7752. ctx: ctx
  7753. });
  7754. return this;
  7755. },
  7756. once: function (name, callback, ctx) {
  7757. var self = this;
  7758. function listener () {
  7759. self.off(name, listener);
  7760. callback.apply(ctx, arguments);
  7761. };
  7762. listener._ = callback
  7763. return this.on(name, listener, ctx);
  7764. },
  7765. emit: function (name) {
  7766. var data = [].slice.call(arguments, 1);
  7767. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7768. var i = 0;
  7769. var len = evtArr.length;
  7770. for (i; i < len; i++) {
  7771. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7772. }
  7773. return this;
  7774. },
  7775. off: function (name, callback) {
  7776. var e = this.e || (this.e = {});
  7777. var evts = e[name];
  7778. var liveEvents = [];
  7779. if (evts && callback) {
  7780. for (var i = 0, len = evts.length; i < len; i++) {
  7781. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7782. liveEvents.push(evts[i]);
  7783. }
  7784. }
  7785. // Remove event from queue to prevent memory leak
  7786. // Suggested by https://github.com/lazd
  7787. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7788. (liveEvents.length)
  7789. ? e[name] = liveEvents
  7790. : delete e[name];
  7791. return this;
  7792. }
  7793. };
  7794. module.exports = E;
  7795. /***/ }),
  7796. /* 4 */
  7797. /***/ (function(module, exports, __webpack_require__) {
  7798. var is = __webpack_require__(5);
  7799. var delegate = __webpack_require__(6);
  7800. /**
  7801. * Validates all params and calls the right
  7802. * listener function based on its target type.
  7803. *
  7804. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7805. * @param {String} type
  7806. * @param {Function} callback
  7807. * @return {Object}
  7808. */
  7809. function listen(target, type, callback) {
  7810. if (!target && !type && !callback) {
  7811. throw new Error('Missing required arguments');
  7812. }
  7813. if (!is.string(type)) {
  7814. throw new TypeError('Second argument must be a String');
  7815. }
  7816. if (!is.fn(callback)) {
  7817. throw new TypeError('Third argument must be a Function');
  7818. }
  7819. if (is.node(target)) {
  7820. return listenNode(target, type, callback);
  7821. }
  7822. else if (is.nodeList(target)) {
  7823. return listenNodeList(target, type, callback);
  7824. }
  7825. else if (is.string(target)) {
  7826. return listenSelector(target, type, callback);
  7827. }
  7828. else {
  7829. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7830. }
  7831. }
  7832. /**
  7833. * Adds an event listener to a HTML element
  7834. * and returns a remove listener function.
  7835. *
  7836. * @param {HTMLElement} node
  7837. * @param {String} type
  7838. * @param {Function} callback
  7839. * @return {Object}
  7840. */
  7841. function listenNode(node, type, callback) {
  7842. node.addEventListener(type, callback);
  7843. return {
  7844. destroy: function() {
  7845. node.removeEventListener(type, callback);
  7846. }
  7847. }
  7848. }
  7849. /**
  7850. * Add an event listener to a list of HTML elements
  7851. * and returns a remove listener function.
  7852. *
  7853. * @param {NodeList|HTMLCollection} nodeList
  7854. * @param {String} type
  7855. * @param {Function} callback
  7856. * @return {Object}
  7857. */
  7858. function listenNodeList(nodeList, type, callback) {
  7859. Array.prototype.forEach.call(nodeList, function(node) {
  7860. node.addEventListener(type, callback);
  7861. });
  7862. return {
  7863. destroy: function() {
  7864. Array.prototype.forEach.call(nodeList, function(node) {
  7865. node.removeEventListener(type, callback);
  7866. });
  7867. }
  7868. }
  7869. }
  7870. /**
  7871. * Add an event listener to a selector
  7872. * and returns a remove listener function.
  7873. *
  7874. * @param {String} selector
  7875. * @param {String} type
  7876. * @param {Function} callback
  7877. * @return {Object}
  7878. */
  7879. function listenSelector(selector, type, callback) {
  7880. return delegate(document.body, selector, type, callback);
  7881. }
  7882. module.exports = listen;
  7883. /***/ }),
  7884. /* 5 */
  7885. /***/ (function(module, exports) {
  7886. /**
  7887. * Check if argument is a HTML element.
  7888. *
  7889. * @param {Object} value
  7890. * @return {Boolean}
  7891. */
  7892. exports.node = function(value) {
  7893. return value !== undefined
  7894. && value instanceof HTMLElement
  7895. && value.nodeType === 1;
  7896. };
  7897. /**
  7898. * Check if argument is a list of HTML elements.
  7899. *
  7900. * @param {Object} value
  7901. * @return {Boolean}
  7902. */
  7903. exports.nodeList = function(value) {
  7904. var type = Object.prototype.toString.call(value);
  7905. return value !== undefined
  7906. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7907. && ('length' in value)
  7908. && (value.length === 0 || exports.node(value[0]));
  7909. };
  7910. /**
  7911. * Check if argument is a string.
  7912. *
  7913. * @param {Object} value
  7914. * @return {Boolean}
  7915. */
  7916. exports.string = function(value) {
  7917. return typeof value === 'string'
  7918. || value instanceof String;
  7919. };
  7920. /**
  7921. * Check if argument is a function.
  7922. *
  7923. * @param {Object} value
  7924. * @return {Boolean}
  7925. */
  7926. exports.fn = function(value) {
  7927. var type = Object.prototype.toString.call(value);
  7928. return type === '[object Function]';
  7929. };
  7930. /***/ }),
  7931. /* 6 */
  7932. /***/ (function(module, exports, __webpack_require__) {
  7933. var closest = __webpack_require__(7);
  7934. /**
  7935. * Delegates event to a selector.
  7936. *
  7937. * @param {Element} element
  7938. * @param {String} selector
  7939. * @param {String} type
  7940. * @param {Function} callback
  7941. * @param {Boolean} useCapture
  7942. * @return {Object}
  7943. */
  7944. function _delegate(element, selector, type, callback, useCapture) {
  7945. var listenerFn = listener.apply(this, arguments);
  7946. element.addEventListener(type, listenerFn, useCapture);
  7947. return {
  7948. destroy: function() {
  7949. element.removeEventListener(type, listenerFn, useCapture);
  7950. }
  7951. }
  7952. }
  7953. /**
  7954. * Delegates event to a selector.
  7955. *
  7956. * @param {Element|String|Array} [elements]
  7957. * @param {String} selector
  7958. * @param {String} type
  7959. * @param {Function} callback
  7960. * @param {Boolean} useCapture
  7961. * @return {Object}
  7962. */
  7963. function delegate(elements, selector, type, callback, useCapture) {
  7964. // Handle the regular Element usage
  7965. if (typeof elements.addEventListener === 'function') {
  7966. return _delegate.apply(null, arguments);
  7967. }
  7968. // Handle Element-less usage, it defaults to global delegation
  7969. if (typeof type === 'function') {
  7970. // Use `document` as the first parameter, then apply arguments
  7971. // This is a short way to .unshift `arguments` without running into deoptimizations
  7972. return _delegate.bind(null, document).apply(null, arguments);
  7973. }
  7974. // Handle Selector-based usage
  7975. if (typeof elements === 'string') {
  7976. elements = document.querySelectorAll(elements);
  7977. }
  7978. // Handle Array-like based usage
  7979. return Array.prototype.map.call(elements, function (element) {
  7980. return _delegate(element, selector, type, callback, useCapture);
  7981. });
  7982. }
  7983. /**
  7984. * Finds closest match and invokes callback.
  7985. *
  7986. * @param {Element} element
  7987. * @param {String} selector
  7988. * @param {String} type
  7989. * @param {Function} callback
  7990. * @return {Function}
  7991. */
  7992. function listener(element, selector, type, callback) {
  7993. return function(e) {
  7994. e.delegateTarget = closest(e.target, selector);
  7995. if (e.delegateTarget) {
  7996. callback.call(element, e);
  7997. }
  7998. }
  7999. }
  8000. module.exports = delegate;
  8001. /***/ }),
  8002. /* 7 */
  8003. /***/ (function(module, exports) {
  8004. var DOCUMENT_NODE_TYPE = 9;
  8005. /**
  8006. * A polyfill for Element.matches()
  8007. */
  8008. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8009. var proto = Element.prototype;
  8010. proto.matches = proto.matchesSelector ||
  8011. proto.mozMatchesSelector ||
  8012. proto.msMatchesSelector ||
  8013. proto.oMatchesSelector ||
  8014. proto.webkitMatchesSelector;
  8015. }
  8016. /**
  8017. * Finds the closest parent that matches a selector.
  8018. *
  8019. * @param {Element} element
  8020. * @param {String} selector
  8021. * @return {Function}
  8022. */
  8023. function closest (element, selector) {
  8024. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8025. if (typeof element.matches === 'function' &&
  8026. element.matches(selector)) {
  8027. return element;
  8028. }
  8029. element = element.parentNode;
  8030. }
  8031. }
  8032. module.exports = closest;
  8033. /***/ })
  8034. /******/ ]);
  8035. });
  8036. /***/ }),
  8037. /***/ "./node_modules/ieee754/index.js":
  8038. /*!***************************************!*\
  8039. !*** ./node_modules/ieee754/index.js ***!
  8040. \***************************************/
  8041. /*! no static exports found */
  8042. /***/ (function(module, exports) {
  8043. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8044. var e, m
  8045. var eLen = (nBytes * 8) - mLen - 1
  8046. var eMax = (1 << eLen) - 1
  8047. var eBias = eMax >> 1
  8048. var nBits = -7
  8049. var i = isLE ? (nBytes - 1) : 0
  8050. var d = isLE ? -1 : 1
  8051. var s = buffer[offset + i]
  8052. i += d
  8053. e = s & ((1 << (-nBits)) - 1)
  8054. s >>= (-nBits)
  8055. nBits += eLen
  8056. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8057. m = e & ((1 << (-nBits)) - 1)
  8058. e >>= (-nBits)
  8059. nBits += mLen
  8060. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8061. if (e === 0) {
  8062. e = 1 - eBias
  8063. } else if (e === eMax) {
  8064. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8065. } else {
  8066. m = m + Math.pow(2, mLen)
  8067. e = e - eBias
  8068. }
  8069. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8070. }
  8071. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8072. var e, m, c
  8073. var eLen = (nBytes * 8) - mLen - 1
  8074. var eMax = (1 << eLen) - 1
  8075. var eBias = eMax >> 1
  8076. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8077. var i = isLE ? 0 : (nBytes - 1)
  8078. var d = isLE ? 1 : -1
  8079. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8080. value = Math.abs(value)
  8081. if (isNaN(value) || value === Infinity) {
  8082. m = isNaN(value) ? 1 : 0
  8083. e = eMax
  8084. } else {
  8085. e = Math.floor(Math.log(value) / Math.LN2)
  8086. if (value * (c = Math.pow(2, -e)) < 1) {
  8087. e--
  8088. c *= 2
  8089. }
  8090. if (e + eBias >= 1) {
  8091. value += rt / c
  8092. } else {
  8093. value += rt * Math.pow(2, 1 - eBias)
  8094. }
  8095. if (value * c >= 2) {
  8096. e++
  8097. c /= 2
  8098. }
  8099. if (e + eBias >= eMax) {
  8100. m = 0
  8101. e = eMax
  8102. } else if (e + eBias >= 1) {
  8103. m = ((value * c) - 1) * Math.pow(2, mLen)
  8104. e = e + eBias
  8105. } else {
  8106. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8107. e = 0
  8108. }
  8109. }
  8110. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8111. e = (e << mLen) | m
  8112. eLen += mLen
  8113. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8114. buffer[offset + i - d] |= s * 128
  8115. }
  8116. /***/ }),
  8117. /***/ "./node_modules/isarray/index.js":
  8118. /*!***************************************!*\
  8119. !*** ./node_modules/isarray/index.js ***!
  8120. \***************************************/
  8121. /*! no static exports found */
  8122. /***/ (function(module, exports) {
  8123. var toString = {}.toString;
  8124. module.exports = Array.isArray || function (arr) {
  8125. return toString.call(arr) == '[object Array]';
  8126. };
  8127. /***/ }),
  8128. /***/ "./node_modules/jquery/dist/jquery.js":
  8129. /*!********************************************!*\
  8130. !*** ./node_modules/jquery/dist/jquery.js ***!
  8131. \********************************************/
  8132. /*! no static exports found */
  8133. /***/ (function(module, exports, __webpack_require__) {
  8134. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8135. * jQuery JavaScript Library v3.4.1
  8136. * https://jquery.com/
  8137. *
  8138. * Includes Sizzle.js
  8139. * https://sizzlejs.com/
  8140. *
  8141. * Copyright JS Foundation and other contributors
  8142. * Released under the MIT license
  8143. * https://jquery.org/license
  8144. *
  8145. * Date: 2019-05-01T21:04Z
  8146. */
  8147. ( function( global, factory ) {
  8148. "use strict";
  8149. if ( true && typeof module.exports === "object" ) {
  8150. // For CommonJS and CommonJS-like environments where a proper `window`
  8151. // is present, execute the factory and get jQuery.
  8152. // For environments that do not have a `window` with a `document`
  8153. // (such as Node.js), expose a factory as module.exports.
  8154. // This accentuates the need for the creation of a real `window`.
  8155. // e.g. var jQuery = require("jquery")(window);
  8156. // See ticket #14549 for more info.
  8157. module.exports = global.document ?
  8158. factory( global, true ) :
  8159. function( w ) {
  8160. if ( !w.document ) {
  8161. throw new Error( "jQuery requires a window with a document" );
  8162. }
  8163. return factory( w );
  8164. };
  8165. } else {
  8166. factory( global );
  8167. }
  8168. // Pass this if window is not defined yet
  8169. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8170. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8171. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8172. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8173. // enough that all such attempts are guarded in a try block.
  8174. "use strict";
  8175. var arr = [];
  8176. var document = window.document;
  8177. var getProto = Object.getPrototypeOf;
  8178. var slice = arr.slice;
  8179. var concat = arr.concat;
  8180. var push = arr.push;
  8181. var indexOf = arr.indexOf;
  8182. var class2type = {};
  8183. var toString = class2type.toString;
  8184. var hasOwn = class2type.hasOwnProperty;
  8185. var fnToString = hasOwn.toString;
  8186. var ObjectFunctionString = fnToString.call( Object );
  8187. var support = {};
  8188. var isFunction = function isFunction( obj ) {
  8189. // Support: Chrome <=57, Firefox <=52
  8190. // In some browsers, typeof returns "function" for HTML <object> elements
  8191. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8192. // We don't want to classify *any* DOM node as a function.
  8193. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8194. };
  8195. var isWindow = function isWindow( obj ) {
  8196. return obj != null && obj === obj.window;
  8197. };
  8198. var preservedScriptAttributes = {
  8199. type: true,
  8200. src: true,
  8201. nonce: true,
  8202. noModule: true
  8203. };
  8204. function DOMEval( code, node, doc ) {
  8205. doc = doc || document;
  8206. var i, val,
  8207. script = doc.createElement( "script" );
  8208. script.text = code;
  8209. if ( node ) {
  8210. for ( i in preservedScriptAttributes ) {
  8211. // Support: Firefox 64+, Edge 18+
  8212. // Some browsers don't support the "nonce" property on scripts.
  8213. // On the other hand, just using `getAttribute` is not enough as
  8214. // the `nonce` attribute is reset to an empty string whenever it
  8215. // becomes browsing-context connected.
  8216. // See https://github.com/whatwg/html/issues/2369
  8217. // See https://html.spec.whatwg.org/#nonce-attributes
  8218. // The `node.getAttribute` check was added for the sake of
  8219. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8220. // via an object.
  8221. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8222. if ( val ) {
  8223. script.setAttribute( i, val );
  8224. }
  8225. }
  8226. }
  8227. doc.head.appendChild( script ).parentNode.removeChild( script );
  8228. }
  8229. function toType( obj ) {
  8230. if ( obj == null ) {
  8231. return obj + "";
  8232. }
  8233. // Support: Android <=2.3 only (functionish RegExp)
  8234. return typeof obj === "object" || typeof obj === "function" ?
  8235. class2type[ toString.call( obj ) ] || "object" :
  8236. typeof obj;
  8237. }
  8238. /* global Symbol */
  8239. // Defining this global in .eslintrc.json would create a danger of using the global
  8240. // unguarded in another place, it seems safer to define global only for this module
  8241. var
  8242. version = "3.4.1",
  8243. // Define a local copy of jQuery
  8244. jQuery = function( selector, context ) {
  8245. // The jQuery object is actually just the init constructor 'enhanced'
  8246. // Need init if jQuery is called (just allow error to be thrown if not included)
  8247. return new jQuery.fn.init( selector, context );
  8248. },
  8249. // Support: Android <=4.0 only
  8250. // Make sure we trim BOM and NBSP
  8251. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8252. jQuery.fn = jQuery.prototype = {
  8253. // The current version of jQuery being used
  8254. jquery: version,
  8255. constructor: jQuery,
  8256. // The default length of a jQuery object is 0
  8257. length: 0,
  8258. toArray: function() {
  8259. return slice.call( this );
  8260. },
  8261. // Get the Nth element in the matched element set OR
  8262. // Get the whole matched element set as a clean array
  8263. get: function( num ) {
  8264. // Return all the elements in a clean array
  8265. if ( num == null ) {
  8266. return slice.call( this );
  8267. }
  8268. // Return just the one element from the set
  8269. return num < 0 ? this[ num + this.length ] : this[ num ];
  8270. },
  8271. // Take an array of elements and push it onto the stack
  8272. // (returning the new matched element set)
  8273. pushStack: function( elems ) {
  8274. // Build a new jQuery matched element set
  8275. var ret = jQuery.merge( this.constructor(), elems );
  8276. // Add the old object onto the stack (as a reference)
  8277. ret.prevObject = this;
  8278. // Return the newly-formed element set
  8279. return ret;
  8280. },
  8281. // Execute a callback for every element in the matched set.
  8282. each: function( callback ) {
  8283. return jQuery.each( this, callback );
  8284. },
  8285. map: function( callback ) {
  8286. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8287. return callback.call( elem, i, elem );
  8288. } ) );
  8289. },
  8290. slice: function() {
  8291. return this.pushStack( slice.apply( this, arguments ) );
  8292. },
  8293. first: function() {
  8294. return this.eq( 0 );
  8295. },
  8296. last: function() {
  8297. return this.eq( -1 );
  8298. },
  8299. eq: function( i ) {
  8300. var len = this.length,
  8301. j = +i + ( i < 0 ? len : 0 );
  8302. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8303. },
  8304. end: function() {
  8305. return this.prevObject || this.constructor();
  8306. },
  8307. // For internal use only.
  8308. // Behaves like an Array's method, not like a jQuery method.
  8309. push: push,
  8310. sort: arr.sort,
  8311. splice: arr.splice
  8312. };
  8313. jQuery.extend = jQuery.fn.extend = function() {
  8314. var options, name, src, copy, copyIsArray, clone,
  8315. target = arguments[ 0 ] || {},
  8316. i = 1,
  8317. length = arguments.length,
  8318. deep = false;
  8319. // Handle a deep copy situation
  8320. if ( typeof target === "boolean" ) {
  8321. deep = target;
  8322. // Skip the boolean and the target
  8323. target = arguments[ i ] || {};
  8324. i++;
  8325. }
  8326. // Handle case when target is a string or something (possible in deep copy)
  8327. if ( typeof target !== "object" && !isFunction( target ) ) {
  8328. target = {};
  8329. }
  8330. // Extend jQuery itself if only one argument is passed
  8331. if ( i === length ) {
  8332. target = this;
  8333. i--;
  8334. }
  8335. for ( ; i < length; i++ ) {
  8336. // Only deal with non-null/undefined values
  8337. if ( ( options = arguments[ i ] ) != null ) {
  8338. // Extend the base object
  8339. for ( name in options ) {
  8340. copy = options[ name ];
  8341. // Prevent Object.prototype pollution
  8342. // Prevent never-ending loop
  8343. if ( name === "__proto__" || target === copy ) {
  8344. continue;
  8345. }
  8346. // Recurse if we're merging plain objects or arrays
  8347. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8348. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8349. src = target[ name ];
  8350. // Ensure proper type for the source value
  8351. if ( copyIsArray && !Array.isArray( src ) ) {
  8352. clone = [];
  8353. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8354. clone = {};
  8355. } else {
  8356. clone = src;
  8357. }
  8358. copyIsArray = false;
  8359. // Never move original objects, clone them
  8360. target[ name ] = jQuery.extend( deep, clone, copy );
  8361. // Don't bring in undefined values
  8362. } else if ( copy !== undefined ) {
  8363. target[ name ] = copy;
  8364. }
  8365. }
  8366. }
  8367. }
  8368. // Return the modified object
  8369. return target;
  8370. };
  8371. jQuery.extend( {
  8372. // Unique for each copy of jQuery on the page
  8373. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8374. // Assume jQuery is ready without the ready module
  8375. isReady: true,
  8376. error: function( msg ) {
  8377. throw new Error( msg );
  8378. },
  8379. noop: function() {},
  8380. isPlainObject: function( obj ) {
  8381. var proto, Ctor;
  8382. // Detect obvious negatives
  8383. // Use toString instead of jQuery.type to catch host objects
  8384. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8385. return false;
  8386. }
  8387. proto = getProto( obj );
  8388. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8389. if ( !proto ) {
  8390. return true;
  8391. }
  8392. // Objects with prototype are plain iff they were constructed by a global Object function
  8393. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8394. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8395. },
  8396. isEmptyObject: function( obj ) {
  8397. var name;
  8398. for ( name in obj ) {
  8399. return false;
  8400. }
  8401. return true;
  8402. },
  8403. // Evaluates a script in a global context
  8404. globalEval: function( code, options ) {
  8405. DOMEval( code, { nonce: options && options.nonce } );
  8406. },
  8407. each: function( obj, callback ) {
  8408. var length, i = 0;
  8409. if ( isArrayLike( obj ) ) {
  8410. length = obj.length;
  8411. for ( ; i < length; i++ ) {
  8412. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8413. break;
  8414. }
  8415. }
  8416. } else {
  8417. for ( i in obj ) {
  8418. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8419. break;
  8420. }
  8421. }
  8422. }
  8423. return obj;
  8424. },
  8425. // Support: Android <=4.0 only
  8426. trim: function( text ) {
  8427. return text == null ?
  8428. "" :
  8429. ( text + "" ).replace( rtrim, "" );
  8430. },
  8431. // results is for internal usage only
  8432. makeArray: function( arr, results ) {
  8433. var ret = results || [];
  8434. if ( arr != null ) {
  8435. if ( isArrayLike( Object( arr ) ) ) {
  8436. jQuery.merge( ret,
  8437. typeof arr === "string" ?
  8438. [ arr ] : arr
  8439. );
  8440. } else {
  8441. push.call( ret, arr );
  8442. }
  8443. }
  8444. return ret;
  8445. },
  8446. inArray: function( elem, arr, i ) {
  8447. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8448. },
  8449. // Support: Android <=4.0 only, PhantomJS 1 only
  8450. // push.apply(_, arraylike) throws on ancient WebKit
  8451. merge: function( first, second ) {
  8452. var len = +second.length,
  8453. j = 0,
  8454. i = first.length;
  8455. for ( ; j < len; j++ ) {
  8456. first[ i++ ] = second[ j ];
  8457. }
  8458. first.length = i;
  8459. return first;
  8460. },
  8461. grep: function( elems, callback, invert ) {
  8462. var callbackInverse,
  8463. matches = [],
  8464. i = 0,
  8465. length = elems.length,
  8466. callbackExpect = !invert;
  8467. // Go through the array, only saving the items
  8468. // that pass the validator function
  8469. for ( ; i < length; i++ ) {
  8470. callbackInverse = !callback( elems[ i ], i );
  8471. if ( callbackInverse !== callbackExpect ) {
  8472. matches.push( elems[ i ] );
  8473. }
  8474. }
  8475. return matches;
  8476. },
  8477. // arg is for internal usage only
  8478. map: function( elems, callback, arg ) {
  8479. var length, value,
  8480. i = 0,
  8481. ret = [];
  8482. // Go through the array, translating each of the items to their new values
  8483. if ( isArrayLike( elems ) ) {
  8484. length = elems.length;
  8485. for ( ; i < length; i++ ) {
  8486. value = callback( elems[ i ], i, arg );
  8487. if ( value != null ) {
  8488. ret.push( value );
  8489. }
  8490. }
  8491. // Go through every key on the object,
  8492. } else {
  8493. for ( i in elems ) {
  8494. value = callback( elems[ i ], i, arg );
  8495. if ( value != null ) {
  8496. ret.push( value );
  8497. }
  8498. }
  8499. }
  8500. // Flatten any nested arrays
  8501. return concat.apply( [], ret );
  8502. },
  8503. // A global GUID counter for objects
  8504. guid: 1,
  8505. // jQuery.support is not used in Core but other projects attach their
  8506. // properties to it so it needs to exist.
  8507. support: support
  8508. } );
  8509. if ( typeof Symbol === "function" ) {
  8510. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8511. }
  8512. // Populate the class2type map
  8513. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8514. function( i, name ) {
  8515. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8516. } );
  8517. function isArrayLike( obj ) {
  8518. // Support: real iOS 8.2 only (not reproducible in simulator)
  8519. // `in` check used to prevent JIT error (gh-2145)
  8520. // hasOwn isn't used here due to false negatives
  8521. // regarding Nodelist length in IE
  8522. var length = !!obj && "length" in obj && obj.length,
  8523. type = toType( obj );
  8524. if ( isFunction( obj ) || isWindow( obj ) ) {
  8525. return false;
  8526. }
  8527. return type === "array" || length === 0 ||
  8528. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8529. }
  8530. var Sizzle =
  8531. /*!
  8532. * Sizzle CSS Selector Engine v2.3.4
  8533. * https://sizzlejs.com/
  8534. *
  8535. * Copyright JS Foundation and other contributors
  8536. * Released under the MIT license
  8537. * https://js.foundation/
  8538. *
  8539. * Date: 2019-04-08
  8540. */
  8541. (function( window ) {
  8542. var i,
  8543. support,
  8544. Expr,
  8545. getText,
  8546. isXML,
  8547. tokenize,
  8548. compile,
  8549. select,
  8550. outermostContext,
  8551. sortInput,
  8552. hasDuplicate,
  8553. // Local document vars
  8554. setDocument,
  8555. document,
  8556. docElem,
  8557. documentIsHTML,
  8558. rbuggyQSA,
  8559. rbuggyMatches,
  8560. matches,
  8561. contains,
  8562. // Instance-specific data
  8563. expando = "sizzle" + 1 * new Date(),
  8564. preferredDoc = window.document,
  8565. dirruns = 0,
  8566. done = 0,
  8567. classCache = createCache(),
  8568. tokenCache = createCache(),
  8569. compilerCache = createCache(),
  8570. nonnativeSelectorCache = createCache(),
  8571. sortOrder = function( a, b ) {
  8572. if ( a === b ) {
  8573. hasDuplicate = true;
  8574. }
  8575. return 0;
  8576. },
  8577. // Instance methods
  8578. hasOwn = ({}).hasOwnProperty,
  8579. arr = [],
  8580. pop = arr.pop,
  8581. push_native = arr.push,
  8582. push = arr.push,
  8583. slice = arr.slice,
  8584. // Use a stripped-down indexOf as it's faster than native
  8585. // https://jsperf.com/thor-indexof-vs-for/5
  8586. indexOf = function( list, elem ) {
  8587. var i = 0,
  8588. len = list.length;
  8589. for ( ; i < len; i++ ) {
  8590. if ( list[i] === elem ) {
  8591. return i;
  8592. }
  8593. }
  8594. return -1;
  8595. },
  8596. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8597. // Regular expressions
  8598. // http://www.w3.org/TR/css3-selectors/#whitespace
  8599. whitespace = "[\\x20\\t\\r\\n\\f]",
  8600. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8601. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8602. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8603. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8604. // Operator (capture 2)
  8605. "*([*^$|!~]?=)" + whitespace +
  8606. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8607. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8608. "*\\]",
  8609. pseudos = ":(" + identifier + ")(?:\\((" +
  8610. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8611. // 1. quoted (capture 3; capture 4 or capture 5)
  8612. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8613. // 2. simple (capture 6)
  8614. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8615. // 3. anything else (capture 2)
  8616. ".*" +
  8617. ")\\)|)",
  8618. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8619. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8620. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8621. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8622. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8623. rdescend = new RegExp( whitespace + "|>" ),
  8624. rpseudo = new RegExp( pseudos ),
  8625. ridentifier = new RegExp( "^" + identifier + "$" ),
  8626. matchExpr = {
  8627. "ID": new RegExp( "^#(" + identifier + ")" ),
  8628. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8629. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8630. "ATTR": new RegExp( "^" + attributes ),
  8631. "PSEUDO": new RegExp( "^" + pseudos ),
  8632. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8633. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8634. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8635. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8636. // For use in libraries implementing .is()
  8637. // We use this for POS matching in `select`
  8638. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8639. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8640. },
  8641. rhtml = /HTML$/i,
  8642. rinputs = /^(?:input|select|textarea|button)$/i,
  8643. rheader = /^h\d$/i,
  8644. rnative = /^[^{]+\{\s*\[native \w/,
  8645. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8646. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8647. rsibling = /[+~]/,
  8648. // CSS escapes
  8649. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8650. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8651. funescape = function( _, escaped, escapedWhitespace ) {
  8652. var high = "0x" + escaped - 0x10000;
  8653. // NaN means non-codepoint
  8654. // Support: Firefox<24
  8655. // Workaround erroneous numeric interpretation of +"0x"
  8656. return high !== high || escapedWhitespace ?
  8657. escaped :
  8658. high < 0 ?
  8659. // BMP codepoint
  8660. String.fromCharCode( high + 0x10000 ) :
  8661. // Supplemental Plane codepoint (surrogate pair)
  8662. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8663. },
  8664. // CSS string/identifier serialization
  8665. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8666. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8667. fcssescape = function( ch, asCodePoint ) {
  8668. if ( asCodePoint ) {
  8669. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8670. if ( ch === "\0" ) {
  8671. return "\uFFFD";
  8672. }
  8673. // Control characters and (dependent upon position) numbers get escaped as code points
  8674. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8675. }
  8676. // Other potentially-special ASCII characters get backslash-escaped
  8677. return "\\" + ch;
  8678. },
  8679. // Used for iframes
  8680. // See setDocument()
  8681. // Removing the function wrapper causes a "Permission Denied"
  8682. // error in IE
  8683. unloadHandler = function() {
  8684. setDocument();
  8685. },
  8686. inDisabledFieldset = addCombinator(
  8687. function( elem ) {
  8688. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8689. },
  8690. { dir: "parentNode", next: "legend" }
  8691. );
  8692. // Optimize for push.apply( _, NodeList )
  8693. try {
  8694. push.apply(
  8695. (arr = slice.call( preferredDoc.childNodes )),
  8696. preferredDoc.childNodes
  8697. );
  8698. // Support: Android<4.0
  8699. // Detect silently failing push.apply
  8700. arr[ preferredDoc.childNodes.length ].nodeType;
  8701. } catch ( e ) {
  8702. push = { apply: arr.length ?
  8703. // Leverage slice if possible
  8704. function( target, els ) {
  8705. push_native.apply( target, slice.call(els) );
  8706. } :
  8707. // Support: IE<9
  8708. // Otherwise append directly
  8709. function( target, els ) {
  8710. var j = target.length,
  8711. i = 0;
  8712. // Can't trust NodeList.length
  8713. while ( (target[j++] = els[i++]) ) {}
  8714. target.length = j - 1;
  8715. }
  8716. };
  8717. }
  8718. function Sizzle( selector, context, results, seed ) {
  8719. var m, i, elem, nid, match, groups, newSelector,
  8720. newContext = context && context.ownerDocument,
  8721. // nodeType defaults to 9, since context defaults to document
  8722. nodeType = context ? context.nodeType : 9;
  8723. results = results || [];
  8724. // Return early from calls with invalid selector or context
  8725. if ( typeof selector !== "string" || !selector ||
  8726. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8727. return results;
  8728. }
  8729. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8730. if ( !seed ) {
  8731. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8732. setDocument( context );
  8733. }
  8734. context = context || document;
  8735. if ( documentIsHTML ) {
  8736. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8737. // (excepting DocumentFragment context, where the methods don't exist)
  8738. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8739. // ID selector
  8740. if ( (m = match[1]) ) {
  8741. // Document context
  8742. if ( nodeType === 9 ) {
  8743. if ( (elem = context.getElementById( m )) ) {
  8744. // Support: IE, Opera, Webkit
  8745. // TODO: identify versions
  8746. // getElementById can match elements by name instead of ID
  8747. if ( elem.id === m ) {
  8748. results.push( elem );
  8749. return results;
  8750. }
  8751. } else {
  8752. return results;
  8753. }
  8754. // Element context
  8755. } else {
  8756. // Support: IE, Opera, Webkit
  8757. // TODO: identify versions
  8758. // getElementById can match elements by name instead of ID
  8759. if ( newContext && (elem = newContext.getElementById( m )) &&
  8760. contains( context, elem ) &&
  8761. elem.id === m ) {
  8762. results.push( elem );
  8763. return results;
  8764. }
  8765. }
  8766. // Type selector
  8767. } else if ( match[2] ) {
  8768. push.apply( results, context.getElementsByTagName( selector ) );
  8769. return results;
  8770. // Class selector
  8771. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8772. context.getElementsByClassName ) {
  8773. push.apply( results, context.getElementsByClassName( m ) );
  8774. return results;
  8775. }
  8776. }
  8777. // Take advantage of querySelectorAll
  8778. if ( support.qsa &&
  8779. !nonnativeSelectorCache[ selector + " " ] &&
  8780. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8781. // Support: IE 8 only
  8782. // Exclude object elements
  8783. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8784. newSelector = selector;
  8785. newContext = context;
  8786. // qSA considers elements outside a scoping root when evaluating child or
  8787. // descendant combinators, which is not what we want.
  8788. // In such cases, we work around the behavior by prefixing every selector in the
  8789. // list with an ID selector referencing the scope context.
  8790. // Thanks to Andrew Dupont for this technique.
  8791. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8792. // Capture the context ID, setting it first if necessary
  8793. if ( (nid = context.getAttribute( "id" )) ) {
  8794. nid = nid.replace( rcssescape, fcssescape );
  8795. } else {
  8796. context.setAttribute( "id", (nid = expando) );
  8797. }
  8798. // Prefix every selector in the list
  8799. groups = tokenize( selector );
  8800. i = groups.length;
  8801. while ( i-- ) {
  8802. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8803. }
  8804. newSelector = groups.join( "," );
  8805. // Expand context for sibling selectors
  8806. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8807. context;
  8808. }
  8809. try {
  8810. push.apply( results,
  8811. newContext.querySelectorAll( newSelector )
  8812. );
  8813. return results;
  8814. } catch ( qsaError ) {
  8815. nonnativeSelectorCache( selector, true );
  8816. } finally {
  8817. if ( nid === expando ) {
  8818. context.removeAttribute( "id" );
  8819. }
  8820. }
  8821. }
  8822. }
  8823. }
  8824. // All others
  8825. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8826. }
  8827. /**
  8828. * Create key-value caches of limited size
  8829. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8830. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8831. * deleting the oldest entry
  8832. */
  8833. function createCache() {
  8834. var keys = [];
  8835. function cache( key, value ) {
  8836. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8837. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8838. // Only keep the most recent entries
  8839. delete cache[ keys.shift() ];
  8840. }
  8841. return (cache[ key + " " ] = value);
  8842. }
  8843. return cache;
  8844. }
  8845. /**
  8846. * Mark a function for special use by Sizzle
  8847. * @param {Function} fn The function to mark
  8848. */
  8849. function markFunction( fn ) {
  8850. fn[ expando ] = true;
  8851. return fn;
  8852. }
  8853. /**
  8854. * Support testing using an element
  8855. * @param {Function} fn Passed the created element and returns a boolean result
  8856. */
  8857. function assert( fn ) {
  8858. var el = document.createElement("fieldset");
  8859. try {
  8860. return !!fn( el );
  8861. } catch (e) {
  8862. return false;
  8863. } finally {
  8864. // Remove from its parent by default
  8865. if ( el.parentNode ) {
  8866. el.parentNode.removeChild( el );
  8867. }
  8868. // release memory in IE
  8869. el = null;
  8870. }
  8871. }
  8872. /**
  8873. * Adds the same handler for all of the specified attrs
  8874. * @param {String} attrs Pipe-separated list of attributes
  8875. * @param {Function} handler The method that will be applied
  8876. */
  8877. function addHandle( attrs, handler ) {
  8878. var arr = attrs.split("|"),
  8879. i = arr.length;
  8880. while ( i-- ) {
  8881. Expr.attrHandle[ arr[i] ] = handler;
  8882. }
  8883. }
  8884. /**
  8885. * Checks document order of two siblings
  8886. * @param {Element} a
  8887. * @param {Element} b
  8888. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8889. */
  8890. function siblingCheck( a, b ) {
  8891. var cur = b && a,
  8892. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8893. a.sourceIndex - b.sourceIndex;
  8894. // Use IE sourceIndex if available on both nodes
  8895. if ( diff ) {
  8896. return diff;
  8897. }
  8898. // Check if b follows a
  8899. if ( cur ) {
  8900. while ( (cur = cur.nextSibling) ) {
  8901. if ( cur === b ) {
  8902. return -1;
  8903. }
  8904. }
  8905. }
  8906. return a ? 1 : -1;
  8907. }
  8908. /**
  8909. * Returns a function to use in pseudos for input types
  8910. * @param {String} type
  8911. */
  8912. function createInputPseudo( type ) {
  8913. return function( elem ) {
  8914. var name = elem.nodeName.toLowerCase();
  8915. return name === "input" && elem.type === type;
  8916. };
  8917. }
  8918. /**
  8919. * Returns a function to use in pseudos for buttons
  8920. * @param {String} type
  8921. */
  8922. function createButtonPseudo( type ) {
  8923. return function( elem ) {
  8924. var name = elem.nodeName.toLowerCase();
  8925. return (name === "input" || name === "button") && elem.type === type;
  8926. };
  8927. }
  8928. /**
  8929. * Returns a function to use in pseudos for :enabled/:disabled
  8930. * @param {Boolean} disabled true for :disabled; false for :enabled
  8931. */
  8932. function createDisabledPseudo( disabled ) {
  8933. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8934. return function( elem ) {
  8935. // Only certain elements can match :enabled or :disabled
  8936. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8937. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8938. if ( "form" in elem ) {
  8939. // Check for inherited disabledness on relevant non-disabled elements:
  8940. // * listed form-associated elements in a disabled fieldset
  8941. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8942. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8943. // * option elements in a disabled optgroup
  8944. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8945. // All such elements have a "form" property.
  8946. if ( elem.parentNode && elem.disabled === false ) {
  8947. // Option elements defer to a parent optgroup if present
  8948. if ( "label" in elem ) {
  8949. if ( "label" in elem.parentNode ) {
  8950. return elem.parentNode.disabled === disabled;
  8951. } else {
  8952. return elem.disabled === disabled;
  8953. }
  8954. }
  8955. // Support: IE 6 - 11
  8956. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8957. return elem.isDisabled === disabled ||
  8958. // Where there is no isDisabled, check manually
  8959. /* jshint -W018 */
  8960. elem.isDisabled !== !disabled &&
  8961. inDisabledFieldset( elem ) === disabled;
  8962. }
  8963. return elem.disabled === disabled;
  8964. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8965. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8966. // even exist on them, let alone have a boolean value.
  8967. } else if ( "label" in elem ) {
  8968. return elem.disabled === disabled;
  8969. }
  8970. // Remaining elements are neither :enabled nor :disabled
  8971. return false;
  8972. };
  8973. }
  8974. /**
  8975. * Returns a function to use in pseudos for positionals
  8976. * @param {Function} fn
  8977. */
  8978. function createPositionalPseudo( fn ) {
  8979. return markFunction(function( argument ) {
  8980. argument = +argument;
  8981. return markFunction(function( seed, matches ) {
  8982. var j,
  8983. matchIndexes = fn( [], seed.length, argument ),
  8984. i = matchIndexes.length;
  8985. // Match elements found at the specified indexes
  8986. while ( i-- ) {
  8987. if ( seed[ (j = matchIndexes[i]) ] ) {
  8988. seed[j] = !(matches[j] = seed[j]);
  8989. }
  8990. }
  8991. });
  8992. });
  8993. }
  8994. /**
  8995. * Checks a node for validity as a Sizzle context
  8996. * @param {Element|Object=} context
  8997. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  8998. */
  8999. function testContext( context ) {
  9000. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9001. }
  9002. // Expose support vars for convenience
  9003. support = Sizzle.support = {};
  9004. /**
  9005. * Detects XML nodes
  9006. * @param {Element|Object} elem An element or a document
  9007. * @returns {Boolean} True iff elem is a non-HTML XML node
  9008. */
  9009. isXML = Sizzle.isXML = function( elem ) {
  9010. var namespace = elem.namespaceURI,
  9011. docElem = (elem.ownerDocument || elem).documentElement;
  9012. // Support: IE <=8
  9013. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9014. // https://bugs.jquery.com/ticket/4833
  9015. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9016. };
  9017. /**
  9018. * Sets document-related variables once based on the current document
  9019. * @param {Element|Object} [doc] An element or document object to use to set the document
  9020. * @returns {Object} Returns the current document
  9021. */
  9022. setDocument = Sizzle.setDocument = function( node ) {
  9023. var hasCompare, subWindow,
  9024. doc = node ? node.ownerDocument || node : preferredDoc;
  9025. // Return early if doc is invalid or already selected
  9026. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9027. return document;
  9028. }
  9029. // Update global variables
  9030. document = doc;
  9031. docElem = document.documentElement;
  9032. documentIsHTML = !isXML( document );
  9033. // Support: IE 9-11, Edge
  9034. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9035. if ( preferredDoc !== document &&
  9036. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9037. // Support: IE 11, Edge
  9038. if ( subWindow.addEventListener ) {
  9039. subWindow.addEventListener( "unload", unloadHandler, false );
  9040. // Support: IE 9 - 10 only
  9041. } else if ( subWindow.attachEvent ) {
  9042. subWindow.attachEvent( "onunload", unloadHandler );
  9043. }
  9044. }
  9045. /* Attributes
  9046. ---------------------------------------------------------------------- */
  9047. // Support: IE<8
  9048. // Verify that getAttribute really returns attributes and not properties
  9049. // (excepting IE8 booleans)
  9050. support.attributes = assert(function( el ) {
  9051. el.className = "i";
  9052. return !el.getAttribute("className");
  9053. });
  9054. /* getElement(s)By*
  9055. ---------------------------------------------------------------------- */
  9056. // Check if getElementsByTagName("*") returns only elements
  9057. support.getElementsByTagName = assert(function( el ) {
  9058. el.appendChild( document.createComment("") );
  9059. return !el.getElementsByTagName("*").length;
  9060. });
  9061. // Support: IE<9
  9062. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9063. // Support: IE<10
  9064. // Check if getElementById returns elements by name
  9065. // The broken getElementById methods don't pick up programmatically-set names,
  9066. // so use a roundabout getElementsByName test
  9067. support.getById = assert(function( el ) {
  9068. docElem.appendChild( el ).id = expando;
  9069. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9070. });
  9071. // ID filter and find
  9072. if ( support.getById ) {
  9073. Expr.filter["ID"] = function( id ) {
  9074. var attrId = id.replace( runescape, funescape );
  9075. return function( elem ) {
  9076. return elem.getAttribute("id") === attrId;
  9077. };
  9078. };
  9079. Expr.find["ID"] = function( id, context ) {
  9080. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9081. var elem = context.getElementById( id );
  9082. return elem ? [ elem ] : [];
  9083. }
  9084. };
  9085. } else {
  9086. Expr.filter["ID"] = function( id ) {
  9087. var attrId = id.replace( runescape, funescape );
  9088. return function( elem ) {
  9089. var node = typeof elem.getAttributeNode !== "undefined" &&
  9090. elem.getAttributeNode("id");
  9091. return node && node.value === attrId;
  9092. };
  9093. };
  9094. // Support: IE 6 - 7 only
  9095. // getElementById is not reliable as a find shortcut
  9096. Expr.find["ID"] = function( id, context ) {
  9097. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9098. var node, i, elems,
  9099. elem = context.getElementById( id );
  9100. if ( elem ) {
  9101. // Verify the id attribute
  9102. node = elem.getAttributeNode("id");
  9103. if ( node && node.value === id ) {
  9104. return [ elem ];
  9105. }
  9106. // Fall back on getElementsByName
  9107. elems = context.getElementsByName( id );
  9108. i = 0;
  9109. while ( (elem = elems[i++]) ) {
  9110. node = elem.getAttributeNode("id");
  9111. if ( node && node.value === id ) {
  9112. return [ elem ];
  9113. }
  9114. }
  9115. }
  9116. return [];
  9117. }
  9118. };
  9119. }
  9120. // Tag
  9121. Expr.find["TAG"] = support.getElementsByTagName ?
  9122. function( tag, context ) {
  9123. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9124. return context.getElementsByTagName( tag );
  9125. // DocumentFragment nodes don't have gEBTN
  9126. } else if ( support.qsa ) {
  9127. return context.querySelectorAll( tag );
  9128. }
  9129. } :
  9130. function( tag, context ) {
  9131. var elem,
  9132. tmp = [],
  9133. i = 0,
  9134. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9135. results = context.getElementsByTagName( tag );
  9136. // Filter out possible comments
  9137. if ( tag === "*" ) {
  9138. while ( (elem = results[i++]) ) {
  9139. if ( elem.nodeType === 1 ) {
  9140. tmp.push( elem );
  9141. }
  9142. }
  9143. return tmp;
  9144. }
  9145. return results;
  9146. };
  9147. // Class
  9148. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9149. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9150. return context.getElementsByClassName( className );
  9151. }
  9152. };
  9153. /* QSA/matchesSelector
  9154. ---------------------------------------------------------------------- */
  9155. // QSA and matchesSelector support
  9156. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9157. rbuggyMatches = [];
  9158. // qSa(:focus) reports false when true (Chrome 21)
  9159. // We allow this because of a bug in IE8/9 that throws an error
  9160. // whenever `document.activeElement` is accessed on an iframe
  9161. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9162. // See https://bugs.jquery.com/ticket/13378
  9163. rbuggyQSA = [];
  9164. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9165. // Build QSA regex
  9166. // Regex strategy adopted from Diego Perini
  9167. assert(function( el ) {
  9168. // Select is set to empty string on purpose
  9169. // This is to test IE's treatment of not explicitly
  9170. // setting a boolean content attribute,
  9171. // since its presence should be enough
  9172. // https://bugs.jquery.com/ticket/12359
  9173. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9174. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9175. "<option selected=''></option></select>";
  9176. // Support: IE8, Opera 11-12.16
  9177. // Nothing should be selected when empty strings follow ^= or $= or *=
  9178. // The test attribute must be unknown in Opera but "safe" for WinRT
  9179. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9180. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9181. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9182. }
  9183. // Support: IE8
  9184. // Boolean attributes and "value" are not treated correctly
  9185. if ( !el.querySelectorAll("[selected]").length ) {
  9186. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9187. }
  9188. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9189. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9190. rbuggyQSA.push("~=");
  9191. }
  9192. // Webkit/Opera - :checked should return selected option elements
  9193. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9194. // IE8 throws error here and will not see later tests
  9195. if ( !el.querySelectorAll(":checked").length ) {
  9196. rbuggyQSA.push(":checked");
  9197. }
  9198. // Support: Safari 8+, iOS 8+
  9199. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9200. // In-page `selector#id sibling-combinator selector` fails
  9201. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9202. rbuggyQSA.push(".#.+[+~]");
  9203. }
  9204. });
  9205. assert(function( el ) {
  9206. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9207. "<select disabled='disabled'><option/></select>";
  9208. // Support: Windows 8 Native Apps
  9209. // The type and name attributes are restricted during .innerHTML assignment
  9210. var input = document.createElement("input");
  9211. input.setAttribute( "type", "hidden" );
  9212. el.appendChild( input ).setAttribute( "name", "D" );
  9213. // Support: IE8
  9214. // Enforce case-sensitivity of name attribute
  9215. if ( el.querySelectorAll("[name=d]").length ) {
  9216. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9217. }
  9218. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9219. // IE8 throws error here and will not see later tests
  9220. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9221. rbuggyQSA.push( ":enabled", ":disabled" );
  9222. }
  9223. // Support: IE9-11+
  9224. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9225. docElem.appendChild( el ).disabled = true;
  9226. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9227. rbuggyQSA.push( ":enabled", ":disabled" );
  9228. }
  9229. // Opera 10-11 does not throw on post-comma invalid pseudos
  9230. el.querySelectorAll("*,:x");
  9231. rbuggyQSA.push(",.*:");
  9232. });
  9233. }
  9234. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9235. docElem.webkitMatchesSelector ||
  9236. docElem.mozMatchesSelector ||
  9237. docElem.oMatchesSelector ||
  9238. docElem.msMatchesSelector) )) ) {
  9239. assert(function( el ) {
  9240. // Check to see if it's possible to do matchesSelector
  9241. // on a disconnected node (IE 9)
  9242. support.disconnectedMatch = matches.call( el, "*" );
  9243. // This should fail with an exception
  9244. // Gecko does not error, returns false instead
  9245. matches.call( el, "[s!='']:x" );
  9246. rbuggyMatches.push( "!=", pseudos );
  9247. });
  9248. }
  9249. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9250. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9251. /* Contains
  9252. ---------------------------------------------------------------------- */
  9253. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9254. // Element contains another
  9255. // Purposefully self-exclusive
  9256. // As in, an element does not contain itself
  9257. contains = hasCompare || rnative.test( docElem.contains ) ?
  9258. function( a, b ) {
  9259. var adown = a.nodeType === 9 ? a.documentElement : a,
  9260. bup = b && b.parentNode;
  9261. return a === bup || !!( bup && bup.nodeType === 1 && (
  9262. adown.contains ?
  9263. adown.contains( bup ) :
  9264. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9265. ));
  9266. } :
  9267. function( a, b ) {
  9268. if ( b ) {
  9269. while ( (b = b.parentNode) ) {
  9270. if ( b === a ) {
  9271. return true;
  9272. }
  9273. }
  9274. }
  9275. return false;
  9276. };
  9277. /* Sorting
  9278. ---------------------------------------------------------------------- */
  9279. // Document order sorting
  9280. sortOrder = hasCompare ?
  9281. function( a, b ) {
  9282. // Flag for duplicate removal
  9283. if ( a === b ) {
  9284. hasDuplicate = true;
  9285. return 0;
  9286. }
  9287. // Sort on method existence if only one input has compareDocumentPosition
  9288. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9289. if ( compare ) {
  9290. return compare;
  9291. }
  9292. // Calculate position if both inputs belong to the same document
  9293. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9294. a.compareDocumentPosition( b ) :
  9295. // Otherwise we know they are disconnected
  9296. 1;
  9297. // Disconnected nodes
  9298. if ( compare & 1 ||
  9299. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9300. // Choose the first element that is related to our preferred document
  9301. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9302. return -1;
  9303. }
  9304. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9305. return 1;
  9306. }
  9307. // Maintain original order
  9308. return sortInput ?
  9309. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9310. 0;
  9311. }
  9312. return compare & 4 ? -1 : 1;
  9313. } :
  9314. function( a, b ) {
  9315. // Exit early if the nodes are identical
  9316. if ( a === b ) {
  9317. hasDuplicate = true;
  9318. return 0;
  9319. }
  9320. var cur,
  9321. i = 0,
  9322. aup = a.parentNode,
  9323. bup = b.parentNode,
  9324. ap = [ a ],
  9325. bp = [ b ];
  9326. // Parentless nodes are either documents or disconnected
  9327. if ( !aup || !bup ) {
  9328. return a === document ? -1 :
  9329. b === document ? 1 :
  9330. aup ? -1 :
  9331. bup ? 1 :
  9332. sortInput ?
  9333. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9334. 0;
  9335. // If the nodes are siblings, we can do a quick check
  9336. } else if ( aup === bup ) {
  9337. return siblingCheck( a, b );
  9338. }
  9339. // Otherwise we need full lists of their ancestors for comparison
  9340. cur = a;
  9341. while ( (cur = cur.parentNode) ) {
  9342. ap.unshift( cur );
  9343. }
  9344. cur = b;
  9345. while ( (cur = cur.parentNode) ) {
  9346. bp.unshift( cur );
  9347. }
  9348. // Walk down the tree looking for a discrepancy
  9349. while ( ap[i] === bp[i] ) {
  9350. i++;
  9351. }
  9352. return i ?
  9353. // Do a sibling check if the nodes have a common ancestor
  9354. siblingCheck( ap[i], bp[i] ) :
  9355. // Otherwise nodes in our document sort first
  9356. ap[i] === preferredDoc ? -1 :
  9357. bp[i] === preferredDoc ? 1 :
  9358. 0;
  9359. };
  9360. return document;
  9361. };
  9362. Sizzle.matches = function( expr, elements ) {
  9363. return Sizzle( expr, null, null, elements );
  9364. };
  9365. Sizzle.matchesSelector = function( elem, expr ) {
  9366. // Set document vars if needed
  9367. if ( ( elem.ownerDocument || elem ) !== document ) {
  9368. setDocument( elem );
  9369. }
  9370. if ( support.matchesSelector && documentIsHTML &&
  9371. !nonnativeSelectorCache[ expr + " " ] &&
  9372. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9373. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9374. try {
  9375. var ret = matches.call( elem, expr );
  9376. // IE 9's matchesSelector returns false on disconnected nodes
  9377. if ( ret || support.disconnectedMatch ||
  9378. // As well, disconnected nodes are said to be in a document
  9379. // fragment in IE 9
  9380. elem.document && elem.document.nodeType !== 11 ) {
  9381. return ret;
  9382. }
  9383. } catch (e) {
  9384. nonnativeSelectorCache( expr, true );
  9385. }
  9386. }
  9387. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9388. };
  9389. Sizzle.contains = function( context, elem ) {
  9390. // Set document vars if needed
  9391. if ( ( context.ownerDocument || context ) !== document ) {
  9392. setDocument( context );
  9393. }
  9394. return contains( context, elem );
  9395. };
  9396. Sizzle.attr = function( elem, name ) {
  9397. // Set document vars if needed
  9398. if ( ( elem.ownerDocument || elem ) !== document ) {
  9399. setDocument( elem );
  9400. }
  9401. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9402. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9403. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9404. fn( elem, name, !documentIsHTML ) :
  9405. undefined;
  9406. return val !== undefined ?
  9407. val :
  9408. support.attributes || !documentIsHTML ?
  9409. elem.getAttribute( name ) :
  9410. (val = elem.getAttributeNode(name)) && val.specified ?
  9411. val.value :
  9412. null;
  9413. };
  9414. Sizzle.escape = function( sel ) {
  9415. return (sel + "").replace( rcssescape, fcssescape );
  9416. };
  9417. Sizzle.error = function( msg ) {
  9418. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9419. };
  9420. /**
  9421. * Document sorting and removing duplicates
  9422. * @param {ArrayLike} results
  9423. */
  9424. Sizzle.uniqueSort = function( results ) {
  9425. var elem,
  9426. duplicates = [],
  9427. j = 0,
  9428. i = 0;
  9429. // Unless we *know* we can detect duplicates, assume their presence
  9430. hasDuplicate = !support.detectDuplicates;
  9431. sortInput = !support.sortStable && results.slice( 0 );
  9432. results.sort( sortOrder );
  9433. if ( hasDuplicate ) {
  9434. while ( (elem = results[i++]) ) {
  9435. if ( elem === results[ i ] ) {
  9436. j = duplicates.push( i );
  9437. }
  9438. }
  9439. while ( j-- ) {
  9440. results.splice( duplicates[ j ], 1 );
  9441. }
  9442. }
  9443. // Clear input after sorting to release objects
  9444. // See https://github.com/jquery/sizzle/pull/225
  9445. sortInput = null;
  9446. return results;
  9447. };
  9448. /**
  9449. * Utility function for retrieving the text value of an array of DOM nodes
  9450. * @param {Array|Element} elem
  9451. */
  9452. getText = Sizzle.getText = function( elem ) {
  9453. var node,
  9454. ret = "",
  9455. i = 0,
  9456. nodeType = elem.nodeType;
  9457. if ( !nodeType ) {
  9458. // If no nodeType, this is expected to be an array
  9459. while ( (node = elem[i++]) ) {
  9460. // Do not traverse comment nodes
  9461. ret += getText( node );
  9462. }
  9463. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9464. // Use textContent for elements
  9465. // innerText usage removed for consistency of new lines (jQuery #11153)
  9466. if ( typeof elem.textContent === "string" ) {
  9467. return elem.textContent;
  9468. } else {
  9469. // Traverse its children
  9470. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9471. ret += getText( elem );
  9472. }
  9473. }
  9474. } else if ( nodeType === 3 || nodeType === 4 ) {
  9475. return elem.nodeValue;
  9476. }
  9477. // Do not include comment or processing instruction nodes
  9478. return ret;
  9479. };
  9480. Expr = Sizzle.selectors = {
  9481. // Can be adjusted by the user
  9482. cacheLength: 50,
  9483. createPseudo: markFunction,
  9484. match: matchExpr,
  9485. attrHandle: {},
  9486. find: {},
  9487. relative: {
  9488. ">": { dir: "parentNode", first: true },
  9489. " ": { dir: "parentNode" },
  9490. "+": { dir: "previousSibling", first: true },
  9491. "~": { dir: "previousSibling" }
  9492. },
  9493. preFilter: {
  9494. "ATTR": function( match ) {
  9495. match[1] = match[1].replace( runescape, funescape );
  9496. // Move the given value to match[3] whether quoted or unquoted
  9497. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9498. if ( match[2] === "~=" ) {
  9499. match[3] = " " + match[3] + " ";
  9500. }
  9501. return match.slice( 0, 4 );
  9502. },
  9503. "CHILD": function( match ) {
  9504. /* matches from matchExpr["CHILD"]
  9505. 1 type (only|nth|...)
  9506. 2 what (child|of-type)
  9507. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9508. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9509. 5 sign of xn-component
  9510. 6 x of xn-component
  9511. 7 sign of y-component
  9512. 8 y of y-component
  9513. */
  9514. match[1] = match[1].toLowerCase();
  9515. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9516. // nth-* requires argument
  9517. if ( !match[3] ) {
  9518. Sizzle.error( match[0] );
  9519. }
  9520. // numeric x and y parameters for Expr.filter.CHILD
  9521. // remember that false/true cast respectively to 0/1
  9522. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9523. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9524. // other types prohibit arguments
  9525. } else if ( match[3] ) {
  9526. Sizzle.error( match[0] );
  9527. }
  9528. return match;
  9529. },
  9530. "PSEUDO": function( match ) {
  9531. var excess,
  9532. unquoted = !match[6] && match[2];
  9533. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9534. return null;
  9535. }
  9536. // Accept quoted arguments as-is
  9537. if ( match[3] ) {
  9538. match[2] = match[4] || match[5] || "";
  9539. // Strip excess characters from unquoted arguments
  9540. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9541. // Get excess from tokenize (recursively)
  9542. (excess = tokenize( unquoted, true )) &&
  9543. // advance to the next closing parenthesis
  9544. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9545. // excess is a negative index
  9546. match[0] = match[0].slice( 0, excess );
  9547. match[2] = unquoted.slice( 0, excess );
  9548. }
  9549. // Return only captures needed by the pseudo filter method (type and argument)
  9550. return match.slice( 0, 3 );
  9551. }
  9552. },
  9553. filter: {
  9554. "TAG": function( nodeNameSelector ) {
  9555. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9556. return nodeNameSelector === "*" ?
  9557. function() { return true; } :
  9558. function( elem ) {
  9559. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9560. };
  9561. },
  9562. "CLASS": function( className ) {
  9563. var pattern = classCache[ className + " " ];
  9564. return pattern ||
  9565. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9566. classCache( className, function( elem ) {
  9567. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9568. });
  9569. },
  9570. "ATTR": function( name, operator, check ) {
  9571. return function( elem ) {
  9572. var result = Sizzle.attr( elem, name );
  9573. if ( result == null ) {
  9574. return operator === "!=";
  9575. }
  9576. if ( !operator ) {
  9577. return true;
  9578. }
  9579. result += "";
  9580. return operator === "=" ? result === check :
  9581. operator === "!=" ? result !== check :
  9582. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9583. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9584. operator === "$=" ? check && result.slice( -check.length ) === check :
  9585. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9586. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9587. false;
  9588. };
  9589. },
  9590. "CHILD": function( type, what, argument, first, last ) {
  9591. var simple = type.slice( 0, 3 ) !== "nth",
  9592. forward = type.slice( -4 ) !== "last",
  9593. ofType = what === "of-type";
  9594. return first === 1 && last === 0 ?
  9595. // Shortcut for :nth-*(n)
  9596. function( elem ) {
  9597. return !!elem.parentNode;
  9598. } :
  9599. function( elem, context, xml ) {
  9600. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9601. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9602. parent = elem.parentNode,
  9603. name = ofType && elem.nodeName.toLowerCase(),
  9604. useCache = !xml && !ofType,
  9605. diff = false;
  9606. if ( parent ) {
  9607. // :(first|last|only)-(child|of-type)
  9608. if ( simple ) {
  9609. while ( dir ) {
  9610. node = elem;
  9611. while ( (node = node[ dir ]) ) {
  9612. if ( ofType ?
  9613. node.nodeName.toLowerCase() === name :
  9614. node.nodeType === 1 ) {
  9615. return false;
  9616. }
  9617. }
  9618. // Reverse direction for :only-* (if we haven't yet done so)
  9619. start = dir = type === "only" && !start && "nextSibling";
  9620. }
  9621. return true;
  9622. }
  9623. start = [ forward ? parent.firstChild : parent.lastChild ];
  9624. // non-xml :nth-child(...) stores cache data on `parent`
  9625. if ( forward && useCache ) {
  9626. // Seek `elem` from a previously-cached index
  9627. // ...in a gzip-friendly way
  9628. node = parent;
  9629. outerCache = node[ expando ] || (node[ expando ] = {});
  9630. // Support: IE <9 only
  9631. // Defend against cloned attroperties (jQuery gh-1709)
  9632. uniqueCache = outerCache[ node.uniqueID ] ||
  9633. (outerCache[ node.uniqueID ] = {});
  9634. cache = uniqueCache[ type ] || [];
  9635. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9636. diff = nodeIndex && cache[ 2 ];
  9637. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9638. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9639. // Fallback to seeking `elem` from the start
  9640. (diff = nodeIndex = 0) || start.pop()) ) {
  9641. // When found, cache indexes on `parent` and break
  9642. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9643. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9644. break;
  9645. }
  9646. }
  9647. } else {
  9648. // Use previously-cached element index if available
  9649. if ( useCache ) {
  9650. // ...in a gzip-friendly way
  9651. node = elem;
  9652. outerCache = node[ expando ] || (node[ expando ] = {});
  9653. // Support: IE <9 only
  9654. // Defend against cloned attroperties (jQuery gh-1709)
  9655. uniqueCache = outerCache[ node.uniqueID ] ||
  9656. (outerCache[ node.uniqueID ] = {});
  9657. cache = uniqueCache[ type ] || [];
  9658. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9659. diff = nodeIndex;
  9660. }
  9661. // xml :nth-child(...)
  9662. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9663. if ( diff === false ) {
  9664. // Use the same loop as above to seek `elem` from the start
  9665. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9666. (diff = nodeIndex = 0) || start.pop()) ) {
  9667. if ( ( ofType ?
  9668. node.nodeName.toLowerCase() === name :
  9669. node.nodeType === 1 ) &&
  9670. ++diff ) {
  9671. // Cache the index of each encountered element
  9672. if ( useCache ) {
  9673. outerCache = node[ expando ] || (node[ expando ] = {});
  9674. // Support: IE <9 only
  9675. // Defend against cloned attroperties (jQuery gh-1709)
  9676. uniqueCache = outerCache[ node.uniqueID ] ||
  9677. (outerCache[ node.uniqueID ] = {});
  9678. uniqueCache[ type ] = [ dirruns, diff ];
  9679. }
  9680. if ( node === elem ) {
  9681. break;
  9682. }
  9683. }
  9684. }
  9685. }
  9686. }
  9687. // Incorporate the offset, then check against cycle size
  9688. diff -= last;
  9689. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9690. }
  9691. };
  9692. },
  9693. "PSEUDO": function( pseudo, argument ) {
  9694. // pseudo-class names are case-insensitive
  9695. // http://www.w3.org/TR/selectors/#pseudo-classes
  9696. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9697. // Remember that setFilters inherits from pseudos
  9698. var args,
  9699. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9700. Sizzle.error( "unsupported pseudo: " + pseudo );
  9701. // The user may use createPseudo to indicate that
  9702. // arguments are needed to create the filter function
  9703. // just as Sizzle does
  9704. if ( fn[ expando ] ) {
  9705. return fn( argument );
  9706. }
  9707. // But maintain support for old signatures
  9708. if ( fn.length > 1 ) {
  9709. args = [ pseudo, pseudo, "", argument ];
  9710. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9711. markFunction(function( seed, matches ) {
  9712. var idx,
  9713. matched = fn( seed, argument ),
  9714. i = matched.length;
  9715. while ( i-- ) {
  9716. idx = indexOf( seed, matched[i] );
  9717. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9718. }
  9719. }) :
  9720. function( elem ) {
  9721. return fn( elem, 0, args );
  9722. };
  9723. }
  9724. return fn;
  9725. }
  9726. },
  9727. pseudos: {
  9728. // Potentially complex pseudos
  9729. "not": markFunction(function( selector ) {
  9730. // Trim the selector passed to compile
  9731. // to avoid treating leading and trailing
  9732. // spaces as combinators
  9733. var input = [],
  9734. results = [],
  9735. matcher = compile( selector.replace( rtrim, "$1" ) );
  9736. return matcher[ expando ] ?
  9737. markFunction(function( seed, matches, context, xml ) {
  9738. var elem,
  9739. unmatched = matcher( seed, null, xml, [] ),
  9740. i = seed.length;
  9741. // Match elements unmatched by `matcher`
  9742. while ( i-- ) {
  9743. if ( (elem = unmatched[i]) ) {
  9744. seed[i] = !(matches[i] = elem);
  9745. }
  9746. }
  9747. }) :
  9748. function( elem, context, xml ) {
  9749. input[0] = elem;
  9750. matcher( input, null, xml, results );
  9751. // Don't keep the element (issue #299)
  9752. input[0] = null;
  9753. return !results.pop();
  9754. };
  9755. }),
  9756. "has": markFunction(function( selector ) {
  9757. return function( elem ) {
  9758. return Sizzle( selector, elem ).length > 0;
  9759. };
  9760. }),
  9761. "contains": markFunction(function( text ) {
  9762. text = text.replace( runescape, funescape );
  9763. return function( elem ) {
  9764. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9765. };
  9766. }),
  9767. // "Whether an element is represented by a :lang() selector
  9768. // is based solely on the element's language value
  9769. // being equal to the identifier C,
  9770. // or beginning with the identifier C immediately followed by "-".
  9771. // The matching of C against the element's language value is performed case-insensitively.
  9772. // The identifier C does not have to be a valid language name."
  9773. // http://www.w3.org/TR/selectors/#lang-pseudo
  9774. "lang": markFunction( function( lang ) {
  9775. // lang value must be a valid identifier
  9776. if ( !ridentifier.test(lang || "") ) {
  9777. Sizzle.error( "unsupported lang: " + lang );
  9778. }
  9779. lang = lang.replace( runescape, funescape ).toLowerCase();
  9780. return function( elem ) {
  9781. var elemLang;
  9782. do {
  9783. if ( (elemLang = documentIsHTML ?
  9784. elem.lang :
  9785. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9786. elemLang = elemLang.toLowerCase();
  9787. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9788. }
  9789. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9790. return false;
  9791. };
  9792. }),
  9793. // Miscellaneous
  9794. "target": function( elem ) {
  9795. var hash = window.location && window.location.hash;
  9796. return hash && hash.slice( 1 ) === elem.id;
  9797. },
  9798. "root": function( elem ) {
  9799. return elem === docElem;
  9800. },
  9801. "focus": function( elem ) {
  9802. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9803. },
  9804. // Boolean properties
  9805. "enabled": createDisabledPseudo( false ),
  9806. "disabled": createDisabledPseudo( true ),
  9807. "checked": function( elem ) {
  9808. // In CSS3, :checked should return both checked and selected elements
  9809. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9810. var nodeName = elem.nodeName.toLowerCase();
  9811. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9812. },
  9813. "selected": function( elem ) {
  9814. // Accessing this property makes selected-by-default
  9815. // options in Safari work properly
  9816. if ( elem.parentNode ) {
  9817. elem.parentNode.selectedIndex;
  9818. }
  9819. return elem.selected === true;
  9820. },
  9821. // Contents
  9822. "empty": function( elem ) {
  9823. // http://www.w3.org/TR/selectors/#empty-pseudo
  9824. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9825. // but not by others (comment: 8; processing instruction: 7; etc.)
  9826. // nodeType < 6 works because attributes (2) do not appear as children
  9827. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9828. if ( elem.nodeType < 6 ) {
  9829. return false;
  9830. }
  9831. }
  9832. return true;
  9833. },
  9834. "parent": function( elem ) {
  9835. return !Expr.pseudos["empty"]( elem );
  9836. },
  9837. // Element/input types
  9838. "header": function( elem ) {
  9839. return rheader.test( elem.nodeName );
  9840. },
  9841. "input": function( elem ) {
  9842. return rinputs.test( elem.nodeName );
  9843. },
  9844. "button": function( elem ) {
  9845. var name = elem.nodeName.toLowerCase();
  9846. return name === "input" && elem.type === "button" || name === "button";
  9847. },
  9848. "text": function( elem ) {
  9849. var attr;
  9850. return elem.nodeName.toLowerCase() === "input" &&
  9851. elem.type === "text" &&
  9852. // Support: IE<8
  9853. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9854. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9855. },
  9856. // Position-in-collection
  9857. "first": createPositionalPseudo(function() {
  9858. return [ 0 ];
  9859. }),
  9860. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9861. return [ length - 1 ];
  9862. }),
  9863. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9864. return [ argument < 0 ? argument + length : argument ];
  9865. }),
  9866. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9867. var i = 0;
  9868. for ( ; i < length; i += 2 ) {
  9869. matchIndexes.push( i );
  9870. }
  9871. return matchIndexes;
  9872. }),
  9873. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9874. var i = 1;
  9875. for ( ; i < length; i += 2 ) {
  9876. matchIndexes.push( i );
  9877. }
  9878. return matchIndexes;
  9879. }),
  9880. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9881. var i = argument < 0 ?
  9882. argument + length :
  9883. argument > length ?
  9884. length :
  9885. argument;
  9886. for ( ; --i >= 0; ) {
  9887. matchIndexes.push( i );
  9888. }
  9889. return matchIndexes;
  9890. }),
  9891. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9892. var i = argument < 0 ? argument + length : argument;
  9893. for ( ; ++i < length; ) {
  9894. matchIndexes.push( i );
  9895. }
  9896. return matchIndexes;
  9897. })
  9898. }
  9899. };
  9900. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9901. // Add button/input type pseudos
  9902. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9903. Expr.pseudos[ i ] = createInputPseudo( i );
  9904. }
  9905. for ( i in { submit: true, reset: true } ) {
  9906. Expr.pseudos[ i ] = createButtonPseudo( i );
  9907. }
  9908. // Easy API for creating new setFilters
  9909. function setFilters() {}
  9910. setFilters.prototype = Expr.filters = Expr.pseudos;
  9911. Expr.setFilters = new setFilters();
  9912. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9913. var matched, match, tokens, type,
  9914. soFar, groups, preFilters,
  9915. cached = tokenCache[ selector + " " ];
  9916. if ( cached ) {
  9917. return parseOnly ? 0 : cached.slice( 0 );
  9918. }
  9919. soFar = selector;
  9920. groups = [];
  9921. preFilters = Expr.preFilter;
  9922. while ( soFar ) {
  9923. // Comma and first run
  9924. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9925. if ( match ) {
  9926. // Don't consume trailing commas as valid
  9927. soFar = soFar.slice( match[0].length ) || soFar;
  9928. }
  9929. groups.push( (tokens = []) );
  9930. }
  9931. matched = false;
  9932. // Combinators
  9933. if ( (match = rcombinators.exec( soFar )) ) {
  9934. matched = match.shift();
  9935. tokens.push({
  9936. value: matched,
  9937. // Cast descendant combinators to space
  9938. type: match[0].replace( rtrim, " " )
  9939. });
  9940. soFar = soFar.slice( matched.length );
  9941. }
  9942. // Filters
  9943. for ( type in Expr.filter ) {
  9944. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9945. (match = preFilters[ type ]( match ))) ) {
  9946. matched = match.shift();
  9947. tokens.push({
  9948. value: matched,
  9949. type: type,
  9950. matches: match
  9951. });
  9952. soFar = soFar.slice( matched.length );
  9953. }
  9954. }
  9955. if ( !matched ) {
  9956. break;
  9957. }
  9958. }
  9959. // Return the length of the invalid excess
  9960. // if we're just parsing
  9961. // Otherwise, throw an error or return tokens
  9962. return parseOnly ?
  9963. soFar.length :
  9964. soFar ?
  9965. Sizzle.error( selector ) :
  9966. // Cache the tokens
  9967. tokenCache( selector, groups ).slice( 0 );
  9968. };
  9969. function toSelector( tokens ) {
  9970. var i = 0,
  9971. len = tokens.length,
  9972. selector = "";
  9973. for ( ; i < len; i++ ) {
  9974. selector += tokens[i].value;
  9975. }
  9976. return selector;
  9977. }
  9978. function addCombinator( matcher, combinator, base ) {
  9979. var dir = combinator.dir,
  9980. skip = combinator.next,
  9981. key = skip || dir,
  9982. checkNonElements = base && key === "parentNode",
  9983. doneName = done++;
  9984. return combinator.first ?
  9985. // Check against closest ancestor/preceding element
  9986. function( elem, context, xml ) {
  9987. while ( (elem = elem[ dir ]) ) {
  9988. if ( elem.nodeType === 1 || checkNonElements ) {
  9989. return matcher( elem, context, xml );
  9990. }
  9991. }
  9992. return false;
  9993. } :
  9994. // Check against all ancestor/preceding elements
  9995. function( elem, context, xml ) {
  9996. var oldCache, uniqueCache, outerCache,
  9997. newCache = [ dirruns, doneName ];
  9998. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  9999. if ( xml ) {
  10000. while ( (elem = elem[ dir ]) ) {
  10001. if ( elem.nodeType === 1 || checkNonElements ) {
  10002. if ( matcher( elem, context, xml ) ) {
  10003. return true;
  10004. }
  10005. }
  10006. }
  10007. } else {
  10008. while ( (elem = elem[ dir ]) ) {
  10009. if ( elem.nodeType === 1 || checkNonElements ) {
  10010. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10011. // Support: IE <9 only
  10012. // Defend against cloned attroperties (jQuery gh-1709)
  10013. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10014. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10015. elem = elem[ dir ] || elem;
  10016. } else if ( (oldCache = uniqueCache[ key ]) &&
  10017. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10018. // Assign to newCache so results back-propagate to previous elements
  10019. return (newCache[ 2 ] = oldCache[ 2 ]);
  10020. } else {
  10021. // Reuse newcache so results back-propagate to previous elements
  10022. uniqueCache[ key ] = newCache;
  10023. // A match means we're done; a fail means we have to keep checking
  10024. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10025. return true;
  10026. }
  10027. }
  10028. }
  10029. }
  10030. }
  10031. return false;
  10032. };
  10033. }
  10034. function elementMatcher( matchers ) {
  10035. return matchers.length > 1 ?
  10036. function( elem, context, xml ) {
  10037. var i = matchers.length;
  10038. while ( i-- ) {
  10039. if ( !matchers[i]( elem, context, xml ) ) {
  10040. return false;
  10041. }
  10042. }
  10043. return true;
  10044. } :
  10045. matchers[0];
  10046. }
  10047. function multipleContexts( selector, contexts, results ) {
  10048. var i = 0,
  10049. len = contexts.length;
  10050. for ( ; i < len; i++ ) {
  10051. Sizzle( selector, contexts[i], results );
  10052. }
  10053. return results;
  10054. }
  10055. function condense( unmatched, map, filter, context, xml ) {
  10056. var elem,
  10057. newUnmatched = [],
  10058. i = 0,
  10059. len = unmatched.length,
  10060. mapped = map != null;
  10061. for ( ; i < len; i++ ) {
  10062. if ( (elem = unmatched[i]) ) {
  10063. if ( !filter || filter( elem, context, xml ) ) {
  10064. newUnmatched.push( elem );
  10065. if ( mapped ) {
  10066. map.push( i );
  10067. }
  10068. }
  10069. }
  10070. }
  10071. return newUnmatched;
  10072. }
  10073. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10074. if ( postFilter && !postFilter[ expando ] ) {
  10075. postFilter = setMatcher( postFilter );
  10076. }
  10077. if ( postFinder && !postFinder[ expando ] ) {
  10078. postFinder = setMatcher( postFinder, postSelector );
  10079. }
  10080. return markFunction(function( seed, results, context, xml ) {
  10081. var temp, i, elem,
  10082. preMap = [],
  10083. postMap = [],
  10084. preexisting = results.length,
  10085. // Get initial elements from seed or context
  10086. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10087. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10088. matcherIn = preFilter && ( seed || !selector ) ?
  10089. condense( elems, preMap, preFilter, context, xml ) :
  10090. elems,
  10091. matcherOut = matcher ?
  10092. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10093. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10094. // ...intermediate processing is necessary
  10095. [] :
  10096. // ...otherwise use results directly
  10097. results :
  10098. matcherIn;
  10099. // Find primary matches
  10100. if ( matcher ) {
  10101. matcher( matcherIn, matcherOut, context, xml );
  10102. }
  10103. // Apply postFilter
  10104. if ( postFilter ) {
  10105. temp = condense( matcherOut, postMap );
  10106. postFilter( temp, [], context, xml );
  10107. // Un-match failing elements by moving them back to matcherIn
  10108. i = temp.length;
  10109. while ( i-- ) {
  10110. if ( (elem = temp[i]) ) {
  10111. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10112. }
  10113. }
  10114. }
  10115. if ( seed ) {
  10116. if ( postFinder || preFilter ) {
  10117. if ( postFinder ) {
  10118. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10119. temp = [];
  10120. i = matcherOut.length;
  10121. while ( i-- ) {
  10122. if ( (elem = matcherOut[i]) ) {
  10123. // Restore matcherIn since elem is not yet a final match
  10124. temp.push( (matcherIn[i] = elem) );
  10125. }
  10126. }
  10127. postFinder( null, (matcherOut = []), temp, xml );
  10128. }
  10129. // Move matched elements from seed to results to keep them synchronized
  10130. i = matcherOut.length;
  10131. while ( i-- ) {
  10132. if ( (elem = matcherOut[i]) &&
  10133. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10134. seed[temp] = !(results[temp] = elem);
  10135. }
  10136. }
  10137. }
  10138. // Add elements to results, through postFinder if defined
  10139. } else {
  10140. matcherOut = condense(
  10141. matcherOut === results ?
  10142. matcherOut.splice( preexisting, matcherOut.length ) :
  10143. matcherOut
  10144. );
  10145. if ( postFinder ) {
  10146. postFinder( null, results, matcherOut, xml );
  10147. } else {
  10148. push.apply( results, matcherOut );
  10149. }
  10150. }
  10151. });
  10152. }
  10153. function matcherFromTokens( tokens ) {
  10154. var checkContext, matcher, j,
  10155. len = tokens.length,
  10156. leadingRelative = Expr.relative[ tokens[0].type ],
  10157. implicitRelative = leadingRelative || Expr.relative[" "],
  10158. i = leadingRelative ? 1 : 0,
  10159. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10160. matchContext = addCombinator( function( elem ) {
  10161. return elem === checkContext;
  10162. }, implicitRelative, true ),
  10163. matchAnyContext = addCombinator( function( elem ) {
  10164. return indexOf( checkContext, elem ) > -1;
  10165. }, implicitRelative, true ),
  10166. matchers = [ function( elem, context, xml ) {
  10167. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10168. (checkContext = context).nodeType ?
  10169. matchContext( elem, context, xml ) :
  10170. matchAnyContext( elem, context, xml ) );
  10171. // Avoid hanging onto element (issue #299)
  10172. checkContext = null;
  10173. return ret;
  10174. } ];
  10175. for ( ; i < len; i++ ) {
  10176. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10177. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10178. } else {
  10179. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10180. // Return special upon seeing a positional matcher
  10181. if ( matcher[ expando ] ) {
  10182. // Find the next relative operator (if any) for proper handling
  10183. j = ++i;
  10184. for ( ; j < len; j++ ) {
  10185. if ( Expr.relative[ tokens[j].type ] ) {
  10186. break;
  10187. }
  10188. }
  10189. return setMatcher(
  10190. i > 1 && elementMatcher( matchers ),
  10191. i > 1 && toSelector(
  10192. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10193. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10194. ).replace( rtrim, "$1" ),
  10195. matcher,
  10196. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10197. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10198. j < len && toSelector( tokens )
  10199. );
  10200. }
  10201. matchers.push( matcher );
  10202. }
  10203. }
  10204. return elementMatcher( matchers );
  10205. }
  10206. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10207. var bySet = setMatchers.length > 0,
  10208. byElement = elementMatchers.length > 0,
  10209. superMatcher = function( seed, context, xml, results, outermost ) {
  10210. var elem, j, matcher,
  10211. matchedCount = 0,
  10212. i = "0",
  10213. unmatched = seed && [],
  10214. setMatched = [],
  10215. contextBackup = outermostContext,
  10216. // We must always have either seed elements or outermost context
  10217. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10218. // Use integer dirruns iff this is the outermost matcher
  10219. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10220. len = elems.length;
  10221. if ( outermost ) {
  10222. outermostContext = context === document || context || outermost;
  10223. }
  10224. // Add elements passing elementMatchers directly to results
  10225. // Support: IE<9, Safari
  10226. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10227. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10228. if ( byElement && elem ) {
  10229. j = 0;
  10230. if ( !context && elem.ownerDocument !== document ) {
  10231. setDocument( elem );
  10232. xml = !documentIsHTML;
  10233. }
  10234. while ( (matcher = elementMatchers[j++]) ) {
  10235. if ( matcher( elem, context || document, xml) ) {
  10236. results.push( elem );
  10237. break;
  10238. }
  10239. }
  10240. if ( outermost ) {
  10241. dirruns = dirrunsUnique;
  10242. }
  10243. }
  10244. // Track unmatched elements for set filters
  10245. if ( bySet ) {
  10246. // They will have gone through all possible matchers
  10247. if ( (elem = !matcher && elem) ) {
  10248. matchedCount--;
  10249. }
  10250. // Lengthen the array for every element, matched or not
  10251. if ( seed ) {
  10252. unmatched.push( elem );
  10253. }
  10254. }
  10255. }
  10256. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10257. // makes the latter nonnegative.
  10258. matchedCount += i;
  10259. // Apply set filters to unmatched elements
  10260. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10261. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10262. // no element matchers and no seed.
  10263. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10264. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10265. // numerically zero.
  10266. if ( bySet && i !== matchedCount ) {
  10267. j = 0;
  10268. while ( (matcher = setMatchers[j++]) ) {
  10269. matcher( unmatched, setMatched, context, xml );
  10270. }
  10271. if ( seed ) {
  10272. // Reintegrate element matches to eliminate the need for sorting
  10273. if ( matchedCount > 0 ) {
  10274. while ( i-- ) {
  10275. if ( !(unmatched[i] || setMatched[i]) ) {
  10276. setMatched[i] = pop.call( results );
  10277. }
  10278. }
  10279. }
  10280. // Discard index placeholder values to get only actual matches
  10281. setMatched = condense( setMatched );
  10282. }
  10283. // Add matches to results
  10284. push.apply( results, setMatched );
  10285. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10286. if ( outermost && !seed && setMatched.length > 0 &&
  10287. ( matchedCount + setMatchers.length ) > 1 ) {
  10288. Sizzle.uniqueSort( results );
  10289. }
  10290. }
  10291. // Override manipulation of globals by nested matchers
  10292. if ( outermost ) {
  10293. dirruns = dirrunsUnique;
  10294. outermostContext = contextBackup;
  10295. }
  10296. return unmatched;
  10297. };
  10298. return bySet ?
  10299. markFunction( superMatcher ) :
  10300. superMatcher;
  10301. }
  10302. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10303. var i,
  10304. setMatchers = [],
  10305. elementMatchers = [],
  10306. cached = compilerCache[ selector + " " ];
  10307. if ( !cached ) {
  10308. // Generate a function of recursive functions that can be used to check each element
  10309. if ( !match ) {
  10310. match = tokenize( selector );
  10311. }
  10312. i = match.length;
  10313. while ( i-- ) {
  10314. cached = matcherFromTokens( match[i] );
  10315. if ( cached[ expando ] ) {
  10316. setMatchers.push( cached );
  10317. } else {
  10318. elementMatchers.push( cached );
  10319. }
  10320. }
  10321. // Cache the compiled function
  10322. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10323. // Save selector and tokenization
  10324. cached.selector = selector;
  10325. }
  10326. return cached;
  10327. };
  10328. /**
  10329. * A low-level selection function that works with Sizzle's compiled
  10330. * selector functions
  10331. * @param {String|Function} selector A selector or a pre-compiled
  10332. * selector function built with Sizzle.compile
  10333. * @param {Element} context
  10334. * @param {Array} [results]
  10335. * @param {Array} [seed] A set of elements to match against
  10336. */
  10337. select = Sizzle.select = function( selector, context, results, seed ) {
  10338. var i, tokens, token, type, find,
  10339. compiled = typeof selector === "function" && selector,
  10340. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10341. results = results || [];
  10342. // Try to minimize operations if there is only one selector in the list and no seed
  10343. // (the latter of which guarantees us context)
  10344. if ( match.length === 1 ) {
  10345. // Reduce context if the leading compound selector is an ID
  10346. tokens = match[0] = match[0].slice( 0 );
  10347. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10348. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10349. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10350. if ( !context ) {
  10351. return results;
  10352. // Precompiled matchers will still verify ancestry, so step up a level
  10353. } else if ( compiled ) {
  10354. context = context.parentNode;
  10355. }
  10356. selector = selector.slice( tokens.shift().value.length );
  10357. }
  10358. // Fetch a seed set for right-to-left matching
  10359. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10360. while ( i-- ) {
  10361. token = tokens[i];
  10362. // Abort if we hit a combinator
  10363. if ( Expr.relative[ (type = token.type) ] ) {
  10364. break;
  10365. }
  10366. if ( (find = Expr.find[ type ]) ) {
  10367. // Search, expanding context for leading sibling combinators
  10368. if ( (seed = find(
  10369. token.matches[0].replace( runescape, funescape ),
  10370. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10371. )) ) {
  10372. // If seed is empty or no tokens remain, we can return early
  10373. tokens.splice( i, 1 );
  10374. selector = seed.length && toSelector( tokens );
  10375. if ( !selector ) {
  10376. push.apply( results, seed );
  10377. return results;
  10378. }
  10379. break;
  10380. }
  10381. }
  10382. }
  10383. }
  10384. // Compile and execute a filtering function if one is not provided
  10385. // Provide `match` to avoid retokenization if we modified the selector above
  10386. ( compiled || compile( selector, match ) )(
  10387. seed,
  10388. context,
  10389. !documentIsHTML,
  10390. results,
  10391. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10392. );
  10393. return results;
  10394. };
  10395. // One-time assignments
  10396. // Sort stability
  10397. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10398. // Support: Chrome 14-35+
  10399. // Always assume duplicates if they aren't passed to the comparison function
  10400. support.detectDuplicates = !!hasDuplicate;
  10401. // Initialize against the default document
  10402. setDocument();
  10403. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10404. // Detached nodes confoundingly follow *each other*
  10405. support.sortDetached = assert(function( el ) {
  10406. // Should return 1, but returns 4 (following)
  10407. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10408. });
  10409. // Support: IE<8
  10410. // Prevent attribute/property "interpolation"
  10411. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10412. if ( !assert(function( el ) {
  10413. el.innerHTML = "<a href='#'></a>";
  10414. return el.firstChild.getAttribute("href") === "#" ;
  10415. }) ) {
  10416. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10417. if ( !isXML ) {
  10418. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10419. }
  10420. });
  10421. }
  10422. // Support: IE<9
  10423. // Use defaultValue in place of getAttribute("value")
  10424. if ( !support.attributes || !assert(function( el ) {
  10425. el.innerHTML = "<input/>";
  10426. el.firstChild.setAttribute( "value", "" );
  10427. return el.firstChild.getAttribute( "value" ) === "";
  10428. }) ) {
  10429. addHandle( "value", function( elem, name, isXML ) {
  10430. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10431. return elem.defaultValue;
  10432. }
  10433. });
  10434. }
  10435. // Support: IE<9
  10436. // Use getAttributeNode to fetch booleans when getAttribute lies
  10437. if ( !assert(function( el ) {
  10438. return el.getAttribute("disabled") == null;
  10439. }) ) {
  10440. addHandle( booleans, function( elem, name, isXML ) {
  10441. var val;
  10442. if ( !isXML ) {
  10443. return elem[ name ] === true ? name.toLowerCase() :
  10444. (val = elem.getAttributeNode( name )) && val.specified ?
  10445. val.value :
  10446. null;
  10447. }
  10448. });
  10449. }
  10450. return Sizzle;
  10451. })( window );
  10452. jQuery.find = Sizzle;
  10453. jQuery.expr = Sizzle.selectors;
  10454. // Deprecated
  10455. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10456. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10457. jQuery.text = Sizzle.getText;
  10458. jQuery.isXMLDoc = Sizzle.isXML;
  10459. jQuery.contains = Sizzle.contains;
  10460. jQuery.escapeSelector = Sizzle.escape;
  10461. var dir = function( elem, dir, until ) {
  10462. var matched = [],
  10463. truncate = until !== undefined;
  10464. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10465. if ( elem.nodeType === 1 ) {
  10466. if ( truncate && jQuery( elem ).is( until ) ) {
  10467. break;
  10468. }
  10469. matched.push( elem );
  10470. }
  10471. }
  10472. return matched;
  10473. };
  10474. var siblings = function( n, elem ) {
  10475. var matched = [];
  10476. for ( ; n; n = n.nextSibling ) {
  10477. if ( n.nodeType === 1 && n !== elem ) {
  10478. matched.push( n );
  10479. }
  10480. }
  10481. return matched;
  10482. };
  10483. var rneedsContext = jQuery.expr.match.needsContext;
  10484. function nodeName( elem, name ) {
  10485. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10486. };
  10487. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10488. // Implement the identical functionality for filter and not
  10489. function winnow( elements, qualifier, not ) {
  10490. if ( isFunction( qualifier ) ) {
  10491. return jQuery.grep( elements, function( elem, i ) {
  10492. return !!qualifier.call( elem, i, elem ) !== not;
  10493. } );
  10494. }
  10495. // Single element
  10496. if ( qualifier.nodeType ) {
  10497. return jQuery.grep( elements, function( elem ) {
  10498. return ( elem === qualifier ) !== not;
  10499. } );
  10500. }
  10501. // Arraylike of elements (jQuery, arguments, Array)
  10502. if ( typeof qualifier !== "string" ) {
  10503. return jQuery.grep( elements, function( elem ) {
  10504. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10505. } );
  10506. }
  10507. // Filtered directly for both simple and complex selectors
  10508. return jQuery.filter( qualifier, elements, not );
  10509. }
  10510. jQuery.filter = function( expr, elems, not ) {
  10511. var elem = elems[ 0 ];
  10512. if ( not ) {
  10513. expr = ":not(" + expr + ")";
  10514. }
  10515. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10516. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10517. }
  10518. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10519. return elem.nodeType === 1;
  10520. } ) );
  10521. };
  10522. jQuery.fn.extend( {
  10523. find: function( selector ) {
  10524. var i, ret,
  10525. len = this.length,
  10526. self = this;
  10527. if ( typeof selector !== "string" ) {
  10528. return this.pushStack( jQuery( selector ).filter( function() {
  10529. for ( i = 0; i < len; i++ ) {
  10530. if ( jQuery.contains( self[ i ], this ) ) {
  10531. return true;
  10532. }
  10533. }
  10534. } ) );
  10535. }
  10536. ret = this.pushStack( [] );
  10537. for ( i = 0; i < len; i++ ) {
  10538. jQuery.find( selector, self[ i ], ret );
  10539. }
  10540. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10541. },
  10542. filter: function( selector ) {
  10543. return this.pushStack( winnow( this, selector || [], false ) );
  10544. },
  10545. not: function( selector ) {
  10546. return this.pushStack( winnow( this, selector || [], true ) );
  10547. },
  10548. is: function( selector ) {
  10549. return !!winnow(
  10550. this,
  10551. // If this is a positional/relative selector, check membership in the returned set
  10552. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10553. typeof selector === "string" && rneedsContext.test( selector ) ?
  10554. jQuery( selector ) :
  10555. selector || [],
  10556. false
  10557. ).length;
  10558. }
  10559. } );
  10560. // Initialize a jQuery object
  10561. // A central reference to the root jQuery(document)
  10562. var rootjQuery,
  10563. // A simple way to check for HTML strings
  10564. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10565. // Strict HTML recognition (#11290: must start with <)
  10566. // Shortcut simple #id case for speed
  10567. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10568. init = jQuery.fn.init = function( selector, context, root ) {
  10569. var match, elem;
  10570. // HANDLE: $(""), $(null), $(undefined), $(false)
  10571. if ( !selector ) {
  10572. return this;
  10573. }
  10574. // Method init() accepts an alternate rootjQuery
  10575. // so migrate can support jQuery.sub (gh-2101)
  10576. root = root || rootjQuery;
  10577. // Handle HTML strings
  10578. if ( typeof selector === "string" ) {
  10579. if ( selector[ 0 ] === "<" &&
  10580. selector[ selector.length - 1 ] === ">" &&
  10581. selector.length >= 3 ) {
  10582. // Assume that strings that start and end with <> are HTML and skip the regex check
  10583. match = [ null, selector, null ];
  10584. } else {
  10585. match = rquickExpr.exec( selector );
  10586. }
  10587. // Match html or make sure no context is specified for #id
  10588. if ( match && ( match[ 1 ] || !context ) ) {
  10589. // HANDLE: $(html) -> $(array)
  10590. if ( match[ 1 ] ) {
  10591. context = context instanceof jQuery ? context[ 0 ] : context;
  10592. // Option to run scripts is true for back-compat
  10593. // Intentionally let the error be thrown if parseHTML is not present
  10594. jQuery.merge( this, jQuery.parseHTML(
  10595. match[ 1 ],
  10596. context && context.nodeType ? context.ownerDocument || context : document,
  10597. true
  10598. ) );
  10599. // HANDLE: $(html, props)
  10600. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10601. for ( match in context ) {
  10602. // Properties of context are called as methods if possible
  10603. if ( isFunction( this[ match ] ) ) {
  10604. this[ match ]( context[ match ] );
  10605. // ...and otherwise set as attributes
  10606. } else {
  10607. this.attr( match, context[ match ] );
  10608. }
  10609. }
  10610. }
  10611. return this;
  10612. // HANDLE: $(#id)
  10613. } else {
  10614. elem = document.getElementById( match[ 2 ] );
  10615. if ( elem ) {
  10616. // Inject the element directly into the jQuery object
  10617. this[ 0 ] = elem;
  10618. this.length = 1;
  10619. }
  10620. return this;
  10621. }
  10622. // HANDLE: $(expr, $(...))
  10623. } else if ( !context || context.jquery ) {
  10624. return ( context || root ).find( selector );
  10625. // HANDLE: $(expr, context)
  10626. // (which is just equivalent to: $(context).find(expr)
  10627. } else {
  10628. return this.constructor( context ).find( selector );
  10629. }
  10630. // HANDLE: $(DOMElement)
  10631. } else if ( selector.nodeType ) {
  10632. this[ 0 ] = selector;
  10633. this.length = 1;
  10634. return this;
  10635. // HANDLE: $(function)
  10636. // Shortcut for document ready
  10637. } else if ( isFunction( selector ) ) {
  10638. return root.ready !== undefined ?
  10639. root.ready( selector ) :
  10640. // Execute immediately if ready is not present
  10641. selector( jQuery );
  10642. }
  10643. return jQuery.makeArray( selector, this );
  10644. };
  10645. // Give the init function the jQuery prototype for later instantiation
  10646. init.prototype = jQuery.fn;
  10647. // Initialize central reference
  10648. rootjQuery = jQuery( document );
  10649. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10650. // Methods guaranteed to produce a unique set when starting from a unique set
  10651. guaranteedUnique = {
  10652. children: true,
  10653. contents: true,
  10654. next: true,
  10655. prev: true
  10656. };
  10657. jQuery.fn.extend( {
  10658. has: function( target ) {
  10659. var targets = jQuery( target, this ),
  10660. l = targets.length;
  10661. return this.filter( function() {
  10662. var i = 0;
  10663. for ( ; i < l; i++ ) {
  10664. if ( jQuery.contains( this, targets[ i ] ) ) {
  10665. return true;
  10666. }
  10667. }
  10668. } );
  10669. },
  10670. closest: function( selectors, context ) {
  10671. var cur,
  10672. i = 0,
  10673. l = this.length,
  10674. matched = [],
  10675. targets = typeof selectors !== "string" && jQuery( selectors );
  10676. // Positional selectors never match, since there's no _selection_ context
  10677. if ( !rneedsContext.test( selectors ) ) {
  10678. for ( ; i < l; i++ ) {
  10679. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10680. // Always skip document fragments
  10681. if ( cur.nodeType < 11 && ( targets ?
  10682. targets.index( cur ) > -1 :
  10683. // Don't pass non-elements to Sizzle
  10684. cur.nodeType === 1 &&
  10685. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10686. matched.push( cur );
  10687. break;
  10688. }
  10689. }
  10690. }
  10691. }
  10692. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10693. },
  10694. // Determine the position of an element within the set
  10695. index: function( elem ) {
  10696. // No argument, return index in parent
  10697. if ( !elem ) {
  10698. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10699. }
  10700. // Index in selector
  10701. if ( typeof elem === "string" ) {
  10702. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10703. }
  10704. // Locate the position of the desired element
  10705. return indexOf.call( this,
  10706. // If it receives a jQuery object, the first element is used
  10707. elem.jquery ? elem[ 0 ] : elem
  10708. );
  10709. },
  10710. add: function( selector, context ) {
  10711. return this.pushStack(
  10712. jQuery.uniqueSort(
  10713. jQuery.merge( this.get(), jQuery( selector, context ) )
  10714. )
  10715. );
  10716. },
  10717. addBack: function( selector ) {
  10718. return this.add( selector == null ?
  10719. this.prevObject : this.prevObject.filter( selector )
  10720. );
  10721. }
  10722. } );
  10723. function sibling( cur, dir ) {
  10724. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10725. return cur;
  10726. }
  10727. jQuery.each( {
  10728. parent: function( elem ) {
  10729. var parent = elem.parentNode;
  10730. return parent && parent.nodeType !== 11 ? parent : null;
  10731. },
  10732. parents: function( elem ) {
  10733. return dir( elem, "parentNode" );
  10734. },
  10735. parentsUntil: function( elem, i, until ) {
  10736. return dir( elem, "parentNode", until );
  10737. },
  10738. next: function( elem ) {
  10739. return sibling( elem, "nextSibling" );
  10740. },
  10741. prev: function( elem ) {
  10742. return sibling( elem, "previousSibling" );
  10743. },
  10744. nextAll: function( elem ) {
  10745. return dir( elem, "nextSibling" );
  10746. },
  10747. prevAll: function( elem ) {
  10748. return dir( elem, "previousSibling" );
  10749. },
  10750. nextUntil: function( elem, i, until ) {
  10751. return dir( elem, "nextSibling", until );
  10752. },
  10753. prevUntil: function( elem, i, until ) {
  10754. return dir( elem, "previousSibling", until );
  10755. },
  10756. siblings: function( elem ) {
  10757. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10758. },
  10759. children: function( elem ) {
  10760. return siblings( elem.firstChild );
  10761. },
  10762. contents: function( elem ) {
  10763. if ( typeof elem.contentDocument !== "undefined" ) {
  10764. return elem.contentDocument;
  10765. }
  10766. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10767. // Treat the template element as a regular one in browsers that
  10768. // don't support it.
  10769. if ( nodeName( elem, "template" ) ) {
  10770. elem = elem.content || elem;
  10771. }
  10772. return jQuery.merge( [], elem.childNodes );
  10773. }
  10774. }, function( name, fn ) {
  10775. jQuery.fn[ name ] = function( until, selector ) {
  10776. var matched = jQuery.map( this, fn, until );
  10777. if ( name.slice( -5 ) !== "Until" ) {
  10778. selector = until;
  10779. }
  10780. if ( selector && typeof selector === "string" ) {
  10781. matched = jQuery.filter( selector, matched );
  10782. }
  10783. if ( this.length > 1 ) {
  10784. // Remove duplicates
  10785. if ( !guaranteedUnique[ name ] ) {
  10786. jQuery.uniqueSort( matched );
  10787. }
  10788. // Reverse order for parents* and prev-derivatives
  10789. if ( rparentsprev.test( name ) ) {
  10790. matched.reverse();
  10791. }
  10792. }
  10793. return this.pushStack( matched );
  10794. };
  10795. } );
  10796. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10797. // Convert String-formatted options into Object-formatted ones
  10798. function createOptions( options ) {
  10799. var object = {};
  10800. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10801. object[ flag ] = true;
  10802. } );
  10803. return object;
  10804. }
  10805. /*
  10806. * Create a callback list using the following parameters:
  10807. *
  10808. * options: an optional list of space-separated options that will change how
  10809. * the callback list behaves or a more traditional option object
  10810. *
  10811. * By default a callback list will act like an event callback list and can be
  10812. * "fired" multiple times.
  10813. *
  10814. * Possible options:
  10815. *
  10816. * once: will ensure the callback list can only be fired once (like a Deferred)
  10817. *
  10818. * memory: will keep track of previous values and will call any callback added
  10819. * after the list has been fired right away with the latest "memorized"
  10820. * values (like a Deferred)
  10821. *
  10822. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10823. *
  10824. * stopOnFalse: interrupt callings when a callback returns false
  10825. *
  10826. */
  10827. jQuery.Callbacks = function( options ) {
  10828. // Convert options from String-formatted to Object-formatted if needed
  10829. // (we check in cache first)
  10830. options = typeof options === "string" ?
  10831. createOptions( options ) :
  10832. jQuery.extend( {}, options );
  10833. var // Flag to know if list is currently firing
  10834. firing,
  10835. // Last fire value for non-forgettable lists
  10836. memory,
  10837. // Flag to know if list was already fired
  10838. fired,
  10839. // Flag to prevent firing
  10840. locked,
  10841. // Actual callback list
  10842. list = [],
  10843. // Queue of execution data for repeatable lists
  10844. queue = [],
  10845. // Index of currently firing callback (modified by add/remove as needed)
  10846. firingIndex = -1,
  10847. // Fire callbacks
  10848. fire = function() {
  10849. // Enforce single-firing
  10850. locked = locked || options.once;
  10851. // Execute callbacks for all pending executions,
  10852. // respecting firingIndex overrides and runtime changes
  10853. fired = firing = true;
  10854. for ( ; queue.length; firingIndex = -1 ) {
  10855. memory = queue.shift();
  10856. while ( ++firingIndex < list.length ) {
  10857. // Run callback and check for early termination
  10858. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10859. options.stopOnFalse ) {
  10860. // Jump to end and forget the data so .add doesn't re-fire
  10861. firingIndex = list.length;
  10862. memory = false;
  10863. }
  10864. }
  10865. }
  10866. // Forget the data if we're done with it
  10867. if ( !options.memory ) {
  10868. memory = false;
  10869. }
  10870. firing = false;
  10871. // Clean up if we're done firing for good
  10872. if ( locked ) {
  10873. // Keep an empty list if we have data for future add calls
  10874. if ( memory ) {
  10875. list = [];
  10876. // Otherwise, this object is spent
  10877. } else {
  10878. list = "";
  10879. }
  10880. }
  10881. },
  10882. // Actual Callbacks object
  10883. self = {
  10884. // Add a callback or a collection of callbacks to the list
  10885. add: function() {
  10886. if ( list ) {
  10887. // If we have memory from a past run, we should fire after adding
  10888. if ( memory && !firing ) {
  10889. firingIndex = list.length - 1;
  10890. queue.push( memory );
  10891. }
  10892. ( function add( args ) {
  10893. jQuery.each( args, function( _, arg ) {
  10894. if ( isFunction( arg ) ) {
  10895. if ( !options.unique || !self.has( arg ) ) {
  10896. list.push( arg );
  10897. }
  10898. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10899. // Inspect recursively
  10900. add( arg );
  10901. }
  10902. } );
  10903. } )( arguments );
  10904. if ( memory && !firing ) {
  10905. fire();
  10906. }
  10907. }
  10908. return this;
  10909. },
  10910. // Remove a callback from the list
  10911. remove: function() {
  10912. jQuery.each( arguments, function( _, arg ) {
  10913. var index;
  10914. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10915. list.splice( index, 1 );
  10916. // Handle firing indexes
  10917. if ( index <= firingIndex ) {
  10918. firingIndex--;
  10919. }
  10920. }
  10921. } );
  10922. return this;
  10923. },
  10924. // Check if a given callback is in the list.
  10925. // If no argument is given, return whether or not list has callbacks attached.
  10926. has: function( fn ) {
  10927. return fn ?
  10928. jQuery.inArray( fn, list ) > -1 :
  10929. list.length > 0;
  10930. },
  10931. // Remove all callbacks from the list
  10932. empty: function() {
  10933. if ( list ) {
  10934. list = [];
  10935. }
  10936. return this;
  10937. },
  10938. // Disable .fire and .add
  10939. // Abort any current/pending executions
  10940. // Clear all callbacks and values
  10941. disable: function() {
  10942. locked = queue = [];
  10943. list = memory = "";
  10944. return this;
  10945. },
  10946. disabled: function() {
  10947. return !list;
  10948. },
  10949. // Disable .fire
  10950. // Also disable .add unless we have memory (since it would have no effect)
  10951. // Abort any pending executions
  10952. lock: function() {
  10953. locked = queue = [];
  10954. if ( !memory && !firing ) {
  10955. list = memory = "";
  10956. }
  10957. return this;
  10958. },
  10959. locked: function() {
  10960. return !!locked;
  10961. },
  10962. // Call all callbacks with the given context and arguments
  10963. fireWith: function( context, args ) {
  10964. if ( !locked ) {
  10965. args = args || [];
  10966. args = [ context, args.slice ? args.slice() : args ];
  10967. queue.push( args );
  10968. if ( !firing ) {
  10969. fire();
  10970. }
  10971. }
  10972. return this;
  10973. },
  10974. // Call all the callbacks with the given arguments
  10975. fire: function() {
  10976. self.fireWith( this, arguments );
  10977. return this;
  10978. },
  10979. // To know if the callbacks have already been called at least once
  10980. fired: function() {
  10981. return !!fired;
  10982. }
  10983. };
  10984. return self;
  10985. };
  10986. function Identity( v ) {
  10987. return v;
  10988. }
  10989. function Thrower( ex ) {
  10990. throw ex;
  10991. }
  10992. function adoptValue( value, resolve, reject, noValue ) {
  10993. var method;
  10994. try {
  10995. // Check for promise aspect first to privilege synchronous behavior
  10996. if ( value && isFunction( ( method = value.promise ) ) ) {
  10997. method.call( value ).done( resolve ).fail( reject );
  10998. // Other thenables
  10999. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11000. method.call( value, resolve, reject );
  11001. // Other non-thenables
  11002. } else {
  11003. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11004. // * false: [ value ].slice( 0 ) => resolve( value )
  11005. // * true: [ value ].slice( 1 ) => resolve()
  11006. resolve.apply( undefined, [ value ].slice( noValue ) );
  11007. }
  11008. // For Promises/A+, convert exceptions into rejections
  11009. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11010. // Deferred#then to conditionally suppress rejection.
  11011. } catch ( value ) {
  11012. // Support: Android 4.0 only
  11013. // Strict mode functions invoked without .call/.apply get global-object context
  11014. reject.apply( undefined, [ value ] );
  11015. }
  11016. }
  11017. jQuery.extend( {
  11018. Deferred: function( func ) {
  11019. var tuples = [
  11020. // action, add listener, callbacks,
  11021. // ... .then handlers, argument index, [final state]
  11022. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11023. jQuery.Callbacks( "memory" ), 2 ],
  11024. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11025. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11026. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11027. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11028. ],
  11029. state = "pending",
  11030. promise = {
  11031. state: function() {
  11032. return state;
  11033. },
  11034. always: function() {
  11035. deferred.done( arguments ).fail( arguments );
  11036. return this;
  11037. },
  11038. "catch": function( fn ) {
  11039. return promise.then( null, fn );
  11040. },
  11041. // Keep pipe for back-compat
  11042. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11043. var fns = arguments;
  11044. return jQuery.Deferred( function( newDefer ) {
  11045. jQuery.each( tuples, function( i, tuple ) {
  11046. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11047. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11048. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11049. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11050. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11051. deferred[ tuple[ 1 ] ]( function() {
  11052. var returned = fn && fn.apply( this, arguments );
  11053. if ( returned && isFunction( returned.promise ) ) {
  11054. returned.promise()
  11055. .progress( newDefer.notify )
  11056. .done( newDefer.resolve )
  11057. .fail( newDefer.reject );
  11058. } else {
  11059. newDefer[ tuple[ 0 ] + "With" ](
  11060. this,
  11061. fn ? [ returned ] : arguments
  11062. );
  11063. }
  11064. } );
  11065. } );
  11066. fns = null;
  11067. } ).promise();
  11068. },
  11069. then: function( onFulfilled, onRejected, onProgress ) {
  11070. var maxDepth = 0;
  11071. function resolve( depth, deferred, handler, special ) {
  11072. return function() {
  11073. var that = this,
  11074. args = arguments,
  11075. mightThrow = function() {
  11076. var returned, then;
  11077. // Support: Promises/A+ section 2.3.3.3.3
  11078. // https://promisesaplus.com/#point-59
  11079. // Ignore double-resolution attempts
  11080. if ( depth < maxDepth ) {
  11081. return;
  11082. }
  11083. returned = handler.apply( that, args );
  11084. // Support: Promises/A+ section 2.3.1
  11085. // https://promisesaplus.com/#point-48
  11086. if ( returned === deferred.promise() ) {
  11087. throw new TypeError( "Thenable self-resolution" );
  11088. }
  11089. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11090. // https://promisesaplus.com/#point-54
  11091. // https://promisesaplus.com/#point-75
  11092. // Retrieve `then` only once
  11093. then = returned &&
  11094. // Support: Promises/A+ section 2.3.4
  11095. // https://promisesaplus.com/#point-64
  11096. // Only check objects and functions for thenability
  11097. ( typeof returned === "object" ||
  11098. typeof returned === "function" ) &&
  11099. returned.then;
  11100. // Handle a returned thenable
  11101. if ( isFunction( then ) ) {
  11102. // Special processors (notify) just wait for resolution
  11103. if ( special ) {
  11104. then.call(
  11105. returned,
  11106. resolve( maxDepth, deferred, Identity, special ),
  11107. resolve( maxDepth, deferred, Thrower, special )
  11108. );
  11109. // Normal processors (resolve) also hook into progress
  11110. } else {
  11111. // ...and disregard older resolution values
  11112. maxDepth++;
  11113. then.call(
  11114. returned,
  11115. resolve( maxDepth, deferred, Identity, special ),
  11116. resolve( maxDepth, deferred, Thrower, special ),
  11117. resolve( maxDepth, deferred, Identity,
  11118. deferred.notifyWith )
  11119. );
  11120. }
  11121. // Handle all other returned values
  11122. } else {
  11123. // Only substitute handlers pass on context
  11124. // and multiple values (non-spec behavior)
  11125. if ( handler !== Identity ) {
  11126. that = undefined;
  11127. args = [ returned ];
  11128. }
  11129. // Process the value(s)
  11130. // Default process is resolve
  11131. ( special || deferred.resolveWith )( that, args );
  11132. }
  11133. },
  11134. // Only normal processors (resolve) catch and reject exceptions
  11135. process = special ?
  11136. mightThrow :
  11137. function() {
  11138. try {
  11139. mightThrow();
  11140. } catch ( e ) {
  11141. if ( jQuery.Deferred.exceptionHook ) {
  11142. jQuery.Deferred.exceptionHook( e,
  11143. process.stackTrace );
  11144. }
  11145. // Support: Promises/A+ section 2.3.3.3.4.1
  11146. // https://promisesaplus.com/#point-61
  11147. // Ignore post-resolution exceptions
  11148. if ( depth + 1 >= maxDepth ) {
  11149. // Only substitute handlers pass on context
  11150. // and multiple values (non-spec behavior)
  11151. if ( handler !== Thrower ) {
  11152. that = undefined;
  11153. args = [ e ];
  11154. }
  11155. deferred.rejectWith( that, args );
  11156. }
  11157. }
  11158. };
  11159. // Support: Promises/A+ section 2.3.3.3.1
  11160. // https://promisesaplus.com/#point-57
  11161. // Re-resolve promises immediately to dodge false rejection from
  11162. // subsequent errors
  11163. if ( depth ) {
  11164. process();
  11165. } else {
  11166. // Call an optional hook to record the stack, in case of exception
  11167. // since it's otherwise lost when execution goes async
  11168. if ( jQuery.Deferred.getStackHook ) {
  11169. process.stackTrace = jQuery.Deferred.getStackHook();
  11170. }
  11171. window.setTimeout( process );
  11172. }
  11173. };
  11174. }
  11175. return jQuery.Deferred( function( newDefer ) {
  11176. // progress_handlers.add( ... )
  11177. tuples[ 0 ][ 3 ].add(
  11178. resolve(
  11179. 0,
  11180. newDefer,
  11181. isFunction( onProgress ) ?
  11182. onProgress :
  11183. Identity,
  11184. newDefer.notifyWith
  11185. )
  11186. );
  11187. // fulfilled_handlers.add( ... )
  11188. tuples[ 1 ][ 3 ].add(
  11189. resolve(
  11190. 0,
  11191. newDefer,
  11192. isFunction( onFulfilled ) ?
  11193. onFulfilled :
  11194. Identity
  11195. )
  11196. );
  11197. // rejected_handlers.add( ... )
  11198. tuples[ 2 ][ 3 ].add(
  11199. resolve(
  11200. 0,
  11201. newDefer,
  11202. isFunction( onRejected ) ?
  11203. onRejected :
  11204. Thrower
  11205. )
  11206. );
  11207. } ).promise();
  11208. },
  11209. // Get a promise for this deferred
  11210. // If obj is provided, the promise aspect is added to the object
  11211. promise: function( obj ) {
  11212. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11213. }
  11214. },
  11215. deferred = {};
  11216. // Add list-specific methods
  11217. jQuery.each( tuples, function( i, tuple ) {
  11218. var list = tuple[ 2 ],
  11219. stateString = tuple[ 5 ];
  11220. // promise.progress = list.add
  11221. // promise.done = list.add
  11222. // promise.fail = list.add
  11223. promise[ tuple[ 1 ] ] = list.add;
  11224. // Handle state
  11225. if ( stateString ) {
  11226. list.add(
  11227. function() {
  11228. // state = "resolved" (i.e., fulfilled)
  11229. // state = "rejected"
  11230. state = stateString;
  11231. },
  11232. // rejected_callbacks.disable
  11233. // fulfilled_callbacks.disable
  11234. tuples[ 3 - i ][ 2 ].disable,
  11235. // rejected_handlers.disable
  11236. // fulfilled_handlers.disable
  11237. tuples[ 3 - i ][ 3 ].disable,
  11238. // progress_callbacks.lock
  11239. tuples[ 0 ][ 2 ].lock,
  11240. // progress_handlers.lock
  11241. tuples[ 0 ][ 3 ].lock
  11242. );
  11243. }
  11244. // progress_handlers.fire
  11245. // fulfilled_handlers.fire
  11246. // rejected_handlers.fire
  11247. list.add( tuple[ 3 ].fire );
  11248. // deferred.notify = function() { deferred.notifyWith(...) }
  11249. // deferred.resolve = function() { deferred.resolveWith(...) }
  11250. // deferred.reject = function() { deferred.rejectWith(...) }
  11251. deferred[ tuple[ 0 ] ] = function() {
  11252. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11253. return this;
  11254. };
  11255. // deferred.notifyWith = list.fireWith
  11256. // deferred.resolveWith = list.fireWith
  11257. // deferred.rejectWith = list.fireWith
  11258. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11259. } );
  11260. // Make the deferred a promise
  11261. promise.promise( deferred );
  11262. // Call given func if any
  11263. if ( func ) {
  11264. func.call( deferred, deferred );
  11265. }
  11266. // All done!
  11267. return deferred;
  11268. },
  11269. // Deferred helper
  11270. when: function( singleValue ) {
  11271. var
  11272. // count of uncompleted subordinates
  11273. remaining = arguments.length,
  11274. // count of unprocessed arguments
  11275. i = remaining,
  11276. // subordinate fulfillment data
  11277. resolveContexts = Array( i ),
  11278. resolveValues = slice.call( arguments ),
  11279. // the master Deferred
  11280. master = jQuery.Deferred(),
  11281. // subordinate callback factory
  11282. updateFunc = function( i ) {
  11283. return function( value ) {
  11284. resolveContexts[ i ] = this;
  11285. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11286. if ( !( --remaining ) ) {
  11287. master.resolveWith( resolveContexts, resolveValues );
  11288. }
  11289. };
  11290. };
  11291. // Single- and empty arguments are adopted like Promise.resolve
  11292. if ( remaining <= 1 ) {
  11293. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11294. !remaining );
  11295. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11296. if ( master.state() === "pending" ||
  11297. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11298. return master.then();
  11299. }
  11300. }
  11301. // Multiple arguments are aggregated like Promise.all array elements
  11302. while ( i-- ) {
  11303. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11304. }
  11305. return master.promise();
  11306. }
  11307. } );
  11308. // These usually indicate a programmer mistake during development,
  11309. // warn about them ASAP rather than swallowing them by default.
  11310. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11311. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11312. // Support: IE 8 - 9 only
  11313. // Console exists when dev tools are open, which can happen at any time
  11314. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11315. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11316. }
  11317. };
  11318. jQuery.readyException = function( error ) {
  11319. window.setTimeout( function() {
  11320. throw error;
  11321. } );
  11322. };
  11323. // The deferred used on DOM ready
  11324. var readyList = jQuery.Deferred();
  11325. jQuery.fn.ready = function( fn ) {
  11326. readyList
  11327. .then( fn )
  11328. // Wrap jQuery.readyException in a function so that the lookup
  11329. // happens at the time of error handling instead of callback
  11330. // registration.
  11331. .catch( function( error ) {
  11332. jQuery.readyException( error );
  11333. } );
  11334. return this;
  11335. };
  11336. jQuery.extend( {
  11337. // Is the DOM ready to be used? Set to true once it occurs.
  11338. isReady: false,
  11339. // A counter to track how many items to wait for before
  11340. // the ready event fires. See #6781
  11341. readyWait: 1,
  11342. // Handle when the DOM is ready
  11343. ready: function( wait ) {
  11344. // Abort if there are pending holds or we're already ready
  11345. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11346. return;
  11347. }
  11348. // Remember that the DOM is ready
  11349. jQuery.isReady = true;
  11350. // If a normal DOM Ready event fired, decrement, and wait if need be
  11351. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11352. return;
  11353. }
  11354. // If there are functions bound, to execute
  11355. readyList.resolveWith( document, [ jQuery ] );
  11356. }
  11357. } );
  11358. jQuery.ready.then = readyList.then;
  11359. // The ready event handler and self cleanup method
  11360. function completed() {
  11361. document.removeEventListener( "DOMContentLoaded", completed );
  11362. window.removeEventListener( "load", completed );
  11363. jQuery.ready();
  11364. }
  11365. // Catch cases where $(document).ready() is called
  11366. // after the browser event has already occurred.
  11367. // Support: IE <=9 - 10 only
  11368. // Older IE sometimes signals "interactive" too soon
  11369. if ( document.readyState === "complete" ||
  11370. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11371. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11372. window.setTimeout( jQuery.ready );
  11373. } else {
  11374. // Use the handy event callback
  11375. document.addEventListener( "DOMContentLoaded", completed );
  11376. // A fallback to window.onload, that will always work
  11377. window.addEventListener( "load", completed );
  11378. }
  11379. // Multifunctional method to get and set values of a collection
  11380. // The value/s can optionally be executed if it's a function
  11381. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11382. var i = 0,
  11383. len = elems.length,
  11384. bulk = key == null;
  11385. // Sets many values
  11386. if ( toType( key ) === "object" ) {
  11387. chainable = true;
  11388. for ( i in key ) {
  11389. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11390. }
  11391. // Sets one value
  11392. } else if ( value !== undefined ) {
  11393. chainable = true;
  11394. if ( !isFunction( value ) ) {
  11395. raw = true;
  11396. }
  11397. if ( bulk ) {
  11398. // Bulk operations run against the entire set
  11399. if ( raw ) {
  11400. fn.call( elems, value );
  11401. fn = null;
  11402. // ...except when executing function values
  11403. } else {
  11404. bulk = fn;
  11405. fn = function( elem, key, value ) {
  11406. return bulk.call( jQuery( elem ), value );
  11407. };
  11408. }
  11409. }
  11410. if ( fn ) {
  11411. for ( ; i < len; i++ ) {
  11412. fn(
  11413. elems[ i ], key, raw ?
  11414. value :
  11415. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11416. );
  11417. }
  11418. }
  11419. }
  11420. if ( chainable ) {
  11421. return elems;
  11422. }
  11423. // Gets
  11424. if ( bulk ) {
  11425. return fn.call( elems );
  11426. }
  11427. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11428. };
  11429. // Matches dashed string for camelizing
  11430. var rmsPrefix = /^-ms-/,
  11431. rdashAlpha = /-([a-z])/g;
  11432. // Used by camelCase as callback to replace()
  11433. function fcamelCase( all, letter ) {
  11434. return letter.toUpperCase();
  11435. }
  11436. // Convert dashed to camelCase; used by the css and data modules
  11437. // Support: IE <=9 - 11, Edge 12 - 15
  11438. // Microsoft forgot to hump their vendor prefix (#9572)
  11439. function camelCase( string ) {
  11440. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11441. }
  11442. var acceptData = function( owner ) {
  11443. // Accepts only:
  11444. // - Node
  11445. // - Node.ELEMENT_NODE
  11446. // - Node.DOCUMENT_NODE
  11447. // - Object
  11448. // - Any
  11449. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11450. };
  11451. function Data() {
  11452. this.expando = jQuery.expando + Data.uid++;
  11453. }
  11454. Data.uid = 1;
  11455. Data.prototype = {
  11456. cache: function( owner ) {
  11457. // Check if the owner object already has a cache
  11458. var value = owner[ this.expando ];
  11459. // If not, create one
  11460. if ( !value ) {
  11461. value = {};
  11462. // We can accept data for non-element nodes in modern browsers,
  11463. // but we should not, see #8335.
  11464. // Always return an empty object.
  11465. if ( acceptData( owner ) ) {
  11466. // If it is a node unlikely to be stringify-ed or looped over
  11467. // use plain assignment
  11468. if ( owner.nodeType ) {
  11469. owner[ this.expando ] = value;
  11470. // Otherwise secure it in a non-enumerable property
  11471. // configurable must be true to allow the property to be
  11472. // deleted when data is removed
  11473. } else {
  11474. Object.defineProperty( owner, this.expando, {
  11475. value: value,
  11476. configurable: true
  11477. } );
  11478. }
  11479. }
  11480. }
  11481. return value;
  11482. },
  11483. set: function( owner, data, value ) {
  11484. var prop,
  11485. cache = this.cache( owner );
  11486. // Handle: [ owner, key, value ] args
  11487. // Always use camelCase key (gh-2257)
  11488. if ( typeof data === "string" ) {
  11489. cache[ camelCase( data ) ] = value;
  11490. // Handle: [ owner, { properties } ] args
  11491. } else {
  11492. // Copy the properties one-by-one to the cache object
  11493. for ( prop in data ) {
  11494. cache[ camelCase( prop ) ] = data[ prop ];
  11495. }
  11496. }
  11497. return cache;
  11498. },
  11499. get: function( owner, key ) {
  11500. return key === undefined ?
  11501. this.cache( owner ) :
  11502. // Always use camelCase key (gh-2257)
  11503. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11504. },
  11505. access: function( owner, key, value ) {
  11506. // In cases where either:
  11507. //
  11508. // 1. No key was specified
  11509. // 2. A string key was specified, but no value provided
  11510. //
  11511. // Take the "read" path and allow the get method to determine
  11512. // which value to return, respectively either:
  11513. //
  11514. // 1. The entire cache object
  11515. // 2. The data stored at the key
  11516. //
  11517. if ( key === undefined ||
  11518. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11519. return this.get( owner, key );
  11520. }
  11521. // When the key is not a string, or both a key and value
  11522. // are specified, set or extend (existing objects) with either:
  11523. //
  11524. // 1. An object of properties
  11525. // 2. A key and value
  11526. //
  11527. this.set( owner, key, value );
  11528. // Since the "set" path can have two possible entry points
  11529. // return the expected data based on which path was taken[*]
  11530. return value !== undefined ? value : key;
  11531. },
  11532. remove: function( owner, key ) {
  11533. var i,
  11534. cache = owner[ this.expando ];
  11535. if ( cache === undefined ) {
  11536. return;
  11537. }
  11538. if ( key !== undefined ) {
  11539. // Support array or space separated string of keys
  11540. if ( Array.isArray( key ) ) {
  11541. // If key is an array of keys...
  11542. // We always set camelCase keys, so remove that.
  11543. key = key.map( camelCase );
  11544. } else {
  11545. key = camelCase( key );
  11546. // If a key with the spaces exists, use it.
  11547. // Otherwise, create an array by matching non-whitespace
  11548. key = key in cache ?
  11549. [ key ] :
  11550. ( key.match( rnothtmlwhite ) || [] );
  11551. }
  11552. i = key.length;
  11553. while ( i-- ) {
  11554. delete cache[ key[ i ] ];
  11555. }
  11556. }
  11557. // Remove the expando if there's no more data
  11558. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11559. // Support: Chrome <=35 - 45
  11560. // Webkit & Blink performance suffers when deleting properties
  11561. // from DOM nodes, so set to undefined instead
  11562. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11563. if ( owner.nodeType ) {
  11564. owner[ this.expando ] = undefined;
  11565. } else {
  11566. delete owner[ this.expando ];
  11567. }
  11568. }
  11569. },
  11570. hasData: function( owner ) {
  11571. var cache = owner[ this.expando ];
  11572. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11573. }
  11574. };
  11575. var dataPriv = new Data();
  11576. var dataUser = new Data();
  11577. // Implementation Summary
  11578. //
  11579. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11580. // 2. Improve the module's maintainability by reducing the storage
  11581. // paths to a single mechanism.
  11582. // 3. Use the same single mechanism to support "private" and "user" data.
  11583. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11584. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11585. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11586. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11587. rmultiDash = /[A-Z]/g;
  11588. function getData( data ) {
  11589. if ( data === "true" ) {
  11590. return true;
  11591. }
  11592. if ( data === "false" ) {
  11593. return false;
  11594. }
  11595. if ( data === "null" ) {
  11596. return null;
  11597. }
  11598. // Only convert to a number if it doesn't change the string
  11599. if ( data === +data + "" ) {
  11600. return +data;
  11601. }
  11602. if ( rbrace.test( data ) ) {
  11603. return JSON.parse( data );
  11604. }
  11605. return data;
  11606. }
  11607. function dataAttr( elem, key, data ) {
  11608. var name;
  11609. // If nothing was found internally, try to fetch any
  11610. // data from the HTML5 data-* attribute
  11611. if ( data === undefined && elem.nodeType === 1 ) {
  11612. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11613. data = elem.getAttribute( name );
  11614. if ( typeof data === "string" ) {
  11615. try {
  11616. data = getData( data );
  11617. } catch ( e ) {}
  11618. // Make sure we set the data so it isn't changed later
  11619. dataUser.set( elem, key, data );
  11620. } else {
  11621. data = undefined;
  11622. }
  11623. }
  11624. return data;
  11625. }
  11626. jQuery.extend( {
  11627. hasData: function( elem ) {
  11628. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11629. },
  11630. data: function( elem, name, data ) {
  11631. return dataUser.access( elem, name, data );
  11632. },
  11633. removeData: function( elem, name ) {
  11634. dataUser.remove( elem, name );
  11635. },
  11636. // TODO: Now that all calls to _data and _removeData have been replaced
  11637. // with direct calls to dataPriv methods, these can be deprecated.
  11638. _data: function( elem, name, data ) {
  11639. return dataPriv.access( elem, name, data );
  11640. },
  11641. _removeData: function( elem, name ) {
  11642. dataPriv.remove( elem, name );
  11643. }
  11644. } );
  11645. jQuery.fn.extend( {
  11646. data: function( key, value ) {
  11647. var i, name, data,
  11648. elem = this[ 0 ],
  11649. attrs = elem && elem.attributes;
  11650. // Gets all values
  11651. if ( key === undefined ) {
  11652. if ( this.length ) {
  11653. data = dataUser.get( elem );
  11654. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11655. i = attrs.length;
  11656. while ( i-- ) {
  11657. // Support: IE 11 only
  11658. // The attrs elements can be null (#14894)
  11659. if ( attrs[ i ] ) {
  11660. name = attrs[ i ].name;
  11661. if ( name.indexOf( "data-" ) === 0 ) {
  11662. name = camelCase( name.slice( 5 ) );
  11663. dataAttr( elem, name, data[ name ] );
  11664. }
  11665. }
  11666. }
  11667. dataPriv.set( elem, "hasDataAttrs", true );
  11668. }
  11669. }
  11670. return data;
  11671. }
  11672. // Sets multiple values
  11673. if ( typeof key === "object" ) {
  11674. return this.each( function() {
  11675. dataUser.set( this, key );
  11676. } );
  11677. }
  11678. return access( this, function( value ) {
  11679. var data;
  11680. // The calling jQuery object (element matches) is not empty
  11681. // (and therefore has an element appears at this[ 0 ]) and the
  11682. // `value` parameter was not undefined. An empty jQuery object
  11683. // will result in `undefined` for elem = this[ 0 ] which will
  11684. // throw an exception if an attempt to read a data cache is made.
  11685. if ( elem && value === undefined ) {
  11686. // Attempt to get data from the cache
  11687. // The key will always be camelCased in Data
  11688. data = dataUser.get( elem, key );
  11689. if ( data !== undefined ) {
  11690. return data;
  11691. }
  11692. // Attempt to "discover" the data in
  11693. // HTML5 custom data-* attrs
  11694. data = dataAttr( elem, key );
  11695. if ( data !== undefined ) {
  11696. return data;
  11697. }
  11698. // We tried really hard, but the data doesn't exist.
  11699. return;
  11700. }
  11701. // Set the data...
  11702. this.each( function() {
  11703. // We always store the camelCased key
  11704. dataUser.set( this, key, value );
  11705. } );
  11706. }, null, value, arguments.length > 1, null, true );
  11707. },
  11708. removeData: function( key ) {
  11709. return this.each( function() {
  11710. dataUser.remove( this, key );
  11711. } );
  11712. }
  11713. } );
  11714. jQuery.extend( {
  11715. queue: function( elem, type, data ) {
  11716. var queue;
  11717. if ( elem ) {
  11718. type = ( type || "fx" ) + "queue";
  11719. queue = dataPriv.get( elem, type );
  11720. // Speed up dequeue by getting out quickly if this is just a lookup
  11721. if ( data ) {
  11722. if ( !queue || Array.isArray( data ) ) {
  11723. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11724. } else {
  11725. queue.push( data );
  11726. }
  11727. }
  11728. return queue || [];
  11729. }
  11730. },
  11731. dequeue: function( elem, type ) {
  11732. type = type || "fx";
  11733. var queue = jQuery.queue( elem, type ),
  11734. startLength = queue.length,
  11735. fn = queue.shift(),
  11736. hooks = jQuery._queueHooks( elem, type ),
  11737. next = function() {
  11738. jQuery.dequeue( elem, type );
  11739. };
  11740. // If the fx queue is dequeued, always remove the progress sentinel
  11741. if ( fn === "inprogress" ) {
  11742. fn = queue.shift();
  11743. startLength--;
  11744. }
  11745. if ( fn ) {
  11746. // Add a progress sentinel to prevent the fx queue from being
  11747. // automatically dequeued
  11748. if ( type === "fx" ) {
  11749. queue.unshift( "inprogress" );
  11750. }
  11751. // Clear up the last queue stop function
  11752. delete hooks.stop;
  11753. fn.call( elem, next, hooks );
  11754. }
  11755. if ( !startLength && hooks ) {
  11756. hooks.empty.fire();
  11757. }
  11758. },
  11759. // Not public - generate a queueHooks object, or return the current one
  11760. _queueHooks: function( elem, type ) {
  11761. var key = type + "queueHooks";
  11762. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11763. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11764. dataPriv.remove( elem, [ type + "queue", key ] );
  11765. } )
  11766. } );
  11767. }
  11768. } );
  11769. jQuery.fn.extend( {
  11770. queue: function( type, data ) {
  11771. var setter = 2;
  11772. if ( typeof type !== "string" ) {
  11773. data = type;
  11774. type = "fx";
  11775. setter--;
  11776. }
  11777. if ( arguments.length < setter ) {
  11778. return jQuery.queue( this[ 0 ], type );
  11779. }
  11780. return data === undefined ?
  11781. this :
  11782. this.each( function() {
  11783. var queue = jQuery.queue( this, type, data );
  11784. // Ensure a hooks for this queue
  11785. jQuery._queueHooks( this, type );
  11786. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11787. jQuery.dequeue( this, type );
  11788. }
  11789. } );
  11790. },
  11791. dequeue: function( type ) {
  11792. return this.each( function() {
  11793. jQuery.dequeue( this, type );
  11794. } );
  11795. },
  11796. clearQueue: function( type ) {
  11797. return this.queue( type || "fx", [] );
  11798. },
  11799. // Get a promise resolved when queues of a certain type
  11800. // are emptied (fx is the type by default)
  11801. promise: function( type, obj ) {
  11802. var tmp,
  11803. count = 1,
  11804. defer = jQuery.Deferred(),
  11805. elements = this,
  11806. i = this.length,
  11807. resolve = function() {
  11808. if ( !( --count ) ) {
  11809. defer.resolveWith( elements, [ elements ] );
  11810. }
  11811. };
  11812. if ( typeof type !== "string" ) {
  11813. obj = type;
  11814. type = undefined;
  11815. }
  11816. type = type || "fx";
  11817. while ( i-- ) {
  11818. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11819. if ( tmp && tmp.empty ) {
  11820. count++;
  11821. tmp.empty.add( resolve );
  11822. }
  11823. }
  11824. resolve();
  11825. return defer.promise( obj );
  11826. }
  11827. } );
  11828. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11829. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11830. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11831. var documentElement = document.documentElement;
  11832. var isAttached = function( elem ) {
  11833. return jQuery.contains( elem.ownerDocument, elem );
  11834. },
  11835. composed = { composed: true };
  11836. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11837. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11838. // Support: iOS 10.0-10.2 only
  11839. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11840. // leading to errors. We need to check for `getRootNode`.
  11841. if ( documentElement.getRootNode ) {
  11842. isAttached = function( elem ) {
  11843. return jQuery.contains( elem.ownerDocument, elem ) ||
  11844. elem.getRootNode( composed ) === elem.ownerDocument;
  11845. };
  11846. }
  11847. var isHiddenWithinTree = function( elem, el ) {
  11848. // isHiddenWithinTree might be called from jQuery#filter function;
  11849. // in that case, element will be second argument
  11850. elem = el || elem;
  11851. // Inline style trumps all
  11852. return elem.style.display === "none" ||
  11853. elem.style.display === "" &&
  11854. // Otherwise, check computed style
  11855. // Support: Firefox <=43 - 45
  11856. // Disconnected elements can have computed display: none, so first confirm that elem is
  11857. // in the document.
  11858. isAttached( elem ) &&
  11859. jQuery.css( elem, "display" ) === "none";
  11860. };
  11861. var swap = function( elem, options, callback, args ) {
  11862. var ret, name,
  11863. old = {};
  11864. // Remember the old values, and insert the new ones
  11865. for ( name in options ) {
  11866. old[ name ] = elem.style[ name ];
  11867. elem.style[ name ] = options[ name ];
  11868. }
  11869. ret = callback.apply( elem, args || [] );
  11870. // Revert the old values
  11871. for ( name in options ) {
  11872. elem.style[ name ] = old[ name ];
  11873. }
  11874. return ret;
  11875. };
  11876. function adjustCSS( elem, prop, valueParts, tween ) {
  11877. var adjusted, scale,
  11878. maxIterations = 20,
  11879. currentValue = tween ?
  11880. function() {
  11881. return tween.cur();
  11882. } :
  11883. function() {
  11884. return jQuery.css( elem, prop, "" );
  11885. },
  11886. initial = currentValue(),
  11887. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11888. // Starting value computation is required for potential unit mismatches
  11889. initialInUnit = elem.nodeType &&
  11890. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11891. rcssNum.exec( jQuery.css( elem, prop ) );
  11892. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11893. // Support: Firefox <=54
  11894. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11895. initial = initial / 2;
  11896. // Trust units reported by jQuery.css
  11897. unit = unit || initialInUnit[ 3 ];
  11898. // Iteratively approximate from a nonzero starting point
  11899. initialInUnit = +initial || 1;
  11900. while ( maxIterations-- ) {
  11901. // Evaluate and update our best guess (doubling guesses that zero out).
  11902. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11903. jQuery.style( elem, prop, initialInUnit + unit );
  11904. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11905. maxIterations = 0;
  11906. }
  11907. initialInUnit = initialInUnit / scale;
  11908. }
  11909. initialInUnit = initialInUnit * 2;
  11910. jQuery.style( elem, prop, initialInUnit + unit );
  11911. // Make sure we update the tween properties later on
  11912. valueParts = valueParts || [];
  11913. }
  11914. if ( valueParts ) {
  11915. initialInUnit = +initialInUnit || +initial || 0;
  11916. // Apply relative offset (+=/-=) if specified
  11917. adjusted = valueParts[ 1 ] ?
  11918. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11919. +valueParts[ 2 ];
  11920. if ( tween ) {
  11921. tween.unit = unit;
  11922. tween.start = initialInUnit;
  11923. tween.end = adjusted;
  11924. }
  11925. }
  11926. return adjusted;
  11927. }
  11928. var defaultDisplayMap = {};
  11929. function getDefaultDisplay( elem ) {
  11930. var temp,
  11931. doc = elem.ownerDocument,
  11932. nodeName = elem.nodeName,
  11933. display = defaultDisplayMap[ nodeName ];
  11934. if ( display ) {
  11935. return display;
  11936. }
  11937. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11938. display = jQuery.css( temp, "display" );
  11939. temp.parentNode.removeChild( temp );
  11940. if ( display === "none" ) {
  11941. display = "block";
  11942. }
  11943. defaultDisplayMap[ nodeName ] = display;
  11944. return display;
  11945. }
  11946. function showHide( elements, show ) {
  11947. var display, elem,
  11948. values = [],
  11949. index = 0,
  11950. length = elements.length;
  11951. // Determine new display value for elements that need to change
  11952. for ( ; index < length; index++ ) {
  11953. elem = elements[ index ];
  11954. if ( !elem.style ) {
  11955. continue;
  11956. }
  11957. display = elem.style.display;
  11958. if ( show ) {
  11959. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11960. // check is required in this first loop unless we have a nonempty display value (either
  11961. // inline or about-to-be-restored)
  11962. if ( display === "none" ) {
  11963. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11964. if ( !values[ index ] ) {
  11965. elem.style.display = "";
  11966. }
  11967. }
  11968. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  11969. values[ index ] = getDefaultDisplay( elem );
  11970. }
  11971. } else {
  11972. if ( display !== "none" ) {
  11973. values[ index ] = "none";
  11974. // Remember what we're overwriting
  11975. dataPriv.set( elem, "display", display );
  11976. }
  11977. }
  11978. }
  11979. // Set the display of the elements in a second loop to avoid constant reflow
  11980. for ( index = 0; index < length; index++ ) {
  11981. if ( values[ index ] != null ) {
  11982. elements[ index ].style.display = values[ index ];
  11983. }
  11984. }
  11985. return elements;
  11986. }
  11987. jQuery.fn.extend( {
  11988. show: function() {
  11989. return showHide( this, true );
  11990. },
  11991. hide: function() {
  11992. return showHide( this );
  11993. },
  11994. toggle: function( state ) {
  11995. if ( typeof state === "boolean" ) {
  11996. return state ? this.show() : this.hide();
  11997. }
  11998. return this.each( function() {
  11999. if ( isHiddenWithinTree( this ) ) {
  12000. jQuery( this ).show();
  12001. } else {
  12002. jQuery( this ).hide();
  12003. }
  12004. } );
  12005. }
  12006. } );
  12007. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12008. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12009. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12010. // We have to close these tags to support XHTML (#13200)
  12011. var wrapMap = {
  12012. // Support: IE <=9 only
  12013. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12014. // XHTML parsers do not magically insert elements in the
  12015. // same way that tag soup parsers do. So we cannot shorten
  12016. // this by omitting <tbody> or other required elements.
  12017. thead: [ 1, "<table>", "</table>" ],
  12018. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12019. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12020. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12021. _default: [ 0, "", "" ]
  12022. };
  12023. // Support: IE <=9 only
  12024. wrapMap.optgroup = wrapMap.option;
  12025. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12026. wrapMap.th = wrapMap.td;
  12027. function getAll( context, tag ) {
  12028. // Support: IE <=9 - 11 only
  12029. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12030. var ret;
  12031. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12032. ret = context.getElementsByTagName( tag || "*" );
  12033. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12034. ret = context.querySelectorAll( tag || "*" );
  12035. } else {
  12036. ret = [];
  12037. }
  12038. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12039. return jQuery.merge( [ context ], ret );
  12040. }
  12041. return ret;
  12042. }
  12043. // Mark scripts as having already been evaluated
  12044. function setGlobalEval( elems, refElements ) {
  12045. var i = 0,
  12046. l = elems.length;
  12047. for ( ; i < l; i++ ) {
  12048. dataPriv.set(
  12049. elems[ i ],
  12050. "globalEval",
  12051. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12052. );
  12053. }
  12054. }
  12055. var rhtml = /<|&#?\w+;/;
  12056. function buildFragment( elems, context, scripts, selection, ignored ) {
  12057. var elem, tmp, tag, wrap, attached, j,
  12058. fragment = context.createDocumentFragment(),
  12059. nodes = [],
  12060. i = 0,
  12061. l = elems.length;
  12062. for ( ; i < l; i++ ) {
  12063. elem = elems[ i ];
  12064. if ( elem || elem === 0 ) {
  12065. // Add nodes directly
  12066. if ( toType( elem ) === "object" ) {
  12067. // Support: Android <=4.0 only, PhantomJS 1 only
  12068. // push.apply(_, arraylike) throws on ancient WebKit
  12069. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12070. // Convert non-html into a text node
  12071. } else if ( !rhtml.test( elem ) ) {
  12072. nodes.push( context.createTextNode( elem ) );
  12073. // Convert html into DOM nodes
  12074. } else {
  12075. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12076. // Deserialize a standard representation
  12077. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12078. wrap = wrapMap[ tag ] || wrapMap._default;
  12079. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12080. // Descend through wrappers to the right content
  12081. j = wrap[ 0 ];
  12082. while ( j-- ) {
  12083. tmp = tmp.lastChild;
  12084. }
  12085. // Support: Android <=4.0 only, PhantomJS 1 only
  12086. // push.apply(_, arraylike) throws on ancient WebKit
  12087. jQuery.merge( nodes, tmp.childNodes );
  12088. // Remember the top-level container
  12089. tmp = fragment.firstChild;
  12090. // Ensure the created nodes are orphaned (#12392)
  12091. tmp.textContent = "";
  12092. }
  12093. }
  12094. }
  12095. // Remove wrapper from fragment
  12096. fragment.textContent = "";
  12097. i = 0;
  12098. while ( ( elem = nodes[ i++ ] ) ) {
  12099. // Skip elements already in the context collection (trac-4087)
  12100. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12101. if ( ignored ) {
  12102. ignored.push( elem );
  12103. }
  12104. continue;
  12105. }
  12106. attached = isAttached( elem );
  12107. // Append to fragment
  12108. tmp = getAll( fragment.appendChild( elem ), "script" );
  12109. // Preserve script evaluation history
  12110. if ( attached ) {
  12111. setGlobalEval( tmp );
  12112. }
  12113. // Capture executables
  12114. if ( scripts ) {
  12115. j = 0;
  12116. while ( ( elem = tmp[ j++ ] ) ) {
  12117. if ( rscriptType.test( elem.type || "" ) ) {
  12118. scripts.push( elem );
  12119. }
  12120. }
  12121. }
  12122. }
  12123. return fragment;
  12124. }
  12125. ( function() {
  12126. var fragment = document.createDocumentFragment(),
  12127. div = fragment.appendChild( document.createElement( "div" ) ),
  12128. input = document.createElement( "input" );
  12129. // Support: Android 4.0 - 4.3 only
  12130. // Check state lost if the name is set (#11217)
  12131. // Support: Windows Web Apps (WWA)
  12132. // `name` and `type` must use .setAttribute for WWA (#14901)
  12133. input.setAttribute( "type", "radio" );
  12134. input.setAttribute( "checked", "checked" );
  12135. input.setAttribute( "name", "t" );
  12136. div.appendChild( input );
  12137. // Support: Android <=4.1 only
  12138. // Older WebKit doesn't clone checked state correctly in fragments
  12139. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12140. // Support: IE <=11 only
  12141. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12142. div.innerHTML = "<textarea>x</textarea>";
  12143. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12144. } )();
  12145. var
  12146. rkeyEvent = /^key/,
  12147. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12148. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12149. function returnTrue() {
  12150. return true;
  12151. }
  12152. function returnFalse() {
  12153. return false;
  12154. }
  12155. // Support: IE <=9 - 11+
  12156. // focus() and blur() are asynchronous, except when they are no-op.
  12157. // So expect focus to be synchronous when the element is already active,
  12158. // and blur to be synchronous when the element is not already active.
  12159. // (focus and blur are always synchronous in other supported browsers,
  12160. // this just defines when we can count on it).
  12161. function expectSync( elem, type ) {
  12162. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12163. }
  12164. // Support: IE <=9 only
  12165. // Accessing document.activeElement can throw unexpectedly
  12166. // https://bugs.jquery.com/ticket/13393
  12167. function safeActiveElement() {
  12168. try {
  12169. return document.activeElement;
  12170. } catch ( err ) { }
  12171. }
  12172. function on( elem, types, selector, data, fn, one ) {
  12173. var origFn, type;
  12174. // Types can be a map of types/handlers
  12175. if ( typeof types === "object" ) {
  12176. // ( types-Object, selector, data )
  12177. if ( typeof selector !== "string" ) {
  12178. // ( types-Object, data )
  12179. data = data || selector;
  12180. selector = undefined;
  12181. }
  12182. for ( type in types ) {
  12183. on( elem, type, selector, data, types[ type ], one );
  12184. }
  12185. return elem;
  12186. }
  12187. if ( data == null && fn == null ) {
  12188. // ( types, fn )
  12189. fn = selector;
  12190. data = selector = undefined;
  12191. } else if ( fn == null ) {
  12192. if ( typeof selector === "string" ) {
  12193. // ( types, selector, fn )
  12194. fn = data;
  12195. data = undefined;
  12196. } else {
  12197. // ( types, data, fn )
  12198. fn = data;
  12199. data = selector;
  12200. selector = undefined;
  12201. }
  12202. }
  12203. if ( fn === false ) {
  12204. fn = returnFalse;
  12205. } else if ( !fn ) {
  12206. return elem;
  12207. }
  12208. if ( one === 1 ) {
  12209. origFn = fn;
  12210. fn = function( event ) {
  12211. // Can use an empty set, since event contains the info
  12212. jQuery().off( event );
  12213. return origFn.apply( this, arguments );
  12214. };
  12215. // Use same guid so caller can remove using origFn
  12216. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12217. }
  12218. return elem.each( function() {
  12219. jQuery.event.add( this, types, fn, data, selector );
  12220. } );
  12221. }
  12222. /*
  12223. * Helper functions for managing events -- not part of the public interface.
  12224. * Props to Dean Edwards' addEvent library for many of the ideas.
  12225. */
  12226. jQuery.event = {
  12227. global: {},
  12228. add: function( elem, types, handler, data, selector ) {
  12229. var handleObjIn, eventHandle, tmp,
  12230. events, t, handleObj,
  12231. special, handlers, type, namespaces, origType,
  12232. elemData = dataPriv.get( elem );
  12233. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12234. if ( !elemData ) {
  12235. return;
  12236. }
  12237. // Caller can pass in an object of custom data in lieu of the handler
  12238. if ( handler.handler ) {
  12239. handleObjIn = handler;
  12240. handler = handleObjIn.handler;
  12241. selector = handleObjIn.selector;
  12242. }
  12243. // Ensure that invalid selectors throw exceptions at attach time
  12244. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12245. if ( selector ) {
  12246. jQuery.find.matchesSelector( documentElement, selector );
  12247. }
  12248. // Make sure that the handler has a unique ID, used to find/remove it later
  12249. if ( !handler.guid ) {
  12250. handler.guid = jQuery.guid++;
  12251. }
  12252. // Init the element's event structure and main handler, if this is the first
  12253. if ( !( events = elemData.events ) ) {
  12254. events = elemData.events = {};
  12255. }
  12256. if ( !( eventHandle = elemData.handle ) ) {
  12257. eventHandle = elemData.handle = function( e ) {
  12258. // Discard the second event of a jQuery.event.trigger() and
  12259. // when an event is called after a page has unloaded
  12260. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12261. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12262. };
  12263. }
  12264. // Handle multiple events separated by a space
  12265. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12266. t = types.length;
  12267. while ( t-- ) {
  12268. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12269. type = origType = tmp[ 1 ];
  12270. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12271. // There *must* be a type, no attaching namespace-only handlers
  12272. if ( !type ) {
  12273. continue;
  12274. }
  12275. // If event changes its type, use the special event handlers for the changed type
  12276. special = jQuery.event.special[ type ] || {};
  12277. // If selector defined, determine special event api type, otherwise given type
  12278. type = ( selector ? special.delegateType : special.bindType ) || type;
  12279. // Update special based on newly reset type
  12280. special = jQuery.event.special[ type ] || {};
  12281. // handleObj is passed to all event handlers
  12282. handleObj = jQuery.extend( {
  12283. type: type,
  12284. origType: origType,
  12285. data: data,
  12286. handler: handler,
  12287. guid: handler.guid,
  12288. selector: selector,
  12289. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12290. namespace: namespaces.join( "." )
  12291. }, handleObjIn );
  12292. // Init the event handler queue if we're the first
  12293. if ( !( handlers = events[ type ] ) ) {
  12294. handlers = events[ type ] = [];
  12295. handlers.delegateCount = 0;
  12296. // Only use addEventListener if the special events handler returns false
  12297. if ( !special.setup ||
  12298. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12299. if ( elem.addEventListener ) {
  12300. elem.addEventListener( type, eventHandle );
  12301. }
  12302. }
  12303. }
  12304. if ( special.add ) {
  12305. special.add.call( elem, handleObj );
  12306. if ( !handleObj.handler.guid ) {
  12307. handleObj.handler.guid = handler.guid;
  12308. }
  12309. }
  12310. // Add to the element's handler list, delegates in front
  12311. if ( selector ) {
  12312. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12313. } else {
  12314. handlers.push( handleObj );
  12315. }
  12316. // Keep track of which events have ever been used, for event optimization
  12317. jQuery.event.global[ type ] = true;
  12318. }
  12319. },
  12320. // Detach an event or set of events from an element
  12321. remove: function( elem, types, handler, selector, mappedTypes ) {
  12322. var j, origCount, tmp,
  12323. events, t, handleObj,
  12324. special, handlers, type, namespaces, origType,
  12325. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12326. if ( !elemData || !( events = elemData.events ) ) {
  12327. return;
  12328. }
  12329. // Once for each type.namespace in types; type may be omitted
  12330. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12331. t = types.length;
  12332. while ( t-- ) {
  12333. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12334. type = origType = tmp[ 1 ];
  12335. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12336. // Unbind all events (on this namespace, if provided) for the element
  12337. if ( !type ) {
  12338. for ( type in events ) {
  12339. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12340. }
  12341. continue;
  12342. }
  12343. special = jQuery.event.special[ type ] || {};
  12344. type = ( selector ? special.delegateType : special.bindType ) || type;
  12345. handlers = events[ type ] || [];
  12346. tmp = tmp[ 2 ] &&
  12347. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12348. // Remove matching events
  12349. origCount = j = handlers.length;
  12350. while ( j-- ) {
  12351. handleObj = handlers[ j ];
  12352. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12353. ( !handler || handler.guid === handleObj.guid ) &&
  12354. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12355. ( !selector || selector === handleObj.selector ||
  12356. selector === "**" && handleObj.selector ) ) {
  12357. handlers.splice( j, 1 );
  12358. if ( handleObj.selector ) {
  12359. handlers.delegateCount--;
  12360. }
  12361. if ( special.remove ) {
  12362. special.remove.call( elem, handleObj );
  12363. }
  12364. }
  12365. }
  12366. // Remove generic event handler if we removed something and no more handlers exist
  12367. // (avoids potential for endless recursion during removal of special event handlers)
  12368. if ( origCount && !handlers.length ) {
  12369. if ( !special.teardown ||
  12370. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12371. jQuery.removeEvent( elem, type, elemData.handle );
  12372. }
  12373. delete events[ type ];
  12374. }
  12375. }
  12376. // Remove data and the expando if it's no longer used
  12377. if ( jQuery.isEmptyObject( events ) ) {
  12378. dataPriv.remove( elem, "handle events" );
  12379. }
  12380. },
  12381. dispatch: function( nativeEvent ) {
  12382. // Make a writable jQuery.Event from the native event object
  12383. var event = jQuery.event.fix( nativeEvent );
  12384. var i, j, ret, matched, handleObj, handlerQueue,
  12385. args = new Array( arguments.length ),
  12386. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12387. special = jQuery.event.special[ event.type ] || {};
  12388. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12389. args[ 0 ] = event;
  12390. for ( i = 1; i < arguments.length; i++ ) {
  12391. args[ i ] = arguments[ i ];
  12392. }
  12393. event.delegateTarget = this;
  12394. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12395. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12396. return;
  12397. }
  12398. // Determine handlers
  12399. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12400. // Run delegates first; they may want to stop propagation beneath us
  12401. i = 0;
  12402. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12403. event.currentTarget = matched.elem;
  12404. j = 0;
  12405. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12406. !event.isImmediatePropagationStopped() ) {
  12407. // If the event is namespaced, then each handler is only invoked if it is
  12408. // specially universal or its namespaces are a superset of the event's.
  12409. if ( !event.rnamespace || handleObj.namespace === false ||
  12410. event.rnamespace.test( handleObj.namespace ) ) {
  12411. event.handleObj = handleObj;
  12412. event.data = handleObj.data;
  12413. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12414. handleObj.handler ).apply( matched.elem, args );
  12415. if ( ret !== undefined ) {
  12416. if ( ( event.result = ret ) === false ) {
  12417. event.preventDefault();
  12418. event.stopPropagation();
  12419. }
  12420. }
  12421. }
  12422. }
  12423. }
  12424. // Call the postDispatch hook for the mapped type
  12425. if ( special.postDispatch ) {
  12426. special.postDispatch.call( this, event );
  12427. }
  12428. return event.result;
  12429. },
  12430. handlers: function( event, handlers ) {
  12431. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12432. handlerQueue = [],
  12433. delegateCount = handlers.delegateCount,
  12434. cur = event.target;
  12435. // Find delegate handlers
  12436. if ( delegateCount &&
  12437. // Support: IE <=9
  12438. // Black-hole SVG <use> instance trees (trac-13180)
  12439. cur.nodeType &&
  12440. // Support: Firefox <=42
  12441. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12442. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12443. // Support: IE 11 only
  12444. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12445. !( event.type === "click" && event.button >= 1 ) ) {
  12446. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12447. // Don't check non-elements (#13208)
  12448. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12449. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12450. matchedHandlers = [];
  12451. matchedSelectors = {};
  12452. for ( i = 0; i < delegateCount; i++ ) {
  12453. handleObj = handlers[ i ];
  12454. // Don't conflict with Object.prototype properties (#13203)
  12455. sel = handleObj.selector + " ";
  12456. if ( matchedSelectors[ sel ] === undefined ) {
  12457. matchedSelectors[ sel ] = handleObj.needsContext ?
  12458. jQuery( sel, this ).index( cur ) > -1 :
  12459. jQuery.find( sel, this, null, [ cur ] ).length;
  12460. }
  12461. if ( matchedSelectors[ sel ] ) {
  12462. matchedHandlers.push( handleObj );
  12463. }
  12464. }
  12465. if ( matchedHandlers.length ) {
  12466. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12467. }
  12468. }
  12469. }
  12470. }
  12471. // Add the remaining (directly-bound) handlers
  12472. cur = this;
  12473. if ( delegateCount < handlers.length ) {
  12474. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12475. }
  12476. return handlerQueue;
  12477. },
  12478. addProp: function( name, hook ) {
  12479. Object.defineProperty( jQuery.Event.prototype, name, {
  12480. enumerable: true,
  12481. configurable: true,
  12482. get: isFunction( hook ) ?
  12483. function() {
  12484. if ( this.originalEvent ) {
  12485. return hook( this.originalEvent );
  12486. }
  12487. } :
  12488. function() {
  12489. if ( this.originalEvent ) {
  12490. return this.originalEvent[ name ];
  12491. }
  12492. },
  12493. set: function( value ) {
  12494. Object.defineProperty( this, name, {
  12495. enumerable: true,
  12496. configurable: true,
  12497. writable: true,
  12498. value: value
  12499. } );
  12500. }
  12501. } );
  12502. },
  12503. fix: function( originalEvent ) {
  12504. return originalEvent[ jQuery.expando ] ?
  12505. originalEvent :
  12506. new jQuery.Event( originalEvent );
  12507. },
  12508. special: {
  12509. load: {
  12510. // Prevent triggered image.load events from bubbling to window.load
  12511. noBubble: true
  12512. },
  12513. click: {
  12514. // Utilize native event to ensure correct state for checkable inputs
  12515. setup: function( data ) {
  12516. // For mutual compressibility with _default, replace `this` access with a local var.
  12517. // `|| data` is dead code meant only to preserve the variable through minification.
  12518. var el = this || data;
  12519. // Claim the first handler
  12520. if ( rcheckableType.test( el.type ) &&
  12521. el.click && nodeName( el, "input" ) ) {
  12522. // dataPriv.set( el, "click", ... )
  12523. leverageNative( el, "click", returnTrue );
  12524. }
  12525. // Return false to allow normal processing in the caller
  12526. return false;
  12527. },
  12528. trigger: function( data ) {
  12529. // For mutual compressibility with _default, replace `this` access with a local var.
  12530. // `|| data` is dead code meant only to preserve the variable through minification.
  12531. var el = this || data;
  12532. // Force setup before triggering a click
  12533. if ( rcheckableType.test( el.type ) &&
  12534. el.click && nodeName( el, "input" ) ) {
  12535. leverageNative( el, "click" );
  12536. }
  12537. // Return non-false to allow normal event-path propagation
  12538. return true;
  12539. },
  12540. // For cross-browser consistency, suppress native .click() on links
  12541. // Also prevent it if we're currently inside a leveraged native-event stack
  12542. _default: function( event ) {
  12543. var target = event.target;
  12544. return rcheckableType.test( target.type ) &&
  12545. target.click && nodeName( target, "input" ) &&
  12546. dataPriv.get( target, "click" ) ||
  12547. nodeName( target, "a" );
  12548. }
  12549. },
  12550. beforeunload: {
  12551. postDispatch: function( event ) {
  12552. // Support: Firefox 20+
  12553. // Firefox doesn't alert if the returnValue field is not set.
  12554. if ( event.result !== undefined && event.originalEvent ) {
  12555. event.originalEvent.returnValue = event.result;
  12556. }
  12557. }
  12558. }
  12559. }
  12560. };
  12561. // Ensure the presence of an event listener that handles manually-triggered
  12562. // synthetic events by interrupting progress until reinvoked in response to
  12563. // *native* events that it fires directly, ensuring that state changes have
  12564. // already occurred before other listeners are invoked.
  12565. function leverageNative( el, type, expectSync ) {
  12566. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12567. if ( !expectSync ) {
  12568. if ( dataPriv.get( el, type ) === undefined ) {
  12569. jQuery.event.add( el, type, returnTrue );
  12570. }
  12571. return;
  12572. }
  12573. // Register the controller as a special universal handler for all event namespaces
  12574. dataPriv.set( el, type, false );
  12575. jQuery.event.add( el, type, {
  12576. namespace: false,
  12577. handler: function( event ) {
  12578. var notAsync, result,
  12579. saved = dataPriv.get( this, type );
  12580. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12581. // Interrupt processing of the outer synthetic .trigger()ed event
  12582. // Saved data should be false in such cases, but might be a leftover capture object
  12583. // from an async native handler (gh-4350)
  12584. if ( !saved.length ) {
  12585. // Store arguments for use when handling the inner native event
  12586. // There will always be at least one argument (an event object), so this array
  12587. // will not be confused with a leftover capture object.
  12588. saved = slice.call( arguments );
  12589. dataPriv.set( this, type, saved );
  12590. // Trigger the native event and capture its result
  12591. // Support: IE <=9 - 11+
  12592. // focus() and blur() are asynchronous
  12593. notAsync = expectSync( this, type );
  12594. this[ type ]();
  12595. result = dataPriv.get( this, type );
  12596. if ( saved !== result || notAsync ) {
  12597. dataPriv.set( this, type, false );
  12598. } else {
  12599. result = {};
  12600. }
  12601. if ( saved !== result ) {
  12602. // Cancel the outer synthetic event
  12603. event.stopImmediatePropagation();
  12604. event.preventDefault();
  12605. return result.value;
  12606. }
  12607. // If this is an inner synthetic event for an event with a bubbling surrogate
  12608. // (focus or blur), assume that the surrogate already propagated from triggering the
  12609. // native event and prevent that from happening again here.
  12610. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12611. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12612. // less bad than duplication.
  12613. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12614. event.stopPropagation();
  12615. }
  12616. // If this is a native event triggered above, everything is now in order
  12617. // Fire an inner synthetic event with the original arguments
  12618. } else if ( saved.length ) {
  12619. // ...and capture the result
  12620. dataPriv.set( this, type, {
  12621. value: jQuery.event.trigger(
  12622. // Support: IE <=9 - 11+
  12623. // Extend with the prototype to reset the above stopImmediatePropagation()
  12624. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12625. saved.slice( 1 ),
  12626. this
  12627. )
  12628. } );
  12629. // Abort handling of the native event
  12630. event.stopImmediatePropagation();
  12631. }
  12632. }
  12633. } );
  12634. }
  12635. jQuery.removeEvent = function( elem, type, handle ) {
  12636. // This "if" is needed for plain objects
  12637. if ( elem.removeEventListener ) {
  12638. elem.removeEventListener( type, handle );
  12639. }
  12640. };
  12641. jQuery.Event = function( src, props ) {
  12642. // Allow instantiation without the 'new' keyword
  12643. if ( !( this instanceof jQuery.Event ) ) {
  12644. return new jQuery.Event( src, props );
  12645. }
  12646. // Event object
  12647. if ( src && src.type ) {
  12648. this.originalEvent = src;
  12649. this.type = src.type;
  12650. // Events bubbling up the document may have been marked as prevented
  12651. // by a handler lower down the tree; reflect the correct value.
  12652. this.isDefaultPrevented = src.defaultPrevented ||
  12653. src.defaultPrevented === undefined &&
  12654. // Support: Android <=2.3 only
  12655. src.returnValue === false ?
  12656. returnTrue :
  12657. returnFalse;
  12658. // Create target properties
  12659. // Support: Safari <=6 - 7 only
  12660. // Target should not be a text node (#504, #13143)
  12661. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12662. src.target.parentNode :
  12663. src.target;
  12664. this.currentTarget = src.currentTarget;
  12665. this.relatedTarget = src.relatedTarget;
  12666. // Event type
  12667. } else {
  12668. this.type = src;
  12669. }
  12670. // Put explicitly provided properties onto the event object
  12671. if ( props ) {
  12672. jQuery.extend( this, props );
  12673. }
  12674. // Create a timestamp if incoming event doesn't have one
  12675. this.timeStamp = src && src.timeStamp || Date.now();
  12676. // Mark it as fixed
  12677. this[ jQuery.expando ] = true;
  12678. };
  12679. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12680. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12681. jQuery.Event.prototype = {
  12682. constructor: jQuery.Event,
  12683. isDefaultPrevented: returnFalse,
  12684. isPropagationStopped: returnFalse,
  12685. isImmediatePropagationStopped: returnFalse,
  12686. isSimulated: false,
  12687. preventDefault: function() {
  12688. var e = this.originalEvent;
  12689. this.isDefaultPrevented = returnTrue;
  12690. if ( e && !this.isSimulated ) {
  12691. e.preventDefault();
  12692. }
  12693. },
  12694. stopPropagation: function() {
  12695. var e = this.originalEvent;
  12696. this.isPropagationStopped = returnTrue;
  12697. if ( e && !this.isSimulated ) {
  12698. e.stopPropagation();
  12699. }
  12700. },
  12701. stopImmediatePropagation: function() {
  12702. var e = this.originalEvent;
  12703. this.isImmediatePropagationStopped = returnTrue;
  12704. if ( e && !this.isSimulated ) {
  12705. e.stopImmediatePropagation();
  12706. }
  12707. this.stopPropagation();
  12708. }
  12709. };
  12710. // Includes all common event props including KeyEvent and MouseEvent specific props
  12711. jQuery.each( {
  12712. altKey: true,
  12713. bubbles: true,
  12714. cancelable: true,
  12715. changedTouches: true,
  12716. ctrlKey: true,
  12717. detail: true,
  12718. eventPhase: true,
  12719. metaKey: true,
  12720. pageX: true,
  12721. pageY: true,
  12722. shiftKey: true,
  12723. view: true,
  12724. "char": true,
  12725. code: true,
  12726. charCode: true,
  12727. key: true,
  12728. keyCode: true,
  12729. button: true,
  12730. buttons: true,
  12731. clientX: true,
  12732. clientY: true,
  12733. offsetX: true,
  12734. offsetY: true,
  12735. pointerId: true,
  12736. pointerType: true,
  12737. screenX: true,
  12738. screenY: true,
  12739. targetTouches: true,
  12740. toElement: true,
  12741. touches: true,
  12742. which: function( event ) {
  12743. var button = event.button;
  12744. // Add which for key events
  12745. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12746. return event.charCode != null ? event.charCode : event.keyCode;
  12747. }
  12748. // Add which for click: 1 === left; 2 === middle; 3 === right
  12749. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12750. if ( button & 1 ) {
  12751. return 1;
  12752. }
  12753. if ( button & 2 ) {
  12754. return 3;
  12755. }
  12756. if ( button & 4 ) {
  12757. return 2;
  12758. }
  12759. return 0;
  12760. }
  12761. return event.which;
  12762. }
  12763. }, jQuery.event.addProp );
  12764. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12765. jQuery.event.special[ type ] = {
  12766. // Utilize native event if possible so blur/focus sequence is correct
  12767. setup: function() {
  12768. // Claim the first handler
  12769. // dataPriv.set( this, "focus", ... )
  12770. // dataPriv.set( this, "blur", ... )
  12771. leverageNative( this, type, expectSync );
  12772. // Return false to allow normal processing in the caller
  12773. return false;
  12774. },
  12775. trigger: function() {
  12776. // Force setup before trigger
  12777. leverageNative( this, type );
  12778. // Return non-false to allow normal event-path propagation
  12779. return true;
  12780. },
  12781. delegateType: delegateType
  12782. };
  12783. } );
  12784. // Create mouseenter/leave events using mouseover/out and event-time checks
  12785. // so that event delegation works in jQuery.
  12786. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12787. //
  12788. // Support: Safari 7 only
  12789. // Safari sends mouseenter too often; see:
  12790. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12791. // for the description of the bug (it existed in older Chrome versions as well).
  12792. jQuery.each( {
  12793. mouseenter: "mouseover",
  12794. mouseleave: "mouseout",
  12795. pointerenter: "pointerover",
  12796. pointerleave: "pointerout"
  12797. }, function( orig, fix ) {
  12798. jQuery.event.special[ orig ] = {
  12799. delegateType: fix,
  12800. bindType: fix,
  12801. handle: function( event ) {
  12802. var ret,
  12803. target = this,
  12804. related = event.relatedTarget,
  12805. handleObj = event.handleObj;
  12806. // For mouseenter/leave call the handler if related is outside the target.
  12807. // NB: No relatedTarget if the mouse left/entered the browser window
  12808. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12809. event.type = handleObj.origType;
  12810. ret = handleObj.handler.apply( this, arguments );
  12811. event.type = fix;
  12812. }
  12813. return ret;
  12814. }
  12815. };
  12816. } );
  12817. jQuery.fn.extend( {
  12818. on: function( types, selector, data, fn ) {
  12819. return on( this, types, selector, data, fn );
  12820. },
  12821. one: function( types, selector, data, fn ) {
  12822. return on( this, types, selector, data, fn, 1 );
  12823. },
  12824. off: function( types, selector, fn ) {
  12825. var handleObj, type;
  12826. if ( types && types.preventDefault && types.handleObj ) {
  12827. // ( event ) dispatched jQuery.Event
  12828. handleObj = types.handleObj;
  12829. jQuery( types.delegateTarget ).off(
  12830. handleObj.namespace ?
  12831. handleObj.origType + "." + handleObj.namespace :
  12832. handleObj.origType,
  12833. handleObj.selector,
  12834. handleObj.handler
  12835. );
  12836. return this;
  12837. }
  12838. if ( typeof types === "object" ) {
  12839. // ( types-object [, selector] )
  12840. for ( type in types ) {
  12841. this.off( type, selector, types[ type ] );
  12842. }
  12843. return this;
  12844. }
  12845. if ( selector === false || typeof selector === "function" ) {
  12846. // ( types [, fn] )
  12847. fn = selector;
  12848. selector = undefined;
  12849. }
  12850. if ( fn === false ) {
  12851. fn = returnFalse;
  12852. }
  12853. return this.each( function() {
  12854. jQuery.event.remove( this, types, fn, selector );
  12855. } );
  12856. }
  12857. } );
  12858. var
  12859. /* eslint-disable max-len */
  12860. // See https://github.com/eslint/eslint/issues/3229
  12861. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12862. /* eslint-enable */
  12863. // Support: IE <=10 - 11, Edge 12 - 13 only
  12864. // In IE/Edge using regex groups here causes severe slowdowns.
  12865. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12866. rnoInnerhtml = /<script|<style|<link/i,
  12867. // checked="checked" or checked
  12868. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12869. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12870. // Prefer a tbody over its parent table for containing new rows
  12871. function manipulationTarget( elem, content ) {
  12872. if ( nodeName( elem, "table" ) &&
  12873. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12874. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12875. }
  12876. return elem;
  12877. }
  12878. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12879. function disableScript( elem ) {
  12880. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12881. return elem;
  12882. }
  12883. function restoreScript( elem ) {
  12884. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12885. elem.type = elem.type.slice( 5 );
  12886. } else {
  12887. elem.removeAttribute( "type" );
  12888. }
  12889. return elem;
  12890. }
  12891. function cloneCopyEvent( src, dest ) {
  12892. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12893. if ( dest.nodeType !== 1 ) {
  12894. return;
  12895. }
  12896. // 1. Copy private data: events, handlers, etc.
  12897. if ( dataPriv.hasData( src ) ) {
  12898. pdataOld = dataPriv.access( src );
  12899. pdataCur = dataPriv.set( dest, pdataOld );
  12900. events = pdataOld.events;
  12901. if ( events ) {
  12902. delete pdataCur.handle;
  12903. pdataCur.events = {};
  12904. for ( type in events ) {
  12905. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12906. jQuery.event.add( dest, type, events[ type ][ i ] );
  12907. }
  12908. }
  12909. }
  12910. }
  12911. // 2. Copy user data
  12912. if ( dataUser.hasData( src ) ) {
  12913. udataOld = dataUser.access( src );
  12914. udataCur = jQuery.extend( {}, udataOld );
  12915. dataUser.set( dest, udataCur );
  12916. }
  12917. }
  12918. // Fix IE bugs, see support tests
  12919. function fixInput( src, dest ) {
  12920. var nodeName = dest.nodeName.toLowerCase();
  12921. // Fails to persist the checked state of a cloned checkbox or radio button.
  12922. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12923. dest.checked = src.checked;
  12924. // Fails to return the selected option to the default selected state when cloning options
  12925. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12926. dest.defaultValue = src.defaultValue;
  12927. }
  12928. }
  12929. function domManip( collection, args, callback, ignored ) {
  12930. // Flatten any nested arrays
  12931. args = concat.apply( [], args );
  12932. var fragment, first, scripts, hasScripts, node, doc,
  12933. i = 0,
  12934. l = collection.length,
  12935. iNoClone = l - 1,
  12936. value = args[ 0 ],
  12937. valueIsFunction = isFunction( value );
  12938. // We can't cloneNode fragments that contain checked, in WebKit
  12939. if ( valueIsFunction ||
  12940. ( l > 1 && typeof value === "string" &&
  12941. !support.checkClone && rchecked.test( value ) ) ) {
  12942. return collection.each( function( index ) {
  12943. var self = collection.eq( index );
  12944. if ( valueIsFunction ) {
  12945. args[ 0 ] = value.call( this, index, self.html() );
  12946. }
  12947. domManip( self, args, callback, ignored );
  12948. } );
  12949. }
  12950. if ( l ) {
  12951. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12952. first = fragment.firstChild;
  12953. if ( fragment.childNodes.length === 1 ) {
  12954. fragment = first;
  12955. }
  12956. // Require either new content or an interest in ignored elements to invoke the callback
  12957. if ( first || ignored ) {
  12958. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12959. hasScripts = scripts.length;
  12960. // Use the original fragment for the last item
  12961. // instead of the first because it can end up
  12962. // being emptied incorrectly in certain situations (#8070).
  12963. for ( ; i < l; i++ ) {
  12964. node = fragment;
  12965. if ( i !== iNoClone ) {
  12966. node = jQuery.clone( node, true, true );
  12967. // Keep references to cloned scripts for later restoration
  12968. if ( hasScripts ) {
  12969. // Support: Android <=4.0 only, PhantomJS 1 only
  12970. // push.apply(_, arraylike) throws on ancient WebKit
  12971. jQuery.merge( scripts, getAll( node, "script" ) );
  12972. }
  12973. }
  12974. callback.call( collection[ i ], node, i );
  12975. }
  12976. if ( hasScripts ) {
  12977. doc = scripts[ scripts.length - 1 ].ownerDocument;
  12978. // Reenable scripts
  12979. jQuery.map( scripts, restoreScript );
  12980. // Evaluate executable scripts on first document insertion
  12981. for ( i = 0; i < hasScripts; i++ ) {
  12982. node = scripts[ i ];
  12983. if ( rscriptType.test( node.type || "" ) &&
  12984. !dataPriv.access( node, "globalEval" ) &&
  12985. jQuery.contains( doc, node ) ) {
  12986. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  12987. // Optional AJAX dependency, but won't run scripts if not present
  12988. if ( jQuery._evalUrl && !node.noModule ) {
  12989. jQuery._evalUrl( node.src, {
  12990. nonce: node.nonce || node.getAttribute( "nonce" )
  12991. } );
  12992. }
  12993. } else {
  12994. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  12995. }
  12996. }
  12997. }
  12998. }
  12999. }
  13000. }
  13001. return collection;
  13002. }
  13003. function remove( elem, selector, keepData ) {
  13004. var node,
  13005. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13006. i = 0;
  13007. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13008. if ( !keepData && node.nodeType === 1 ) {
  13009. jQuery.cleanData( getAll( node ) );
  13010. }
  13011. if ( node.parentNode ) {
  13012. if ( keepData && isAttached( node ) ) {
  13013. setGlobalEval( getAll( node, "script" ) );
  13014. }
  13015. node.parentNode.removeChild( node );
  13016. }
  13017. }
  13018. return elem;
  13019. }
  13020. jQuery.extend( {
  13021. htmlPrefilter: function( html ) {
  13022. return html.replace( rxhtmlTag, "<$1></$2>" );
  13023. },
  13024. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13025. var i, l, srcElements, destElements,
  13026. clone = elem.cloneNode( true ),
  13027. inPage = isAttached( elem );
  13028. // Fix IE cloning issues
  13029. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13030. !jQuery.isXMLDoc( elem ) ) {
  13031. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13032. destElements = getAll( clone );
  13033. srcElements = getAll( elem );
  13034. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13035. fixInput( srcElements[ i ], destElements[ i ] );
  13036. }
  13037. }
  13038. // Copy the events from the original to the clone
  13039. if ( dataAndEvents ) {
  13040. if ( deepDataAndEvents ) {
  13041. srcElements = srcElements || getAll( elem );
  13042. destElements = destElements || getAll( clone );
  13043. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13044. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13045. }
  13046. } else {
  13047. cloneCopyEvent( elem, clone );
  13048. }
  13049. }
  13050. // Preserve script evaluation history
  13051. destElements = getAll( clone, "script" );
  13052. if ( destElements.length > 0 ) {
  13053. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13054. }
  13055. // Return the cloned set
  13056. return clone;
  13057. },
  13058. cleanData: function( elems ) {
  13059. var data, elem, type,
  13060. special = jQuery.event.special,
  13061. i = 0;
  13062. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13063. if ( acceptData( elem ) ) {
  13064. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13065. if ( data.events ) {
  13066. for ( type in data.events ) {
  13067. if ( special[ type ] ) {
  13068. jQuery.event.remove( elem, type );
  13069. // This is a shortcut to avoid jQuery.event.remove's overhead
  13070. } else {
  13071. jQuery.removeEvent( elem, type, data.handle );
  13072. }
  13073. }
  13074. }
  13075. // Support: Chrome <=35 - 45+
  13076. // Assign undefined instead of using delete, see Data#remove
  13077. elem[ dataPriv.expando ] = undefined;
  13078. }
  13079. if ( elem[ dataUser.expando ] ) {
  13080. // Support: Chrome <=35 - 45+
  13081. // Assign undefined instead of using delete, see Data#remove
  13082. elem[ dataUser.expando ] = undefined;
  13083. }
  13084. }
  13085. }
  13086. }
  13087. } );
  13088. jQuery.fn.extend( {
  13089. detach: function( selector ) {
  13090. return remove( this, selector, true );
  13091. },
  13092. remove: function( selector ) {
  13093. return remove( this, selector );
  13094. },
  13095. text: function( value ) {
  13096. return access( this, function( value ) {
  13097. return value === undefined ?
  13098. jQuery.text( this ) :
  13099. this.empty().each( function() {
  13100. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13101. this.textContent = value;
  13102. }
  13103. } );
  13104. }, null, value, arguments.length );
  13105. },
  13106. append: function() {
  13107. return domManip( this, arguments, function( elem ) {
  13108. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13109. var target = manipulationTarget( this, elem );
  13110. target.appendChild( elem );
  13111. }
  13112. } );
  13113. },
  13114. prepend: function() {
  13115. return domManip( this, arguments, function( elem ) {
  13116. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13117. var target = manipulationTarget( this, elem );
  13118. target.insertBefore( elem, target.firstChild );
  13119. }
  13120. } );
  13121. },
  13122. before: function() {
  13123. return domManip( this, arguments, function( elem ) {
  13124. if ( this.parentNode ) {
  13125. this.parentNode.insertBefore( elem, this );
  13126. }
  13127. } );
  13128. },
  13129. after: function() {
  13130. return domManip( this, arguments, function( elem ) {
  13131. if ( this.parentNode ) {
  13132. this.parentNode.insertBefore( elem, this.nextSibling );
  13133. }
  13134. } );
  13135. },
  13136. empty: function() {
  13137. var elem,
  13138. i = 0;
  13139. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13140. if ( elem.nodeType === 1 ) {
  13141. // Prevent memory leaks
  13142. jQuery.cleanData( getAll( elem, false ) );
  13143. // Remove any remaining nodes
  13144. elem.textContent = "";
  13145. }
  13146. }
  13147. return this;
  13148. },
  13149. clone: function( dataAndEvents, deepDataAndEvents ) {
  13150. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13151. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13152. return this.map( function() {
  13153. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13154. } );
  13155. },
  13156. html: function( value ) {
  13157. return access( this, function( value ) {
  13158. var elem = this[ 0 ] || {},
  13159. i = 0,
  13160. l = this.length;
  13161. if ( value === undefined && elem.nodeType === 1 ) {
  13162. return elem.innerHTML;
  13163. }
  13164. // See if we can take a shortcut and just use innerHTML
  13165. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13166. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13167. value = jQuery.htmlPrefilter( value );
  13168. try {
  13169. for ( ; i < l; i++ ) {
  13170. elem = this[ i ] || {};
  13171. // Remove element nodes and prevent memory leaks
  13172. if ( elem.nodeType === 1 ) {
  13173. jQuery.cleanData( getAll( elem, false ) );
  13174. elem.innerHTML = value;
  13175. }
  13176. }
  13177. elem = 0;
  13178. // If using innerHTML throws an exception, use the fallback method
  13179. } catch ( e ) {}
  13180. }
  13181. if ( elem ) {
  13182. this.empty().append( value );
  13183. }
  13184. }, null, value, arguments.length );
  13185. },
  13186. replaceWith: function() {
  13187. var ignored = [];
  13188. // Make the changes, replacing each non-ignored context element with the new content
  13189. return domManip( this, arguments, function( elem ) {
  13190. var parent = this.parentNode;
  13191. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13192. jQuery.cleanData( getAll( this ) );
  13193. if ( parent ) {
  13194. parent.replaceChild( elem, this );
  13195. }
  13196. }
  13197. // Force callback invocation
  13198. }, ignored );
  13199. }
  13200. } );
  13201. jQuery.each( {
  13202. appendTo: "append",
  13203. prependTo: "prepend",
  13204. insertBefore: "before",
  13205. insertAfter: "after",
  13206. replaceAll: "replaceWith"
  13207. }, function( name, original ) {
  13208. jQuery.fn[ name ] = function( selector ) {
  13209. var elems,
  13210. ret = [],
  13211. insert = jQuery( selector ),
  13212. last = insert.length - 1,
  13213. i = 0;
  13214. for ( ; i <= last; i++ ) {
  13215. elems = i === last ? this : this.clone( true );
  13216. jQuery( insert[ i ] )[ original ]( elems );
  13217. // Support: Android <=4.0 only, PhantomJS 1 only
  13218. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13219. push.apply( ret, elems.get() );
  13220. }
  13221. return this.pushStack( ret );
  13222. };
  13223. } );
  13224. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13225. var getStyles = function( elem ) {
  13226. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13227. // IE throws on elements created in popups
  13228. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13229. var view = elem.ownerDocument.defaultView;
  13230. if ( !view || !view.opener ) {
  13231. view = window;
  13232. }
  13233. return view.getComputedStyle( elem );
  13234. };
  13235. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13236. ( function() {
  13237. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13238. // so they're executed at the same time to save the second computation.
  13239. function computeStyleTests() {
  13240. // This is a singleton, we need to execute it only once
  13241. if ( !div ) {
  13242. return;
  13243. }
  13244. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13245. "margin-top:1px;padding:0;border:0";
  13246. div.style.cssText =
  13247. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13248. "margin:auto;border:1px;padding:1px;" +
  13249. "width:60%;top:1%";
  13250. documentElement.appendChild( container ).appendChild( div );
  13251. var divStyle = window.getComputedStyle( div );
  13252. pixelPositionVal = divStyle.top !== "1%";
  13253. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13254. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13255. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13256. // Some styles come back with percentage values, even though they shouldn't
  13257. div.style.right = "60%";
  13258. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13259. // Support: IE 9 - 11 only
  13260. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13261. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13262. // Support: IE 9 only
  13263. // Detect overflow:scroll screwiness (gh-3699)
  13264. // Support: Chrome <=64
  13265. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13266. div.style.position = "absolute";
  13267. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13268. documentElement.removeChild( container );
  13269. // Nullify the div so it wouldn't be stored in the memory and
  13270. // it will also be a sign that checks already performed
  13271. div = null;
  13272. }
  13273. function roundPixelMeasures( measure ) {
  13274. return Math.round( parseFloat( measure ) );
  13275. }
  13276. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13277. reliableMarginLeftVal,
  13278. container = document.createElement( "div" ),
  13279. div = document.createElement( "div" );
  13280. // Finish early in limited (non-browser) environments
  13281. if ( !div.style ) {
  13282. return;
  13283. }
  13284. // Support: IE <=9 - 11 only
  13285. // Style of cloned element affects source element cloned (#8908)
  13286. div.style.backgroundClip = "content-box";
  13287. div.cloneNode( true ).style.backgroundClip = "";
  13288. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13289. jQuery.extend( support, {
  13290. boxSizingReliable: function() {
  13291. computeStyleTests();
  13292. return boxSizingReliableVal;
  13293. },
  13294. pixelBoxStyles: function() {
  13295. computeStyleTests();
  13296. return pixelBoxStylesVal;
  13297. },
  13298. pixelPosition: function() {
  13299. computeStyleTests();
  13300. return pixelPositionVal;
  13301. },
  13302. reliableMarginLeft: function() {
  13303. computeStyleTests();
  13304. return reliableMarginLeftVal;
  13305. },
  13306. scrollboxSize: function() {
  13307. computeStyleTests();
  13308. return scrollboxSizeVal;
  13309. }
  13310. } );
  13311. } )();
  13312. function curCSS( elem, name, computed ) {
  13313. var width, minWidth, maxWidth, ret,
  13314. // Support: Firefox 51+
  13315. // Retrieving style before computed somehow
  13316. // fixes an issue with getting wrong values
  13317. // on detached elements
  13318. style = elem.style;
  13319. computed = computed || getStyles( elem );
  13320. // getPropertyValue is needed for:
  13321. // .css('filter') (IE 9 only, #12537)
  13322. // .css('--customProperty) (#3144)
  13323. if ( computed ) {
  13324. ret = computed.getPropertyValue( name ) || computed[ name ];
  13325. if ( ret === "" && !isAttached( elem ) ) {
  13326. ret = jQuery.style( elem, name );
  13327. }
  13328. // A tribute to the "awesome hack by Dean Edwards"
  13329. // Android Browser returns percentage for some values,
  13330. // but width seems to be reliably pixels.
  13331. // This is against the CSSOM draft spec:
  13332. // https://drafts.csswg.org/cssom/#resolved-values
  13333. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13334. // Remember the original values
  13335. width = style.width;
  13336. minWidth = style.minWidth;
  13337. maxWidth = style.maxWidth;
  13338. // Put in the new values to get a computed value out
  13339. style.minWidth = style.maxWidth = style.width = ret;
  13340. ret = computed.width;
  13341. // Revert the changed values
  13342. style.width = width;
  13343. style.minWidth = minWidth;
  13344. style.maxWidth = maxWidth;
  13345. }
  13346. }
  13347. return ret !== undefined ?
  13348. // Support: IE <=9 - 11 only
  13349. // IE returns zIndex value as an integer.
  13350. ret + "" :
  13351. ret;
  13352. }
  13353. function addGetHookIf( conditionFn, hookFn ) {
  13354. // Define the hook, we'll check on the first run if it's really needed.
  13355. return {
  13356. get: function() {
  13357. if ( conditionFn() ) {
  13358. // Hook not needed (or it's not possible to use it due
  13359. // to missing dependency), remove it.
  13360. delete this.get;
  13361. return;
  13362. }
  13363. // Hook needed; redefine it so that the support test is not executed again.
  13364. return ( this.get = hookFn ).apply( this, arguments );
  13365. }
  13366. };
  13367. }
  13368. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13369. emptyStyle = document.createElement( "div" ).style,
  13370. vendorProps = {};
  13371. // Return a vendor-prefixed property or undefined
  13372. function vendorPropName( name ) {
  13373. // Check for vendor prefixed names
  13374. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13375. i = cssPrefixes.length;
  13376. while ( i-- ) {
  13377. name = cssPrefixes[ i ] + capName;
  13378. if ( name in emptyStyle ) {
  13379. return name;
  13380. }
  13381. }
  13382. }
  13383. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13384. function finalPropName( name ) {
  13385. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13386. if ( final ) {
  13387. return final;
  13388. }
  13389. if ( name in emptyStyle ) {
  13390. return name;
  13391. }
  13392. return vendorProps[ name ] = vendorPropName( name ) || name;
  13393. }
  13394. var
  13395. // Swappable if display is none or starts with table
  13396. // except "table", "table-cell", or "table-caption"
  13397. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13398. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13399. rcustomProp = /^--/,
  13400. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13401. cssNormalTransform = {
  13402. letterSpacing: "0",
  13403. fontWeight: "400"
  13404. };
  13405. function setPositiveNumber( elem, value, subtract ) {
  13406. // Any relative (+/-) values have already been
  13407. // normalized at this point
  13408. var matches = rcssNum.exec( value );
  13409. return matches ?
  13410. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13411. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13412. value;
  13413. }
  13414. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13415. var i = dimension === "width" ? 1 : 0,
  13416. extra = 0,
  13417. delta = 0;
  13418. // Adjustment may not be necessary
  13419. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13420. return 0;
  13421. }
  13422. for ( ; i < 4; i += 2 ) {
  13423. // Both box models exclude margin
  13424. if ( box === "margin" ) {
  13425. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13426. }
  13427. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13428. if ( !isBorderBox ) {
  13429. // Add padding
  13430. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13431. // For "border" or "margin", add border
  13432. if ( box !== "padding" ) {
  13433. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13434. // But still keep track of it otherwise
  13435. } else {
  13436. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13437. }
  13438. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13439. // "padding" or "margin"
  13440. } else {
  13441. // For "content", subtract padding
  13442. if ( box === "content" ) {
  13443. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13444. }
  13445. // For "content" or "padding", subtract border
  13446. if ( box !== "margin" ) {
  13447. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13448. }
  13449. }
  13450. }
  13451. // Account for positive content-box scroll gutter when requested by providing computedVal
  13452. if ( !isBorderBox && computedVal >= 0 ) {
  13453. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13454. // Assuming integer scroll gutter, subtract the rest and round down
  13455. delta += Math.max( 0, Math.ceil(
  13456. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13457. computedVal -
  13458. delta -
  13459. extra -
  13460. 0.5
  13461. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13462. // Use an explicit zero to avoid NaN (gh-3964)
  13463. ) ) || 0;
  13464. }
  13465. return delta;
  13466. }
  13467. function getWidthOrHeight( elem, dimension, extra ) {
  13468. // Start with computed style
  13469. var styles = getStyles( elem ),
  13470. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13471. // Fake content-box until we know it's needed to know the true value.
  13472. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13473. isBorderBox = boxSizingNeeded &&
  13474. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13475. valueIsBorderBox = isBorderBox,
  13476. val = curCSS( elem, dimension, styles ),
  13477. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13478. // Support: Firefox <=54
  13479. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13480. if ( rnumnonpx.test( val ) ) {
  13481. if ( !extra ) {
  13482. return val;
  13483. }
  13484. val = "auto";
  13485. }
  13486. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13487. // This happens for inline elements with no explicit setting (gh-3571)
  13488. // Support: Android <=4.1 - 4.3 only
  13489. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13490. // Support: IE 9-11 only
  13491. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13492. // We use getClientRects() to check for hidden/disconnected.
  13493. // In those cases, the computed value can be trusted to be border-box
  13494. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13495. val === "auto" ||
  13496. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13497. elem.getClientRects().length ) {
  13498. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13499. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13500. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13501. // retrieved value as a content box dimension.
  13502. valueIsBorderBox = offsetProp in elem;
  13503. if ( valueIsBorderBox ) {
  13504. val = elem[ offsetProp ];
  13505. }
  13506. }
  13507. // Normalize "" and auto
  13508. val = parseFloat( val ) || 0;
  13509. // Adjust for the element's box model
  13510. return ( val +
  13511. boxModelAdjustment(
  13512. elem,
  13513. dimension,
  13514. extra || ( isBorderBox ? "border" : "content" ),
  13515. valueIsBorderBox,
  13516. styles,
  13517. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13518. val
  13519. )
  13520. ) + "px";
  13521. }
  13522. jQuery.extend( {
  13523. // Add in style property hooks for overriding the default
  13524. // behavior of getting and setting a style property
  13525. cssHooks: {
  13526. opacity: {
  13527. get: function( elem, computed ) {
  13528. if ( computed ) {
  13529. // We should always get a number back from opacity
  13530. var ret = curCSS( elem, "opacity" );
  13531. return ret === "" ? "1" : ret;
  13532. }
  13533. }
  13534. }
  13535. },
  13536. // Don't automatically add "px" to these possibly-unitless properties
  13537. cssNumber: {
  13538. "animationIterationCount": true,
  13539. "columnCount": true,
  13540. "fillOpacity": true,
  13541. "flexGrow": true,
  13542. "flexShrink": true,
  13543. "fontWeight": true,
  13544. "gridArea": true,
  13545. "gridColumn": true,
  13546. "gridColumnEnd": true,
  13547. "gridColumnStart": true,
  13548. "gridRow": true,
  13549. "gridRowEnd": true,
  13550. "gridRowStart": true,
  13551. "lineHeight": true,
  13552. "opacity": true,
  13553. "order": true,
  13554. "orphans": true,
  13555. "widows": true,
  13556. "zIndex": true,
  13557. "zoom": true
  13558. },
  13559. // Add in properties whose names you wish to fix before
  13560. // setting or getting the value
  13561. cssProps: {},
  13562. // Get and set the style property on a DOM Node
  13563. style: function( elem, name, value, extra ) {
  13564. // Don't set styles on text and comment nodes
  13565. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13566. return;
  13567. }
  13568. // Make sure that we're working with the right name
  13569. var ret, type, hooks,
  13570. origName = camelCase( name ),
  13571. isCustomProp = rcustomProp.test( name ),
  13572. style = elem.style;
  13573. // Make sure that we're working with the right name. We don't
  13574. // want to query the value if it is a CSS custom property
  13575. // since they are user-defined.
  13576. if ( !isCustomProp ) {
  13577. name = finalPropName( origName );
  13578. }
  13579. // Gets hook for the prefixed version, then unprefixed version
  13580. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13581. // Check if we're setting a value
  13582. if ( value !== undefined ) {
  13583. type = typeof value;
  13584. // Convert "+=" or "-=" to relative numbers (#7345)
  13585. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13586. value = adjustCSS( elem, name, ret );
  13587. // Fixes bug #9237
  13588. type = "number";
  13589. }
  13590. // Make sure that null and NaN values aren't set (#7116)
  13591. if ( value == null || value !== value ) {
  13592. return;
  13593. }
  13594. // If a number was passed in, add the unit (except for certain CSS properties)
  13595. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13596. // "px" to a few hardcoded values.
  13597. if ( type === "number" && !isCustomProp ) {
  13598. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13599. }
  13600. // background-* props affect original clone's values
  13601. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13602. style[ name ] = "inherit";
  13603. }
  13604. // If a hook was provided, use that value, otherwise just set the specified value
  13605. if ( !hooks || !( "set" in hooks ) ||
  13606. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13607. if ( isCustomProp ) {
  13608. style.setProperty( name, value );
  13609. } else {
  13610. style[ name ] = value;
  13611. }
  13612. }
  13613. } else {
  13614. // If a hook was provided get the non-computed value from there
  13615. if ( hooks && "get" in hooks &&
  13616. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13617. return ret;
  13618. }
  13619. // Otherwise just get the value from the style object
  13620. return style[ name ];
  13621. }
  13622. },
  13623. css: function( elem, name, extra, styles ) {
  13624. var val, num, hooks,
  13625. origName = camelCase( name ),
  13626. isCustomProp = rcustomProp.test( name );
  13627. // Make sure that we're working with the right name. We don't
  13628. // want to modify the value if it is a CSS custom property
  13629. // since they are user-defined.
  13630. if ( !isCustomProp ) {
  13631. name = finalPropName( origName );
  13632. }
  13633. // Try prefixed name followed by the unprefixed name
  13634. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13635. // If a hook was provided get the computed value from there
  13636. if ( hooks && "get" in hooks ) {
  13637. val = hooks.get( elem, true, extra );
  13638. }
  13639. // Otherwise, if a way to get the computed value exists, use that
  13640. if ( val === undefined ) {
  13641. val = curCSS( elem, name, styles );
  13642. }
  13643. // Convert "normal" to computed value
  13644. if ( val === "normal" && name in cssNormalTransform ) {
  13645. val = cssNormalTransform[ name ];
  13646. }
  13647. // Make numeric if forced or a qualifier was provided and val looks numeric
  13648. if ( extra === "" || extra ) {
  13649. num = parseFloat( val );
  13650. return extra === true || isFinite( num ) ? num || 0 : val;
  13651. }
  13652. return val;
  13653. }
  13654. } );
  13655. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13656. jQuery.cssHooks[ dimension ] = {
  13657. get: function( elem, computed, extra ) {
  13658. if ( computed ) {
  13659. // Certain elements can have dimension info if we invisibly show them
  13660. // but it must have a current display style that would benefit
  13661. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13662. // Support: Safari 8+
  13663. // Table columns in Safari have non-zero offsetWidth & zero
  13664. // getBoundingClientRect().width unless display is changed.
  13665. // Support: IE <=11 only
  13666. // Running getBoundingClientRect on a disconnected node
  13667. // in IE throws an error.
  13668. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13669. swap( elem, cssShow, function() {
  13670. return getWidthOrHeight( elem, dimension, extra );
  13671. } ) :
  13672. getWidthOrHeight( elem, dimension, extra );
  13673. }
  13674. },
  13675. set: function( elem, value, extra ) {
  13676. var matches,
  13677. styles = getStyles( elem ),
  13678. // Only read styles.position if the test has a chance to fail
  13679. // to avoid forcing a reflow.
  13680. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13681. styles.position === "absolute",
  13682. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13683. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13684. isBorderBox = boxSizingNeeded &&
  13685. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13686. subtract = extra ?
  13687. boxModelAdjustment(
  13688. elem,
  13689. dimension,
  13690. extra,
  13691. isBorderBox,
  13692. styles
  13693. ) :
  13694. 0;
  13695. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13696. // faking a content-box to get border and padding (gh-3699)
  13697. if ( isBorderBox && scrollboxSizeBuggy ) {
  13698. subtract -= Math.ceil(
  13699. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13700. parseFloat( styles[ dimension ] ) -
  13701. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13702. 0.5
  13703. );
  13704. }
  13705. // Convert to pixels if value adjustment is needed
  13706. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13707. ( matches[ 3 ] || "px" ) !== "px" ) {
  13708. elem.style[ dimension ] = value;
  13709. value = jQuery.css( elem, dimension );
  13710. }
  13711. return setPositiveNumber( elem, value, subtract );
  13712. }
  13713. };
  13714. } );
  13715. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13716. function( elem, computed ) {
  13717. if ( computed ) {
  13718. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13719. elem.getBoundingClientRect().left -
  13720. swap( elem, { marginLeft: 0 }, function() {
  13721. return elem.getBoundingClientRect().left;
  13722. } )
  13723. ) + "px";
  13724. }
  13725. }
  13726. );
  13727. // These hooks are used by animate to expand properties
  13728. jQuery.each( {
  13729. margin: "",
  13730. padding: "",
  13731. border: "Width"
  13732. }, function( prefix, suffix ) {
  13733. jQuery.cssHooks[ prefix + suffix ] = {
  13734. expand: function( value ) {
  13735. var i = 0,
  13736. expanded = {},
  13737. // Assumes a single number if not a string
  13738. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13739. for ( ; i < 4; i++ ) {
  13740. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13741. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13742. }
  13743. return expanded;
  13744. }
  13745. };
  13746. if ( prefix !== "margin" ) {
  13747. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13748. }
  13749. } );
  13750. jQuery.fn.extend( {
  13751. css: function( name, value ) {
  13752. return access( this, function( elem, name, value ) {
  13753. var styles, len,
  13754. map = {},
  13755. i = 0;
  13756. if ( Array.isArray( name ) ) {
  13757. styles = getStyles( elem );
  13758. len = name.length;
  13759. for ( ; i < len; i++ ) {
  13760. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13761. }
  13762. return map;
  13763. }
  13764. return value !== undefined ?
  13765. jQuery.style( elem, name, value ) :
  13766. jQuery.css( elem, name );
  13767. }, name, value, arguments.length > 1 );
  13768. }
  13769. } );
  13770. function Tween( elem, options, prop, end, easing ) {
  13771. return new Tween.prototype.init( elem, options, prop, end, easing );
  13772. }
  13773. jQuery.Tween = Tween;
  13774. Tween.prototype = {
  13775. constructor: Tween,
  13776. init: function( elem, options, prop, end, easing, unit ) {
  13777. this.elem = elem;
  13778. this.prop = prop;
  13779. this.easing = easing || jQuery.easing._default;
  13780. this.options = options;
  13781. this.start = this.now = this.cur();
  13782. this.end = end;
  13783. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13784. },
  13785. cur: function() {
  13786. var hooks = Tween.propHooks[ this.prop ];
  13787. return hooks && hooks.get ?
  13788. hooks.get( this ) :
  13789. Tween.propHooks._default.get( this );
  13790. },
  13791. run: function( percent ) {
  13792. var eased,
  13793. hooks = Tween.propHooks[ this.prop ];
  13794. if ( this.options.duration ) {
  13795. this.pos = eased = jQuery.easing[ this.easing ](
  13796. percent, this.options.duration * percent, 0, 1, this.options.duration
  13797. );
  13798. } else {
  13799. this.pos = eased = percent;
  13800. }
  13801. this.now = ( this.end - this.start ) * eased + this.start;
  13802. if ( this.options.step ) {
  13803. this.options.step.call( this.elem, this.now, this );
  13804. }
  13805. if ( hooks && hooks.set ) {
  13806. hooks.set( this );
  13807. } else {
  13808. Tween.propHooks._default.set( this );
  13809. }
  13810. return this;
  13811. }
  13812. };
  13813. Tween.prototype.init.prototype = Tween.prototype;
  13814. Tween.propHooks = {
  13815. _default: {
  13816. get: function( tween ) {
  13817. var result;
  13818. // Use a property on the element directly when it is not a DOM element,
  13819. // or when there is no matching style property that exists.
  13820. if ( tween.elem.nodeType !== 1 ||
  13821. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13822. return tween.elem[ tween.prop ];
  13823. }
  13824. // Passing an empty string as a 3rd parameter to .css will automatically
  13825. // attempt a parseFloat and fallback to a string if the parse fails.
  13826. // Simple values such as "10px" are parsed to Float;
  13827. // complex values such as "rotate(1rad)" are returned as-is.
  13828. result = jQuery.css( tween.elem, tween.prop, "" );
  13829. // Empty strings, null, undefined and "auto" are converted to 0.
  13830. return !result || result === "auto" ? 0 : result;
  13831. },
  13832. set: function( tween ) {
  13833. // Use step hook for back compat.
  13834. // Use cssHook if its there.
  13835. // Use .style if available and use plain properties where available.
  13836. if ( jQuery.fx.step[ tween.prop ] ) {
  13837. jQuery.fx.step[ tween.prop ]( tween );
  13838. } else if ( tween.elem.nodeType === 1 && (
  13839. jQuery.cssHooks[ tween.prop ] ||
  13840. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13841. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13842. } else {
  13843. tween.elem[ tween.prop ] = tween.now;
  13844. }
  13845. }
  13846. }
  13847. };
  13848. // Support: IE <=9 only
  13849. // Panic based approach to setting things on disconnected nodes
  13850. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13851. set: function( tween ) {
  13852. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13853. tween.elem[ tween.prop ] = tween.now;
  13854. }
  13855. }
  13856. };
  13857. jQuery.easing = {
  13858. linear: function( p ) {
  13859. return p;
  13860. },
  13861. swing: function( p ) {
  13862. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13863. },
  13864. _default: "swing"
  13865. };
  13866. jQuery.fx = Tween.prototype.init;
  13867. // Back compat <1.8 extension point
  13868. jQuery.fx.step = {};
  13869. var
  13870. fxNow, inProgress,
  13871. rfxtypes = /^(?:toggle|show|hide)$/,
  13872. rrun = /queueHooks$/;
  13873. function schedule() {
  13874. if ( inProgress ) {
  13875. if ( document.hidden === false && window.requestAnimationFrame ) {
  13876. window.requestAnimationFrame( schedule );
  13877. } else {
  13878. window.setTimeout( schedule, jQuery.fx.interval );
  13879. }
  13880. jQuery.fx.tick();
  13881. }
  13882. }
  13883. // Animations created synchronously will run synchronously
  13884. function createFxNow() {
  13885. window.setTimeout( function() {
  13886. fxNow = undefined;
  13887. } );
  13888. return ( fxNow = Date.now() );
  13889. }
  13890. // Generate parameters to create a standard animation
  13891. function genFx( type, includeWidth ) {
  13892. var which,
  13893. i = 0,
  13894. attrs = { height: type };
  13895. // If we include width, step value is 1 to do all cssExpand values,
  13896. // otherwise step value is 2 to skip over Left and Right
  13897. includeWidth = includeWidth ? 1 : 0;
  13898. for ( ; i < 4; i += 2 - includeWidth ) {
  13899. which = cssExpand[ i ];
  13900. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13901. }
  13902. if ( includeWidth ) {
  13903. attrs.opacity = attrs.width = type;
  13904. }
  13905. return attrs;
  13906. }
  13907. function createTween( value, prop, animation ) {
  13908. var tween,
  13909. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13910. index = 0,
  13911. length = collection.length;
  13912. for ( ; index < length; index++ ) {
  13913. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13914. // We're done with this property
  13915. return tween;
  13916. }
  13917. }
  13918. }
  13919. function defaultPrefilter( elem, props, opts ) {
  13920. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13921. isBox = "width" in props || "height" in props,
  13922. anim = this,
  13923. orig = {},
  13924. style = elem.style,
  13925. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13926. dataShow = dataPriv.get( elem, "fxshow" );
  13927. // Queue-skipping animations hijack the fx hooks
  13928. if ( !opts.queue ) {
  13929. hooks = jQuery._queueHooks( elem, "fx" );
  13930. if ( hooks.unqueued == null ) {
  13931. hooks.unqueued = 0;
  13932. oldfire = hooks.empty.fire;
  13933. hooks.empty.fire = function() {
  13934. if ( !hooks.unqueued ) {
  13935. oldfire();
  13936. }
  13937. };
  13938. }
  13939. hooks.unqueued++;
  13940. anim.always( function() {
  13941. // Ensure the complete handler is called before this completes
  13942. anim.always( function() {
  13943. hooks.unqueued--;
  13944. if ( !jQuery.queue( elem, "fx" ).length ) {
  13945. hooks.empty.fire();
  13946. }
  13947. } );
  13948. } );
  13949. }
  13950. // Detect show/hide animations
  13951. for ( prop in props ) {
  13952. value = props[ prop ];
  13953. if ( rfxtypes.test( value ) ) {
  13954. delete props[ prop ];
  13955. toggle = toggle || value === "toggle";
  13956. if ( value === ( hidden ? "hide" : "show" ) ) {
  13957. // Pretend to be hidden if this is a "show" and
  13958. // there is still data from a stopped show/hide
  13959. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13960. hidden = true;
  13961. // Ignore all other no-op show/hide data
  13962. } else {
  13963. continue;
  13964. }
  13965. }
  13966. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13967. }
  13968. }
  13969. // Bail out if this is a no-op like .hide().hide()
  13970. propTween = !jQuery.isEmptyObject( props );
  13971. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  13972. return;
  13973. }
  13974. // Restrict "overflow" and "display" styles during box animations
  13975. if ( isBox && elem.nodeType === 1 ) {
  13976. // Support: IE <=9 - 11, Edge 12 - 15
  13977. // Record all 3 overflow attributes because IE does not infer the shorthand
  13978. // from identically-valued overflowX and overflowY and Edge just mirrors
  13979. // the overflowX value there.
  13980. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  13981. // Identify a display type, preferring old show/hide data over the CSS cascade
  13982. restoreDisplay = dataShow && dataShow.display;
  13983. if ( restoreDisplay == null ) {
  13984. restoreDisplay = dataPriv.get( elem, "display" );
  13985. }
  13986. display = jQuery.css( elem, "display" );
  13987. if ( display === "none" ) {
  13988. if ( restoreDisplay ) {
  13989. display = restoreDisplay;
  13990. } else {
  13991. // Get nonempty value(s) by temporarily forcing visibility
  13992. showHide( [ elem ], true );
  13993. restoreDisplay = elem.style.display || restoreDisplay;
  13994. display = jQuery.css( elem, "display" );
  13995. showHide( [ elem ] );
  13996. }
  13997. }
  13998. // Animate inline elements as inline-block
  13999. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14000. if ( jQuery.css( elem, "float" ) === "none" ) {
  14001. // Restore the original display value at the end of pure show/hide animations
  14002. if ( !propTween ) {
  14003. anim.done( function() {
  14004. style.display = restoreDisplay;
  14005. } );
  14006. if ( restoreDisplay == null ) {
  14007. display = style.display;
  14008. restoreDisplay = display === "none" ? "" : display;
  14009. }
  14010. }
  14011. style.display = "inline-block";
  14012. }
  14013. }
  14014. }
  14015. if ( opts.overflow ) {
  14016. style.overflow = "hidden";
  14017. anim.always( function() {
  14018. style.overflow = opts.overflow[ 0 ];
  14019. style.overflowX = opts.overflow[ 1 ];
  14020. style.overflowY = opts.overflow[ 2 ];
  14021. } );
  14022. }
  14023. // Implement show/hide animations
  14024. propTween = false;
  14025. for ( prop in orig ) {
  14026. // General show/hide setup for this element animation
  14027. if ( !propTween ) {
  14028. if ( dataShow ) {
  14029. if ( "hidden" in dataShow ) {
  14030. hidden = dataShow.hidden;
  14031. }
  14032. } else {
  14033. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14034. }
  14035. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14036. if ( toggle ) {
  14037. dataShow.hidden = !hidden;
  14038. }
  14039. // Show elements before animating them
  14040. if ( hidden ) {
  14041. showHide( [ elem ], true );
  14042. }
  14043. /* eslint-disable no-loop-func */
  14044. anim.done( function() {
  14045. /* eslint-enable no-loop-func */
  14046. // The final step of a "hide" animation is actually hiding the element
  14047. if ( !hidden ) {
  14048. showHide( [ elem ] );
  14049. }
  14050. dataPriv.remove( elem, "fxshow" );
  14051. for ( prop in orig ) {
  14052. jQuery.style( elem, prop, orig[ prop ] );
  14053. }
  14054. } );
  14055. }
  14056. // Per-property setup
  14057. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14058. if ( !( prop in dataShow ) ) {
  14059. dataShow[ prop ] = propTween.start;
  14060. if ( hidden ) {
  14061. propTween.end = propTween.start;
  14062. propTween.start = 0;
  14063. }
  14064. }
  14065. }
  14066. }
  14067. function propFilter( props, specialEasing ) {
  14068. var index, name, easing, value, hooks;
  14069. // camelCase, specialEasing and expand cssHook pass
  14070. for ( index in props ) {
  14071. name = camelCase( index );
  14072. easing = specialEasing[ name ];
  14073. value = props[ index ];
  14074. if ( Array.isArray( value ) ) {
  14075. easing = value[ 1 ];
  14076. value = props[ index ] = value[ 0 ];
  14077. }
  14078. if ( index !== name ) {
  14079. props[ name ] = value;
  14080. delete props[ index ];
  14081. }
  14082. hooks = jQuery.cssHooks[ name ];
  14083. if ( hooks && "expand" in hooks ) {
  14084. value = hooks.expand( value );
  14085. delete props[ name ];
  14086. // Not quite $.extend, this won't overwrite existing keys.
  14087. // Reusing 'index' because we have the correct "name"
  14088. for ( index in value ) {
  14089. if ( !( index in props ) ) {
  14090. props[ index ] = value[ index ];
  14091. specialEasing[ index ] = easing;
  14092. }
  14093. }
  14094. } else {
  14095. specialEasing[ name ] = easing;
  14096. }
  14097. }
  14098. }
  14099. function Animation( elem, properties, options ) {
  14100. var result,
  14101. stopped,
  14102. index = 0,
  14103. length = Animation.prefilters.length,
  14104. deferred = jQuery.Deferred().always( function() {
  14105. // Don't match elem in the :animated selector
  14106. delete tick.elem;
  14107. } ),
  14108. tick = function() {
  14109. if ( stopped ) {
  14110. return false;
  14111. }
  14112. var currentTime = fxNow || createFxNow(),
  14113. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14114. // Support: Android 2.3 only
  14115. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14116. temp = remaining / animation.duration || 0,
  14117. percent = 1 - temp,
  14118. index = 0,
  14119. length = animation.tweens.length;
  14120. for ( ; index < length; index++ ) {
  14121. animation.tweens[ index ].run( percent );
  14122. }
  14123. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14124. // If there's more to do, yield
  14125. if ( percent < 1 && length ) {
  14126. return remaining;
  14127. }
  14128. // If this was an empty animation, synthesize a final progress notification
  14129. if ( !length ) {
  14130. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14131. }
  14132. // Resolve the animation and report its conclusion
  14133. deferred.resolveWith( elem, [ animation ] );
  14134. return false;
  14135. },
  14136. animation = deferred.promise( {
  14137. elem: elem,
  14138. props: jQuery.extend( {}, properties ),
  14139. opts: jQuery.extend( true, {
  14140. specialEasing: {},
  14141. easing: jQuery.easing._default
  14142. }, options ),
  14143. originalProperties: properties,
  14144. originalOptions: options,
  14145. startTime: fxNow || createFxNow(),
  14146. duration: options.duration,
  14147. tweens: [],
  14148. createTween: function( prop, end ) {
  14149. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14150. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14151. animation.tweens.push( tween );
  14152. return tween;
  14153. },
  14154. stop: function( gotoEnd ) {
  14155. var index = 0,
  14156. // If we are going to the end, we want to run all the tweens
  14157. // otherwise we skip this part
  14158. length = gotoEnd ? animation.tweens.length : 0;
  14159. if ( stopped ) {
  14160. return this;
  14161. }
  14162. stopped = true;
  14163. for ( ; index < length; index++ ) {
  14164. animation.tweens[ index ].run( 1 );
  14165. }
  14166. // Resolve when we played the last frame; otherwise, reject
  14167. if ( gotoEnd ) {
  14168. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14169. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14170. } else {
  14171. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14172. }
  14173. return this;
  14174. }
  14175. } ),
  14176. props = animation.props;
  14177. propFilter( props, animation.opts.specialEasing );
  14178. for ( ; index < length; index++ ) {
  14179. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14180. if ( result ) {
  14181. if ( isFunction( result.stop ) ) {
  14182. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14183. result.stop.bind( result );
  14184. }
  14185. return result;
  14186. }
  14187. }
  14188. jQuery.map( props, createTween, animation );
  14189. if ( isFunction( animation.opts.start ) ) {
  14190. animation.opts.start.call( elem, animation );
  14191. }
  14192. // Attach callbacks from options
  14193. animation
  14194. .progress( animation.opts.progress )
  14195. .done( animation.opts.done, animation.opts.complete )
  14196. .fail( animation.opts.fail )
  14197. .always( animation.opts.always );
  14198. jQuery.fx.timer(
  14199. jQuery.extend( tick, {
  14200. elem: elem,
  14201. anim: animation,
  14202. queue: animation.opts.queue
  14203. } )
  14204. );
  14205. return animation;
  14206. }
  14207. jQuery.Animation = jQuery.extend( Animation, {
  14208. tweeners: {
  14209. "*": [ function( prop, value ) {
  14210. var tween = this.createTween( prop, value );
  14211. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14212. return tween;
  14213. } ]
  14214. },
  14215. tweener: function( props, callback ) {
  14216. if ( isFunction( props ) ) {
  14217. callback = props;
  14218. props = [ "*" ];
  14219. } else {
  14220. props = props.match( rnothtmlwhite );
  14221. }
  14222. var prop,
  14223. index = 0,
  14224. length = props.length;
  14225. for ( ; index < length; index++ ) {
  14226. prop = props[ index ];
  14227. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14228. Animation.tweeners[ prop ].unshift( callback );
  14229. }
  14230. },
  14231. prefilters: [ defaultPrefilter ],
  14232. prefilter: function( callback, prepend ) {
  14233. if ( prepend ) {
  14234. Animation.prefilters.unshift( callback );
  14235. } else {
  14236. Animation.prefilters.push( callback );
  14237. }
  14238. }
  14239. } );
  14240. jQuery.speed = function( speed, easing, fn ) {
  14241. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14242. complete: fn || !fn && easing ||
  14243. isFunction( speed ) && speed,
  14244. duration: speed,
  14245. easing: fn && easing || easing && !isFunction( easing ) && easing
  14246. };
  14247. // Go to the end state if fx are off
  14248. if ( jQuery.fx.off ) {
  14249. opt.duration = 0;
  14250. } else {
  14251. if ( typeof opt.duration !== "number" ) {
  14252. if ( opt.duration in jQuery.fx.speeds ) {
  14253. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14254. } else {
  14255. opt.duration = jQuery.fx.speeds._default;
  14256. }
  14257. }
  14258. }
  14259. // Normalize opt.queue - true/undefined/null -> "fx"
  14260. if ( opt.queue == null || opt.queue === true ) {
  14261. opt.queue = "fx";
  14262. }
  14263. // Queueing
  14264. opt.old = opt.complete;
  14265. opt.complete = function() {
  14266. if ( isFunction( opt.old ) ) {
  14267. opt.old.call( this );
  14268. }
  14269. if ( opt.queue ) {
  14270. jQuery.dequeue( this, opt.queue );
  14271. }
  14272. };
  14273. return opt;
  14274. };
  14275. jQuery.fn.extend( {
  14276. fadeTo: function( speed, to, easing, callback ) {
  14277. // Show any hidden elements after setting opacity to 0
  14278. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14279. // Animate to the value specified
  14280. .end().animate( { opacity: to }, speed, easing, callback );
  14281. },
  14282. animate: function( prop, speed, easing, callback ) {
  14283. var empty = jQuery.isEmptyObject( prop ),
  14284. optall = jQuery.speed( speed, easing, callback ),
  14285. doAnimation = function() {
  14286. // Operate on a copy of prop so per-property easing won't be lost
  14287. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14288. // Empty animations, or finishing resolves immediately
  14289. if ( empty || dataPriv.get( this, "finish" ) ) {
  14290. anim.stop( true );
  14291. }
  14292. };
  14293. doAnimation.finish = doAnimation;
  14294. return empty || optall.queue === false ?
  14295. this.each( doAnimation ) :
  14296. this.queue( optall.queue, doAnimation );
  14297. },
  14298. stop: function( type, clearQueue, gotoEnd ) {
  14299. var stopQueue = function( hooks ) {
  14300. var stop = hooks.stop;
  14301. delete hooks.stop;
  14302. stop( gotoEnd );
  14303. };
  14304. if ( typeof type !== "string" ) {
  14305. gotoEnd = clearQueue;
  14306. clearQueue = type;
  14307. type = undefined;
  14308. }
  14309. if ( clearQueue && type !== false ) {
  14310. this.queue( type || "fx", [] );
  14311. }
  14312. return this.each( function() {
  14313. var dequeue = true,
  14314. index = type != null && type + "queueHooks",
  14315. timers = jQuery.timers,
  14316. data = dataPriv.get( this );
  14317. if ( index ) {
  14318. if ( data[ index ] && data[ index ].stop ) {
  14319. stopQueue( data[ index ] );
  14320. }
  14321. } else {
  14322. for ( index in data ) {
  14323. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14324. stopQueue( data[ index ] );
  14325. }
  14326. }
  14327. }
  14328. for ( index = timers.length; index--; ) {
  14329. if ( timers[ index ].elem === this &&
  14330. ( type == null || timers[ index ].queue === type ) ) {
  14331. timers[ index ].anim.stop( gotoEnd );
  14332. dequeue = false;
  14333. timers.splice( index, 1 );
  14334. }
  14335. }
  14336. // Start the next in the queue if the last step wasn't forced.
  14337. // Timers currently will call their complete callbacks, which
  14338. // will dequeue but only if they were gotoEnd.
  14339. if ( dequeue || !gotoEnd ) {
  14340. jQuery.dequeue( this, type );
  14341. }
  14342. } );
  14343. },
  14344. finish: function( type ) {
  14345. if ( type !== false ) {
  14346. type = type || "fx";
  14347. }
  14348. return this.each( function() {
  14349. var index,
  14350. data = dataPriv.get( this ),
  14351. queue = data[ type + "queue" ],
  14352. hooks = data[ type + "queueHooks" ],
  14353. timers = jQuery.timers,
  14354. length = queue ? queue.length : 0;
  14355. // Enable finishing flag on private data
  14356. data.finish = true;
  14357. // Empty the queue first
  14358. jQuery.queue( this, type, [] );
  14359. if ( hooks && hooks.stop ) {
  14360. hooks.stop.call( this, true );
  14361. }
  14362. // Look for any active animations, and finish them
  14363. for ( index = timers.length; index--; ) {
  14364. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14365. timers[ index ].anim.stop( true );
  14366. timers.splice( index, 1 );
  14367. }
  14368. }
  14369. // Look for any animations in the old queue and finish them
  14370. for ( index = 0; index < length; index++ ) {
  14371. if ( queue[ index ] && queue[ index ].finish ) {
  14372. queue[ index ].finish.call( this );
  14373. }
  14374. }
  14375. // Turn off finishing flag
  14376. delete data.finish;
  14377. } );
  14378. }
  14379. } );
  14380. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14381. var cssFn = jQuery.fn[ name ];
  14382. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14383. return speed == null || typeof speed === "boolean" ?
  14384. cssFn.apply( this, arguments ) :
  14385. this.animate( genFx( name, true ), speed, easing, callback );
  14386. };
  14387. } );
  14388. // Generate shortcuts for custom animations
  14389. jQuery.each( {
  14390. slideDown: genFx( "show" ),
  14391. slideUp: genFx( "hide" ),
  14392. slideToggle: genFx( "toggle" ),
  14393. fadeIn: { opacity: "show" },
  14394. fadeOut: { opacity: "hide" },
  14395. fadeToggle: { opacity: "toggle" }
  14396. }, function( name, props ) {
  14397. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14398. return this.animate( props, speed, easing, callback );
  14399. };
  14400. } );
  14401. jQuery.timers = [];
  14402. jQuery.fx.tick = function() {
  14403. var timer,
  14404. i = 0,
  14405. timers = jQuery.timers;
  14406. fxNow = Date.now();
  14407. for ( ; i < timers.length; i++ ) {
  14408. timer = timers[ i ];
  14409. // Run the timer and safely remove it when done (allowing for external removal)
  14410. if ( !timer() && timers[ i ] === timer ) {
  14411. timers.splice( i--, 1 );
  14412. }
  14413. }
  14414. if ( !timers.length ) {
  14415. jQuery.fx.stop();
  14416. }
  14417. fxNow = undefined;
  14418. };
  14419. jQuery.fx.timer = function( timer ) {
  14420. jQuery.timers.push( timer );
  14421. jQuery.fx.start();
  14422. };
  14423. jQuery.fx.interval = 13;
  14424. jQuery.fx.start = function() {
  14425. if ( inProgress ) {
  14426. return;
  14427. }
  14428. inProgress = true;
  14429. schedule();
  14430. };
  14431. jQuery.fx.stop = function() {
  14432. inProgress = null;
  14433. };
  14434. jQuery.fx.speeds = {
  14435. slow: 600,
  14436. fast: 200,
  14437. // Default speed
  14438. _default: 400
  14439. };
  14440. // Based off of the plugin by Clint Helfers, with permission.
  14441. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14442. jQuery.fn.delay = function( time, type ) {
  14443. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14444. type = type || "fx";
  14445. return this.queue( type, function( next, hooks ) {
  14446. var timeout = window.setTimeout( next, time );
  14447. hooks.stop = function() {
  14448. window.clearTimeout( timeout );
  14449. };
  14450. } );
  14451. };
  14452. ( function() {
  14453. var input = document.createElement( "input" ),
  14454. select = document.createElement( "select" ),
  14455. opt = select.appendChild( document.createElement( "option" ) );
  14456. input.type = "checkbox";
  14457. // Support: Android <=4.3 only
  14458. // Default value for a checkbox should be "on"
  14459. support.checkOn = input.value !== "";
  14460. // Support: IE <=11 only
  14461. // Must access selectedIndex to make default options select
  14462. support.optSelected = opt.selected;
  14463. // Support: IE <=11 only
  14464. // An input loses its value after becoming a radio
  14465. input = document.createElement( "input" );
  14466. input.value = "t";
  14467. input.type = "radio";
  14468. support.radioValue = input.value === "t";
  14469. } )();
  14470. var boolHook,
  14471. attrHandle = jQuery.expr.attrHandle;
  14472. jQuery.fn.extend( {
  14473. attr: function( name, value ) {
  14474. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14475. },
  14476. removeAttr: function( name ) {
  14477. return this.each( function() {
  14478. jQuery.removeAttr( this, name );
  14479. } );
  14480. }
  14481. } );
  14482. jQuery.extend( {
  14483. attr: function( elem, name, value ) {
  14484. var ret, hooks,
  14485. nType = elem.nodeType;
  14486. // Don't get/set attributes on text, comment and attribute nodes
  14487. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14488. return;
  14489. }
  14490. // Fallback to prop when attributes are not supported
  14491. if ( typeof elem.getAttribute === "undefined" ) {
  14492. return jQuery.prop( elem, name, value );
  14493. }
  14494. // Attribute hooks are determined by the lowercase version
  14495. // Grab necessary hook if one is defined
  14496. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14497. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14498. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14499. }
  14500. if ( value !== undefined ) {
  14501. if ( value === null ) {
  14502. jQuery.removeAttr( elem, name );
  14503. return;
  14504. }
  14505. if ( hooks && "set" in hooks &&
  14506. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14507. return ret;
  14508. }
  14509. elem.setAttribute( name, value + "" );
  14510. return value;
  14511. }
  14512. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14513. return ret;
  14514. }
  14515. ret = jQuery.find.attr( elem, name );
  14516. // Non-existent attributes return null, we normalize to undefined
  14517. return ret == null ? undefined : ret;
  14518. },
  14519. attrHooks: {
  14520. type: {
  14521. set: function( elem, value ) {
  14522. if ( !support.radioValue && value === "radio" &&
  14523. nodeName( elem, "input" ) ) {
  14524. var val = elem.value;
  14525. elem.setAttribute( "type", value );
  14526. if ( val ) {
  14527. elem.value = val;
  14528. }
  14529. return value;
  14530. }
  14531. }
  14532. }
  14533. },
  14534. removeAttr: function( elem, value ) {
  14535. var name,
  14536. i = 0,
  14537. // Attribute names can contain non-HTML whitespace characters
  14538. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14539. attrNames = value && value.match( rnothtmlwhite );
  14540. if ( attrNames && elem.nodeType === 1 ) {
  14541. while ( ( name = attrNames[ i++ ] ) ) {
  14542. elem.removeAttribute( name );
  14543. }
  14544. }
  14545. }
  14546. } );
  14547. // Hooks for boolean attributes
  14548. boolHook = {
  14549. set: function( elem, value, name ) {
  14550. if ( value === false ) {
  14551. // Remove boolean attributes when set to false
  14552. jQuery.removeAttr( elem, name );
  14553. } else {
  14554. elem.setAttribute( name, name );
  14555. }
  14556. return name;
  14557. }
  14558. };
  14559. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14560. var getter = attrHandle[ name ] || jQuery.find.attr;
  14561. attrHandle[ name ] = function( elem, name, isXML ) {
  14562. var ret, handle,
  14563. lowercaseName = name.toLowerCase();
  14564. if ( !isXML ) {
  14565. // Avoid an infinite loop by temporarily removing this function from the getter
  14566. handle = attrHandle[ lowercaseName ];
  14567. attrHandle[ lowercaseName ] = ret;
  14568. ret = getter( elem, name, isXML ) != null ?
  14569. lowercaseName :
  14570. null;
  14571. attrHandle[ lowercaseName ] = handle;
  14572. }
  14573. return ret;
  14574. };
  14575. } );
  14576. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14577. rclickable = /^(?:a|area)$/i;
  14578. jQuery.fn.extend( {
  14579. prop: function( name, value ) {
  14580. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14581. },
  14582. removeProp: function( name ) {
  14583. return this.each( function() {
  14584. delete this[ jQuery.propFix[ name ] || name ];
  14585. } );
  14586. }
  14587. } );
  14588. jQuery.extend( {
  14589. prop: function( elem, name, value ) {
  14590. var ret, hooks,
  14591. nType = elem.nodeType;
  14592. // Don't get/set properties on text, comment and attribute nodes
  14593. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14594. return;
  14595. }
  14596. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14597. // Fix name and attach hooks
  14598. name = jQuery.propFix[ name ] || name;
  14599. hooks = jQuery.propHooks[ name ];
  14600. }
  14601. if ( value !== undefined ) {
  14602. if ( hooks && "set" in hooks &&
  14603. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14604. return ret;
  14605. }
  14606. return ( elem[ name ] = value );
  14607. }
  14608. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14609. return ret;
  14610. }
  14611. return elem[ name ];
  14612. },
  14613. propHooks: {
  14614. tabIndex: {
  14615. get: function( elem ) {
  14616. // Support: IE <=9 - 11 only
  14617. // elem.tabIndex doesn't always return the
  14618. // correct value when it hasn't been explicitly set
  14619. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14620. // Use proper attribute retrieval(#12072)
  14621. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14622. if ( tabindex ) {
  14623. return parseInt( tabindex, 10 );
  14624. }
  14625. if (
  14626. rfocusable.test( elem.nodeName ) ||
  14627. rclickable.test( elem.nodeName ) &&
  14628. elem.href
  14629. ) {
  14630. return 0;
  14631. }
  14632. return -1;
  14633. }
  14634. }
  14635. },
  14636. propFix: {
  14637. "for": "htmlFor",
  14638. "class": "className"
  14639. }
  14640. } );
  14641. // Support: IE <=11 only
  14642. // Accessing the selectedIndex property
  14643. // forces the browser to respect setting selected
  14644. // on the option
  14645. // The getter ensures a default option is selected
  14646. // when in an optgroup
  14647. // eslint rule "no-unused-expressions" is disabled for this code
  14648. // since it considers such accessions noop
  14649. if ( !support.optSelected ) {
  14650. jQuery.propHooks.selected = {
  14651. get: function( elem ) {
  14652. /* eslint no-unused-expressions: "off" */
  14653. var parent = elem.parentNode;
  14654. if ( parent && parent.parentNode ) {
  14655. parent.parentNode.selectedIndex;
  14656. }
  14657. return null;
  14658. },
  14659. set: function( elem ) {
  14660. /* eslint no-unused-expressions: "off" */
  14661. var parent = elem.parentNode;
  14662. if ( parent ) {
  14663. parent.selectedIndex;
  14664. if ( parent.parentNode ) {
  14665. parent.parentNode.selectedIndex;
  14666. }
  14667. }
  14668. }
  14669. };
  14670. }
  14671. jQuery.each( [
  14672. "tabIndex",
  14673. "readOnly",
  14674. "maxLength",
  14675. "cellSpacing",
  14676. "cellPadding",
  14677. "rowSpan",
  14678. "colSpan",
  14679. "useMap",
  14680. "frameBorder",
  14681. "contentEditable"
  14682. ], function() {
  14683. jQuery.propFix[ this.toLowerCase() ] = this;
  14684. } );
  14685. // Strip and collapse whitespace according to HTML spec
  14686. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14687. function stripAndCollapse( value ) {
  14688. var tokens = value.match( rnothtmlwhite ) || [];
  14689. return tokens.join( " " );
  14690. }
  14691. function getClass( elem ) {
  14692. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14693. }
  14694. function classesToArray( value ) {
  14695. if ( Array.isArray( value ) ) {
  14696. return value;
  14697. }
  14698. if ( typeof value === "string" ) {
  14699. return value.match( rnothtmlwhite ) || [];
  14700. }
  14701. return [];
  14702. }
  14703. jQuery.fn.extend( {
  14704. addClass: function( value ) {
  14705. var classes, elem, cur, curValue, clazz, j, finalValue,
  14706. i = 0;
  14707. if ( isFunction( value ) ) {
  14708. return this.each( function( j ) {
  14709. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14710. } );
  14711. }
  14712. classes = classesToArray( value );
  14713. if ( classes.length ) {
  14714. while ( ( elem = this[ i++ ] ) ) {
  14715. curValue = getClass( elem );
  14716. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14717. if ( cur ) {
  14718. j = 0;
  14719. while ( ( clazz = classes[ j++ ] ) ) {
  14720. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14721. cur += clazz + " ";
  14722. }
  14723. }
  14724. // Only assign if different to avoid unneeded rendering.
  14725. finalValue = stripAndCollapse( cur );
  14726. if ( curValue !== finalValue ) {
  14727. elem.setAttribute( "class", finalValue );
  14728. }
  14729. }
  14730. }
  14731. }
  14732. return this;
  14733. },
  14734. removeClass: function( value ) {
  14735. var classes, elem, cur, curValue, clazz, j, finalValue,
  14736. i = 0;
  14737. if ( isFunction( value ) ) {
  14738. return this.each( function( j ) {
  14739. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14740. } );
  14741. }
  14742. if ( !arguments.length ) {
  14743. return this.attr( "class", "" );
  14744. }
  14745. classes = classesToArray( value );
  14746. if ( classes.length ) {
  14747. while ( ( elem = this[ i++ ] ) ) {
  14748. curValue = getClass( elem );
  14749. // This expression is here for better compressibility (see addClass)
  14750. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14751. if ( cur ) {
  14752. j = 0;
  14753. while ( ( clazz = classes[ j++ ] ) ) {
  14754. // Remove *all* instances
  14755. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14756. cur = cur.replace( " " + clazz + " ", " " );
  14757. }
  14758. }
  14759. // Only assign if different to avoid unneeded rendering.
  14760. finalValue = stripAndCollapse( cur );
  14761. if ( curValue !== finalValue ) {
  14762. elem.setAttribute( "class", finalValue );
  14763. }
  14764. }
  14765. }
  14766. }
  14767. return this;
  14768. },
  14769. toggleClass: function( value, stateVal ) {
  14770. var type = typeof value,
  14771. isValidValue = type === "string" || Array.isArray( value );
  14772. if ( typeof stateVal === "boolean" && isValidValue ) {
  14773. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14774. }
  14775. if ( isFunction( value ) ) {
  14776. return this.each( function( i ) {
  14777. jQuery( this ).toggleClass(
  14778. value.call( this, i, getClass( this ), stateVal ),
  14779. stateVal
  14780. );
  14781. } );
  14782. }
  14783. return this.each( function() {
  14784. var className, i, self, classNames;
  14785. if ( isValidValue ) {
  14786. // Toggle individual class names
  14787. i = 0;
  14788. self = jQuery( this );
  14789. classNames = classesToArray( value );
  14790. while ( ( className = classNames[ i++ ] ) ) {
  14791. // Check each className given, space separated list
  14792. if ( self.hasClass( className ) ) {
  14793. self.removeClass( className );
  14794. } else {
  14795. self.addClass( className );
  14796. }
  14797. }
  14798. // Toggle whole class name
  14799. } else if ( value === undefined || type === "boolean" ) {
  14800. className = getClass( this );
  14801. if ( className ) {
  14802. // Store className if set
  14803. dataPriv.set( this, "__className__", className );
  14804. }
  14805. // If the element has a class name or if we're passed `false`,
  14806. // then remove the whole classname (if there was one, the above saved it).
  14807. // Otherwise bring back whatever was previously saved (if anything),
  14808. // falling back to the empty string if nothing was stored.
  14809. if ( this.setAttribute ) {
  14810. this.setAttribute( "class",
  14811. className || value === false ?
  14812. "" :
  14813. dataPriv.get( this, "__className__" ) || ""
  14814. );
  14815. }
  14816. }
  14817. } );
  14818. },
  14819. hasClass: function( selector ) {
  14820. var className, elem,
  14821. i = 0;
  14822. className = " " + selector + " ";
  14823. while ( ( elem = this[ i++ ] ) ) {
  14824. if ( elem.nodeType === 1 &&
  14825. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14826. return true;
  14827. }
  14828. }
  14829. return false;
  14830. }
  14831. } );
  14832. var rreturn = /\r/g;
  14833. jQuery.fn.extend( {
  14834. val: function( value ) {
  14835. var hooks, ret, valueIsFunction,
  14836. elem = this[ 0 ];
  14837. if ( !arguments.length ) {
  14838. if ( elem ) {
  14839. hooks = jQuery.valHooks[ elem.type ] ||
  14840. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14841. if ( hooks &&
  14842. "get" in hooks &&
  14843. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14844. ) {
  14845. return ret;
  14846. }
  14847. ret = elem.value;
  14848. // Handle most common string cases
  14849. if ( typeof ret === "string" ) {
  14850. return ret.replace( rreturn, "" );
  14851. }
  14852. // Handle cases where value is null/undef or number
  14853. return ret == null ? "" : ret;
  14854. }
  14855. return;
  14856. }
  14857. valueIsFunction = isFunction( value );
  14858. return this.each( function( i ) {
  14859. var val;
  14860. if ( this.nodeType !== 1 ) {
  14861. return;
  14862. }
  14863. if ( valueIsFunction ) {
  14864. val = value.call( this, i, jQuery( this ).val() );
  14865. } else {
  14866. val = value;
  14867. }
  14868. // Treat null/undefined as ""; convert numbers to string
  14869. if ( val == null ) {
  14870. val = "";
  14871. } else if ( typeof val === "number" ) {
  14872. val += "";
  14873. } else if ( Array.isArray( val ) ) {
  14874. val = jQuery.map( val, function( value ) {
  14875. return value == null ? "" : value + "";
  14876. } );
  14877. }
  14878. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14879. // If set returns undefined, fall back to normal setting
  14880. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14881. this.value = val;
  14882. }
  14883. } );
  14884. }
  14885. } );
  14886. jQuery.extend( {
  14887. valHooks: {
  14888. option: {
  14889. get: function( elem ) {
  14890. var val = jQuery.find.attr( elem, "value" );
  14891. return val != null ?
  14892. val :
  14893. // Support: IE <=10 - 11 only
  14894. // option.text throws exceptions (#14686, #14858)
  14895. // Strip and collapse whitespace
  14896. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14897. stripAndCollapse( jQuery.text( elem ) );
  14898. }
  14899. },
  14900. select: {
  14901. get: function( elem ) {
  14902. var value, option, i,
  14903. options = elem.options,
  14904. index = elem.selectedIndex,
  14905. one = elem.type === "select-one",
  14906. values = one ? null : [],
  14907. max = one ? index + 1 : options.length;
  14908. if ( index < 0 ) {
  14909. i = max;
  14910. } else {
  14911. i = one ? index : 0;
  14912. }
  14913. // Loop through all the selected options
  14914. for ( ; i < max; i++ ) {
  14915. option = options[ i ];
  14916. // Support: IE <=9 only
  14917. // IE8-9 doesn't update selected after form reset (#2551)
  14918. if ( ( option.selected || i === index ) &&
  14919. // Don't return options that are disabled or in a disabled optgroup
  14920. !option.disabled &&
  14921. ( !option.parentNode.disabled ||
  14922. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14923. // Get the specific value for the option
  14924. value = jQuery( option ).val();
  14925. // We don't need an array for one selects
  14926. if ( one ) {
  14927. return value;
  14928. }
  14929. // Multi-Selects return an array
  14930. values.push( value );
  14931. }
  14932. }
  14933. return values;
  14934. },
  14935. set: function( elem, value ) {
  14936. var optionSet, option,
  14937. options = elem.options,
  14938. values = jQuery.makeArray( value ),
  14939. i = options.length;
  14940. while ( i-- ) {
  14941. option = options[ i ];
  14942. /* eslint-disable no-cond-assign */
  14943. if ( option.selected =
  14944. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14945. ) {
  14946. optionSet = true;
  14947. }
  14948. /* eslint-enable no-cond-assign */
  14949. }
  14950. // Force browsers to behave consistently when non-matching value is set
  14951. if ( !optionSet ) {
  14952. elem.selectedIndex = -1;
  14953. }
  14954. return values;
  14955. }
  14956. }
  14957. }
  14958. } );
  14959. // Radios and checkboxes getter/setter
  14960. jQuery.each( [ "radio", "checkbox" ], function() {
  14961. jQuery.valHooks[ this ] = {
  14962. set: function( elem, value ) {
  14963. if ( Array.isArray( value ) ) {
  14964. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14965. }
  14966. }
  14967. };
  14968. if ( !support.checkOn ) {
  14969. jQuery.valHooks[ this ].get = function( elem ) {
  14970. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  14971. };
  14972. }
  14973. } );
  14974. // Return jQuery for attributes-only inclusion
  14975. support.focusin = "onfocusin" in window;
  14976. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  14977. stopPropagationCallback = function( e ) {
  14978. e.stopPropagation();
  14979. };
  14980. jQuery.extend( jQuery.event, {
  14981. trigger: function( event, data, elem, onlyHandlers ) {
  14982. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  14983. eventPath = [ elem || document ],
  14984. type = hasOwn.call( event, "type" ) ? event.type : event,
  14985. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  14986. cur = lastElement = tmp = elem = elem || document;
  14987. // Don't do events on text and comment nodes
  14988. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  14989. return;
  14990. }
  14991. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  14992. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  14993. return;
  14994. }
  14995. if ( type.indexOf( "." ) > -1 ) {
  14996. // Namespaced trigger; create a regexp to match event type in handle()
  14997. namespaces = type.split( "." );
  14998. type = namespaces.shift();
  14999. namespaces.sort();
  15000. }
  15001. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15002. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15003. event = event[ jQuery.expando ] ?
  15004. event :
  15005. new jQuery.Event( type, typeof event === "object" && event );
  15006. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15007. event.isTrigger = onlyHandlers ? 2 : 3;
  15008. event.namespace = namespaces.join( "." );
  15009. event.rnamespace = event.namespace ?
  15010. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15011. null;
  15012. // Clean up the event in case it is being reused
  15013. event.result = undefined;
  15014. if ( !event.target ) {
  15015. event.target = elem;
  15016. }
  15017. // Clone any incoming data and prepend the event, creating the handler arg list
  15018. data = data == null ?
  15019. [ event ] :
  15020. jQuery.makeArray( data, [ event ] );
  15021. // Allow special events to draw outside the lines
  15022. special = jQuery.event.special[ type ] || {};
  15023. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15024. return;
  15025. }
  15026. // Determine event propagation path in advance, per W3C events spec (#9951)
  15027. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15028. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15029. bubbleType = special.delegateType || type;
  15030. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15031. cur = cur.parentNode;
  15032. }
  15033. for ( ; cur; cur = cur.parentNode ) {
  15034. eventPath.push( cur );
  15035. tmp = cur;
  15036. }
  15037. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15038. if ( tmp === ( elem.ownerDocument || document ) ) {
  15039. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15040. }
  15041. }
  15042. // Fire handlers on the event path
  15043. i = 0;
  15044. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15045. lastElement = cur;
  15046. event.type = i > 1 ?
  15047. bubbleType :
  15048. special.bindType || type;
  15049. // jQuery handler
  15050. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15051. dataPriv.get( cur, "handle" );
  15052. if ( handle ) {
  15053. handle.apply( cur, data );
  15054. }
  15055. // Native handler
  15056. handle = ontype && cur[ ontype ];
  15057. if ( handle && handle.apply && acceptData( cur ) ) {
  15058. event.result = handle.apply( cur, data );
  15059. if ( event.result === false ) {
  15060. event.preventDefault();
  15061. }
  15062. }
  15063. }
  15064. event.type = type;
  15065. // If nobody prevented the default action, do it now
  15066. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15067. if ( ( !special._default ||
  15068. special._default.apply( eventPath.pop(), data ) === false ) &&
  15069. acceptData( elem ) ) {
  15070. // Call a native DOM method on the target with the same name as the event.
  15071. // Don't do default actions on window, that's where global variables be (#6170)
  15072. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15073. // Don't re-trigger an onFOO event when we call its FOO() method
  15074. tmp = elem[ ontype ];
  15075. if ( tmp ) {
  15076. elem[ ontype ] = null;
  15077. }
  15078. // Prevent re-triggering of the same event, since we already bubbled it above
  15079. jQuery.event.triggered = type;
  15080. if ( event.isPropagationStopped() ) {
  15081. lastElement.addEventListener( type, stopPropagationCallback );
  15082. }
  15083. elem[ type ]();
  15084. if ( event.isPropagationStopped() ) {
  15085. lastElement.removeEventListener( type, stopPropagationCallback );
  15086. }
  15087. jQuery.event.triggered = undefined;
  15088. if ( tmp ) {
  15089. elem[ ontype ] = tmp;
  15090. }
  15091. }
  15092. }
  15093. }
  15094. return event.result;
  15095. },
  15096. // Piggyback on a donor event to simulate a different one
  15097. // Used only for `focus(in | out)` events
  15098. simulate: function( type, elem, event ) {
  15099. var e = jQuery.extend(
  15100. new jQuery.Event(),
  15101. event,
  15102. {
  15103. type: type,
  15104. isSimulated: true
  15105. }
  15106. );
  15107. jQuery.event.trigger( e, null, elem );
  15108. }
  15109. } );
  15110. jQuery.fn.extend( {
  15111. trigger: function( type, data ) {
  15112. return this.each( function() {
  15113. jQuery.event.trigger( type, data, this );
  15114. } );
  15115. },
  15116. triggerHandler: function( type, data ) {
  15117. var elem = this[ 0 ];
  15118. if ( elem ) {
  15119. return jQuery.event.trigger( type, data, elem, true );
  15120. }
  15121. }
  15122. } );
  15123. // Support: Firefox <=44
  15124. // Firefox doesn't have focus(in | out) events
  15125. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15126. //
  15127. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15128. // focus(in | out) events fire after focus & blur events,
  15129. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15130. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15131. if ( !support.focusin ) {
  15132. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15133. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15134. var handler = function( event ) {
  15135. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15136. };
  15137. jQuery.event.special[ fix ] = {
  15138. setup: function() {
  15139. var doc = this.ownerDocument || this,
  15140. attaches = dataPriv.access( doc, fix );
  15141. if ( !attaches ) {
  15142. doc.addEventListener( orig, handler, true );
  15143. }
  15144. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15145. },
  15146. teardown: function() {
  15147. var doc = this.ownerDocument || this,
  15148. attaches = dataPriv.access( doc, fix ) - 1;
  15149. if ( !attaches ) {
  15150. doc.removeEventListener( orig, handler, true );
  15151. dataPriv.remove( doc, fix );
  15152. } else {
  15153. dataPriv.access( doc, fix, attaches );
  15154. }
  15155. }
  15156. };
  15157. } );
  15158. }
  15159. var location = window.location;
  15160. var nonce = Date.now();
  15161. var rquery = ( /\?/ );
  15162. // Cross-browser xml parsing
  15163. jQuery.parseXML = function( data ) {
  15164. var xml;
  15165. if ( !data || typeof data !== "string" ) {
  15166. return null;
  15167. }
  15168. // Support: IE 9 - 11 only
  15169. // IE throws on parseFromString with invalid input.
  15170. try {
  15171. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15172. } catch ( e ) {
  15173. xml = undefined;
  15174. }
  15175. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15176. jQuery.error( "Invalid XML: " + data );
  15177. }
  15178. return xml;
  15179. };
  15180. var
  15181. rbracket = /\[\]$/,
  15182. rCRLF = /\r?\n/g,
  15183. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15184. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15185. function buildParams( prefix, obj, traditional, add ) {
  15186. var name;
  15187. if ( Array.isArray( obj ) ) {
  15188. // Serialize array item.
  15189. jQuery.each( obj, function( i, v ) {
  15190. if ( traditional || rbracket.test( prefix ) ) {
  15191. // Treat each array item as a scalar.
  15192. add( prefix, v );
  15193. } else {
  15194. // Item is non-scalar (array or object), encode its numeric index.
  15195. buildParams(
  15196. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15197. v,
  15198. traditional,
  15199. add
  15200. );
  15201. }
  15202. } );
  15203. } else if ( !traditional && toType( obj ) === "object" ) {
  15204. // Serialize object item.
  15205. for ( name in obj ) {
  15206. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15207. }
  15208. } else {
  15209. // Serialize scalar item.
  15210. add( prefix, obj );
  15211. }
  15212. }
  15213. // Serialize an array of form elements or a set of
  15214. // key/values into a query string
  15215. jQuery.param = function( a, traditional ) {
  15216. var prefix,
  15217. s = [],
  15218. add = function( key, valueOrFunction ) {
  15219. // If value is a function, invoke it and use its return value
  15220. var value = isFunction( valueOrFunction ) ?
  15221. valueOrFunction() :
  15222. valueOrFunction;
  15223. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15224. encodeURIComponent( value == null ? "" : value );
  15225. };
  15226. if ( a == null ) {
  15227. return "";
  15228. }
  15229. // If an array was passed in, assume that it is an array of form elements.
  15230. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15231. // Serialize the form elements
  15232. jQuery.each( a, function() {
  15233. add( this.name, this.value );
  15234. } );
  15235. } else {
  15236. // If traditional, encode the "old" way (the way 1.3.2 or older
  15237. // did it), otherwise encode params recursively.
  15238. for ( prefix in a ) {
  15239. buildParams( prefix, a[ prefix ], traditional, add );
  15240. }
  15241. }
  15242. // Return the resulting serialization
  15243. return s.join( "&" );
  15244. };
  15245. jQuery.fn.extend( {
  15246. serialize: function() {
  15247. return jQuery.param( this.serializeArray() );
  15248. },
  15249. serializeArray: function() {
  15250. return this.map( function() {
  15251. // Can add propHook for "elements" to filter or add form elements
  15252. var elements = jQuery.prop( this, "elements" );
  15253. return elements ? jQuery.makeArray( elements ) : this;
  15254. } )
  15255. .filter( function() {
  15256. var type = this.type;
  15257. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15258. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15259. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15260. ( this.checked || !rcheckableType.test( type ) );
  15261. } )
  15262. .map( function( i, elem ) {
  15263. var val = jQuery( this ).val();
  15264. if ( val == null ) {
  15265. return null;
  15266. }
  15267. if ( Array.isArray( val ) ) {
  15268. return jQuery.map( val, function( val ) {
  15269. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15270. } );
  15271. }
  15272. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15273. } ).get();
  15274. }
  15275. } );
  15276. var
  15277. r20 = /%20/g,
  15278. rhash = /#.*$/,
  15279. rantiCache = /([?&])_=[^&]*/,
  15280. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15281. // #7653, #8125, #8152: local protocol detection
  15282. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15283. rnoContent = /^(?:GET|HEAD)$/,
  15284. rprotocol = /^\/\//,
  15285. /* Prefilters
  15286. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15287. * 2) These are called:
  15288. * - BEFORE asking for a transport
  15289. * - AFTER param serialization (s.data is a string if s.processData is true)
  15290. * 3) key is the dataType
  15291. * 4) the catchall symbol "*" can be used
  15292. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15293. */
  15294. prefilters = {},
  15295. /* Transports bindings
  15296. * 1) key is the dataType
  15297. * 2) the catchall symbol "*" can be used
  15298. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15299. */
  15300. transports = {},
  15301. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15302. allTypes = "*/".concat( "*" ),
  15303. // Anchor tag for parsing the document origin
  15304. originAnchor = document.createElement( "a" );
  15305. originAnchor.href = location.href;
  15306. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15307. function addToPrefiltersOrTransports( structure ) {
  15308. // dataTypeExpression is optional and defaults to "*"
  15309. return function( dataTypeExpression, func ) {
  15310. if ( typeof dataTypeExpression !== "string" ) {
  15311. func = dataTypeExpression;
  15312. dataTypeExpression = "*";
  15313. }
  15314. var dataType,
  15315. i = 0,
  15316. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15317. if ( isFunction( func ) ) {
  15318. // For each dataType in the dataTypeExpression
  15319. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15320. // Prepend if requested
  15321. if ( dataType[ 0 ] === "+" ) {
  15322. dataType = dataType.slice( 1 ) || "*";
  15323. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15324. // Otherwise append
  15325. } else {
  15326. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15327. }
  15328. }
  15329. }
  15330. };
  15331. }
  15332. // Base inspection function for prefilters and transports
  15333. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15334. var inspected = {},
  15335. seekingTransport = ( structure === transports );
  15336. function inspect( dataType ) {
  15337. var selected;
  15338. inspected[ dataType ] = true;
  15339. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15340. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15341. if ( typeof dataTypeOrTransport === "string" &&
  15342. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15343. options.dataTypes.unshift( dataTypeOrTransport );
  15344. inspect( dataTypeOrTransport );
  15345. return false;
  15346. } else if ( seekingTransport ) {
  15347. return !( selected = dataTypeOrTransport );
  15348. }
  15349. } );
  15350. return selected;
  15351. }
  15352. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15353. }
  15354. // A special extend for ajax options
  15355. // that takes "flat" options (not to be deep extended)
  15356. // Fixes #9887
  15357. function ajaxExtend( target, src ) {
  15358. var key, deep,
  15359. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15360. for ( key in src ) {
  15361. if ( src[ key ] !== undefined ) {
  15362. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15363. }
  15364. }
  15365. if ( deep ) {
  15366. jQuery.extend( true, target, deep );
  15367. }
  15368. return target;
  15369. }
  15370. /* Handles responses to an ajax request:
  15371. * - finds the right dataType (mediates between content-type and expected dataType)
  15372. * - returns the corresponding response
  15373. */
  15374. function ajaxHandleResponses( s, jqXHR, responses ) {
  15375. var ct, type, finalDataType, firstDataType,
  15376. contents = s.contents,
  15377. dataTypes = s.dataTypes;
  15378. // Remove auto dataType and get content-type in the process
  15379. while ( dataTypes[ 0 ] === "*" ) {
  15380. dataTypes.shift();
  15381. if ( ct === undefined ) {
  15382. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15383. }
  15384. }
  15385. // Check if we're dealing with a known content-type
  15386. if ( ct ) {
  15387. for ( type in contents ) {
  15388. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15389. dataTypes.unshift( type );
  15390. break;
  15391. }
  15392. }
  15393. }
  15394. // Check to see if we have a response for the expected dataType
  15395. if ( dataTypes[ 0 ] in responses ) {
  15396. finalDataType = dataTypes[ 0 ];
  15397. } else {
  15398. // Try convertible dataTypes
  15399. for ( type in responses ) {
  15400. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15401. finalDataType = type;
  15402. break;
  15403. }
  15404. if ( !firstDataType ) {
  15405. firstDataType = type;
  15406. }
  15407. }
  15408. // Or just use first one
  15409. finalDataType = finalDataType || firstDataType;
  15410. }
  15411. // If we found a dataType
  15412. // We add the dataType to the list if needed
  15413. // and return the corresponding response
  15414. if ( finalDataType ) {
  15415. if ( finalDataType !== dataTypes[ 0 ] ) {
  15416. dataTypes.unshift( finalDataType );
  15417. }
  15418. return responses[ finalDataType ];
  15419. }
  15420. }
  15421. /* Chain conversions given the request and the original response
  15422. * Also sets the responseXXX fields on the jqXHR instance
  15423. */
  15424. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15425. var conv2, current, conv, tmp, prev,
  15426. converters = {},
  15427. // Work with a copy of dataTypes in case we need to modify it for conversion
  15428. dataTypes = s.dataTypes.slice();
  15429. // Create converters map with lowercased keys
  15430. if ( dataTypes[ 1 ] ) {
  15431. for ( conv in s.converters ) {
  15432. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15433. }
  15434. }
  15435. current = dataTypes.shift();
  15436. // Convert to each sequential dataType
  15437. while ( current ) {
  15438. if ( s.responseFields[ current ] ) {
  15439. jqXHR[ s.responseFields[ current ] ] = response;
  15440. }
  15441. // Apply the dataFilter if provided
  15442. if ( !prev && isSuccess && s.dataFilter ) {
  15443. response = s.dataFilter( response, s.dataType );
  15444. }
  15445. prev = current;
  15446. current = dataTypes.shift();
  15447. if ( current ) {
  15448. // There's only work to do if current dataType is non-auto
  15449. if ( current === "*" ) {
  15450. current = prev;
  15451. // Convert response if prev dataType is non-auto and differs from current
  15452. } else if ( prev !== "*" && prev !== current ) {
  15453. // Seek a direct converter
  15454. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15455. // If none found, seek a pair
  15456. if ( !conv ) {
  15457. for ( conv2 in converters ) {
  15458. // If conv2 outputs current
  15459. tmp = conv2.split( " " );
  15460. if ( tmp[ 1 ] === current ) {
  15461. // If prev can be converted to accepted input
  15462. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15463. converters[ "* " + tmp[ 0 ] ];
  15464. if ( conv ) {
  15465. // Condense equivalence converters
  15466. if ( conv === true ) {
  15467. conv = converters[ conv2 ];
  15468. // Otherwise, insert the intermediate dataType
  15469. } else if ( converters[ conv2 ] !== true ) {
  15470. current = tmp[ 0 ];
  15471. dataTypes.unshift( tmp[ 1 ] );
  15472. }
  15473. break;
  15474. }
  15475. }
  15476. }
  15477. }
  15478. // Apply converter (if not an equivalence)
  15479. if ( conv !== true ) {
  15480. // Unless errors are allowed to bubble, catch and return them
  15481. if ( conv && s.throws ) {
  15482. response = conv( response );
  15483. } else {
  15484. try {
  15485. response = conv( response );
  15486. } catch ( e ) {
  15487. return {
  15488. state: "parsererror",
  15489. error: conv ? e : "No conversion from " + prev + " to " + current
  15490. };
  15491. }
  15492. }
  15493. }
  15494. }
  15495. }
  15496. }
  15497. return { state: "success", data: response };
  15498. }
  15499. jQuery.extend( {
  15500. // Counter for holding the number of active queries
  15501. active: 0,
  15502. // Last-Modified header cache for next request
  15503. lastModified: {},
  15504. etag: {},
  15505. ajaxSettings: {
  15506. url: location.href,
  15507. type: "GET",
  15508. isLocal: rlocalProtocol.test( location.protocol ),
  15509. global: true,
  15510. processData: true,
  15511. async: true,
  15512. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15513. /*
  15514. timeout: 0,
  15515. data: null,
  15516. dataType: null,
  15517. username: null,
  15518. password: null,
  15519. cache: null,
  15520. throws: false,
  15521. traditional: false,
  15522. headers: {},
  15523. */
  15524. accepts: {
  15525. "*": allTypes,
  15526. text: "text/plain",
  15527. html: "text/html",
  15528. xml: "application/xml, text/xml",
  15529. json: "application/json, text/javascript"
  15530. },
  15531. contents: {
  15532. xml: /\bxml\b/,
  15533. html: /\bhtml/,
  15534. json: /\bjson\b/
  15535. },
  15536. responseFields: {
  15537. xml: "responseXML",
  15538. text: "responseText",
  15539. json: "responseJSON"
  15540. },
  15541. // Data converters
  15542. // Keys separate source (or catchall "*") and destination types with a single space
  15543. converters: {
  15544. // Convert anything to text
  15545. "* text": String,
  15546. // Text to html (true = no transformation)
  15547. "text html": true,
  15548. // Evaluate text as a json expression
  15549. "text json": JSON.parse,
  15550. // Parse text as xml
  15551. "text xml": jQuery.parseXML
  15552. },
  15553. // For options that shouldn't be deep extended:
  15554. // you can add your own custom options here if
  15555. // and when you create one that shouldn't be
  15556. // deep extended (see ajaxExtend)
  15557. flatOptions: {
  15558. url: true,
  15559. context: true
  15560. }
  15561. },
  15562. // Creates a full fledged settings object into target
  15563. // with both ajaxSettings and settings fields.
  15564. // If target is omitted, writes into ajaxSettings.
  15565. ajaxSetup: function( target, settings ) {
  15566. return settings ?
  15567. // Building a settings object
  15568. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15569. // Extending ajaxSettings
  15570. ajaxExtend( jQuery.ajaxSettings, target );
  15571. },
  15572. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15573. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15574. // Main method
  15575. ajax: function( url, options ) {
  15576. // If url is an object, simulate pre-1.5 signature
  15577. if ( typeof url === "object" ) {
  15578. options = url;
  15579. url = undefined;
  15580. }
  15581. // Force options to be an object
  15582. options = options || {};
  15583. var transport,
  15584. // URL without anti-cache param
  15585. cacheURL,
  15586. // Response headers
  15587. responseHeadersString,
  15588. responseHeaders,
  15589. // timeout handle
  15590. timeoutTimer,
  15591. // Url cleanup var
  15592. urlAnchor,
  15593. // Request state (becomes false upon send and true upon completion)
  15594. completed,
  15595. // To know if global events are to be dispatched
  15596. fireGlobals,
  15597. // Loop variable
  15598. i,
  15599. // uncached part of the url
  15600. uncached,
  15601. // Create the final options object
  15602. s = jQuery.ajaxSetup( {}, options ),
  15603. // Callbacks context
  15604. callbackContext = s.context || s,
  15605. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15606. globalEventContext = s.context &&
  15607. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15608. jQuery( callbackContext ) :
  15609. jQuery.event,
  15610. // Deferreds
  15611. deferred = jQuery.Deferred(),
  15612. completeDeferred = jQuery.Callbacks( "once memory" ),
  15613. // Status-dependent callbacks
  15614. statusCode = s.statusCode || {},
  15615. // Headers (they are sent all at once)
  15616. requestHeaders = {},
  15617. requestHeadersNames = {},
  15618. // Default abort message
  15619. strAbort = "canceled",
  15620. // Fake xhr
  15621. jqXHR = {
  15622. readyState: 0,
  15623. // Builds headers hashtable if needed
  15624. getResponseHeader: function( key ) {
  15625. var match;
  15626. if ( completed ) {
  15627. if ( !responseHeaders ) {
  15628. responseHeaders = {};
  15629. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15630. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15631. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15632. .concat( match[ 2 ] );
  15633. }
  15634. }
  15635. match = responseHeaders[ key.toLowerCase() + " " ];
  15636. }
  15637. return match == null ? null : match.join( ", " );
  15638. },
  15639. // Raw string
  15640. getAllResponseHeaders: function() {
  15641. return completed ? responseHeadersString : null;
  15642. },
  15643. // Caches the header
  15644. setRequestHeader: function( name, value ) {
  15645. if ( completed == null ) {
  15646. name = requestHeadersNames[ name.toLowerCase() ] =
  15647. requestHeadersNames[ name.toLowerCase() ] || name;
  15648. requestHeaders[ name ] = value;
  15649. }
  15650. return this;
  15651. },
  15652. // Overrides response content-type header
  15653. overrideMimeType: function( type ) {
  15654. if ( completed == null ) {
  15655. s.mimeType = type;
  15656. }
  15657. return this;
  15658. },
  15659. // Status-dependent callbacks
  15660. statusCode: function( map ) {
  15661. var code;
  15662. if ( map ) {
  15663. if ( completed ) {
  15664. // Execute the appropriate callbacks
  15665. jqXHR.always( map[ jqXHR.status ] );
  15666. } else {
  15667. // Lazy-add the new callbacks in a way that preserves old ones
  15668. for ( code in map ) {
  15669. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15670. }
  15671. }
  15672. }
  15673. return this;
  15674. },
  15675. // Cancel the request
  15676. abort: function( statusText ) {
  15677. var finalText = statusText || strAbort;
  15678. if ( transport ) {
  15679. transport.abort( finalText );
  15680. }
  15681. done( 0, finalText );
  15682. return this;
  15683. }
  15684. };
  15685. // Attach deferreds
  15686. deferred.promise( jqXHR );
  15687. // Add protocol if not provided (prefilters might expect it)
  15688. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15689. // We also use the url parameter if available
  15690. s.url = ( ( url || s.url || location.href ) + "" )
  15691. .replace( rprotocol, location.protocol + "//" );
  15692. // Alias method option to type as per ticket #12004
  15693. s.type = options.method || options.type || s.method || s.type;
  15694. // Extract dataTypes list
  15695. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15696. // A cross-domain request is in order when the origin doesn't match the current origin.
  15697. if ( s.crossDomain == null ) {
  15698. urlAnchor = document.createElement( "a" );
  15699. // Support: IE <=8 - 11, Edge 12 - 15
  15700. // IE throws exception on accessing the href property if url is malformed,
  15701. // e.g. http://example.com:80x/
  15702. try {
  15703. urlAnchor.href = s.url;
  15704. // Support: IE <=8 - 11 only
  15705. // Anchor's host property isn't correctly set when s.url is relative
  15706. urlAnchor.href = urlAnchor.href;
  15707. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15708. urlAnchor.protocol + "//" + urlAnchor.host;
  15709. } catch ( e ) {
  15710. // If there is an error parsing the URL, assume it is crossDomain,
  15711. // it can be rejected by the transport if it is invalid
  15712. s.crossDomain = true;
  15713. }
  15714. }
  15715. // Convert data if not already a string
  15716. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15717. s.data = jQuery.param( s.data, s.traditional );
  15718. }
  15719. // Apply prefilters
  15720. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15721. // If request was aborted inside a prefilter, stop there
  15722. if ( completed ) {
  15723. return jqXHR;
  15724. }
  15725. // We can fire global events as of now if asked to
  15726. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15727. fireGlobals = jQuery.event && s.global;
  15728. // Watch for a new set of requests
  15729. if ( fireGlobals && jQuery.active++ === 0 ) {
  15730. jQuery.event.trigger( "ajaxStart" );
  15731. }
  15732. // Uppercase the type
  15733. s.type = s.type.toUpperCase();
  15734. // Determine if request has content
  15735. s.hasContent = !rnoContent.test( s.type );
  15736. // Save the URL in case we're toying with the If-Modified-Since
  15737. // and/or If-None-Match header later on
  15738. // Remove hash to simplify url manipulation
  15739. cacheURL = s.url.replace( rhash, "" );
  15740. // More options handling for requests with no content
  15741. if ( !s.hasContent ) {
  15742. // Remember the hash so we can put it back
  15743. uncached = s.url.slice( cacheURL.length );
  15744. // If data is available and should be processed, append data to url
  15745. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15746. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15747. // #9682: remove data so that it's not used in an eventual retry
  15748. delete s.data;
  15749. }
  15750. // Add or update anti-cache param if needed
  15751. if ( s.cache === false ) {
  15752. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15753. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15754. }
  15755. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15756. s.url = cacheURL + uncached;
  15757. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15758. } else if ( s.data && s.processData &&
  15759. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15760. s.data = s.data.replace( r20, "+" );
  15761. }
  15762. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15763. if ( s.ifModified ) {
  15764. if ( jQuery.lastModified[ cacheURL ] ) {
  15765. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15766. }
  15767. if ( jQuery.etag[ cacheURL ] ) {
  15768. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15769. }
  15770. }
  15771. // Set the correct header, if data is being sent
  15772. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15773. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15774. }
  15775. // Set the Accepts header for the server, depending on the dataType
  15776. jqXHR.setRequestHeader(
  15777. "Accept",
  15778. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15779. s.accepts[ s.dataTypes[ 0 ] ] +
  15780. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15781. s.accepts[ "*" ]
  15782. );
  15783. // Check for headers option
  15784. for ( i in s.headers ) {
  15785. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15786. }
  15787. // Allow custom headers/mimetypes and early abort
  15788. if ( s.beforeSend &&
  15789. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15790. // Abort if not done already and return
  15791. return jqXHR.abort();
  15792. }
  15793. // Aborting is no longer a cancellation
  15794. strAbort = "abort";
  15795. // Install callbacks on deferreds
  15796. completeDeferred.add( s.complete );
  15797. jqXHR.done( s.success );
  15798. jqXHR.fail( s.error );
  15799. // Get transport
  15800. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15801. // If no transport, we auto-abort
  15802. if ( !transport ) {
  15803. done( -1, "No Transport" );
  15804. } else {
  15805. jqXHR.readyState = 1;
  15806. // Send global event
  15807. if ( fireGlobals ) {
  15808. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15809. }
  15810. // If request was aborted inside ajaxSend, stop there
  15811. if ( completed ) {
  15812. return jqXHR;
  15813. }
  15814. // Timeout
  15815. if ( s.async && s.timeout > 0 ) {
  15816. timeoutTimer = window.setTimeout( function() {
  15817. jqXHR.abort( "timeout" );
  15818. }, s.timeout );
  15819. }
  15820. try {
  15821. completed = false;
  15822. transport.send( requestHeaders, done );
  15823. } catch ( e ) {
  15824. // Rethrow post-completion exceptions
  15825. if ( completed ) {
  15826. throw e;
  15827. }
  15828. // Propagate others as results
  15829. done( -1, e );
  15830. }
  15831. }
  15832. // Callback for when everything is done
  15833. function done( status, nativeStatusText, responses, headers ) {
  15834. var isSuccess, success, error, response, modified,
  15835. statusText = nativeStatusText;
  15836. // Ignore repeat invocations
  15837. if ( completed ) {
  15838. return;
  15839. }
  15840. completed = true;
  15841. // Clear timeout if it exists
  15842. if ( timeoutTimer ) {
  15843. window.clearTimeout( timeoutTimer );
  15844. }
  15845. // Dereference transport for early garbage collection
  15846. // (no matter how long the jqXHR object will be used)
  15847. transport = undefined;
  15848. // Cache response headers
  15849. responseHeadersString = headers || "";
  15850. // Set readyState
  15851. jqXHR.readyState = status > 0 ? 4 : 0;
  15852. // Determine if successful
  15853. isSuccess = status >= 200 && status < 300 || status === 304;
  15854. // Get response data
  15855. if ( responses ) {
  15856. response = ajaxHandleResponses( s, jqXHR, responses );
  15857. }
  15858. // Convert no matter what (that way responseXXX fields are always set)
  15859. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15860. // If successful, handle type chaining
  15861. if ( isSuccess ) {
  15862. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15863. if ( s.ifModified ) {
  15864. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15865. if ( modified ) {
  15866. jQuery.lastModified[ cacheURL ] = modified;
  15867. }
  15868. modified = jqXHR.getResponseHeader( "etag" );
  15869. if ( modified ) {
  15870. jQuery.etag[ cacheURL ] = modified;
  15871. }
  15872. }
  15873. // if no content
  15874. if ( status === 204 || s.type === "HEAD" ) {
  15875. statusText = "nocontent";
  15876. // if not modified
  15877. } else if ( status === 304 ) {
  15878. statusText = "notmodified";
  15879. // If we have data, let's convert it
  15880. } else {
  15881. statusText = response.state;
  15882. success = response.data;
  15883. error = response.error;
  15884. isSuccess = !error;
  15885. }
  15886. } else {
  15887. // Extract error from statusText and normalize for non-aborts
  15888. error = statusText;
  15889. if ( status || !statusText ) {
  15890. statusText = "error";
  15891. if ( status < 0 ) {
  15892. status = 0;
  15893. }
  15894. }
  15895. }
  15896. // Set data for the fake xhr object
  15897. jqXHR.status = status;
  15898. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15899. // Success/Error
  15900. if ( isSuccess ) {
  15901. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15902. } else {
  15903. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15904. }
  15905. // Status-dependent callbacks
  15906. jqXHR.statusCode( statusCode );
  15907. statusCode = undefined;
  15908. if ( fireGlobals ) {
  15909. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15910. [ jqXHR, s, isSuccess ? success : error ] );
  15911. }
  15912. // Complete
  15913. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15914. if ( fireGlobals ) {
  15915. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15916. // Handle the global AJAX counter
  15917. if ( !( --jQuery.active ) ) {
  15918. jQuery.event.trigger( "ajaxStop" );
  15919. }
  15920. }
  15921. }
  15922. return jqXHR;
  15923. },
  15924. getJSON: function( url, data, callback ) {
  15925. return jQuery.get( url, data, callback, "json" );
  15926. },
  15927. getScript: function( url, callback ) {
  15928. return jQuery.get( url, undefined, callback, "script" );
  15929. }
  15930. } );
  15931. jQuery.each( [ "get", "post" ], function( i, method ) {
  15932. jQuery[ method ] = function( url, data, callback, type ) {
  15933. // Shift arguments if data argument was omitted
  15934. if ( isFunction( data ) ) {
  15935. type = type || callback;
  15936. callback = data;
  15937. data = undefined;
  15938. }
  15939. // The url can be an options object (which then must have .url)
  15940. return jQuery.ajax( jQuery.extend( {
  15941. url: url,
  15942. type: method,
  15943. dataType: type,
  15944. data: data,
  15945. success: callback
  15946. }, jQuery.isPlainObject( url ) && url ) );
  15947. };
  15948. } );
  15949. jQuery._evalUrl = function( url, options ) {
  15950. return jQuery.ajax( {
  15951. url: url,
  15952. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15953. type: "GET",
  15954. dataType: "script",
  15955. cache: true,
  15956. async: false,
  15957. global: false,
  15958. // Only evaluate the response if it is successful (gh-4126)
  15959. // dataFilter is not invoked for failure responses, so using it instead
  15960. // of the default converter is kludgy but it works.
  15961. converters: {
  15962. "text script": function() {}
  15963. },
  15964. dataFilter: function( response ) {
  15965. jQuery.globalEval( response, options );
  15966. }
  15967. } );
  15968. };
  15969. jQuery.fn.extend( {
  15970. wrapAll: function( html ) {
  15971. var wrap;
  15972. if ( this[ 0 ] ) {
  15973. if ( isFunction( html ) ) {
  15974. html = html.call( this[ 0 ] );
  15975. }
  15976. // The elements to wrap the target around
  15977. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  15978. if ( this[ 0 ].parentNode ) {
  15979. wrap.insertBefore( this[ 0 ] );
  15980. }
  15981. wrap.map( function() {
  15982. var elem = this;
  15983. while ( elem.firstElementChild ) {
  15984. elem = elem.firstElementChild;
  15985. }
  15986. return elem;
  15987. } ).append( this );
  15988. }
  15989. return this;
  15990. },
  15991. wrapInner: function( html ) {
  15992. if ( isFunction( html ) ) {
  15993. return this.each( function( i ) {
  15994. jQuery( this ).wrapInner( html.call( this, i ) );
  15995. } );
  15996. }
  15997. return this.each( function() {
  15998. var self = jQuery( this ),
  15999. contents = self.contents();
  16000. if ( contents.length ) {
  16001. contents.wrapAll( html );
  16002. } else {
  16003. self.append( html );
  16004. }
  16005. } );
  16006. },
  16007. wrap: function( html ) {
  16008. var htmlIsFunction = isFunction( html );
  16009. return this.each( function( i ) {
  16010. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16011. } );
  16012. },
  16013. unwrap: function( selector ) {
  16014. this.parent( selector ).not( "body" ).each( function() {
  16015. jQuery( this ).replaceWith( this.childNodes );
  16016. } );
  16017. return this;
  16018. }
  16019. } );
  16020. jQuery.expr.pseudos.hidden = function( elem ) {
  16021. return !jQuery.expr.pseudos.visible( elem );
  16022. };
  16023. jQuery.expr.pseudos.visible = function( elem ) {
  16024. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16025. };
  16026. jQuery.ajaxSettings.xhr = function() {
  16027. try {
  16028. return new window.XMLHttpRequest();
  16029. } catch ( e ) {}
  16030. };
  16031. var xhrSuccessStatus = {
  16032. // File protocol always yields status code 0, assume 200
  16033. 0: 200,
  16034. // Support: IE <=9 only
  16035. // #1450: sometimes IE returns 1223 when it should be 204
  16036. 1223: 204
  16037. },
  16038. xhrSupported = jQuery.ajaxSettings.xhr();
  16039. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16040. support.ajax = xhrSupported = !!xhrSupported;
  16041. jQuery.ajaxTransport( function( options ) {
  16042. var callback, errorCallback;
  16043. // Cross domain only allowed if supported through XMLHttpRequest
  16044. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16045. return {
  16046. send: function( headers, complete ) {
  16047. var i,
  16048. xhr = options.xhr();
  16049. xhr.open(
  16050. options.type,
  16051. options.url,
  16052. options.async,
  16053. options.username,
  16054. options.password
  16055. );
  16056. // Apply custom fields if provided
  16057. if ( options.xhrFields ) {
  16058. for ( i in options.xhrFields ) {
  16059. xhr[ i ] = options.xhrFields[ i ];
  16060. }
  16061. }
  16062. // Override mime type if needed
  16063. if ( options.mimeType && xhr.overrideMimeType ) {
  16064. xhr.overrideMimeType( options.mimeType );
  16065. }
  16066. // X-Requested-With header
  16067. // For cross-domain requests, seeing as conditions for a preflight are
  16068. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16069. // (it can always be set on a per-request basis or even using ajaxSetup)
  16070. // For same-domain requests, won't change header if already provided.
  16071. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16072. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16073. }
  16074. // Set headers
  16075. for ( i in headers ) {
  16076. xhr.setRequestHeader( i, headers[ i ] );
  16077. }
  16078. // Callback
  16079. callback = function( type ) {
  16080. return function() {
  16081. if ( callback ) {
  16082. callback = errorCallback = xhr.onload =
  16083. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16084. xhr.onreadystatechange = null;
  16085. if ( type === "abort" ) {
  16086. xhr.abort();
  16087. } else if ( type === "error" ) {
  16088. // Support: IE <=9 only
  16089. // On a manual native abort, IE9 throws
  16090. // errors on any property access that is not readyState
  16091. if ( typeof xhr.status !== "number" ) {
  16092. complete( 0, "error" );
  16093. } else {
  16094. complete(
  16095. // File: protocol always yields status 0; see #8605, #14207
  16096. xhr.status,
  16097. xhr.statusText
  16098. );
  16099. }
  16100. } else {
  16101. complete(
  16102. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16103. xhr.statusText,
  16104. // Support: IE <=9 only
  16105. // IE9 has no XHR2 but throws on binary (trac-11426)
  16106. // For XHR2 non-text, let the caller handle it (gh-2498)
  16107. ( xhr.responseType || "text" ) !== "text" ||
  16108. typeof xhr.responseText !== "string" ?
  16109. { binary: xhr.response } :
  16110. { text: xhr.responseText },
  16111. xhr.getAllResponseHeaders()
  16112. );
  16113. }
  16114. }
  16115. };
  16116. };
  16117. // Listen to events
  16118. xhr.onload = callback();
  16119. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16120. // Support: IE 9 only
  16121. // Use onreadystatechange to replace onabort
  16122. // to handle uncaught aborts
  16123. if ( xhr.onabort !== undefined ) {
  16124. xhr.onabort = errorCallback;
  16125. } else {
  16126. xhr.onreadystatechange = function() {
  16127. // Check readyState before timeout as it changes
  16128. if ( xhr.readyState === 4 ) {
  16129. // Allow onerror to be called first,
  16130. // but that will not handle a native abort
  16131. // Also, save errorCallback to a variable
  16132. // as xhr.onerror cannot be accessed
  16133. window.setTimeout( function() {
  16134. if ( callback ) {
  16135. errorCallback();
  16136. }
  16137. } );
  16138. }
  16139. };
  16140. }
  16141. // Create the abort callback
  16142. callback = callback( "abort" );
  16143. try {
  16144. // Do send the request (this may raise an exception)
  16145. xhr.send( options.hasContent && options.data || null );
  16146. } catch ( e ) {
  16147. // #14683: Only rethrow if this hasn't been notified as an error yet
  16148. if ( callback ) {
  16149. throw e;
  16150. }
  16151. }
  16152. },
  16153. abort: function() {
  16154. if ( callback ) {
  16155. callback();
  16156. }
  16157. }
  16158. };
  16159. }
  16160. } );
  16161. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16162. jQuery.ajaxPrefilter( function( s ) {
  16163. if ( s.crossDomain ) {
  16164. s.contents.script = false;
  16165. }
  16166. } );
  16167. // Install script dataType
  16168. jQuery.ajaxSetup( {
  16169. accepts: {
  16170. script: "text/javascript, application/javascript, " +
  16171. "application/ecmascript, application/x-ecmascript"
  16172. },
  16173. contents: {
  16174. script: /\b(?:java|ecma)script\b/
  16175. },
  16176. converters: {
  16177. "text script": function( text ) {
  16178. jQuery.globalEval( text );
  16179. return text;
  16180. }
  16181. }
  16182. } );
  16183. // Handle cache's special case and crossDomain
  16184. jQuery.ajaxPrefilter( "script", function( s ) {
  16185. if ( s.cache === undefined ) {
  16186. s.cache = false;
  16187. }
  16188. if ( s.crossDomain ) {
  16189. s.type = "GET";
  16190. }
  16191. } );
  16192. // Bind script tag hack transport
  16193. jQuery.ajaxTransport( "script", function( s ) {
  16194. // This transport only deals with cross domain or forced-by-attrs requests
  16195. if ( s.crossDomain || s.scriptAttrs ) {
  16196. var script, callback;
  16197. return {
  16198. send: function( _, complete ) {
  16199. script = jQuery( "<script>" )
  16200. .attr( s.scriptAttrs || {} )
  16201. .prop( { charset: s.scriptCharset, src: s.url } )
  16202. .on( "load error", callback = function( evt ) {
  16203. script.remove();
  16204. callback = null;
  16205. if ( evt ) {
  16206. complete( evt.type === "error" ? 404 : 200, evt.type );
  16207. }
  16208. } );
  16209. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16210. document.head.appendChild( script[ 0 ] );
  16211. },
  16212. abort: function() {
  16213. if ( callback ) {
  16214. callback();
  16215. }
  16216. }
  16217. };
  16218. }
  16219. } );
  16220. var oldCallbacks = [],
  16221. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16222. // Default jsonp settings
  16223. jQuery.ajaxSetup( {
  16224. jsonp: "callback",
  16225. jsonpCallback: function() {
  16226. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16227. this[ callback ] = true;
  16228. return callback;
  16229. }
  16230. } );
  16231. // Detect, normalize options and install callbacks for jsonp requests
  16232. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16233. var callbackName, overwritten, responseContainer,
  16234. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16235. "url" :
  16236. typeof s.data === "string" &&
  16237. ( s.contentType || "" )
  16238. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16239. rjsonp.test( s.data ) && "data"
  16240. );
  16241. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16242. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16243. // Get callback name, remembering preexisting value associated with it
  16244. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16245. s.jsonpCallback() :
  16246. s.jsonpCallback;
  16247. // Insert callback into url or form data
  16248. if ( jsonProp ) {
  16249. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16250. } else if ( s.jsonp !== false ) {
  16251. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16252. }
  16253. // Use data converter to retrieve json after script execution
  16254. s.converters[ "script json" ] = function() {
  16255. if ( !responseContainer ) {
  16256. jQuery.error( callbackName + " was not called" );
  16257. }
  16258. return responseContainer[ 0 ];
  16259. };
  16260. // Force json dataType
  16261. s.dataTypes[ 0 ] = "json";
  16262. // Install callback
  16263. overwritten = window[ callbackName ];
  16264. window[ callbackName ] = function() {
  16265. responseContainer = arguments;
  16266. };
  16267. // Clean-up function (fires after converters)
  16268. jqXHR.always( function() {
  16269. // If previous value didn't exist - remove it
  16270. if ( overwritten === undefined ) {
  16271. jQuery( window ).removeProp( callbackName );
  16272. // Otherwise restore preexisting value
  16273. } else {
  16274. window[ callbackName ] = overwritten;
  16275. }
  16276. // Save back as free
  16277. if ( s[ callbackName ] ) {
  16278. // Make sure that re-using the options doesn't screw things around
  16279. s.jsonpCallback = originalSettings.jsonpCallback;
  16280. // Save the callback name for future use
  16281. oldCallbacks.push( callbackName );
  16282. }
  16283. // Call if it was a function and we have a response
  16284. if ( responseContainer && isFunction( overwritten ) ) {
  16285. overwritten( responseContainer[ 0 ] );
  16286. }
  16287. responseContainer = overwritten = undefined;
  16288. } );
  16289. // Delegate to script
  16290. return "script";
  16291. }
  16292. } );
  16293. // Support: Safari 8 only
  16294. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16295. // collapse sibling forms: the second one becomes a child of the first one.
  16296. // Because of that, this security measure has to be disabled in Safari 8.
  16297. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16298. support.createHTMLDocument = ( function() {
  16299. var body = document.implementation.createHTMLDocument( "" ).body;
  16300. body.innerHTML = "<form></form><form></form>";
  16301. return body.childNodes.length === 2;
  16302. } )();
  16303. // Argument "data" should be string of html
  16304. // context (optional): If specified, the fragment will be created in this context,
  16305. // defaults to document
  16306. // keepScripts (optional): If true, will include scripts passed in the html string
  16307. jQuery.parseHTML = function( data, context, keepScripts ) {
  16308. if ( typeof data !== "string" ) {
  16309. return [];
  16310. }
  16311. if ( typeof context === "boolean" ) {
  16312. keepScripts = context;
  16313. context = false;
  16314. }
  16315. var base, parsed, scripts;
  16316. if ( !context ) {
  16317. // Stop scripts or inline event handlers from being executed immediately
  16318. // by using document.implementation
  16319. if ( support.createHTMLDocument ) {
  16320. context = document.implementation.createHTMLDocument( "" );
  16321. // Set the base href for the created document
  16322. // so any parsed elements with URLs
  16323. // are based on the document's URL (gh-2965)
  16324. base = context.createElement( "base" );
  16325. base.href = document.location.href;
  16326. context.head.appendChild( base );
  16327. } else {
  16328. context = document;
  16329. }
  16330. }
  16331. parsed = rsingleTag.exec( data );
  16332. scripts = !keepScripts && [];
  16333. // Single tag
  16334. if ( parsed ) {
  16335. return [ context.createElement( parsed[ 1 ] ) ];
  16336. }
  16337. parsed = buildFragment( [ data ], context, scripts );
  16338. if ( scripts && scripts.length ) {
  16339. jQuery( scripts ).remove();
  16340. }
  16341. return jQuery.merge( [], parsed.childNodes );
  16342. };
  16343. /**
  16344. * Load a url into a page
  16345. */
  16346. jQuery.fn.load = function( url, params, callback ) {
  16347. var selector, type, response,
  16348. self = this,
  16349. off = url.indexOf( " " );
  16350. if ( off > -1 ) {
  16351. selector = stripAndCollapse( url.slice( off ) );
  16352. url = url.slice( 0, off );
  16353. }
  16354. // If it's a function
  16355. if ( isFunction( params ) ) {
  16356. // We assume that it's the callback
  16357. callback = params;
  16358. params = undefined;
  16359. // Otherwise, build a param string
  16360. } else if ( params && typeof params === "object" ) {
  16361. type = "POST";
  16362. }
  16363. // If we have elements to modify, make the request
  16364. if ( self.length > 0 ) {
  16365. jQuery.ajax( {
  16366. url: url,
  16367. // If "type" variable is undefined, then "GET" method will be used.
  16368. // Make value of this field explicit since
  16369. // user can override it through ajaxSetup method
  16370. type: type || "GET",
  16371. dataType: "html",
  16372. data: params
  16373. } ).done( function( responseText ) {
  16374. // Save response for use in complete callback
  16375. response = arguments;
  16376. self.html( selector ?
  16377. // If a selector was specified, locate the right elements in a dummy div
  16378. // Exclude scripts to avoid IE 'Permission Denied' errors
  16379. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16380. // Otherwise use the full result
  16381. responseText );
  16382. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16383. // but they are ignored because response was set above.
  16384. // If it fails, this function gets "jqXHR", "status", "error"
  16385. } ).always( callback && function( jqXHR, status ) {
  16386. self.each( function() {
  16387. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16388. } );
  16389. } );
  16390. }
  16391. return this;
  16392. };
  16393. // Attach a bunch of functions for handling common AJAX events
  16394. jQuery.each( [
  16395. "ajaxStart",
  16396. "ajaxStop",
  16397. "ajaxComplete",
  16398. "ajaxError",
  16399. "ajaxSuccess",
  16400. "ajaxSend"
  16401. ], function( i, type ) {
  16402. jQuery.fn[ type ] = function( fn ) {
  16403. return this.on( type, fn );
  16404. };
  16405. } );
  16406. jQuery.expr.pseudos.animated = function( elem ) {
  16407. return jQuery.grep( jQuery.timers, function( fn ) {
  16408. return elem === fn.elem;
  16409. } ).length;
  16410. };
  16411. jQuery.offset = {
  16412. setOffset: function( elem, options, i ) {
  16413. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16414. position = jQuery.css( elem, "position" ),
  16415. curElem = jQuery( elem ),
  16416. props = {};
  16417. // Set position first, in-case top/left are set even on static elem
  16418. if ( position === "static" ) {
  16419. elem.style.position = "relative";
  16420. }
  16421. curOffset = curElem.offset();
  16422. curCSSTop = jQuery.css( elem, "top" );
  16423. curCSSLeft = jQuery.css( elem, "left" );
  16424. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16425. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16426. // Need to be able to calculate position if either
  16427. // top or left is auto and position is either absolute or fixed
  16428. if ( calculatePosition ) {
  16429. curPosition = curElem.position();
  16430. curTop = curPosition.top;
  16431. curLeft = curPosition.left;
  16432. } else {
  16433. curTop = parseFloat( curCSSTop ) || 0;
  16434. curLeft = parseFloat( curCSSLeft ) || 0;
  16435. }
  16436. if ( isFunction( options ) ) {
  16437. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16438. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16439. }
  16440. if ( options.top != null ) {
  16441. props.top = ( options.top - curOffset.top ) + curTop;
  16442. }
  16443. if ( options.left != null ) {
  16444. props.left = ( options.left - curOffset.left ) + curLeft;
  16445. }
  16446. if ( "using" in options ) {
  16447. options.using.call( elem, props );
  16448. } else {
  16449. curElem.css( props );
  16450. }
  16451. }
  16452. };
  16453. jQuery.fn.extend( {
  16454. // offset() relates an element's border box to the document origin
  16455. offset: function( options ) {
  16456. // Preserve chaining for setter
  16457. if ( arguments.length ) {
  16458. return options === undefined ?
  16459. this :
  16460. this.each( function( i ) {
  16461. jQuery.offset.setOffset( this, options, i );
  16462. } );
  16463. }
  16464. var rect, win,
  16465. elem = this[ 0 ];
  16466. if ( !elem ) {
  16467. return;
  16468. }
  16469. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16470. // Support: IE <=11 only
  16471. // Running getBoundingClientRect on a
  16472. // disconnected node in IE throws an error
  16473. if ( !elem.getClientRects().length ) {
  16474. return { top: 0, left: 0 };
  16475. }
  16476. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16477. rect = elem.getBoundingClientRect();
  16478. win = elem.ownerDocument.defaultView;
  16479. return {
  16480. top: rect.top + win.pageYOffset,
  16481. left: rect.left + win.pageXOffset
  16482. };
  16483. },
  16484. // position() relates an element's margin box to its offset parent's padding box
  16485. // This corresponds to the behavior of CSS absolute positioning
  16486. position: function() {
  16487. if ( !this[ 0 ] ) {
  16488. return;
  16489. }
  16490. var offsetParent, offset, doc,
  16491. elem = this[ 0 ],
  16492. parentOffset = { top: 0, left: 0 };
  16493. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16494. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16495. // Assume position:fixed implies availability of getBoundingClientRect
  16496. offset = elem.getBoundingClientRect();
  16497. } else {
  16498. offset = this.offset();
  16499. // Account for the *real* offset parent, which can be the document or its root element
  16500. // when a statically positioned element is identified
  16501. doc = elem.ownerDocument;
  16502. offsetParent = elem.offsetParent || doc.documentElement;
  16503. while ( offsetParent &&
  16504. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16505. jQuery.css( offsetParent, "position" ) === "static" ) {
  16506. offsetParent = offsetParent.parentNode;
  16507. }
  16508. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16509. // Incorporate borders into its offset, since they are outside its content origin
  16510. parentOffset = jQuery( offsetParent ).offset();
  16511. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16512. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16513. }
  16514. }
  16515. // Subtract parent offsets and element margins
  16516. return {
  16517. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16518. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16519. };
  16520. },
  16521. // This method will return documentElement in the following cases:
  16522. // 1) For the element inside the iframe without offsetParent, this method will return
  16523. // documentElement of the parent window
  16524. // 2) For the hidden or detached element
  16525. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16526. //
  16527. // but those exceptions were never presented as a real life use-cases
  16528. // and might be considered as more preferable results.
  16529. //
  16530. // This logic, however, is not guaranteed and can change at any point in the future
  16531. offsetParent: function() {
  16532. return this.map( function() {
  16533. var offsetParent = this.offsetParent;
  16534. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16535. offsetParent = offsetParent.offsetParent;
  16536. }
  16537. return offsetParent || documentElement;
  16538. } );
  16539. }
  16540. } );
  16541. // Create scrollLeft and scrollTop methods
  16542. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16543. var top = "pageYOffset" === prop;
  16544. jQuery.fn[ method ] = function( val ) {
  16545. return access( this, function( elem, method, val ) {
  16546. // Coalesce documents and windows
  16547. var win;
  16548. if ( isWindow( elem ) ) {
  16549. win = elem;
  16550. } else if ( elem.nodeType === 9 ) {
  16551. win = elem.defaultView;
  16552. }
  16553. if ( val === undefined ) {
  16554. return win ? win[ prop ] : elem[ method ];
  16555. }
  16556. if ( win ) {
  16557. win.scrollTo(
  16558. !top ? val : win.pageXOffset,
  16559. top ? val : win.pageYOffset
  16560. );
  16561. } else {
  16562. elem[ method ] = val;
  16563. }
  16564. }, method, val, arguments.length );
  16565. };
  16566. } );
  16567. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16568. // Add the top/left cssHooks using jQuery.fn.position
  16569. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16570. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16571. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16572. // rather than make the css module depend on the offset module, just check for it here
  16573. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16574. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16575. function( elem, computed ) {
  16576. if ( computed ) {
  16577. computed = curCSS( elem, prop );
  16578. // If curCSS returns percentage, fallback to offset
  16579. return rnumnonpx.test( computed ) ?
  16580. jQuery( elem ).position()[ prop ] + "px" :
  16581. computed;
  16582. }
  16583. }
  16584. );
  16585. } );
  16586. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16587. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16588. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16589. function( defaultExtra, funcName ) {
  16590. // Margin is only for outerHeight, outerWidth
  16591. jQuery.fn[ funcName ] = function( margin, value ) {
  16592. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16593. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16594. return access( this, function( elem, type, value ) {
  16595. var doc;
  16596. if ( isWindow( elem ) ) {
  16597. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16598. return funcName.indexOf( "outer" ) === 0 ?
  16599. elem[ "inner" + name ] :
  16600. elem.document.documentElement[ "client" + name ];
  16601. }
  16602. // Get document width or height
  16603. if ( elem.nodeType === 9 ) {
  16604. doc = elem.documentElement;
  16605. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16606. // whichever is greatest
  16607. return Math.max(
  16608. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16609. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16610. doc[ "client" + name ]
  16611. );
  16612. }
  16613. return value === undefined ?
  16614. // Get width or height on the element, requesting but not forcing parseFloat
  16615. jQuery.css( elem, type, extra ) :
  16616. // Set width or height on the element
  16617. jQuery.style( elem, type, value, extra );
  16618. }, type, chainable ? margin : undefined, chainable );
  16619. };
  16620. } );
  16621. } );
  16622. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16623. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16624. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16625. function( i, name ) {
  16626. // Handle event binding
  16627. jQuery.fn[ name ] = function( data, fn ) {
  16628. return arguments.length > 0 ?
  16629. this.on( name, null, data, fn ) :
  16630. this.trigger( name );
  16631. };
  16632. } );
  16633. jQuery.fn.extend( {
  16634. hover: function( fnOver, fnOut ) {
  16635. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16636. }
  16637. } );
  16638. jQuery.fn.extend( {
  16639. bind: function( types, data, fn ) {
  16640. return this.on( types, null, data, fn );
  16641. },
  16642. unbind: function( types, fn ) {
  16643. return this.off( types, null, fn );
  16644. },
  16645. delegate: function( selector, types, data, fn ) {
  16646. return this.on( types, selector, data, fn );
  16647. },
  16648. undelegate: function( selector, types, fn ) {
  16649. // ( namespace ) or ( selector, types [, fn] )
  16650. return arguments.length === 1 ?
  16651. this.off( selector, "**" ) :
  16652. this.off( types, selector || "**", fn );
  16653. }
  16654. } );
  16655. // Bind a function to a context, optionally partially applying any
  16656. // arguments.
  16657. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16658. // However, it is not slated for removal any time soon
  16659. jQuery.proxy = function( fn, context ) {
  16660. var tmp, args, proxy;
  16661. if ( typeof context === "string" ) {
  16662. tmp = fn[ context ];
  16663. context = fn;
  16664. fn = tmp;
  16665. }
  16666. // Quick check to determine if target is callable, in the spec
  16667. // this throws a TypeError, but we will just return undefined.
  16668. if ( !isFunction( fn ) ) {
  16669. return undefined;
  16670. }
  16671. // Simulated bind
  16672. args = slice.call( arguments, 2 );
  16673. proxy = function() {
  16674. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16675. };
  16676. // Set the guid of unique handler to the same of original handler, so it can be removed
  16677. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16678. return proxy;
  16679. };
  16680. jQuery.holdReady = function( hold ) {
  16681. if ( hold ) {
  16682. jQuery.readyWait++;
  16683. } else {
  16684. jQuery.ready( true );
  16685. }
  16686. };
  16687. jQuery.isArray = Array.isArray;
  16688. jQuery.parseJSON = JSON.parse;
  16689. jQuery.nodeName = nodeName;
  16690. jQuery.isFunction = isFunction;
  16691. jQuery.isWindow = isWindow;
  16692. jQuery.camelCase = camelCase;
  16693. jQuery.type = toType;
  16694. jQuery.now = Date.now;
  16695. jQuery.isNumeric = function( obj ) {
  16696. // As of jQuery 3.0, isNumeric is limited to
  16697. // strings and numbers (primitives or objects)
  16698. // that can be coerced to finite numbers (gh-2662)
  16699. var type = jQuery.type( obj );
  16700. return ( type === "number" || type === "string" ) &&
  16701. // parseFloat NaNs numeric-cast false positives ("")
  16702. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16703. // subtraction forces infinities to NaN
  16704. !isNaN( obj - parseFloat( obj ) );
  16705. };
  16706. // Register as a named AMD module, since jQuery can be concatenated with other
  16707. // files that may use define, but not via a proper concatenation script that
  16708. // understands anonymous AMD modules. A named AMD is safest and most robust
  16709. // way to register. Lowercase jquery is used because AMD module names are
  16710. // derived from file names, and jQuery is normally delivered in a lowercase
  16711. // file name. Do this after creating the global so that if an AMD module wants
  16712. // to call noConflict to hide this version of jQuery, it will work.
  16713. // Note that for maximum portability, libraries that are not jQuery should
  16714. // declare themselves as anonymous modules, and avoid setting a global if an
  16715. // AMD loader is present. jQuery is a special case. For more information, see
  16716. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16717. if ( true ) {
  16718. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16719. return jQuery;
  16720. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16721. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16722. }
  16723. var
  16724. // Map over jQuery in case of overwrite
  16725. _jQuery = window.jQuery,
  16726. // Map over the $ in case of overwrite
  16727. _$ = window.$;
  16728. jQuery.noConflict = function( deep ) {
  16729. if ( window.$ === jQuery ) {
  16730. window.$ = _$;
  16731. }
  16732. if ( deep && window.jQuery === jQuery ) {
  16733. window.jQuery = _jQuery;
  16734. }
  16735. return jQuery;
  16736. };
  16737. // Expose jQuery and $ identifiers, even in AMD
  16738. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16739. // and CommonJS for browser emulators (#13566)
  16740. if ( !noGlobal ) {
  16741. window.jQuery = window.$ = jQuery;
  16742. }
  16743. return jQuery;
  16744. } );
  16745. /***/ }),
  16746. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16747. /*!************************************************!*\
  16748. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16749. \************************************************/
  16750. /*! exports provided: default */
  16751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16752. "use strict";
  16753. __webpack_require__.r(__webpack_exports__);
  16754. var classCallCheck = function (instance, Constructor) {
  16755. if (!(instance instanceof Constructor)) {
  16756. throw new TypeError("Cannot call a class as a function");
  16757. }
  16758. };
  16759. var createClass = function () {
  16760. function defineProperties(target, props) {
  16761. for (var i = 0; i < props.length; i++) {
  16762. var descriptor = props[i];
  16763. descriptor.enumerable = descriptor.enumerable || false;
  16764. descriptor.configurable = true;
  16765. if ("value" in descriptor) descriptor.writable = true;
  16766. Object.defineProperty(target, descriptor.key, descriptor);
  16767. }
  16768. }
  16769. return function (Constructor, protoProps, staticProps) {
  16770. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16771. if (staticProps) defineProperties(Constructor, staticProps);
  16772. return Constructor;
  16773. };
  16774. }();
  16775. var _extends = Object.assign || function (target) {
  16776. for (var i = 1; i < arguments.length; i++) {
  16777. var source = arguments[i];
  16778. for (var key in source) {
  16779. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16780. target[key] = source[key];
  16781. }
  16782. }
  16783. }
  16784. return target;
  16785. };
  16786. var inherits = function (subClass, superClass) {
  16787. if (typeof superClass !== "function" && superClass !== null) {
  16788. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16789. }
  16790. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16791. constructor: {
  16792. value: subClass,
  16793. enumerable: false,
  16794. writable: true,
  16795. configurable: true
  16796. }
  16797. });
  16798. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16799. };
  16800. var possibleConstructorReturn = function (self, call) {
  16801. if (!self) {
  16802. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16803. }
  16804. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16805. };
  16806. var Connector = function () {
  16807. /**
  16808. * Create a new class instance.
  16809. */
  16810. function Connector(options) {
  16811. classCallCheck(this, Connector);
  16812. /**
  16813. * Default connector options.
  16814. */
  16815. this._defaultOptions = {
  16816. auth: {
  16817. headers: {}
  16818. },
  16819. authEndpoint: '/broadcasting/auth',
  16820. broadcaster: 'pusher',
  16821. csrfToken: null,
  16822. host: null,
  16823. key: null,
  16824. namespace: 'App.Events'
  16825. };
  16826. this.setOptions(options);
  16827. this.connect();
  16828. }
  16829. /**
  16830. * Merge the custom options with the defaults.
  16831. */
  16832. createClass(Connector, [{
  16833. key: 'setOptions',
  16834. value: function setOptions(options) {
  16835. this.options = _extends(this._defaultOptions, options);
  16836. if (this.csrfToken()) {
  16837. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16838. }
  16839. return options;
  16840. }
  16841. /**
  16842. * Extract the CSRF token from the page.
  16843. */
  16844. }, {
  16845. key: 'csrfToken',
  16846. value: function csrfToken() {
  16847. var selector = void 0;
  16848. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16849. return window['Laravel'].csrfToken;
  16850. } else if (this.options.csrfToken) {
  16851. return this.options.csrfToken;
  16852. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16853. return selector.getAttribute('content');
  16854. }
  16855. return null;
  16856. }
  16857. }]);
  16858. return Connector;
  16859. }();
  16860. /**
  16861. * This class represents a basic channel.
  16862. */
  16863. var Channel = function () {
  16864. function Channel() {
  16865. classCallCheck(this, Channel);
  16866. }
  16867. createClass(Channel, [{
  16868. key: 'listenForWhisper',
  16869. /**
  16870. * Listen for a whisper event on the channel instance.
  16871. */
  16872. value: function listenForWhisper(event, callback) {
  16873. return this.listen('.client-' + event, callback);
  16874. }
  16875. /**
  16876. * Listen for an event on the channel instance.
  16877. */
  16878. }, {
  16879. key: 'notification',
  16880. value: function notification(callback) {
  16881. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16882. }
  16883. /**
  16884. * Stop listening for a whispser event on the channel instance.
  16885. */
  16886. }, {
  16887. key: 'stopListeningForWhisper',
  16888. value: function stopListeningForWhisper(event) {
  16889. return this.stopListening('.client-' + event);
  16890. }
  16891. }]);
  16892. return Channel;
  16893. }();
  16894. /**
  16895. * Event name formatter
  16896. */
  16897. var EventFormatter = function () {
  16898. /**
  16899. * Create a new class instance.
  16900. */
  16901. function EventFormatter(namespace) {
  16902. classCallCheck(this, EventFormatter);
  16903. this.setNamespace(namespace);
  16904. }
  16905. /**
  16906. * Format the given event name.
  16907. */
  16908. createClass(EventFormatter, [{
  16909. key: 'format',
  16910. value: function format(event) {
  16911. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16912. return event.substr(1);
  16913. } else if (this.namespace) {
  16914. event = this.namespace + '.' + event;
  16915. }
  16916. return event.replace(/\./g, '\\');
  16917. }
  16918. /**
  16919. * Set the event namespace.
  16920. */
  16921. }, {
  16922. key: 'setNamespace',
  16923. value: function setNamespace(value) {
  16924. this.namespace = value;
  16925. }
  16926. }]);
  16927. return EventFormatter;
  16928. }();
  16929. /**
  16930. * This class represents a Pusher channel.
  16931. */
  16932. var PusherChannel = function (_Channel) {
  16933. inherits(PusherChannel, _Channel);
  16934. /**
  16935. * Create a new class instance.
  16936. */
  16937. function PusherChannel(pusher, name, options) {
  16938. classCallCheck(this, PusherChannel);
  16939. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16940. _this.name = name;
  16941. _this.pusher = pusher;
  16942. _this.options = options;
  16943. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16944. _this.subscribe();
  16945. return _this;
  16946. }
  16947. /**
  16948. * Subscribe to a Pusher channel.
  16949. */
  16950. createClass(PusherChannel, [{
  16951. key: 'subscribe',
  16952. value: function subscribe() {
  16953. this.subscription = this.pusher.subscribe(this.name);
  16954. }
  16955. /**
  16956. * Unsubscribe from a Pusher channel.
  16957. */
  16958. }, {
  16959. key: 'unsubscribe',
  16960. value: function unsubscribe() {
  16961. this.pusher.unsubscribe(this.name);
  16962. }
  16963. /**
  16964. * Listen for an event on the channel instance.
  16965. */
  16966. }, {
  16967. key: 'listen',
  16968. value: function listen(event, callback) {
  16969. this.on(this.eventFormatter.format(event), callback);
  16970. return this;
  16971. }
  16972. /**
  16973. * Stop listening for an event on the channel instance.
  16974. */
  16975. }, {
  16976. key: 'stopListening',
  16977. value: function stopListening(event) {
  16978. this.subscription.unbind(this.eventFormatter.format(event));
  16979. return this;
  16980. }
  16981. /**
  16982. * Bind a channel to an event.
  16983. */
  16984. }, {
  16985. key: 'on',
  16986. value: function on(event, callback) {
  16987. this.subscription.bind(event, callback);
  16988. return this;
  16989. }
  16990. }]);
  16991. return PusherChannel;
  16992. }(Channel);
  16993. /**
  16994. * This class represents a Pusher private channel.
  16995. */
  16996. var PusherPrivateChannel = function (_PusherChannel) {
  16997. inherits(PusherPrivateChannel, _PusherChannel);
  16998. function PusherPrivateChannel() {
  16999. classCallCheck(this, PusherPrivateChannel);
  17000. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17001. }
  17002. createClass(PusherPrivateChannel, [{
  17003. key: 'whisper',
  17004. /**
  17005. * Trigger client event on the channel.
  17006. */
  17007. value: function whisper(eventName, data) {
  17008. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17009. return this;
  17010. }
  17011. }]);
  17012. return PusherPrivateChannel;
  17013. }(PusherChannel);
  17014. /**
  17015. * This class represents a Pusher presence channel.
  17016. */
  17017. var PusherPresenceChannel = function (_PusherChannel) {
  17018. inherits(PusherPresenceChannel, _PusherChannel);
  17019. function PusherPresenceChannel() {
  17020. classCallCheck(this, PusherPresenceChannel);
  17021. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17022. }
  17023. createClass(PusherPresenceChannel, [{
  17024. key: 'here',
  17025. /**
  17026. * Register a callback to be called anytime the member list changes.
  17027. */
  17028. value: function here(callback) {
  17029. this.on('pusher:subscription_succeeded', function (data) {
  17030. callback(Object.keys(data.members).map(function (k) {
  17031. return data.members[k];
  17032. }));
  17033. });
  17034. return this;
  17035. }
  17036. /**
  17037. * Listen for someone joining the channel.
  17038. */
  17039. }, {
  17040. key: 'joining',
  17041. value: function joining(callback) {
  17042. this.on('pusher:member_added', function (member) {
  17043. callback(member.info);
  17044. });
  17045. return this;
  17046. }
  17047. /**
  17048. * Listen for someone leaving the channel.
  17049. */
  17050. }, {
  17051. key: 'leaving',
  17052. value: function leaving(callback) {
  17053. this.on('pusher:member_removed', function (member) {
  17054. callback(member.info);
  17055. });
  17056. return this;
  17057. }
  17058. /**
  17059. * Trigger client event on the channel.
  17060. */
  17061. }, {
  17062. key: 'whisper',
  17063. value: function whisper(eventName, data) {
  17064. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17065. return this;
  17066. }
  17067. }]);
  17068. return PusherPresenceChannel;
  17069. }(PusherChannel);
  17070. /**
  17071. * This class represents a Socket.io channel.
  17072. */
  17073. var SocketIoChannel = function (_Channel) {
  17074. inherits(SocketIoChannel, _Channel);
  17075. /**
  17076. * Create a new class instance.
  17077. */
  17078. function SocketIoChannel(socket, name, options) {
  17079. classCallCheck(this, SocketIoChannel);
  17080. /**
  17081. * The event callbacks applied to the channel.
  17082. */
  17083. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17084. _this.events = {};
  17085. _this.name = name;
  17086. _this.socket = socket;
  17087. _this.options = options;
  17088. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17089. _this.subscribe();
  17090. _this.configureReconnector();
  17091. return _this;
  17092. }
  17093. /**
  17094. * Subscribe to a Socket.io channel.
  17095. */
  17096. createClass(SocketIoChannel, [{
  17097. key: 'subscribe',
  17098. value: function subscribe() {
  17099. this.socket.emit('subscribe', {
  17100. channel: this.name,
  17101. auth: this.options.auth || {}
  17102. });
  17103. }
  17104. /**
  17105. * Unsubscribe from channel and ubind event callbacks.
  17106. */
  17107. }, {
  17108. key: 'unsubscribe',
  17109. value: function unsubscribe() {
  17110. this.unbind();
  17111. this.socket.emit('unsubscribe', {
  17112. channel: this.name,
  17113. auth: this.options.auth || {}
  17114. });
  17115. }
  17116. /**
  17117. * Listen for an event on the channel instance.
  17118. */
  17119. }, {
  17120. key: 'listen',
  17121. value: function listen(event, callback) {
  17122. this.on(this.eventFormatter.format(event), callback);
  17123. return this;
  17124. }
  17125. /**
  17126. * Stop listening for an event on the channel instance.
  17127. */
  17128. }, {
  17129. key: 'stopListening',
  17130. value: function stopListening(event) {
  17131. var name = this.eventFormatter.format(event);
  17132. this.socket.removeListener(name);
  17133. delete this.events[name];
  17134. return this;
  17135. }
  17136. /**
  17137. * Bind the channel's socket to an event and store the callback.
  17138. */
  17139. }, {
  17140. key: 'on',
  17141. value: function on(event, callback) {
  17142. var _this2 = this;
  17143. var listener = function listener(channel, data) {
  17144. if (_this2.name == channel) {
  17145. callback(data);
  17146. }
  17147. };
  17148. this.socket.on(event, listener);
  17149. this.bind(event, listener);
  17150. }
  17151. /**
  17152. * Attach a 'reconnect' listener and bind the event.
  17153. */
  17154. }, {
  17155. key: 'configureReconnector',
  17156. value: function configureReconnector() {
  17157. var _this3 = this;
  17158. var listener = function listener() {
  17159. _this3.subscribe();
  17160. };
  17161. this.socket.on('reconnect', listener);
  17162. this.bind('reconnect', listener);
  17163. }
  17164. /**
  17165. * Bind the channel's socket to an event and store the callback.
  17166. */
  17167. }, {
  17168. key: 'bind',
  17169. value: function bind(event, callback) {
  17170. this.events[event] = this.events[event] || [];
  17171. this.events[event].push(callback);
  17172. }
  17173. /**
  17174. * Unbind the channel's socket from all stored event callbacks.
  17175. */
  17176. }, {
  17177. key: 'unbind',
  17178. value: function unbind() {
  17179. var _this4 = this;
  17180. Object.keys(this.events).forEach(function (event) {
  17181. _this4.events[event].forEach(function (callback) {
  17182. _this4.socket.removeListener(event, callback);
  17183. });
  17184. delete _this4.events[event];
  17185. });
  17186. }
  17187. }]);
  17188. return SocketIoChannel;
  17189. }(Channel);
  17190. /**
  17191. * This class represents a Socket.io presence channel.
  17192. */
  17193. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17194. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17195. function SocketIoPrivateChannel() {
  17196. classCallCheck(this, SocketIoPrivateChannel);
  17197. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17198. }
  17199. createClass(SocketIoPrivateChannel, [{
  17200. key: 'whisper',
  17201. /**
  17202. * Trigger client event on the channel.
  17203. */
  17204. value: function whisper(eventName, data) {
  17205. this.socket.emit('client event', {
  17206. channel: this.name,
  17207. event: 'client-' + eventName,
  17208. data: data
  17209. });
  17210. return this;
  17211. }
  17212. }]);
  17213. return SocketIoPrivateChannel;
  17214. }(SocketIoChannel);
  17215. /**
  17216. * This class represents a Socket.io presence channel.
  17217. */
  17218. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17219. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17220. function SocketIoPresenceChannel() {
  17221. classCallCheck(this, SocketIoPresenceChannel);
  17222. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17223. }
  17224. createClass(SocketIoPresenceChannel, [{
  17225. key: 'here',
  17226. /**
  17227. * Register a callback to be called anytime the member list changes.
  17228. */
  17229. value: function here(callback) {
  17230. this.on('presence:subscribed', function (members) {
  17231. callback(members.map(function (m) {
  17232. return m.user_info;
  17233. }));
  17234. });
  17235. return this;
  17236. }
  17237. /**
  17238. * Listen for someone joining the channel.
  17239. */
  17240. }, {
  17241. key: 'joining',
  17242. value: function joining(callback) {
  17243. this.on('presence:joining', function (member) {
  17244. return callback(member.user_info);
  17245. });
  17246. return this;
  17247. }
  17248. /**
  17249. * Listen for someone leaving the channel.
  17250. */
  17251. }, {
  17252. key: 'leaving',
  17253. value: function leaving(callback) {
  17254. this.on('presence:leaving', function (member) {
  17255. return callback(member.user_info);
  17256. });
  17257. return this;
  17258. }
  17259. }]);
  17260. return SocketIoPresenceChannel;
  17261. }(SocketIoPrivateChannel);
  17262. /**
  17263. * This class represents a null channel.
  17264. */
  17265. var NullChannel = function (_Channel) {
  17266. inherits(NullChannel, _Channel);
  17267. function NullChannel() {
  17268. classCallCheck(this, NullChannel);
  17269. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17270. }
  17271. createClass(NullChannel, [{
  17272. key: 'subscribe',
  17273. /**
  17274. * Subscribe to a channel.
  17275. */
  17276. value: function subscribe() {}
  17277. //
  17278. /**
  17279. * Unsubscribe from a channel.
  17280. */
  17281. }, {
  17282. key: 'unsubscribe',
  17283. value: function unsubscribe() {}
  17284. //
  17285. /**
  17286. * Listen for an event on the channel instance.
  17287. */
  17288. }, {
  17289. key: 'listen',
  17290. value: function listen(event, callback) {
  17291. return this;
  17292. }
  17293. /**
  17294. * Stop listening for an event on the channel instance.
  17295. */
  17296. }, {
  17297. key: 'stopListening',
  17298. value: function stopListening(event) {
  17299. return this;
  17300. }
  17301. /**
  17302. * Bind a channel to an event.
  17303. */
  17304. }, {
  17305. key: 'on',
  17306. value: function on(event, callback) {
  17307. return this;
  17308. }
  17309. }]);
  17310. return NullChannel;
  17311. }(Channel);
  17312. /**
  17313. * This class represents a null private channel.
  17314. */
  17315. var NullPrivateChannel = function (_NullChannel) {
  17316. inherits(NullPrivateChannel, _NullChannel);
  17317. function NullPrivateChannel() {
  17318. classCallCheck(this, NullPrivateChannel);
  17319. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17320. }
  17321. createClass(NullPrivateChannel, [{
  17322. key: 'whisper',
  17323. /**
  17324. * Trigger client event on the channel.
  17325. */
  17326. value: function whisper(eventName, data) {
  17327. return this;
  17328. }
  17329. }]);
  17330. return NullPrivateChannel;
  17331. }(NullChannel);
  17332. /**
  17333. * This class represents a null presence channel.
  17334. */
  17335. var NullPresenceChannel = function (_NullChannel) {
  17336. inherits(NullPresenceChannel, _NullChannel);
  17337. function NullPresenceChannel() {
  17338. classCallCheck(this, NullPresenceChannel);
  17339. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17340. }
  17341. createClass(NullPresenceChannel, [{
  17342. key: 'here',
  17343. /**
  17344. * Register a callback to be called anytime the member list changes.
  17345. */
  17346. value: function here(callback) {
  17347. return this;
  17348. }
  17349. /**
  17350. * Listen for someone joining the channel.
  17351. */
  17352. }, {
  17353. key: 'joining',
  17354. value: function joining(callback) {
  17355. return this;
  17356. }
  17357. /**
  17358. * Listen for someone leaving the channel.
  17359. */
  17360. }, {
  17361. key: 'leaving',
  17362. value: function leaving(callback) {
  17363. return this;
  17364. }
  17365. /**
  17366. * Trigger client event on the channel.
  17367. */
  17368. }, {
  17369. key: 'whisper',
  17370. value: function whisper(eventName, data) {
  17371. return this;
  17372. }
  17373. }]);
  17374. return NullPresenceChannel;
  17375. }(NullChannel);
  17376. /**
  17377. * This class creates a connector to Pusher.
  17378. */
  17379. var PusherConnector = function (_Connector) {
  17380. inherits(PusherConnector, _Connector);
  17381. function PusherConnector() {
  17382. classCallCheck(this, PusherConnector);
  17383. /**
  17384. * All of the subscribed channel names.
  17385. */
  17386. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17387. _this.channels = {};
  17388. return _this;
  17389. }
  17390. /**
  17391. * Create a fresh Pusher connection.
  17392. */
  17393. createClass(PusherConnector, [{
  17394. key: 'connect',
  17395. value: function connect() {
  17396. if (typeof this.options.client !== 'undefined') {
  17397. this.pusher = this.options.client;
  17398. } else {
  17399. this.pusher = new Pusher(this.options.key, this.options);
  17400. }
  17401. }
  17402. /**
  17403. * Listen for an event on a channel instance.
  17404. */
  17405. }, {
  17406. key: 'listen',
  17407. value: function listen(name, event, callback) {
  17408. return this.channel(name).listen(event, callback);
  17409. }
  17410. /**
  17411. * Get a channel instance by name.
  17412. */
  17413. }, {
  17414. key: 'channel',
  17415. value: function channel(name) {
  17416. if (!this.channels[name]) {
  17417. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17418. }
  17419. return this.channels[name];
  17420. }
  17421. /**
  17422. * Get a private channel instance by name.
  17423. */
  17424. }, {
  17425. key: 'privateChannel',
  17426. value: function privateChannel(name) {
  17427. if (!this.channels['private-' + name]) {
  17428. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17429. }
  17430. return this.channels['private-' + name];
  17431. }
  17432. /**
  17433. * Get a presence channel instance by name.
  17434. */
  17435. }, {
  17436. key: 'presenceChannel',
  17437. value: function presenceChannel(name) {
  17438. if (!this.channels['presence-' + name]) {
  17439. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17440. }
  17441. return this.channels['presence-' + name];
  17442. }
  17443. /**
  17444. * Leave the given channel, as well as its private and presence variants.
  17445. */
  17446. }, {
  17447. key: 'leave',
  17448. value: function leave(name) {
  17449. var _this2 = this;
  17450. var channels = [name, 'private-' + name, 'presence-' + name];
  17451. channels.forEach(function (name, index) {
  17452. _this2.leaveChannel(name);
  17453. });
  17454. }
  17455. /**
  17456. * Leave the given channel.
  17457. */
  17458. }, {
  17459. key: 'leaveChannel',
  17460. value: function leaveChannel(name) {
  17461. if (this.channels[name]) {
  17462. this.channels[name].unsubscribe();
  17463. delete this.channels[name];
  17464. }
  17465. }
  17466. /**
  17467. * Get the socket ID for the connection.
  17468. */
  17469. }, {
  17470. key: 'socketId',
  17471. value: function socketId() {
  17472. return this.pusher.connection.socket_id;
  17473. }
  17474. /**
  17475. * Disconnect Pusher connection.
  17476. */
  17477. }, {
  17478. key: 'disconnect',
  17479. value: function disconnect() {
  17480. this.pusher.disconnect();
  17481. }
  17482. }]);
  17483. return PusherConnector;
  17484. }(Connector);
  17485. /**
  17486. * This class creates a connnector to a Socket.io server.
  17487. */
  17488. var SocketIoConnector = function (_Connector) {
  17489. inherits(SocketIoConnector, _Connector);
  17490. function SocketIoConnector() {
  17491. classCallCheck(this, SocketIoConnector);
  17492. /**
  17493. * All of the subscribed channel names.
  17494. */
  17495. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17496. _this.channels = {};
  17497. return _this;
  17498. }
  17499. /**
  17500. * Create a fresh Socket.io connection.
  17501. */
  17502. createClass(SocketIoConnector, [{
  17503. key: 'connect',
  17504. value: function connect() {
  17505. var io = this.getSocketIO();
  17506. this.socket = io(this.options.host, this.options);
  17507. return this.socket;
  17508. }
  17509. /**
  17510. * Get socket.io module from global scope or options.
  17511. */
  17512. }, {
  17513. key: 'getSocketIO',
  17514. value: function getSocketIO() {
  17515. if (typeof this.options.client !== 'undefined') {
  17516. return this.options.client;
  17517. }
  17518. if (typeof io !== 'undefined') {
  17519. return io;
  17520. }
  17521. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17522. }
  17523. /**
  17524. * Listen for an event on a channel instance.
  17525. */
  17526. }, {
  17527. key: 'listen',
  17528. value: function listen(name, event, callback) {
  17529. return this.channel(name).listen(event, callback);
  17530. }
  17531. /**
  17532. * Get a channel instance by name.
  17533. */
  17534. }, {
  17535. key: 'channel',
  17536. value: function channel(name) {
  17537. if (!this.channels[name]) {
  17538. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17539. }
  17540. return this.channels[name];
  17541. }
  17542. /**
  17543. * Get a private channel instance by name.
  17544. */
  17545. }, {
  17546. key: 'privateChannel',
  17547. value: function privateChannel(name) {
  17548. if (!this.channels['private-' + name]) {
  17549. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17550. }
  17551. return this.channels['private-' + name];
  17552. }
  17553. /**
  17554. * Get a presence channel instance by name.
  17555. */
  17556. }, {
  17557. key: 'presenceChannel',
  17558. value: function presenceChannel(name) {
  17559. if (!this.channels['presence-' + name]) {
  17560. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17561. }
  17562. return this.channels['presence-' + name];
  17563. }
  17564. /**
  17565. * Leave the given channel, as well as its private and presence variants.
  17566. */
  17567. }, {
  17568. key: 'leave',
  17569. value: function leave(name) {
  17570. var _this2 = this;
  17571. var channels = [name, 'private-' + name, 'presence-' + name];
  17572. channels.forEach(function (name) {
  17573. _this2.leaveChannel(name);
  17574. });
  17575. }
  17576. /**
  17577. * Leave the given channel.
  17578. */
  17579. }, {
  17580. key: 'leaveChannel',
  17581. value: function leaveChannel(name) {
  17582. if (this.channels[name]) {
  17583. this.channels[name].unsubscribe();
  17584. delete this.channels[name];
  17585. }
  17586. }
  17587. /**
  17588. * Get the socket ID for the connection.
  17589. */
  17590. }, {
  17591. key: 'socketId',
  17592. value: function socketId() {
  17593. return this.socket.id;
  17594. }
  17595. /**
  17596. * Disconnect Socketio connection.
  17597. */
  17598. }, {
  17599. key: 'disconnect',
  17600. value: function disconnect() {
  17601. this.socket.disconnect();
  17602. }
  17603. }]);
  17604. return SocketIoConnector;
  17605. }(Connector);
  17606. /**
  17607. * This class creates a null connector.
  17608. */
  17609. var NullConnector = function (_Connector) {
  17610. inherits(NullConnector, _Connector);
  17611. function NullConnector() {
  17612. classCallCheck(this, NullConnector);
  17613. /**
  17614. * All of the subscribed channel names.
  17615. */
  17616. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17617. _this.channels = {};
  17618. return _this;
  17619. }
  17620. /**
  17621. * Create a fresh connection.
  17622. */
  17623. createClass(NullConnector, [{
  17624. key: 'connect',
  17625. value: function connect() {}
  17626. //
  17627. /**
  17628. * Listen for an event on a channel instance.
  17629. */
  17630. }, {
  17631. key: 'listen',
  17632. value: function listen(name, event, callback) {
  17633. return new NullChannel();
  17634. }
  17635. /**
  17636. * Get a channel instance by name.
  17637. */
  17638. }, {
  17639. key: 'channel',
  17640. value: function channel(name) {
  17641. return new NullChannel();
  17642. }
  17643. /**
  17644. * Get a private channel instance by name.
  17645. */
  17646. }, {
  17647. key: 'privateChannel',
  17648. value: function privateChannel(name) {
  17649. return new NullPrivateChannel();
  17650. }
  17651. /**
  17652. * Get a presence channel instance by name.
  17653. */
  17654. }, {
  17655. key: 'presenceChannel',
  17656. value: function presenceChannel(name) {
  17657. return new NullPresenceChannel();
  17658. }
  17659. /**
  17660. * Leave the given channel, as well as its private and presence variants.
  17661. */
  17662. }, {
  17663. key: 'leave',
  17664. value: function leave(name) {}
  17665. //
  17666. /**
  17667. * Leave the given channel.
  17668. */
  17669. }, {
  17670. key: 'leaveChannel',
  17671. value: function leaveChannel(name) {}
  17672. //
  17673. /**
  17674. * Get the socket ID for the connection.
  17675. */
  17676. }, {
  17677. key: 'socketId',
  17678. value: function socketId() {
  17679. return 'fake-socket-id';
  17680. }
  17681. /**
  17682. * Disconnect the connection.
  17683. */
  17684. }, {
  17685. key: 'disconnect',
  17686. value: function disconnect() {
  17687. //
  17688. }
  17689. }]);
  17690. return NullConnector;
  17691. }(Connector);
  17692. /**
  17693. * This class is the primary API for interacting with broadcasting.
  17694. */
  17695. var Echo = function () {
  17696. /**
  17697. * Create a new class instance.
  17698. */
  17699. function Echo(options) {
  17700. classCallCheck(this, Echo);
  17701. this.options = options;
  17702. this.connect();
  17703. if (!this.options.withoutInterceptors) {
  17704. this.registerInterceptors();
  17705. }
  17706. }
  17707. /**
  17708. * Get a channel instance by name.
  17709. */
  17710. createClass(Echo, [{
  17711. key: 'channel',
  17712. value: function channel(_channel) {
  17713. return this.connector.channel(_channel);
  17714. }
  17715. /**
  17716. * Create a new connection.
  17717. */
  17718. }, {
  17719. key: 'connect',
  17720. value: function connect() {
  17721. if (this.options.broadcaster == 'pusher') {
  17722. this.connector = new PusherConnector(this.options);
  17723. } else if (this.options.broadcaster == 'socket.io') {
  17724. this.connector = new SocketIoConnector(this.options);
  17725. } else if (this.options.broadcaster == 'null') {
  17726. this.connector = new NullConnector(this.options);
  17727. } else if (typeof this.options.broadcaster == 'function') {
  17728. this.connector = new this.options.broadcaster(this.options);
  17729. }
  17730. }
  17731. /**
  17732. * Disconnect from the Echo server.
  17733. */
  17734. }, {
  17735. key: 'disconnect',
  17736. value: function disconnect() {
  17737. this.connector.disconnect();
  17738. }
  17739. /**
  17740. * Get a presence channel instance by name.
  17741. */
  17742. }, {
  17743. key: 'join',
  17744. value: function join(channel) {
  17745. return this.connector.presenceChannel(channel);
  17746. }
  17747. /**
  17748. * Leave the given channel, as well as its private and presence variants.
  17749. */
  17750. }, {
  17751. key: 'leave',
  17752. value: function leave(channel) {
  17753. this.connector.leave(channel);
  17754. }
  17755. /**
  17756. * Leave the given channel.
  17757. */
  17758. }, {
  17759. key: 'leaveChannel',
  17760. value: function leaveChannel(channel) {
  17761. this.connector.leaveChannel(channel);
  17762. }
  17763. /**
  17764. * Listen for an event on a channel instance.
  17765. */
  17766. }, {
  17767. key: 'listen',
  17768. value: function listen(channel, event, callback) {
  17769. return this.connector.listen(channel, event, callback);
  17770. }
  17771. /**
  17772. * Get a private channel instance by name.
  17773. */
  17774. }, {
  17775. key: 'private',
  17776. value: function _private(channel) {
  17777. return this.connector.privateChannel(channel);
  17778. }
  17779. /**
  17780. * Get the Socket ID for the connection.
  17781. */
  17782. }, {
  17783. key: 'socketId',
  17784. value: function socketId() {
  17785. return this.connector.socketId();
  17786. }
  17787. /**
  17788. * Register 3rd party request interceptiors. These are used to automatically
  17789. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17790. */
  17791. }, {
  17792. key: 'registerInterceptors',
  17793. value: function registerInterceptors() {
  17794. if (typeof Vue === 'function' && Vue.http) {
  17795. this.registerVueRequestInterceptor();
  17796. }
  17797. if (typeof axios === 'function') {
  17798. this.registerAxiosRequestInterceptor();
  17799. }
  17800. if (typeof jQuery === 'function') {
  17801. this.registerjQueryAjaxSetup();
  17802. }
  17803. }
  17804. /**
  17805. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17806. */
  17807. }, {
  17808. key: 'registerVueRequestInterceptor',
  17809. value: function registerVueRequestInterceptor() {
  17810. var _this = this;
  17811. Vue.http.interceptors.push(function (request, next) {
  17812. if (_this.socketId()) {
  17813. request.headers.set('X-Socket-ID', _this.socketId());
  17814. }
  17815. next();
  17816. });
  17817. }
  17818. /**
  17819. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17820. */
  17821. }, {
  17822. key: 'registerAxiosRequestInterceptor',
  17823. value: function registerAxiosRequestInterceptor() {
  17824. var _this2 = this;
  17825. axios.interceptors.request.use(function (config) {
  17826. if (_this2.socketId()) {
  17827. config.headers['X-Socket-Id'] = _this2.socketId();
  17828. }
  17829. return config;
  17830. });
  17831. }
  17832. /**
  17833. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17834. */
  17835. }, {
  17836. key: 'registerjQueryAjaxSetup',
  17837. value: function registerjQueryAjaxSetup() {
  17838. var _this3 = this;
  17839. if (typeof jQuery.ajax != 'undefined') {
  17840. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17841. if (_this3.socketId()) {
  17842. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17843. }
  17844. });
  17845. }
  17846. }
  17847. }]);
  17848. return Echo;
  17849. }();
  17850. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17851. /***/ }),
  17852. /***/ "./node_modules/lodash/lodash.js":
  17853. /*!***************************************!*\
  17854. !*** ./node_modules/lodash/lodash.js ***!
  17855. \***************************************/
  17856. /*! no static exports found */
  17857. /***/ (function(module, exports, __webpack_require__) {
  17858. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17859. * @license
  17860. * Lodash <https://lodash.com/>
  17861. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17862. * Released under MIT license <https://lodash.com/license>
  17863. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17864. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17865. */
  17866. ;(function() {
  17867. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17868. var undefined;
  17869. /** Used as the semantic version number. */
  17870. var VERSION = '4.17.15';
  17871. /** Used as the size to enable large array optimizations. */
  17872. var LARGE_ARRAY_SIZE = 200;
  17873. /** Error message constants. */
  17874. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17875. FUNC_ERROR_TEXT = 'Expected a function';
  17876. /** Used to stand-in for `undefined` hash values. */
  17877. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17878. /** Used as the maximum memoize cache size. */
  17879. var MAX_MEMOIZE_SIZE = 500;
  17880. /** Used as the internal argument placeholder. */
  17881. var PLACEHOLDER = '__lodash_placeholder__';
  17882. /** Used to compose bitmasks for cloning. */
  17883. var CLONE_DEEP_FLAG = 1,
  17884. CLONE_FLAT_FLAG = 2,
  17885. CLONE_SYMBOLS_FLAG = 4;
  17886. /** Used to compose bitmasks for value comparisons. */
  17887. var COMPARE_PARTIAL_FLAG = 1,
  17888. COMPARE_UNORDERED_FLAG = 2;
  17889. /** Used to compose bitmasks for function metadata. */
  17890. var WRAP_BIND_FLAG = 1,
  17891. WRAP_BIND_KEY_FLAG = 2,
  17892. WRAP_CURRY_BOUND_FLAG = 4,
  17893. WRAP_CURRY_FLAG = 8,
  17894. WRAP_CURRY_RIGHT_FLAG = 16,
  17895. WRAP_PARTIAL_FLAG = 32,
  17896. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17897. WRAP_ARY_FLAG = 128,
  17898. WRAP_REARG_FLAG = 256,
  17899. WRAP_FLIP_FLAG = 512;
  17900. /** Used as default options for `_.truncate`. */
  17901. var DEFAULT_TRUNC_LENGTH = 30,
  17902. DEFAULT_TRUNC_OMISSION = '...';
  17903. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17904. var HOT_COUNT = 800,
  17905. HOT_SPAN = 16;
  17906. /** Used to indicate the type of lazy iteratees. */
  17907. var LAZY_FILTER_FLAG = 1,
  17908. LAZY_MAP_FLAG = 2,
  17909. LAZY_WHILE_FLAG = 3;
  17910. /** Used as references for various `Number` constants. */
  17911. var INFINITY = 1 / 0,
  17912. MAX_SAFE_INTEGER = 9007199254740991,
  17913. MAX_INTEGER = 1.7976931348623157e+308,
  17914. NAN = 0 / 0;
  17915. /** Used as references for the maximum length and index of an array. */
  17916. var MAX_ARRAY_LENGTH = 4294967295,
  17917. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17918. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17919. /** Used to associate wrap methods with their bit flags. */
  17920. var wrapFlags = [
  17921. ['ary', WRAP_ARY_FLAG],
  17922. ['bind', WRAP_BIND_FLAG],
  17923. ['bindKey', WRAP_BIND_KEY_FLAG],
  17924. ['curry', WRAP_CURRY_FLAG],
  17925. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17926. ['flip', WRAP_FLIP_FLAG],
  17927. ['partial', WRAP_PARTIAL_FLAG],
  17928. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17929. ['rearg', WRAP_REARG_FLAG]
  17930. ];
  17931. /** `Object#toString` result references. */
  17932. var argsTag = '[object Arguments]',
  17933. arrayTag = '[object Array]',
  17934. asyncTag = '[object AsyncFunction]',
  17935. boolTag = '[object Boolean]',
  17936. dateTag = '[object Date]',
  17937. domExcTag = '[object DOMException]',
  17938. errorTag = '[object Error]',
  17939. funcTag = '[object Function]',
  17940. genTag = '[object GeneratorFunction]',
  17941. mapTag = '[object Map]',
  17942. numberTag = '[object Number]',
  17943. nullTag = '[object Null]',
  17944. objectTag = '[object Object]',
  17945. promiseTag = '[object Promise]',
  17946. proxyTag = '[object Proxy]',
  17947. regexpTag = '[object RegExp]',
  17948. setTag = '[object Set]',
  17949. stringTag = '[object String]',
  17950. symbolTag = '[object Symbol]',
  17951. undefinedTag = '[object Undefined]',
  17952. weakMapTag = '[object WeakMap]',
  17953. weakSetTag = '[object WeakSet]';
  17954. var arrayBufferTag = '[object ArrayBuffer]',
  17955. dataViewTag = '[object DataView]',
  17956. float32Tag = '[object Float32Array]',
  17957. float64Tag = '[object Float64Array]',
  17958. int8Tag = '[object Int8Array]',
  17959. int16Tag = '[object Int16Array]',
  17960. int32Tag = '[object Int32Array]',
  17961. uint8Tag = '[object Uint8Array]',
  17962. uint8ClampedTag = '[object Uint8ClampedArray]',
  17963. uint16Tag = '[object Uint16Array]',
  17964. uint32Tag = '[object Uint32Array]';
  17965. /** Used to match empty string literals in compiled template source. */
  17966. var reEmptyStringLeading = /\b__p \+= '';/g,
  17967. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  17968. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  17969. /** Used to match HTML entities and HTML characters. */
  17970. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  17971. reUnescapedHtml = /[&<>"']/g,
  17972. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  17973. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  17974. /** Used to match template delimiters. */
  17975. var reEscape = /<%-([\s\S]+?)%>/g,
  17976. reEvaluate = /<%([\s\S]+?)%>/g,
  17977. reInterpolate = /<%=([\s\S]+?)%>/g;
  17978. /** Used to match property names within property paths. */
  17979. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  17980. reIsPlainProp = /^\w*$/,
  17981. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  17982. /**
  17983. * Used to match `RegExp`
  17984. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  17985. */
  17986. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  17987. reHasRegExpChar = RegExp(reRegExpChar.source);
  17988. /** Used to match leading and trailing whitespace. */
  17989. var reTrim = /^\s+|\s+$/g,
  17990. reTrimStart = /^\s+/,
  17991. reTrimEnd = /\s+$/;
  17992. /** Used to match wrap detail comments. */
  17993. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  17994. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  17995. reSplitDetails = /,? & /;
  17996. /** Used to match words composed of alphanumeric characters. */
  17997. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  17998. /** Used to match backslashes in property paths. */
  17999. var reEscapeChar = /\\(\\)?/g;
  18000. /**
  18001. * Used to match
  18002. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18003. */
  18004. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18005. /** Used to match `RegExp` flags from their coerced string values. */
  18006. var reFlags = /\w*$/;
  18007. /** Used to detect bad signed hexadecimal string values. */
  18008. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18009. /** Used to detect binary string values. */
  18010. var reIsBinary = /^0b[01]+$/i;
  18011. /** Used to detect host constructors (Safari). */
  18012. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18013. /** Used to detect octal string values. */
  18014. var reIsOctal = /^0o[0-7]+$/i;
  18015. /** Used to detect unsigned integer values. */
  18016. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18017. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18018. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18019. /** Used to ensure capturing order of template delimiters. */
  18020. var reNoMatch = /($^)/;
  18021. /** Used to match unescaped characters in compiled string literals. */
  18022. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18023. /** Used to compose unicode character classes. */
  18024. var rsAstralRange = '\\ud800-\\udfff',
  18025. rsComboMarksRange = '\\u0300-\\u036f',
  18026. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18027. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18028. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18029. rsDingbatRange = '\\u2700-\\u27bf',
  18030. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18031. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18032. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18033. rsPunctuationRange = '\\u2000-\\u206f',
  18034. 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',
  18035. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18036. rsVarRange = '\\ufe0e\\ufe0f',
  18037. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18038. /** Used to compose unicode capture groups. */
  18039. var rsApos = "['\u2019]",
  18040. rsAstral = '[' + rsAstralRange + ']',
  18041. rsBreak = '[' + rsBreakRange + ']',
  18042. rsCombo = '[' + rsComboRange + ']',
  18043. rsDigits = '\\d+',
  18044. rsDingbat = '[' + rsDingbatRange + ']',
  18045. rsLower = '[' + rsLowerRange + ']',
  18046. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18047. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18048. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18049. rsNonAstral = '[^' + rsAstralRange + ']',
  18050. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18051. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18052. rsUpper = '[' + rsUpperRange + ']',
  18053. rsZWJ = '\\u200d';
  18054. /** Used to compose unicode regexes. */
  18055. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18056. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18057. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18058. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18059. reOptMod = rsModifier + '?',
  18060. rsOptVar = '[' + rsVarRange + ']?',
  18061. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18062. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18063. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18064. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18065. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18066. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18067. /** Used to match apostrophes. */
  18068. var reApos = RegExp(rsApos, 'g');
  18069. /**
  18070. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18071. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18072. */
  18073. var reComboMark = RegExp(rsCombo, 'g');
  18074. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18075. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18076. /** Used to match complex or compound words. */
  18077. var reUnicodeWord = RegExp([
  18078. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18079. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18080. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18081. rsUpper + '+' + rsOptContrUpper,
  18082. rsOrdUpper,
  18083. rsOrdLower,
  18084. rsDigits,
  18085. rsEmoji
  18086. ].join('|'), 'g');
  18087. /** 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/). */
  18088. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18089. /** Used to detect strings that need a more robust regexp to match words. */
  18090. 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 ]/;
  18091. /** Used to assign default `context` object properties. */
  18092. var contextProps = [
  18093. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18094. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18095. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18096. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18097. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18098. ];
  18099. /** Used to make template sourceURLs easier to identify. */
  18100. var templateCounter = -1;
  18101. /** Used to identify `toStringTag` values of typed arrays. */
  18102. var typedArrayTags = {};
  18103. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18104. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18105. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18106. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18107. typedArrayTags[uint32Tag] = true;
  18108. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18109. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18110. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18111. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18112. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18113. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18114. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18115. typedArrayTags[weakMapTag] = false;
  18116. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18117. var cloneableTags = {};
  18118. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18119. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18120. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18121. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18122. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18123. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18124. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18125. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18126. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18127. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18128. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18129. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18130. cloneableTags[weakMapTag] = false;
  18131. /** Used to map Latin Unicode letters to basic Latin letters. */
  18132. var deburredLetters = {
  18133. // Latin-1 Supplement block.
  18134. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18135. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18136. '\xc7': 'C', '\xe7': 'c',
  18137. '\xd0': 'D', '\xf0': 'd',
  18138. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18139. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18140. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18141. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18142. '\xd1': 'N', '\xf1': 'n',
  18143. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18144. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18145. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18146. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18147. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18148. '\xc6': 'Ae', '\xe6': 'ae',
  18149. '\xde': 'Th', '\xfe': 'th',
  18150. '\xdf': 'ss',
  18151. // Latin Extended-A block.
  18152. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18153. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18154. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18155. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18156. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18157. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18158. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18159. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18160. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18161. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18162. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18163. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18164. '\u0134': 'J', '\u0135': 'j',
  18165. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18166. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18167. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18168. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18169. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18170. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18171. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18172. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18173. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18174. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18175. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18176. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18177. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18178. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18179. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18180. '\u0174': 'W', '\u0175': 'w',
  18181. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18182. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18183. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18184. '\u0132': 'IJ', '\u0133': 'ij',
  18185. '\u0152': 'Oe', '\u0153': 'oe',
  18186. '\u0149': "'n", '\u017f': 's'
  18187. };
  18188. /** Used to map characters to HTML entities. */
  18189. var htmlEscapes = {
  18190. '&': '&amp;',
  18191. '<': '&lt;',
  18192. '>': '&gt;',
  18193. '"': '&quot;',
  18194. "'": '&#39;'
  18195. };
  18196. /** Used to map HTML entities to characters. */
  18197. var htmlUnescapes = {
  18198. '&amp;': '&',
  18199. '&lt;': '<',
  18200. '&gt;': '>',
  18201. '&quot;': '"',
  18202. '&#39;': "'"
  18203. };
  18204. /** Used to escape characters for inclusion in compiled string literals. */
  18205. var stringEscapes = {
  18206. '\\': '\\',
  18207. "'": "'",
  18208. '\n': 'n',
  18209. '\r': 'r',
  18210. '\u2028': 'u2028',
  18211. '\u2029': 'u2029'
  18212. };
  18213. /** Built-in method references without a dependency on `root`. */
  18214. var freeParseFloat = parseFloat,
  18215. freeParseInt = parseInt;
  18216. /** Detect free variable `global` from Node.js. */
  18217. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18218. /** Detect free variable `self`. */
  18219. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18220. /** Used as a reference to the global object. */
  18221. var root = freeGlobal || freeSelf || Function('return this')();
  18222. /** Detect free variable `exports`. */
  18223. var freeExports = true && exports && !exports.nodeType && exports;
  18224. /** Detect free variable `module`. */
  18225. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18226. /** Detect the popular CommonJS extension `module.exports`. */
  18227. var moduleExports = freeModule && freeModule.exports === freeExports;
  18228. /** Detect free variable `process` from Node.js. */
  18229. var freeProcess = moduleExports && freeGlobal.process;
  18230. /** Used to access faster Node.js helpers. */
  18231. var nodeUtil = (function() {
  18232. try {
  18233. // Use `util.types` for Node.js 10+.
  18234. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18235. if (types) {
  18236. return types;
  18237. }
  18238. // Legacy `process.binding('util')` for Node.js < 10.
  18239. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18240. } catch (e) {}
  18241. }());
  18242. /* Node.js helper references. */
  18243. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18244. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18245. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18246. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18247. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18248. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18249. /*--------------------------------------------------------------------------*/
  18250. /**
  18251. * A faster alternative to `Function#apply`, this function invokes `func`
  18252. * with the `this` binding of `thisArg` and the arguments of `args`.
  18253. *
  18254. * @private
  18255. * @param {Function} func The function to invoke.
  18256. * @param {*} thisArg The `this` binding of `func`.
  18257. * @param {Array} args The arguments to invoke `func` with.
  18258. * @returns {*} Returns the result of `func`.
  18259. */
  18260. function apply(func, thisArg, args) {
  18261. switch (args.length) {
  18262. case 0: return func.call(thisArg);
  18263. case 1: return func.call(thisArg, args[0]);
  18264. case 2: return func.call(thisArg, args[0], args[1]);
  18265. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18266. }
  18267. return func.apply(thisArg, args);
  18268. }
  18269. /**
  18270. * A specialized version of `baseAggregator` for arrays.
  18271. *
  18272. * @private
  18273. * @param {Array} [array] The array to iterate over.
  18274. * @param {Function} setter The function to set `accumulator` values.
  18275. * @param {Function} iteratee The iteratee to transform keys.
  18276. * @param {Object} accumulator The initial aggregated object.
  18277. * @returns {Function} Returns `accumulator`.
  18278. */
  18279. function arrayAggregator(array, setter, iteratee, accumulator) {
  18280. var index = -1,
  18281. length = array == null ? 0 : array.length;
  18282. while (++index < length) {
  18283. var value = array[index];
  18284. setter(accumulator, value, iteratee(value), array);
  18285. }
  18286. return accumulator;
  18287. }
  18288. /**
  18289. * A specialized version of `_.forEach` for arrays without support for
  18290. * iteratee shorthands.
  18291. *
  18292. * @private
  18293. * @param {Array} [array] The array to iterate over.
  18294. * @param {Function} iteratee The function invoked per iteration.
  18295. * @returns {Array} Returns `array`.
  18296. */
  18297. function arrayEach(array, iteratee) {
  18298. var index = -1,
  18299. length = array == null ? 0 : array.length;
  18300. while (++index < length) {
  18301. if (iteratee(array[index], index, array) === false) {
  18302. break;
  18303. }
  18304. }
  18305. return array;
  18306. }
  18307. /**
  18308. * A specialized version of `_.forEachRight` for arrays without support for
  18309. * iteratee shorthands.
  18310. *
  18311. * @private
  18312. * @param {Array} [array] The array to iterate over.
  18313. * @param {Function} iteratee The function invoked per iteration.
  18314. * @returns {Array} Returns `array`.
  18315. */
  18316. function arrayEachRight(array, iteratee) {
  18317. var length = array == null ? 0 : array.length;
  18318. while (length--) {
  18319. if (iteratee(array[length], length, array) === false) {
  18320. break;
  18321. }
  18322. }
  18323. return array;
  18324. }
  18325. /**
  18326. * A specialized version of `_.every` for arrays without support for
  18327. * iteratee shorthands.
  18328. *
  18329. * @private
  18330. * @param {Array} [array] The array to iterate over.
  18331. * @param {Function} predicate The function invoked per iteration.
  18332. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18333. * else `false`.
  18334. */
  18335. function arrayEvery(array, predicate) {
  18336. var index = -1,
  18337. length = array == null ? 0 : array.length;
  18338. while (++index < length) {
  18339. if (!predicate(array[index], index, array)) {
  18340. return false;
  18341. }
  18342. }
  18343. return true;
  18344. }
  18345. /**
  18346. * A specialized version of `_.filter` for arrays without support for
  18347. * iteratee shorthands.
  18348. *
  18349. * @private
  18350. * @param {Array} [array] The array to iterate over.
  18351. * @param {Function} predicate The function invoked per iteration.
  18352. * @returns {Array} Returns the new filtered array.
  18353. */
  18354. function arrayFilter(array, predicate) {
  18355. var index = -1,
  18356. length = array == null ? 0 : array.length,
  18357. resIndex = 0,
  18358. result = [];
  18359. while (++index < length) {
  18360. var value = array[index];
  18361. if (predicate(value, index, array)) {
  18362. result[resIndex++] = value;
  18363. }
  18364. }
  18365. return result;
  18366. }
  18367. /**
  18368. * A specialized version of `_.includes` for arrays without support for
  18369. * specifying an index to search from.
  18370. *
  18371. * @private
  18372. * @param {Array} [array] The array to inspect.
  18373. * @param {*} target The value to search for.
  18374. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18375. */
  18376. function arrayIncludes(array, value) {
  18377. var length = array == null ? 0 : array.length;
  18378. return !!length && baseIndexOf(array, value, 0) > -1;
  18379. }
  18380. /**
  18381. * This function is like `arrayIncludes` except that it accepts a comparator.
  18382. *
  18383. * @private
  18384. * @param {Array} [array] The array to inspect.
  18385. * @param {*} target The value to search for.
  18386. * @param {Function} comparator The comparator invoked per element.
  18387. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18388. */
  18389. function arrayIncludesWith(array, value, comparator) {
  18390. var index = -1,
  18391. length = array == null ? 0 : array.length;
  18392. while (++index < length) {
  18393. if (comparator(value, array[index])) {
  18394. return true;
  18395. }
  18396. }
  18397. return false;
  18398. }
  18399. /**
  18400. * A specialized version of `_.map` for arrays without support for iteratee
  18401. * shorthands.
  18402. *
  18403. * @private
  18404. * @param {Array} [array] The array to iterate over.
  18405. * @param {Function} iteratee The function invoked per iteration.
  18406. * @returns {Array} Returns the new mapped array.
  18407. */
  18408. function arrayMap(array, iteratee) {
  18409. var index = -1,
  18410. length = array == null ? 0 : array.length,
  18411. result = Array(length);
  18412. while (++index < length) {
  18413. result[index] = iteratee(array[index], index, array);
  18414. }
  18415. return result;
  18416. }
  18417. /**
  18418. * Appends the elements of `values` to `array`.
  18419. *
  18420. * @private
  18421. * @param {Array} array The array to modify.
  18422. * @param {Array} values The values to append.
  18423. * @returns {Array} Returns `array`.
  18424. */
  18425. function arrayPush(array, values) {
  18426. var index = -1,
  18427. length = values.length,
  18428. offset = array.length;
  18429. while (++index < length) {
  18430. array[offset + index] = values[index];
  18431. }
  18432. return array;
  18433. }
  18434. /**
  18435. * A specialized version of `_.reduce` for arrays without support for
  18436. * iteratee shorthands.
  18437. *
  18438. * @private
  18439. * @param {Array} [array] The array to iterate over.
  18440. * @param {Function} iteratee The function invoked per iteration.
  18441. * @param {*} [accumulator] The initial value.
  18442. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18443. * the initial value.
  18444. * @returns {*} Returns the accumulated value.
  18445. */
  18446. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18447. var index = -1,
  18448. length = array == null ? 0 : array.length;
  18449. if (initAccum && length) {
  18450. accumulator = array[++index];
  18451. }
  18452. while (++index < length) {
  18453. accumulator = iteratee(accumulator, array[index], index, array);
  18454. }
  18455. return accumulator;
  18456. }
  18457. /**
  18458. * A specialized version of `_.reduceRight` for arrays without support for
  18459. * iteratee shorthands.
  18460. *
  18461. * @private
  18462. * @param {Array} [array] The array to iterate over.
  18463. * @param {Function} iteratee The function invoked per iteration.
  18464. * @param {*} [accumulator] The initial value.
  18465. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18466. * the initial value.
  18467. * @returns {*} Returns the accumulated value.
  18468. */
  18469. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18470. var length = array == null ? 0 : array.length;
  18471. if (initAccum && length) {
  18472. accumulator = array[--length];
  18473. }
  18474. while (length--) {
  18475. accumulator = iteratee(accumulator, array[length], length, array);
  18476. }
  18477. return accumulator;
  18478. }
  18479. /**
  18480. * A specialized version of `_.some` for arrays without support for iteratee
  18481. * shorthands.
  18482. *
  18483. * @private
  18484. * @param {Array} [array] The array to iterate over.
  18485. * @param {Function} predicate The function invoked per iteration.
  18486. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18487. * else `false`.
  18488. */
  18489. function arraySome(array, predicate) {
  18490. var index = -1,
  18491. length = array == null ? 0 : array.length;
  18492. while (++index < length) {
  18493. if (predicate(array[index], index, array)) {
  18494. return true;
  18495. }
  18496. }
  18497. return false;
  18498. }
  18499. /**
  18500. * Gets the size of an ASCII `string`.
  18501. *
  18502. * @private
  18503. * @param {string} string The string inspect.
  18504. * @returns {number} Returns the string size.
  18505. */
  18506. var asciiSize = baseProperty('length');
  18507. /**
  18508. * Converts an ASCII `string` to an array.
  18509. *
  18510. * @private
  18511. * @param {string} string The string to convert.
  18512. * @returns {Array} Returns the converted array.
  18513. */
  18514. function asciiToArray(string) {
  18515. return string.split('');
  18516. }
  18517. /**
  18518. * Splits an ASCII `string` into an array of its words.
  18519. *
  18520. * @private
  18521. * @param {string} The string to inspect.
  18522. * @returns {Array} Returns the words of `string`.
  18523. */
  18524. function asciiWords(string) {
  18525. return string.match(reAsciiWord) || [];
  18526. }
  18527. /**
  18528. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18529. * without support for iteratee shorthands, which iterates over `collection`
  18530. * using `eachFunc`.
  18531. *
  18532. * @private
  18533. * @param {Array|Object} collection The collection to inspect.
  18534. * @param {Function} predicate The function invoked per iteration.
  18535. * @param {Function} eachFunc The function to iterate over `collection`.
  18536. * @returns {*} Returns the found element or its key, else `undefined`.
  18537. */
  18538. function baseFindKey(collection, predicate, eachFunc) {
  18539. var result;
  18540. eachFunc(collection, function(value, key, collection) {
  18541. if (predicate(value, key, collection)) {
  18542. result = key;
  18543. return false;
  18544. }
  18545. });
  18546. return result;
  18547. }
  18548. /**
  18549. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18550. * support for iteratee shorthands.
  18551. *
  18552. * @private
  18553. * @param {Array} array The array to inspect.
  18554. * @param {Function} predicate The function invoked per iteration.
  18555. * @param {number} fromIndex The index to search from.
  18556. * @param {boolean} [fromRight] Specify iterating from right to left.
  18557. * @returns {number} Returns the index of the matched value, else `-1`.
  18558. */
  18559. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18560. var length = array.length,
  18561. index = fromIndex + (fromRight ? 1 : -1);
  18562. while ((fromRight ? index-- : ++index < length)) {
  18563. if (predicate(array[index], index, array)) {
  18564. return index;
  18565. }
  18566. }
  18567. return -1;
  18568. }
  18569. /**
  18570. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18571. *
  18572. * @private
  18573. * @param {Array} array The array to inspect.
  18574. * @param {*} value The value to search for.
  18575. * @param {number} fromIndex The index to search from.
  18576. * @returns {number} Returns the index of the matched value, else `-1`.
  18577. */
  18578. function baseIndexOf(array, value, fromIndex) {
  18579. return value === value
  18580. ? strictIndexOf(array, value, fromIndex)
  18581. : baseFindIndex(array, baseIsNaN, fromIndex);
  18582. }
  18583. /**
  18584. * This function is like `baseIndexOf` except that it accepts a comparator.
  18585. *
  18586. * @private
  18587. * @param {Array} array The array to inspect.
  18588. * @param {*} value The value to search for.
  18589. * @param {number} fromIndex The index to search from.
  18590. * @param {Function} comparator The comparator invoked per element.
  18591. * @returns {number} Returns the index of the matched value, else `-1`.
  18592. */
  18593. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18594. var index = fromIndex - 1,
  18595. length = array.length;
  18596. while (++index < length) {
  18597. if (comparator(array[index], value)) {
  18598. return index;
  18599. }
  18600. }
  18601. return -1;
  18602. }
  18603. /**
  18604. * The base implementation of `_.isNaN` without support for number objects.
  18605. *
  18606. * @private
  18607. * @param {*} value The value to check.
  18608. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18609. */
  18610. function baseIsNaN(value) {
  18611. return value !== value;
  18612. }
  18613. /**
  18614. * The base implementation of `_.mean` and `_.meanBy` without support for
  18615. * iteratee shorthands.
  18616. *
  18617. * @private
  18618. * @param {Array} array The array to iterate over.
  18619. * @param {Function} iteratee The function invoked per iteration.
  18620. * @returns {number} Returns the mean.
  18621. */
  18622. function baseMean(array, iteratee) {
  18623. var length = array == null ? 0 : array.length;
  18624. return length ? (baseSum(array, iteratee) / length) : NAN;
  18625. }
  18626. /**
  18627. * The base implementation of `_.property` without support for deep paths.
  18628. *
  18629. * @private
  18630. * @param {string} key The key of the property to get.
  18631. * @returns {Function} Returns the new accessor function.
  18632. */
  18633. function baseProperty(key) {
  18634. return function(object) {
  18635. return object == null ? undefined : object[key];
  18636. };
  18637. }
  18638. /**
  18639. * The base implementation of `_.propertyOf` without support for deep paths.
  18640. *
  18641. * @private
  18642. * @param {Object} object The object to query.
  18643. * @returns {Function} Returns the new accessor function.
  18644. */
  18645. function basePropertyOf(object) {
  18646. return function(key) {
  18647. return object == null ? undefined : object[key];
  18648. };
  18649. }
  18650. /**
  18651. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18652. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18653. *
  18654. * @private
  18655. * @param {Array|Object} collection The collection to iterate over.
  18656. * @param {Function} iteratee The function invoked per iteration.
  18657. * @param {*} accumulator The initial value.
  18658. * @param {boolean} initAccum Specify using the first or last element of
  18659. * `collection` as the initial value.
  18660. * @param {Function} eachFunc The function to iterate over `collection`.
  18661. * @returns {*} Returns the accumulated value.
  18662. */
  18663. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18664. eachFunc(collection, function(value, index, collection) {
  18665. accumulator = initAccum
  18666. ? (initAccum = false, value)
  18667. : iteratee(accumulator, value, index, collection);
  18668. });
  18669. return accumulator;
  18670. }
  18671. /**
  18672. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18673. * sort order of `array` and replaces criteria objects with their corresponding
  18674. * values.
  18675. *
  18676. * @private
  18677. * @param {Array} array The array to sort.
  18678. * @param {Function} comparer The function to define sort order.
  18679. * @returns {Array} Returns `array`.
  18680. */
  18681. function baseSortBy(array, comparer) {
  18682. var length = array.length;
  18683. array.sort(comparer);
  18684. while (length--) {
  18685. array[length] = array[length].value;
  18686. }
  18687. return array;
  18688. }
  18689. /**
  18690. * The base implementation of `_.sum` and `_.sumBy` without support for
  18691. * iteratee shorthands.
  18692. *
  18693. * @private
  18694. * @param {Array} array The array to iterate over.
  18695. * @param {Function} iteratee The function invoked per iteration.
  18696. * @returns {number} Returns the sum.
  18697. */
  18698. function baseSum(array, iteratee) {
  18699. var result,
  18700. index = -1,
  18701. length = array.length;
  18702. while (++index < length) {
  18703. var current = iteratee(array[index]);
  18704. if (current !== undefined) {
  18705. result = result === undefined ? current : (result + current);
  18706. }
  18707. }
  18708. return result;
  18709. }
  18710. /**
  18711. * The base implementation of `_.times` without support for iteratee shorthands
  18712. * or max array length checks.
  18713. *
  18714. * @private
  18715. * @param {number} n The number of times to invoke `iteratee`.
  18716. * @param {Function} iteratee The function invoked per iteration.
  18717. * @returns {Array} Returns the array of results.
  18718. */
  18719. function baseTimes(n, iteratee) {
  18720. var index = -1,
  18721. result = Array(n);
  18722. while (++index < n) {
  18723. result[index] = iteratee(index);
  18724. }
  18725. return result;
  18726. }
  18727. /**
  18728. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18729. * of key-value pairs for `object` corresponding to the property names of `props`.
  18730. *
  18731. * @private
  18732. * @param {Object} object The object to query.
  18733. * @param {Array} props The property names to get values for.
  18734. * @returns {Object} Returns the key-value pairs.
  18735. */
  18736. function baseToPairs(object, props) {
  18737. return arrayMap(props, function(key) {
  18738. return [key, object[key]];
  18739. });
  18740. }
  18741. /**
  18742. * The base implementation of `_.unary` without support for storing metadata.
  18743. *
  18744. * @private
  18745. * @param {Function} func The function to cap arguments for.
  18746. * @returns {Function} Returns the new capped function.
  18747. */
  18748. function baseUnary(func) {
  18749. return function(value) {
  18750. return func(value);
  18751. };
  18752. }
  18753. /**
  18754. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18755. * array of `object` property values corresponding to the property names
  18756. * of `props`.
  18757. *
  18758. * @private
  18759. * @param {Object} object The object to query.
  18760. * @param {Array} props The property names to get values for.
  18761. * @returns {Object} Returns the array of property values.
  18762. */
  18763. function baseValues(object, props) {
  18764. return arrayMap(props, function(key) {
  18765. return object[key];
  18766. });
  18767. }
  18768. /**
  18769. * Checks if a `cache` value for `key` exists.
  18770. *
  18771. * @private
  18772. * @param {Object} cache The cache to query.
  18773. * @param {string} key The key of the entry to check.
  18774. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18775. */
  18776. function cacheHas(cache, key) {
  18777. return cache.has(key);
  18778. }
  18779. /**
  18780. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18781. * that is not found in the character symbols.
  18782. *
  18783. * @private
  18784. * @param {Array} strSymbols The string symbols to inspect.
  18785. * @param {Array} chrSymbols The character symbols to find.
  18786. * @returns {number} Returns the index of the first unmatched string symbol.
  18787. */
  18788. function charsStartIndex(strSymbols, chrSymbols) {
  18789. var index = -1,
  18790. length = strSymbols.length;
  18791. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18792. return index;
  18793. }
  18794. /**
  18795. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18796. * that is not found in the character symbols.
  18797. *
  18798. * @private
  18799. * @param {Array} strSymbols The string symbols to inspect.
  18800. * @param {Array} chrSymbols The character symbols to find.
  18801. * @returns {number} Returns the index of the last unmatched string symbol.
  18802. */
  18803. function charsEndIndex(strSymbols, chrSymbols) {
  18804. var index = strSymbols.length;
  18805. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18806. return index;
  18807. }
  18808. /**
  18809. * Gets the number of `placeholder` occurrences in `array`.
  18810. *
  18811. * @private
  18812. * @param {Array} array The array to inspect.
  18813. * @param {*} placeholder The placeholder to search for.
  18814. * @returns {number} Returns the placeholder count.
  18815. */
  18816. function countHolders(array, placeholder) {
  18817. var length = array.length,
  18818. result = 0;
  18819. while (length--) {
  18820. if (array[length] === placeholder) {
  18821. ++result;
  18822. }
  18823. }
  18824. return result;
  18825. }
  18826. /**
  18827. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18828. * letters to basic Latin letters.
  18829. *
  18830. * @private
  18831. * @param {string} letter The matched letter to deburr.
  18832. * @returns {string} Returns the deburred letter.
  18833. */
  18834. var deburrLetter = basePropertyOf(deburredLetters);
  18835. /**
  18836. * Used by `_.escape` to convert characters to HTML entities.
  18837. *
  18838. * @private
  18839. * @param {string} chr The matched character to escape.
  18840. * @returns {string} Returns the escaped character.
  18841. */
  18842. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18843. /**
  18844. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18845. *
  18846. * @private
  18847. * @param {string} chr The matched character to escape.
  18848. * @returns {string} Returns the escaped character.
  18849. */
  18850. function escapeStringChar(chr) {
  18851. return '\\' + stringEscapes[chr];
  18852. }
  18853. /**
  18854. * Gets the value at `key` of `object`.
  18855. *
  18856. * @private
  18857. * @param {Object} [object] The object to query.
  18858. * @param {string} key The key of the property to get.
  18859. * @returns {*} Returns the property value.
  18860. */
  18861. function getValue(object, key) {
  18862. return object == null ? undefined : object[key];
  18863. }
  18864. /**
  18865. * Checks if `string` contains Unicode symbols.
  18866. *
  18867. * @private
  18868. * @param {string} string The string to inspect.
  18869. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18870. */
  18871. function hasUnicode(string) {
  18872. return reHasUnicode.test(string);
  18873. }
  18874. /**
  18875. * Checks if `string` contains a word composed of Unicode symbols.
  18876. *
  18877. * @private
  18878. * @param {string} string The string to inspect.
  18879. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18880. */
  18881. function hasUnicodeWord(string) {
  18882. return reHasUnicodeWord.test(string);
  18883. }
  18884. /**
  18885. * Converts `iterator` to an array.
  18886. *
  18887. * @private
  18888. * @param {Object} iterator The iterator to convert.
  18889. * @returns {Array} Returns the converted array.
  18890. */
  18891. function iteratorToArray(iterator) {
  18892. var data,
  18893. result = [];
  18894. while (!(data = iterator.next()).done) {
  18895. result.push(data.value);
  18896. }
  18897. return result;
  18898. }
  18899. /**
  18900. * Converts `map` to its key-value pairs.
  18901. *
  18902. * @private
  18903. * @param {Object} map The map to convert.
  18904. * @returns {Array} Returns the key-value pairs.
  18905. */
  18906. function mapToArray(map) {
  18907. var index = -1,
  18908. result = Array(map.size);
  18909. map.forEach(function(value, key) {
  18910. result[++index] = [key, value];
  18911. });
  18912. return result;
  18913. }
  18914. /**
  18915. * Creates a unary function that invokes `func` with its argument transformed.
  18916. *
  18917. * @private
  18918. * @param {Function} func The function to wrap.
  18919. * @param {Function} transform The argument transform.
  18920. * @returns {Function} Returns the new function.
  18921. */
  18922. function overArg(func, transform) {
  18923. return function(arg) {
  18924. return func(transform(arg));
  18925. };
  18926. }
  18927. /**
  18928. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18929. * and returns an array of their indexes.
  18930. *
  18931. * @private
  18932. * @param {Array} array The array to modify.
  18933. * @param {*} placeholder The placeholder to replace.
  18934. * @returns {Array} Returns the new array of placeholder indexes.
  18935. */
  18936. function replaceHolders(array, placeholder) {
  18937. var index = -1,
  18938. length = array.length,
  18939. resIndex = 0,
  18940. result = [];
  18941. while (++index < length) {
  18942. var value = array[index];
  18943. if (value === placeholder || value === PLACEHOLDER) {
  18944. array[index] = PLACEHOLDER;
  18945. result[resIndex++] = index;
  18946. }
  18947. }
  18948. return result;
  18949. }
  18950. /**
  18951. * Converts `set` to an array of its values.
  18952. *
  18953. * @private
  18954. * @param {Object} set The set to convert.
  18955. * @returns {Array} Returns the values.
  18956. */
  18957. function setToArray(set) {
  18958. var index = -1,
  18959. result = Array(set.size);
  18960. set.forEach(function(value) {
  18961. result[++index] = value;
  18962. });
  18963. return result;
  18964. }
  18965. /**
  18966. * Converts `set` to its value-value pairs.
  18967. *
  18968. * @private
  18969. * @param {Object} set The set to convert.
  18970. * @returns {Array} Returns the value-value pairs.
  18971. */
  18972. function setToPairs(set) {
  18973. var index = -1,
  18974. result = Array(set.size);
  18975. set.forEach(function(value) {
  18976. result[++index] = [value, value];
  18977. });
  18978. return result;
  18979. }
  18980. /**
  18981. * A specialized version of `_.indexOf` which performs strict equality
  18982. * comparisons of values, i.e. `===`.
  18983. *
  18984. * @private
  18985. * @param {Array} array The array to inspect.
  18986. * @param {*} value The value to search for.
  18987. * @param {number} fromIndex The index to search from.
  18988. * @returns {number} Returns the index of the matched value, else `-1`.
  18989. */
  18990. function strictIndexOf(array, value, fromIndex) {
  18991. var index = fromIndex - 1,
  18992. length = array.length;
  18993. while (++index < length) {
  18994. if (array[index] === value) {
  18995. return index;
  18996. }
  18997. }
  18998. return -1;
  18999. }
  19000. /**
  19001. * A specialized version of `_.lastIndexOf` which performs strict equality
  19002. * comparisons of values, i.e. `===`.
  19003. *
  19004. * @private
  19005. * @param {Array} array The array to inspect.
  19006. * @param {*} value The value to search for.
  19007. * @param {number} fromIndex The index to search from.
  19008. * @returns {number} Returns the index of the matched value, else `-1`.
  19009. */
  19010. function strictLastIndexOf(array, value, fromIndex) {
  19011. var index = fromIndex + 1;
  19012. while (index--) {
  19013. if (array[index] === value) {
  19014. return index;
  19015. }
  19016. }
  19017. return index;
  19018. }
  19019. /**
  19020. * Gets the number of symbols in `string`.
  19021. *
  19022. * @private
  19023. * @param {string} string The string to inspect.
  19024. * @returns {number} Returns the string size.
  19025. */
  19026. function stringSize(string) {
  19027. return hasUnicode(string)
  19028. ? unicodeSize(string)
  19029. : asciiSize(string);
  19030. }
  19031. /**
  19032. * Converts `string` to an array.
  19033. *
  19034. * @private
  19035. * @param {string} string The string to convert.
  19036. * @returns {Array} Returns the converted array.
  19037. */
  19038. function stringToArray(string) {
  19039. return hasUnicode(string)
  19040. ? unicodeToArray(string)
  19041. : asciiToArray(string);
  19042. }
  19043. /**
  19044. * Used by `_.unescape` to convert HTML entities to characters.
  19045. *
  19046. * @private
  19047. * @param {string} chr The matched character to unescape.
  19048. * @returns {string} Returns the unescaped character.
  19049. */
  19050. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19051. /**
  19052. * Gets the size of a Unicode `string`.
  19053. *
  19054. * @private
  19055. * @param {string} string The string inspect.
  19056. * @returns {number} Returns the string size.
  19057. */
  19058. function unicodeSize(string) {
  19059. var result = reUnicode.lastIndex = 0;
  19060. while (reUnicode.test(string)) {
  19061. ++result;
  19062. }
  19063. return result;
  19064. }
  19065. /**
  19066. * Converts a Unicode `string` to an array.
  19067. *
  19068. * @private
  19069. * @param {string} string The string to convert.
  19070. * @returns {Array} Returns the converted array.
  19071. */
  19072. function unicodeToArray(string) {
  19073. return string.match(reUnicode) || [];
  19074. }
  19075. /**
  19076. * Splits a Unicode `string` into an array of its words.
  19077. *
  19078. * @private
  19079. * @param {string} The string to inspect.
  19080. * @returns {Array} Returns the words of `string`.
  19081. */
  19082. function unicodeWords(string) {
  19083. return string.match(reUnicodeWord) || [];
  19084. }
  19085. /*--------------------------------------------------------------------------*/
  19086. /**
  19087. * Create a new pristine `lodash` function using the `context` object.
  19088. *
  19089. * @static
  19090. * @memberOf _
  19091. * @since 1.1.0
  19092. * @category Util
  19093. * @param {Object} [context=root] The context object.
  19094. * @returns {Function} Returns a new `lodash` function.
  19095. * @example
  19096. *
  19097. * _.mixin({ 'foo': _.constant('foo') });
  19098. *
  19099. * var lodash = _.runInContext();
  19100. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19101. *
  19102. * _.isFunction(_.foo);
  19103. * // => true
  19104. * _.isFunction(_.bar);
  19105. * // => false
  19106. *
  19107. * lodash.isFunction(lodash.foo);
  19108. * // => false
  19109. * lodash.isFunction(lodash.bar);
  19110. * // => true
  19111. *
  19112. * // Create a suped-up `defer` in Node.js.
  19113. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19114. */
  19115. var runInContext = (function runInContext(context) {
  19116. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19117. /** Built-in constructor references. */
  19118. var Array = context.Array,
  19119. Date = context.Date,
  19120. Error = context.Error,
  19121. Function = context.Function,
  19122. Math = context.Math,
  19123. Object = context.Object,
  19124. RegExp = context.RegExp,
  19125. String = context.String,
  19126. TypeError = context.TypeError;
  19127. /** Used for built-in method references. */
  19128. var arrayProto = Array.prototype,
  19129. funcProto = Function.prototype,
  19130. objectProto = Object.prototype;
  19131. /** Used to detect overreaching core-js shims. */
  19132. var coreJsData = context['__core-js_shared__'];
  19133. /** Used to resolve the decompiled source of functions. */
  19134. var funcToString = funcProto.toString;
  19135. /** Used to check objects for own properties. */
  19136. var hasOwnProperty = objectProto.hasOwnProperty;
  19137. /** Used to generate unique IDs. */
  19138. var idCounter = 0;
  19139. /** Used to detect methods masquerading as native. */
  19140. var maskSrcKey = (function() {
  19141. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19142. return uid ? ('Symbol(src)_1.' + uid) : '';
  19143. }());
  19144. /**
  19145. * Used to resolve the
  19146. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19147. * of values.
  19148. */
  19149. var nativeObjectToString = objectProto.toString;
  19150. /** Used to infer the `Object` constructor. */
  19151. var objectCtorString = funcToString.call(Object);
  19152. /** Used to restore the original `_` reference in `_.noConflict`. */
  19153. var oldDash = root._;
  19154. /** Used to detect if a method is native. */
  19155. var reIsNative = RegExp('^' +
  19156. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19157. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19158. );
  19159. /** Built-in value references. */
  19160. var Buffer = moduleExports ? context.Buffer : undefined,
  19161. Symbol = context.Symbol,
  19162. Uint8Array = context.Uint8Array,
  19163. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19164. getPrototype = overArg(Object.getPrototypeOf, Object),
  19165. objectCreate = Object.create,
  19166. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19167. splice = arrayProto.splice,
  19168. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19169. symIterator = Symbol ? Symbol.iterator : undefined,
  19170. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19171. var defineProperty = (function() {
  19172. try {
  19173. var func = getNative(Object, 'defineProperty');
  19174. func({}, '', {});
  19175. return func;
  19176. } catch (e) {}
  19177. }());
  19178. /** Mocked built-ins. */
  19179. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19180. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19181. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19182. /* Built-in method references for those with the same name as other `lodash` methods. */
  19183. var nativeCeil = Math.ceil,
  19184. nativeFloor = Math.floor,
  19185. nativeGetSymbols = Object.getOwnPropertySymbols,
  19186. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19187. nativeIsFinite = context.isFinite,
  19188. nativeJoin = arrayProto.join,
  19189. nativeKeys = overArg(Object.keys, Object),
  19190. nativeMax = Math.max,
  19191. nativeMin = Math.min,
  19192. nativeNow = Date.now,
  19193. nativeParseInt = context.parseInt,
  19194. nativeRandom = Math.random,
  19195. nativeReverse = arrayProto.reverse;
  19196. /* Built-in method references that are verified to be native. */
  19197. var DataView = getNative(context, 'DataView'),
  19198. Map = getNative(context, 'Map'),
  19199. Promise = getNative(context, 'Promise'),
  19200. Set = getNative(context, 'Set'),
  19201. WeakMap = getNative(context, 'WeakMap'),
  19202. nativeCreate = getNative(Object, 'create');
  19203. /** Used to store function metadata. */
  19204. var metaMap = WeakMap && new WeakMap;
  19205. /** Used to lookup unminified function names. */
  19206. var realNames = {};
  19207. /** Used to detect maps, sets, and weakmaps. */
  19208. var dataViewCtorString = toSource(DataView),
  19209. mapCtorString = toSource(Map),
  19210. promiseCtorString = toSource(Promise),
  19211. setCtorString = toSource(Set),
  19212. weakMapCtorString = toSource(WeakMap);
  19213. /** Used to convert symbols to primitives and strings. */
  19214. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19215. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19216. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19217. /*------------------------------------------------------------------------*/
  19218. /**
  19219. * Creates a `lodash` object which wraps `value` to enable implicit method
  19220. * chain sequences. Methods that operate on and return arrays, collections,
  19221. * and functions can be chained together. Methods that retrieve a single value
  19222. * or may return a primitive value will automatically end the chain sequence
  19223. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19224. * with `_#value`.
  19225. *
  19226. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19227. * enabled using `_.chain`.
  19228. *
  19229. * The execution of chained methods is lazy, that is, it's deferred until
  19230. * `_#value` is implicitly or explicitly called.
  19231. *
  19232. * Lazy evaluation allows several methods to support shortcut fusion.
  19233. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19234. * the creation of intermediate arrays and can greatly reduce the number of
  19235. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19236. * fusion if the section is applied to an array and iteratees accept only
  19237. * one argument. The heuristic for whether a section qualifies for shortcut
  19238. * fusion is subject to change.
  19239. *
  19240. * Chaining is supported in custom builds as long as the `_#value` method is
  19241. * directly or indirectly included in the build.
  19242. *
  19243. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19244. *
  19245. * The wrapper `Array` methods are:
  19246. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19247. *
  19248. * The wrapper `String` methods are:
  19249. * `replace` and `split`
  19250. *
  19251. * The wrapper methods that support shortcut fusion are:
  19252. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19253. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19254. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19255. *
  19256. * The chainable wrapper methods are:
  19257. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19258. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19259. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19260. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19261. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19262. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19263. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19264. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19265. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19266. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19267. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19268. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19269. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19270. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19271. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19272. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19273. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19274. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19275. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19276. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19277. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19278. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19279. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19280. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19281. *
  19282. * The wrapper methods that are **not** chainable by default are:
  19283. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19284. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19285. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19286. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19287. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19288. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19289. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19290. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19291. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19292. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19293. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19294. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19295. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19296. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19297. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19298. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19299. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19300. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19301. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19302. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19303. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19304. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19305. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19306. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19307. * `upperFirst`, `value`, and `words`
  19308. *
  19309. * @name _
  19310. * @constructor
  19311. * @category Seq
  19312. * @param {*} value The value to wrap in a `lodash` instance.
  19313. * @returns {Object} Returns the new `lodash` wrapper instance.
  19314. * @example
  19315. *
  19316. * function square(n) {
  19317. * return n * n;
  19318. * }
  19319. *
  19320. * var wrapped = _([1, 2, 3]);
  19321. *
  19322. * // Returns an unwrapped value.
  19323. * wrapped.reduce(_.add);
  19324. * // => 6
  19325. *
  19326. * // Returns a wrapped value.
  19327. * var squares = wrapped.map(square);
  19328. *
  19329. * _.isArray(squares);
  19330. * // => false
  19331. *
  19332. * _.isArray(squares.value());
  19333. * // => true
  19334. */
  19335. function lodash(value) {
  19336. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19337. if (value instanceof LodashWrapper) {
  19338. return value;
  19339. }
  19340. if (hasOwnProperty.call(value, '__wrapped__')) {
  19341. return wrapperClone(value);
  19342. }
  19343. }
  19344. return new LodashWrapper(value);
  19345. }
  19346. /**
  19347. * The base implementation of `_.create` without support for assigning
  19348. * properties to the created object.
  19349. *
  19350. * @private
  19351. * @param {Object} proto The object to inherit from.
  19352. * @returns {Object} Returns the new object.
  19353. */
  19354. var baseCreate = (function() {
  19355. function object() {}
  19356. return function(proto) {
  19357. if (!isObject(proto)) {
  19358. return {};
  19359. }
  19360. if (objectCreate) {
  19361. return objectCreate(proto);
  19362. }
  19363. object.prototype = proto;
  19364. var result = new object;
  19365. object.prototype = undefined;
  19366. return result;
  19367. };
  19368. }());
  19369. /**
  19370. * The function whose prototype chain sequence wrappers inherit from.
  19371. *
  19372. * @private
  19373. */
  19374. function baseLodash() {
  19375. // No operation performed.
  19376. }
  19377. /**
  19378. * The base constructor for creating `lodash` wrapper objects.
  19379. *
  19380. * @private
  19381. * @param {*} value The value to wrap.
  19382. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19383. */
  19384. function LodashWrapper(value, chainAll) {
  19385. this.__wrapped__ = value;
  19386. this.__actions__ = [];
  19387. this.__chain__ = !!chainAll;
  19388. this.__index__ = 0;
  19389. this.__values__ = undefined;
  19390. }
  19391. /**
  19392. * By default, the template delimiters used by lodash are like those in
  19393. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19394. * following template settings to use alternative delimiters.
  19395. *
  19396. * @static
  19397. * @memberOf _
  19398. * @type {Object}
  19399. */
  19400. lodash.templateSettings = {
  19401. /**
  19402. * Used to detect `data` property values to be HTML-escaped.
  19403. *
  19404. * @memberOf _.templateSettings
  19405. * @type {RegExp}
  19406. */
  19407. 'escape': reEscape,
  19408. /**
  19409. * Used to detect code to be evaluated.
  19410. *
  19411. * @memberOf _.templateSettings
  19412. * @type {RegExp}
  19413. */
  19414. 'evaluate': reEvaluate,
  19415. /**
  19416. * Used to detect `data` property values to inject.
  19417. *
  19418. * @memberOf _.templateSettings
  19419. * @type {RegExp}
  19420. */
  19421. 'interpolate': reInterpolate,
  19422. /**
  19423. * Used to reference the data object in the template text.
  19424. *
  19425. * @memberOf _.templateSettings
  19426. * @type {string}
  19427. */
  19428. 'variable': '',
  19429. /**
  19430. * Used to import variables into the compiled template.
  19431. *
  19432. * @memberOf _.templateSettings
  19433. * @type {Object}
  19434. */
  19435. 'imports': {
  19436. /**
  19437. * A reference to the `lodash` function.
  19438. *
  19439. * @memberOf _.templateSettings.imports
  19440. * @type {Function}
  19441. */
  19442. '_': lodash
  19443. }
  19444. };
  19445. // Ensure wrappers are instances of `baseLodash`.
  19446. lodash.prototype = baseLodash.prototype;
  19447. lodash.prototype.constructor = lodash;
  19448. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19449. LodashWrapper.prototype.constructor = LodashWrapper;
  19450. /*------------------------------------------------------------------------*/
  19451. /**
  19452. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19453. *
  19454. * @private
  19455. * @constructor
  19456. * @param {*} value The value to wrap.
  19457. */
  19458. function LazyWrapper(value) {
  19459. this.__wrapped__ = value;
  19460. this.__actions__ = [];
  19461. this.__dir__ = 1;
  19462. this.__filtered__ = false;
  19463. this.__iteratees__ = [];
  19464. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19465. this.__views__ = [];
  19466. }
  19467. /**
  19468. * Creates a clone of the lazy wrapper object.
  19469. *
  19470. * @private
  19471. * @name clone
  19472. * @memberOf LazyWrapper
  19473. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19474. */
  19475. function lazyClone() {
  19476. var result = new LazyWrapper(this.__wrapped__);
  19477. result.__actions__ = copyArray(this.__actions__);
  19478. result.__dir__ = this.__dir__;
  19479. result.__filtered__ = this.__filtered__;
  19480. result.__iteratees__ = copyArray(this.__iteratees__);
  19481. result.__takeCount__ = this.__takeCount__;
  19482. result.__views__ = copyArray(this.__views__);
  19483. return result;
  19484. }
  19485. /**
  19486. * Reverses the direction of lazy iteration.
  19487. *
  19488. * @private
  19489. * @name reverse
  19490. * @memberOf LazyWrapper
  19491. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19492. */
  19493. function lazyReverse() {
  19494. if (this.__filtered__) {
  19495. var result = new LazyWrapper(this);
  19496. result.__dir__ = -1;
  19497. result.__filtered__ = true;
  19498. } else {
  19499. result = this.clone();
  19500. result.__dir__ *= -1;
  19501. }
  19502. return result;
  19503. }
  19504. /**
  19505. * Extracts the unwrapped value from its lazy wrapper.
  19506. *
  19507. * @private
  19508. * @name value
  19509. * @memberOf LazyWrapper
  19510. * @returns {*} Returns the unwrapped value.
  19511. */
  19512. function lazyValue() {
  19513. var array = this.__wrapped__.value(),
  19514. dir = this.__dir__,
  19515. isArr = isArray(array),
  19516. isRight = dir < 0,
  19517. arrLength = isArr ? array.length : 0,
  19518. view = getView(0, arrLength, this.__views__),
  19519. start = view.start,
  19520. end = view.end,
  19521. length = end - start,
  19522. index = isRight ? end : (start - 1),
  19523. iteratees = this.__iteratees__,
  19524. iterLength = iteratees.length,
  19525. resIndex = 0,
  19526. takeCount = nativeMin(length, this.__takeCount__);
  19527. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19528. return baseWrapperValue(array, this.__actions__);
  19529. }
  19530. var result = [];
  19531. outer:
  19532. while (length-- && resIndex < takeCount) {
  19533. index += dir;
  19534. var iterIndex = -1,
  19535. value = array[index];
  19536. while (++iterIndex < iterLength) {
  19537. var data = iteratees[iterIndex],
  19538. iteratee = data.iteratee,
  19539. type = data.type,
  19540. computed = iteratee(value);
  19541. if (type == LAZY_MAP_FLAG) {
  19542. value = computed;
  19543. } else if (!computed) {
  19544. if (type == LAZY_FILTER_FLAG) {
  19545. continue outer;
  19546. } else {
  19547. break outer;
  19548. }
  19549. }
  19550. }
  19551. result[resIndex++] = value;
  19552. }
  19553. return result;
  19554. }
  19555. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19556. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19557. LazyWrapper.prototype.constructor = LazyWrapper;
  19558. /*------------------------------------------------------------------------*/
  19559. /**
  19560. * Creates a hash object.
  19561. *
  19562. * @private
  19563. * @constructor
  19564. * @param {Array} [entries] The key-value pairs to cache.
  19565. */
  19566. function Hash(entries) {
  19567. var index = -1,
  19568. length = entries == null ? 0 : entries.length;
  19569. this.clear();
  19570. while (++index < length) {
  19571. var entry = entries[index];
  19572. this.set(entry[0], entry[1]);
  19573. }
  19574. }
  19575. /**
  19576. * Removes all key-value entries from the hash.
  19577. *
  19578. * @private
  19579. * @name clear
  19580. * @memberOf Hash
  19581. */
  19582. function hashClear() {
  19583. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19584. this.size = 0;
  19585. }
  19586. /**
  19587. * Removes `key` and its value from the hash.
  19588. *
  19589. * @private
  19590. * @name delete
  19591. * @memberOf Hash
  19592. * @param {Object} hash The hash to modify.
  19593. * @param {string} key The key of the value to remove.
  19594. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19595. */
  19596. function hashDelete(key) {
  19597. var result = this.has(key) && delete this.__data__[key];
  19598. this.size -= result ? 1 : 0;
  19599. return result;
  19600. }
  19601. /**
  19602. * Gets the hash value for `key`.
  19603. *
  19604. * @private
  19605. * @name get
  19606. * @memberOf Hash
  19607. * @param {string} key The key of the value to get.
  19608. * @returns {*} Returns the entry value.
  19609. */
  19610. function hashGet(key) {
  19611. var data = this.__data__;
  19612. if (nativeCreate) {
  19613. var result = data[key];
  19614. return result === HASH_UNDEFINED ? undefined : result;
  19615. }
  19616. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19617. }
  19618. /**
  19619. * Checks if a hash value for `key` exists.
  19620. *
  19621. * @private
  19622. * @name has
  19623. * @memberOf Hash
  19624. * @param {string} key The key of the entry to check.
  19625. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19626. */
  19627. function hashHas(key) {
  19628. var data = this.__data__;
  19629. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19630. }
  19631. /**
  19632. * Sets the hash `key` to `value`.
  19633. *
  19634. * @private
  19635. * @name set
  19636. * @memberOf Hash
  19637. * @param {string} key The key of the value to set.
  19638. * @param {*} value The value to set.
  19639. * @returns {Object} Returns the hash instance.
  19640. */
  19641. function hashSet(key, value) {
  19642. var data = this.__data__;
  19643. this.size += this.has(key) ? 0 : 1;
  19644. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19645. return this;
  19646. }
  19647. // Add methods to `Hash`.
  19648. Hash.prototype.clear = hashClear;
  19649. Hash.prototype['delete'] = hashDelete;
  19650. Hash.prototype.get = hashGet;
  19651. Hash.prototype.has = hashHas;
  19652. Hash.prototype.set = hashSet;
  19653. /*------------------------------------------------------------------------*/
  19654. /**
  19655. * Creates an list cache object.
  19656. *
  19657. * @private
  19658. * @constructor
  19659. * @param {Array} [entries] The key-value pairs to cache.
  19660. */
  19661. function ListCache(entries) {
  19662. var index = -1,
  19663. length = entries == null ? 0 : entries.length;
  19664. this.clear();
  19665. while (++index < length) {
  19666. var entry = entries[index];
  19667. this.set(entry[0], entry[1]);
  19668. }
  19669. }
  19670. /**
  19671. * Removes all key-value entries from the list cache.
  19672. *
  19673. * @private
  19674. * @name clear
  19675. * @memberOf ListCache
  19676. */
  19677. function listCacheClear() {
  19678. this.__data__ = [];
  19679. this.size = 0;
  19680. }
  19681. /**
  19682. * Removes `key` and its value from the list cache.
  19683. *
  19684. * @private
  19685. * @name delete
  19686. * @memberOf ListCache
  19687. * @param {string} key The key of the value to remove.
  19688. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19689. */
  19690. function listCacheDelete(key) {
  19691. var data = this.__data__,
  19692. index = assocIndexOf(data, key);
  19693. if (index < 0) {
  19694. return false;
  19695. }
  19696. var lastIndex = data.length - 1;
  19697. if (index == lastIndex) {
  19698. data.pop();
  19699. } else {
  19700. splice.call(data, index, 1);
  19701. }
  19702. --this.size;
  19703. return true;
  19704. }
  19705. /**
  19706. * Gets the list cache value for `key`.
  19707. *
  19708. * @private
  19709. * @name get
  19710. * @memberOf ListCache
  19711. * @param {string} key The key of the value to get.
  19712. * @returns {*} Returns the entry value.
  19713. */
  19714. function listCacheGet(key) {
  19715. var data = this.__data__,
  19716. index = assocIndexOf(data, key);
  19717. return index < 0 ? undefined : data[index][1];
  19718. }
  19719. /**
  19720. * Checks if a list cache value for `key` exists.
  19721. *
  19722. * @private
  19723. * @name has
  19724. * @memberOf ListCache
  19725. * @param {string} key The key of the entry to check.
  19726. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19727. */
  19728. function listCacheHas(key) {
  19729. return assocIndexOf(this.__data__, key) > -1;
  19730. }
  19731. /**
  19732. * Sets the list cache `key` to `value`.
  19733. *
  19734. * @private
  19735. * @name set
  19736. * @memberOf ListCache
  19737. * @param {string} key The key of the value to set.
  19738. * @param {*} value The value to set.
  19739. * @returns {Object} Returns the list cache instance.
  19740. */
  19741. function listCacheSet(key, value) {
  19742. var data = this.__data__,
  19743. index = assocIndexOf(data, key);
  19744. if (index < 0) {
  19745. ++this.size;
  19746. data.push([key, value]);
  19747. } else {
  19748. data[index][1] = value;
  19749. }
  19750. return this;
  19751. }
  19752. // Add methods to `ListCache`.
  19753. ListCache.prototype.clear = listCacheClear;
  19754. ListCache.prototype['delete'] = listCacheDelete;
  19755. ListCache.prototype.get = listCacheGet;
  19756. ListCache.prototype.has = listCacheHas;
  19757. ListCache.prototype.set = listCacheSet;
  19758. /*------------------------------------------------------------------------*/
  19759. /**
  19760. * Creates a map cache object to store key-value pairs.
  19761. *
  19762. * @private
  19763. * @constructor
  19764. * @param {Array} [entries] The key-value pairs to cache.
  19765. */
  19766. function MapCache(entries) {
  19767. var index = -1,
  19768. length = entries == null ? 0 : entries.length;
  19769. this.clear();
  19770. while (++index < length) {
  19771. var entry = entries[index];
  19772. this.set(entry[0], entry[1]);
  19773. }
  19774. }
  19775. /**
  19776. * Removes all key-value entries from the map.
  19777. *
  19778. * @private
  19779. * @name clear
  19780. * @memberOf MapCache
  19781. */
  19782. function mapCacheClear() {
  19783. this.size = 0;
  19784. this.__data__ = {
  19785. 'hash': new Hash,
  19786. 'map': new (Map || ListCache),
  19787. 'string': new Hash
  19788. };
  19789. }
  19790. /**
  19791. * Removes `key` and its value from the map.
  19792. *
  19793. * @private
  19794. * @name delete
  19795. * @memberOf MapCache
  19796. * @param {string} key The key of the value to remove.
  19797. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19798. */
  19799. function mapCacheDelete(key) {
  19800. var result = getMapData(this, key)['delete'](key);
  19801. this.size -= result ? 1 : 0;
  19802. return result;
  19803. }
  19804. /**
  19805. * Gets the map value for `key`.
  19806. *
  19807. * @private
  19808. * @name get
  19809. * @memberOf MapCache
  19810. * @param {string} key The key of the value to get.
  19811. * @returns {*} Returns the entry value.
  19812. */
  19813. function mapCacheGet(key) {
  19814. return getMapData(this, key).get(key);
  19815. }
  19816. /**
  19817. * Checks if a map value for `key` exists.
  19818. *
  19819. * @private
  19820. * @name has
  19821. * @memberOf MapCache
  19822. * @param {string} key The key of the entry to check.
  19823. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19824. */
  19825. function mapCacheHas(key) {
  19826. return getMapData(this, key).has(key);
  19827. }
  19828. /**
  19829. * Sets the map `key` to `value`.
  19830. *
  19831. * @private
  19832. * @name set
  19833. * @memberOf MapCache
  19834. * @param {string} key The key of the value to set.
  19835. * @param {*} value The value to set.
  19836. * @returns {Object} Returns the map cache instance.
  19837. */
  19838. function mapCacheSet(key, value) {
  19839. var data = getMapData(this, key),
  19840. size = data.size;
  19841. data.set(key, value);
  19842. this.size += data.size == size ? 0 : 1;
  19843. return this;
  19844. }
  19845. // Add methods to `MapCache`.
  19846. MapCache.prototype.clear = mapCacheClear;
  19847. MapCache.prototype['delete'] = mapCacheDelete;
  19848. MapCache.prototype.get = mapCacheGet;
  19849. MapCache.prototype.has = mapCacheHas;
  19850. MapCache.prototype.set = mapCacheSet;
  19851. /*------------------------------------------------------------------------*/
  19852. /**
  19853. *
  19854. * Creates an array cache object to store unique values.
  19855. *
  19856. * @private
  19857. * @constructor
  19858. * @param {Array} [values] The values to cache.
  19859. */
  19860. function SetCache(values) {
  19861. var index = -1,
  19862. length = values == null ? 0 : values.length;
  19863. this.__data__ = new MapCache;
  19864. while (++index < length) {
  19865. this.add(values[index]);
  19866. }
  19867. }
  19868. /**
  19869. * Adds `value` to the array cache.
  19870. *
  19871. * @private
  19872. * @name add
  19873. * @memberOf SetCache
  19874. * @alias push
  19875. * @param {*} value The value to cache.
  19876. * @returns {Object} Returns the cache instance.
  19877. */
  19878. function setCacheAdd(value) {
  19879. this.__data__.set(value, HASH_UNDEFINED);
  19880. return this;
  19881. }
  19882. /**
  19883. * Checks if `value` is in the array cache.
  19884. *
  19885. * @private
  19886. * @name has
  19887. * @memberOf SetCache
  19888. * @param {*} value The value to search for.
  19889. * @returns {number} Returns `true` if `value` is found, else `false`.
  19890. */
  19891. function setCacheHas(value) {
  19892. return this.__data__.has(value);
  19893. }
  19894. // Add methods to `SetCache`.
  19895. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19896. SetCache.prototype.has = setCacheHas;
  19897. /*------------------------------------------------------------------------*/
  19898. /**
  19899. * Creates a stack cache object to store key-value pairs.
  19900. *
  19901. * @private
  19902. * @constructor
  19903. * @param {Array} [entries] The key-value pairs to cache.
  19904. */
  19905. function Stack(entries) {
  19906. var data = this.__data__ = new ListCache(entries);
  19907. this.size = data.size;
  19908. }
  19909. /**
  19910. * Removes all key-value entries from the stack.
  19911. *
  19912. * @private
  19913. * @name clear
  19914. * @memberOf Stack
  19915. */
  19916. function stackClear() {
  19917. this.__data__ = new ListCache;
  19918. this.size = 0;
  19919. }
  19920. /**
  19921. * Removes `key` and its value from the stack.
  19922. *
  19923. * @private
  19924. * @name delete
  19925. * @memberOf Stack
  19926. * @param {string} key The key of the value to remove.
  19927. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19928. */
  19929. function stackDelete(key) {
  19930. var data = this.__data__,
  19931. result = data['delete'](key);
  19932. this.size = data.size;
  19933. return result;
  19934. }
  19935. /**
  19936. * Gets the stack value for `key`.
  19937. *
  19938. * @private
  19939. * @name get
  19940. * @memberOf Stack
  19941. * @param {string} key The key of the value to get.
  19942. * @returns {*} Returns the entry value.
  19943. */
  19944. function stackGet(key) {
  19945. return this.__data__.get(key);
  19946. }
  19947. /**
  19948. * Checks if a stack value for `key` exists.
  19949. *
  19950. * @private
  19951. * @name has
  19952. * @memberOf Stack
  19953. * @param {string} key The key of the entry to check.
  19954. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19955. */
  19956. function stackHas(key) {
  19957. return this.__data__.has(key);
  19958. }
  19959. /**
  19960. * Sets the stack `key` to `value`.
  19961. *
  19962. * @private
  19963. * @name set
  19964. * @memberOf Stack
  19965. * @param {string} key The key of the value to set.
  19966. * @param {*} value The value to set.
  19967. * @returns {Object} Returns the stack cache instance.
  19968. */
  19969. function stackSet(key, value) {
  19970. var data = this.__data__;
  19971. if (data instanceof ListCache) {
  19972. var pairs = data.__data__;
  19973. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  19974. pairs.push([key, value]);
  19975. this.size = ++data.size;
  19976. return this;
  19977. }
  19978. data = this.__data__ = new MapCache(pairs);
  19979. }
  19980. data.set(key, value);
  19981. this.size = data.size;
  19982. return this;
  19983. }
  19984. // Add methods to `Stack`.
  19985. Stack.prototype.clear = stackClear;
  19986. Stack.prototype['delete'] = stackDelete;
  19987. Stack.prototype.get = stackGet;
  19988. Stack.prototype.has = stackHas;
  19989. Stack.prototype.set = stackSet;
  19990. /*------------------------------------------------------------------------*/
  19991. /**
  19992. * Creates an array of the enumerable property names of the array-like `value`.
  19993. *
  19994. * @private
  19995. * @param {*} value The value to query.
  19996. * @param {boolean} inherited Specify returning inherited property names.
  19997. * @returns {Array} Returns the array of property names.
  19998. */
  19999. function arrayLikeKeys(value, inherited) {
  20000. var isArr = isArray(value),
  20001. isArg = !isArr && isArguments(value),
  20002. isBuff = !isArr && !isArg && isBuffer(value),
  20003. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20004. skipIndexes = isArr || isArg || isBuff || isType,
  20005. result = skipIndexes ? baseTimes(value.length, String) : [],
  20006. length = result.length;
  20007. for (var key in value) {
  20008. if ((inherited || hasOwnProperty.call(value, key)) &&
  20009. !(skipIndexes && (
  20010. // Safari 9 has enumerable `arguments.length` in strict mode.
  20011. key == 'length' ||
  20012. // Node.js 0.10 has enumerable non-index properties on buffers.
  20013. (isBuff && (key == 'offset' || key == 'parent')) ||
  20014. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20015. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20016. // Skip index properties.
  20017. isIndex(key, length)
  20018. ))) {
  20019. result.push(key);
  20020. }
  20021. }
  20022. return result;
  20023. }
  20024. /**
  20025. * A specialized version of `_.sample` for arrays.
  20026. *
  20027. * @private
  20028. * @param {Array} array The array to sample.
  20029. * @returns {*} Returns the random element.
  20030. */
  20031. function arraySample(array) {
  20032. var length = array.length;
  20033. return length ? array[baseRandom(0, length - 1)] : undefined;
  20034. }
  20035. /**
  20036. * A specialized version of `_.sampleSize` for arrays.
  20037. *
  20038. * @private
  20039. * @param {Array} array The array to sample.
  20040. * @param {number} n The number of elements to sample.
  20041. * @returns {Array} Returns the random elements.
  20042. */
  20043. function arraySampleSize(array, n) {
  20044. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20045. }
  20046. /**
  20047. * A specialized version of `_.shuffle` for arrays.
  20048. *
  20049. * @private
  20050. * @param {Array} array The array to shuffle.
  20051. * @returns {Array} Returns the new shuffled array.
  20052. */
  20053. function arrayShuffle(array) {
  20054. return shuffleSelf(copyArray(array));
  20055. }
  20056. /**
  20057. * This function is like `assignValue` except that it doesn't assign
  20058. * `undefined` values.
  20059. *
  20060. * @private
  20061. * @param {Object} object The object to modify.
  20062. * @param {string} key The key of the property to assign.
  20063. * @param {*} value The value to assign.
  20064. */
  20065. function assignMergeValue(object, key, value) {
  20066. if ((value !== undefined && !eq(object[key], value)) ||
  20067. (value === undefined && !(key in object))) {
  20068. baseAssignValue(object, key, value);
  20069. }
  20070. }
  20071. /**
  20072. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20073. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20074. * for equality comparisons.
  20075. *
  20076. * @private
  20077. * @param {Object} object The object to modify.
  20078. * @param {string} key The key of the property to assign.
  20079. * @param {*} value The value to assign.
  20080. */
  20081. function assignValue(object, key, value) {
  20082. var objValue = object[key];
  20083. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20084. (value === undefined && !(key in object))) {
  20085. baseAssignValue(object, key, value);
  20086. }
  20087. }
  20088. /**
  20089. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20090. *
  20091. * @private
  20092. * @param {Array} array The array to inspect.
  20093. * @param {*} key The key to search for.
  20094. * @returns {number} Returns the index of the matched value, else `-1`.
  20095. */
  20096. function assocIndexOf(array, key) {
  20097. var length = array.length;
  20098. while (length--) {
  20099. if (eq(array[length][0], key)) {
  20100. return length;
  20101. }
  20102. }
  20103. return -1;
  20104. }
  20105. /**
  20106. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20107. * by `iteratee` and values set by `setter`.
  20108. *
  20109. * @private
  20110. * @param {Array|Object} collection The collection to iterate over.
  20111. * @param {Function} setter The function to set `accumulator` values.
  20112. * @param {Function} iteratee The iteratee to transform keys.
  20113. * @param {Object} accumulator The initial aggregated object.
  20114. * @returns {Function} Returns `accumulator`.
  20115. */
  20116. function baseAggregator(collection, setter, iteratee, accumulator) {
  20117. baseEach(collection, function(value, key, collection) {
  20118. setter(accumulator, value, iteratee(value), collection);
  20119. });
  20120. return accumulator;
  20121. }
  20122. /**
  20123. * The base implementation of `_.assign` without support for multiple sources
  20124. * or `customizer` functions.
  20125. *
  20126. * @private
  20127. * @param {Object} object The destination object.
  20128. * @param {Object} source The source object.
  20129. * @returns {Object} Returns `object`.
  20130. */
  20131. function baseAssign(object, source) {
  20132. return object && copyObject(source, keys(source), object);
  20133. }
  20134. /**
  20135. * The base implementation of `_.assignIn` without support for multiple sources
  20136. * or `customizer` functions.
  20137. *
  20138. * @private
  20139. * @param {Object} object The destination object.
  20140. * @param {Object} source The source object.
  20141. * @returns {Object} Returns `object`.
  20142. */
  20143. function baseAssignIn(object, source) {
  20144. return object && copyObject(source, keysIn(source), object);
  20145. }
  20146. /**
  20147. * The base implementation of `assignValue` and `assignMergeValue` without
  20148. * value checks.
  20149. *
  20150. * @private
  20151. * @param {Object} object The object to modify.
  20152. * @param {string} key The key of the property to assign.
  20153. * @param {*} value The value to assign.
  20154. */
  20155. function baseAssignValue(object, key, value) {
  20156. if (key == '__proto__' && defineProperty) {
  20157. defineProperty(object, key, {
  20158. 'configurable': true,
  20159. 'enumerable': true,
  20160. 'value': value,
  20161. 'writable': true
  20162. });
  20163. } else {
  20164. object[key] = value;
  20165. }
  20166. }
  20167. /**
  20168. * The base implementation of `_.at` without support for individual paths.
  20169. *
  20170. * @private
  20171. * @param {Object} object The object to iterate over.
  20172. * @param {string[]} paths The property paths to pick.
  20173. * @returns {Array} Returns the picked elements.
  20174. */
  20175. function baseAt(object, paths) {
  20176. var index = -1,
  20177. length = paths.length,
  20178. result = Array(length),
  20179. skip = object == null;
  20180. while (++index < length) {
  20181. result[index] = skip ? undefined : get(object, paths[index]);
  20182. }
  20183. return result;
  20184. }
  20185. /**
  20186. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20187. *
  20188. * @private
  20189. * @param {number} number The number to clamp.
  20190. * @param {number} [lower] The lower bound.
  20191. * @param {number} upper The upper bound.
  20192. * @returns {number} Returns the clamped number.
  20193. */
  20194. function baseClamp(number, lower, upper) {
  20195. if (number === number) {
  20196. if (upper !== undefined) {
  20197. number = number <= upper ? number : upper;
  20198. }
  20199. if (lower !== undefined) {
  20200. number = number >= lower ? number : lower;
  20201. }
  20202. }
  20203. return number;
  20204. }
  20205. /**
  20206. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20207. * traversed objects.
  20208. *
  20209. * @private
  20210. * @param {*} value The value to clone.
  20211. * @param {boolean} bitmask The bitmask flags.
  20212. * 1 - Deep clone
  20213. * 2 - Flatten inherited properties
  20214. * 4 - Clone symbols
  20215. * @param {Function} [customizer] The function to customize cloning.
  20216. * @param {string} [key] The key of `value`.
  20217. * @param {Object} [object] The parent object of `value`.
  20218. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20219. * @returns {*} Returns the cloned value.
  20220. */
  20221. function baseClone(value, bitmask, customizer, key, object, stack) {
  20222. var result,
  20223. isDeep = bitmask & CLONE_DEEP_FLAG,
  20224. isFlat = bitmask & CLONE_FLAT_FLAG,
  20225. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20226. if (customizer) {
  20227. result = object ? customizer(value, key, object, stack) : customizer(value);
  20228. }
  20229. if (result !== undefined) {
  20230. return result;
  20231. }
  20232. if (!isObject(value)) {
  20233. return value;
  20234. }
  20235. var isArr = isArray(value);
  20236. if (isArr) {
  20237. result = initCloneArray(value);
  20238. if (!isDeep) {
  20239. return copyArray(value, result);
  20240. }
  20241. } else {
  20242. var tag = getTag(value),
  20243. isFunc = tag == funcTag || tag == genTag;
  20244. if (isBuffer(value)) {
  20245. return cloneBuffer(value, isDeep);
  20246. }
  20247. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20248. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20249. if (!isDeep) {
  20250. return isFlat
  20251. ? copySymbolsIn(value, baseAssignIn(result, value))
  20252. : copySymbols(value, baseAssign(result, value));
  20253. }
  20254. } else {
  20255. if (!cloneableTags[tag]) {
  20256. return object ? value : {};
  20257. }
  20258. result = initCloneByTag(value, tag, isDeep);
  20259. }
  20260. }
  20261. // Check for circular references and return its corresponding clone.
  20262. stack || (stack = new Stack);
  20263. var stacked = stack.get(value);
  20264. if (stacked) {
  20265. return stacked;
  20266. }
  20267. stack.set(value, result);
  20268. if (isSet(value)) {
  20269. value.forEach(function(subValue) {
  20270. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20271. });
  20272. } else if (isMap(value)) {
  20273. value.forEach(function(subValue, key) {
  20274. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20275. });
  20276. }
  20277. var keysFunc = isFull
  20278. ? (isFlat ? getAllKeysIn : getAllKeys)
  20279. : (isFlat ? keysIn : keys);
  20280. var props = isArr ? undefined : keysFunc(value);
  20281. arrayEach(props || value, function(subValue, key) {
  20282. if (props) {
  20283. key = subValue;
  20284. subValue = value[key];
  20285. }
  20286. // Recursively populate clone (susceptible to call stack limits).
  20287. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20288. });
  20289. return result;
  20290. }
  20291. /**
  20292. * The base implementation of `_.conforms` which doesn't clone `source`.
  20293. *
  20294. * @private
  20295. * @param {Object} source The object of property predicates to conform to.
  20296. * @returns {Function} Returns the new spec function.
  20297. */
  20298. function baseConforms(source) {
  20299. var props = keys(source);
  20300. return function(object) {
  20301. return baseConformsTo(object, source, props);
  20302. };
  20303. }
  20304. /**
  20305. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20306. *
  20307. * @private
  20308. * @param {Object} object The object to inspect.
  20309. * @param {Object} source The object of property predicates to conform to.
  20310. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20311. */
  20312. function baseConformsTo(object, source, props) {
  20313. var length = props.length;
  20314. if (object == null) {
  20315. return !length;
  20316. }
  20317. object = Object(object);
  20318. while (length--) {
  20319. var key = props[length],
  20320. predicate = source[key],
  20321. value = object[key];
  20322. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20323. return false;
  20324. }
  20325. }
  20326. return true;
  20327. }
  20328. /**
  20329. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20330. * to provide to `func`.
  20331. *
  20332. * @private
  20333. * @param {Function} func The function to delay.
  20334. * @param {number} wait The number of milliseconds to delay invocation.
  20335. * @param {Array} args The arguments to provide to `func`.
  20336. * @returns {number|Object} Returns the timer id or timeout object.
  20337. */
  20338. function baseDelay(func, wait, args) {
  20339. if (typeof func != 'function') {
  20340. throw new TypeError(FUNC_ERROR_TEXT);
  20341. }
  20342. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20343. }
  20344. /**
  20345. * The base implementation of methods like `_.difference` without support
  20346. * for excluding multiple arrays or iteratee shorthands.
  20347. *
  20348. * @private
  20349. * @param {Array} array The array to inspect.
  20350. * @param {Array} values The values to exclude.
  20351. * @param {Function} [iteratee] The iteratee invoked per element.
  20352. * @param {Function} [comparator] The comparator invoked per element.
  20353. * @returns {Array} Returns the new array of filtered values.
  20354. */
  20355. function baseDifference(array, values, iteratee, comparator) {
  20356. var index = -1,
  20357. includes = arrayIncludes,
  20358. isCommon = true,
  20359. length = array.length,
  20360. result = [],
  20361. valuesLength = values.length;
  20362. if (!length) {
  20363. return result;
  20364. }
  20365. if (iteratee) {
  20366. values = arrayMap(values, baseUnary(iteratee));
  20367. }
  20368. if (comparator) {
  20369. includes = arrayIncludesWith;
  20370. isCommon = false;
  20371. }
  20372. else if (values.length >= LARGE_ARRAY_SIZE) {
  20373. includes = cacheHas;
  20374. isCommon = false;
  20375. values = new SetCache(values);
  20376. }
  20377. outer:
  20378. while (++index < length) {
  20379. var value = array[index],
  20380. computed = iteratee == null ? value : iteratee(value);
  20381. value = (comparator || value !== 0) ? value : 0;
  20382. if (isCommon && computed === computed) {
  20383. var valuesIndex = valuesLength;
  20384. while (valuesIndex--) {
  20385. if (values[valuesIndex] === computed) {
  20386. continue outer;
  20387. }
  20388. }
  20389. result.push(value);
  20390. }
  20391. else if (!includes(values, computed, comparator)) {
  20392. result.push(value);
  20393. }
  20394. }
  20395. return result;
  20396. }
  20397. /**
  20398. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20399. *
  20400. * @private
  20401. * @param {Array|Object} collection The collection to iterate over.
  20402. * @param {Function} iteratee The function invoked per iteration.
  20403. * @returns {Array|Object} Returns `collection`.
  20404. */
  20405. var baseEach = createBaseEach(baseForOwn);
  20406. /**
  20407. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20408. *
  20409. * @private
  20410. * @param {Array|Object} collection The collection to iterate over.
  20411. * @param {Function} iteratee The function invoked per iteration.
  20412. * @returns {Array|Object} Returns `collection`.
  20413. */
  20414. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20415. /**
  20416. * The base implementation of `_.every` without support for iteratee shorthands.
  20417. *
  20418. * @private
  20419. * @param {Array|Object} collection The collection to iterate over.
  20420. * @param {Function} predicate The function invoked per iteration.
  20421. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20422. * else `false`
  20423. */
  20424. function baseEvery(collection, predicate) {
  20425. var result = true;
  20426. baseEach(collection, function(value, index, collection) {
  20427. result = !!predicate(value, index, collection);
  20428. return result;
  20429. });
  20430. return result;
  20431. }
  20432. /**
  20433. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20434. * `comparator` to determine the extremum value.
  20435. *
  20436. * @private
  20437. * @param {Array} array The array to iterate over.
  20438. * @param {Function} iteratee The iteratee invoked per iteration.
  20439. * @param {Function} comparator The comparator used to compare values.
  20440. * @returns {*} Returns the extremum value.
  20441. */
  20442. function baseExtremum(array, iteratee, comparator) {
  20443. var index = -1,
  20444. length = array.length;
  20445. while (++index < length) {
  20446. var value = array[index],
  20447. current = iteratee(value);
  20448. if (current != null && (computed === undefined
  20449. ? (current === current && !isSymbol(current))
  20450. : comparator(current, computed)
  20451. )) {
  20452. var computed = current,
  20453. result = value;
  20454. }
  20455. }
  20456. return result;
  20457. }
  20458. /**
  20459. * The base implementation of `_.fill` without an iteratee call guard.
  20460. *
  20461. * @private
  20462. * @param {Array} array The array to fill.
  20463. * @param {*} value The value to fill `array` with.
  20464. * @param {number} [start=0] The start position.
  20465. * @param {number} [end=array.length] The end position.
  20466. * @returns {Array} Returns `array`.
  20467. */
  20468. function baseFill(array, value, start, end) {
  20469. var length = array.length;
  20470. start = toInteger(start);
  20471. if (start < 0) {
  20472. start = -start > length ? 0 : (length + start);
  20473. }
  20474. end = (end === undefined || end > length) ? length : toInteger(end);
  20475. if (end < 0) {
  20476. end += length;
  20477. }
  20478. end = start > end ? 0 : toLength(end);
  20479. while (start < end) {
  20480. array[start++] = value;
  20481. }
  20482. return array;
  20483. }
  20484. /**
  20485. * The base implementation of `_.filter` without support for iteratee shorthands.
  20486. *
  20487. * @private
  20488. * @param {Array|Object} collection The collection to iterate over.
  20489. * @param {Function} predicate The function invoked per iteration.
  20490. * @returns {Array} Returns the new filtered array.
  20491. */
  20492. function baseFilter(collection, predicate) {
  20493. var result = [];
  20494. baseEach(collection, function(value, index, collection) {
  20495. if (predicate(value, index, collection)) {
  20496. result.push(value);
  20497. }
  20498. });
  20499. return result;
  20500. }
  20501. /**
  20502. * The base implementation of `_.flatten` with support for restricting flattening.
  20503. *
  20504. * @private
  20505. * @param {Array} array The array to flatten.
  20506. * @param {number} depth The maximum recursion depth.
  20507. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20508. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20509. * @param {Array} [result=[]] The initial result value.
  20510. * @returns {Array} Returns the new flattened array.
  20511. */
  20512. function baseFlatten(array, depth, predicate, isStrict, result) {
  20513. var index = -1,
  20514. length = array.length;
  20515. predicate || (predicate = isFlattenable);
  20516. result || (result = []);
  20517. while (++index < length) {
  20518. var value = array[index];
  20519. if (depth > 0 && predicate(value)) {
  20520. if (depth > 1) {
  20521. // Recursively flatten arrays (susceptible to call stack limits).
  20522. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20523. } else {
  20524. arrayPush(result, value);
  20525. }
  20526. } else if (!isStrict) {
  20527. result[result.length] = value;
  20528. }
  20529. }
  20530. return result;
  20531. }
  20532. /**
  20533. * The base implementation of `baseForOwn` which iterates over `object`
  20534. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20535. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20536. *
  20537. * @private
  20538. * @param {Object} object The object to iterate over.
  20539. * @param {Function} iteratee The function invoked per iteration.
  20540. * @param {Function} keysFunc The function to get the keys of `object`.
  20541. * @returns {Object} Returns `object`.
  20542. */
  20543. var baseFor = createBaseFor();
  20544. /**
  20545. * This function is like `baseFor` except that it iterates over properties
  20546. * in the opposite order.
  20547. *
  20548. * @private
  20549. * @param {Object} object The object to iterate over.
  20550. * @param {Function} iteratee The function invoked per iteration.
  20551. * @param {Function} keysFunc The function to get the keys of `object`.
  20552. * @returns {Object} Returns `object`.
  20553. */
  20554. var baseForRight = createBaseFor(true);
  20555. /**
  20556. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20557. *
  20558. * @private
  20559. * @param {Object} object The object to iterate over.
  20560. * @param {Function} iteratee The function invoked per iteration.
  20561. * @returns {Object} Returns `object`.
  20562. */
  20563. function baseForOwn(object, iteratee) {
  20564. return object && baseFor(object, iteratee, keys);
  20565. }
  20566. /**
  20567. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20568. *
  20569. * @private
  20570. * @param {Object} object The object to iterate over.
  20571. * @param {Function} iteratee The function invoked per iteration.
  20572. * @returns {Object} Returns `object`.
  20573. */
  20574. function baseForOwnRight(object, iteratee) {
  20575. return object && baseForRight(object, iteratee, keys);
  20576. }
  20577. /**
  20578. * The base implementation of `_.functions` which creates an array of
  20579. * `object` function property names filtered from `props`.
  20580. *
  20581. * @private
  20582. * @param {Object} object The object to inspect.
  20583. * @param {Array} props The property names to filter.
  20584. * @returns {Array} Returns the function names.
  20585. */
  20586. function baseFunctions(object, props) {
  20587. return arrayFilter(props, function(key) {
  20588. return isFunction(object[key]);
  20589. });
  20590. }
  20591. /**
  20592. * The base implementation of `_.get` without support for default values.
  20593. *
  20594. * @private
  20595. * @param {Object} object The object to query.
  20596. * @param {Array|string} path The path of the property to get.
  20597. * @returns {*} Returns the resolved value.
  20598. */
  20599. function baseGet(object, path) {
  20600. path = castPath(path, object);
  20601. var index = 0,
  20602. length = path.length;
  20603. while (object != null && index < length) {
  20604. object = object[toKey(path[index++])];
  20605. }
  20606. return (index && index == length) ? object : undefined;
  20607. }
  20608. /**
  20609. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20610. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20611. * symbols of `object`.
  20612. *
  20613. * @private
  20614. * @param {Object} object The object to query.
  20615. * @param {Function} keysFunc The function to get the keys of `object`.
  20616. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20617. * @returns {Array} Returns the array of property names and symbols.
  20618. */
  20619. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20620. var result = keysFunc(object);
  20621. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20622. }
  20623. /**
  20624. * The base implementation of `getTag` without fallbacks for buggy environments.
  20625. *
  20626. * @private
  20627. * @param {*} value The value to query.
  20628. * @returns {string} Returns the `toStringTag`.
  20629. */
  20630. function baseGetTag(value) {
  20631. if (value == null) {
  20632. return value === undefined ? undefinedTag : nullTag;
  20633. }
  20634. return (symToStringTag && symToStringTag in Object(value))
  20635. ? getRawTag(value)
  20636. : objectToString(value);
  20637. }
  20638. /**
  20639. * The base implementation of `_.gt` which doesn't coerce arguments.
  20640. *
  20641. * @private
  20642. * @param {*} value The value to compare.
  20643. * @param {*} other The other value to compare.
  20644. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20645. * else `false`.
  20646. */
  20647. function baseGt(value, other) {
  20648. return value > other;
  20649. }
  20650. /**
  20651. * The base implementation of `_.has` without support for deep paths.
  20652. *
  20653. * @private
  20654. * @param {Object} [object] The object to query.
  20655. * @param {Array|string} key The key to check.
  20656. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20657. */
  20658. function baseHas(object, key) {
  20659. return object != null && hasOwnProperty.call(object, key);
  20660. }
  20661. /**
  20662. * The base implementation of `_.hasIn` without support for deep paths.
  20663. *
  20664. * @private
  20665. * @param {Object} [object] The object to query.
  20666. * @param {Array|string} key The key to check.
  20667. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20668. */
  20669. function baseHasIn(object, key) {
  20670. return object != null && key in Object(object);
  20671. }
  20672. /**
  20673. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20674. *
  20675. * @private
  20676. * @param {number} number The number to check.
  20677. * @param {number} start The start of the range.
  20678. * @param {number} end The end of the range.
  20679. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20680. */
  20681. function baseInRange(number, start, end) {
  20682. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20683. }
  20684. /**
  20685. * The base implementation of methods like `_.intersection`, without support
  20686. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20687. *
  20688. * @private
  20689. * @param {Array} arrays The arrays to inspect.
  20690. * @param {Function} [iteratee] The iteratee invoked per element.
  20691. * @param {Function} [comparator] The comparator invoked per element.
  20692. * @returns {Array} Returns the new array of shared values.
  20693. */
  20694. function baseIntersection(arrays, iteratee, comparator) {
  20695. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20696. length = arrays[0].length,
  20697. othLength = arrays.length,
  20698. othIndex = othLength,
  20699. caches = Array(othLength),
  20700. maxLength = Infinity,
  20701. result = [];
  20702. while (othIndex--) {
  20703. var array = arrays[othIndex];
  20704. if (othIndex && iteratee) {
  20705. array = arrayMap(array, baseUnary(iteratee));
  20706. }
  20707. maxLength = nativeMin(array.length, maxLength);
  20708. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20709. ? new SetCache(othIndex && array)
  20710. : undefined;
  20711. }
  20712. array = arrays[0];
  20713. var index = -1,
  20714. seen = caches[0];
  20715. outer:
  20716. while (++index < length && result.length < maxLength) {
  20717. var value = array[index],
  20718. computed = iteratee ? iteratee(value) : value;
  20719. value = (comparator || value !== 0) ? value : 0;
  20720. if (!(seen
  20721. ? cacheHas(seen, computed)
  20722. : includes(result, computed, comparator)
  20723. )) {
  20724. othIndex = othLength;
  20725. while (--othIndex) {
  20726. var cache = caches[othIndex];
  20727. if (!(cache
  20728. ? cacheHas(cache, computed)
  20729. : includes(arrays[othIndex], computed, comparator))
  20730. ) {
  20731. continue outer;
  20732. }
  20733. }
  20734. if (seen) {
  20735. seen.push(computed);
  20736. }
  20737. result.push(value);
  20738. }
  20739. }
  20740. return result;
  20741. }
  20742. /**
  20743. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20744. * `object` with values transformed by `iteratee` and set by `setter`.
  20745. *
  20746. * @private
  20747. * @param {Object} object The object to iterate over.
  20748. * @param {Function} setter The function to set `accumulator` values.
  20749. * @param {Function} iteratee The iteratee to transform values.
  20750. * @param {Object} accumulator The initial inverted object.
  20751. * @returns {Function} Returns `accumulator`.
  20752. */
  20753. function baseInverter(object, setter, iteratee, accumulator) {
  20754. baseForOwn(object, function(value, key, object) {
  20755. setter(accumulator, iteratee(value), key, object);
  20756. });
  20757. return accumulator;
  20758. }
  20759. /**
  20760. * The base implementation of `_.invoke` without support for individual
  20761. * method arguments.
  20762. *
  20763. * @private
  20764. * @param {Object} object The object to query.
  20765. * @param {Array|string} path The path of the method to invoke.
  20766. * @param {Array} args The arguments to invoke the method with.
  20767. * @returns {*} Returns the result of the invoked method.
  20768. */
  20769. function baseInvoke(object, path, args) {
  20770. path = castPath(path, object);
  20771. object = parent(object, path);
  20772. var func = object == null ? object : object[toKey(last(path))];
  20773. return func == null ? undefined : apply(func, object, args);
  20774. }
  20775. /**
  20776. * The base implementation of `_.isArguments`.
  20777. *
  20778. * @private
  20779. * @param {*} value The value to check.
  20780. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20781. */
  20782. function baseIsArguments(value) {
  20783. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20784. }
  20785. /**
  20786. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20787. *
  20788. * @private
  20789. * @param {*} value The value to check.
  20790. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20791. */
  20792. function baseIsArrayBuffer(value) {
  20793. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20794. }
  20795. /**
  20796. * The base implementation of `_.isDate` without Node.js optimizations.
  20797. *
  20798. * @private
  20799. * @param {*} value The value to check.
  20800. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20801. */
  20802. function baseIsDate(value) {
  20803. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20804. }
  20805. /**
  20806. * The base implementation of `_.isEqual` which supports partial comparisons
  20807. * and tracks traversed objects.
  20808. *
  20809. * @private
  20810. * @param {*} value The value to compare.
  20811. * @param {*} other The other value to compare.
  20812. * @param {boolean} bitmask The bitmask flags.
  20813. * 1 - Unordered comparison
  20814. * 2 - Partial comparison
  20815. * @param {Function} [customizer] The function to customize comparisons.
  20816. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20817. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20818. */
  20819. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20820. if (value === other) {
  20821. return true;
  20822. }
  20823. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20824. return value !== value && other !== other;
  20825. }
  20826. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20827. }
  20828. /**
  20829. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20830. * deep comparisons and tracks traversed objects enabling objects with circular
  20831. * references to be compared.
  20832. *
  20833. * @private
  20834. * @param {Object} object The object to compare.
  20835. * @param {Object} other The other object to compare.
  20836. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20837. * @param {Function} customizer The function to customize comparisons.
  20838. * @param {Function} equalFunc The function to determine equivalents of values.
  20839. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20840. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20841. */
  20842. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20843. var objIsArr = isArray(object),
  20844. othIsArr = isArray(other),
  20845. objTag = objIsArr ? arrayTag : getTag(object),
  20846. othTag = othIsArr ? arrayTag : getTag(other);
  20847. objTag = objTag == argsTag ? objectTag : objTag;
  20848. othTag = othTag == argsTag ? objectTag : othTag;
  20849. var objIsObj = objTag == objectTag,
  20850. othIsObj = othTag == objectTag,
  20851. isSameTag = objTag == othTag;
  20852. if (isSameTag && isBuffer(object)) {
  20853. if (!isBuffer(other)) {
  20854. return false;
  20855. }
  20856. objIsArr = true;
  20857. objIsObj = false;
  20858. }
  20859. if (isSameTag && !objIsObj) {
  20860. stack || (stack = new Stack);
  20861. return (objIsArr || isTypedArray(object))
  20862. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20863. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20864. }
  20865. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20866. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20867. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20868. if (objIsWrapped || othIsWrapped) {
  20869. var objUnwrapped = objIsWrapped ? object.value() : object,
  20870. othUnwrapped = othIsWrapped ? other.value() : other;
  20871. stack || (stack = new Stack);
  20872. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20873. }
  20874. }
  20875. if (!isSameTag) {
  20876. return false;
  20877. }
  20878. stack || (stack = new Stack);
  20879. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20880. }
  20881. /**
  20882. * The base implementation of `_.isMap` without Node.js optimizations.
  20883. *
  20884. * @private
  20885. * @param {*} value The value to check.
  20886. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20887. */
  20888. function baseIsMap(value) {
  20889. return isObjectLike(value) && getTag(value) == mapTag;
  20890. }
  20891. /**
  20892. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20893. *
  20894. * @private
  20895. * @param {Object} object The object to inspect.
  20896. * @param {Object} source The object of property values to match.
  20897. * @param {Array} matchData The property names, values, and compare flags to match.
  20898. * @param {Function} [customizer] The function to customize comparisons.
  20899. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20900. */
  20901. function baseIsMatch(object, source, matchData, customizer) {
  20902. var index = matchData.length,
  20903. length = index,
  20904. noCustomizer = !customizer;
  20905. if (object == null) {
  20906. return !length;
  20907. }
  20908. object = Object(object);
  20909. while (index--) {
  20910. var data = matchData[index];
  20911. if ((noCustomizer && data[2])
  20912. ? data[1] !== object[data[0]]
  20913. : !(data[0] in object)
  20914. ) {
  20915. return false;
  20916. }
  20917. }
  20918. while (++index < length) {
  20919. data = matchData[index];
  20920. var key = data[0],
  20921. objValue = object[key],
  20922. srcValue = data[1];
  20923. if (noCustomizer && data[2]) {
  20924. if (objValue === undefined && !(key in object)) {
  20925. return false;
  20926. }
  20927. } else {
  20928. var stack = new Stack;
  20929. if (customizer) {
  20930. var result = customizer(objValue, srcValue, key, object, source, stack);
  20931. }
  20932. if (!(result === undefined
  20933. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20934. : result
  20935. )) {
  20936. return false;
  20937. }
  20938. }
  20939. }
  20940. return true;
  20941. }
  20942. /**
  20943. * The base implementation of `_.isNative` without bad shim checks.
  20944. *
  20945. * @private
  20946. * @param {*} value The value to check.
  20947. * @returns {boolean} Returns `true` if `value` is a native function,
  20948. * else `false`.
  20949. */
  20950. function baseIsNative(value) {
  20951. if (!isObject(value) || isMasked(value)) {
  20952. return false;
  20953. }
  20954. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20955. return pattern.test(toSource(value));
  20956. }
  20957. /**
  20958. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20959. *
  20960. * @private
  20961. * @param {*} value The value to check.
  20962. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20963. */
  20964. function baseIsRegExp(value) {
  20965. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20966. }
  20967. /**
  20968. * The base implementation of `_.isSet` without Node.js optimizations.
  20969. *
  20970. * @private
  20971. * @param {*} value The value to check.
  20972. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20973. */
  20974. function baseIsSet(value) {
  20975. return isObjectLike(value) && getTag(value) == setTag;
  20976. }
  20977. /**
  20978. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  20979. *
  20980. * @private
  20981. * @param {*} value The value to check.
  20982. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20983. */
  20984. function baseIsTypedArray(value) {
  20985. return isObjectLike(value) &&
  20986. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  20987. }
  20988. /**
  20989. * The base implementation of `_.iteratee`.
  20990. *
  20991. * @private
  20992. * @param {*} [value=_.identity] The value to convert to an iteratee.
  20993. * @returns {Function} Returns the iteratee.
  20994. */
  20995. function baseIteratee(value) {
  20996. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  20997. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  20998. if (typeof value == 'function') {
  20999. return value;
  21000. }
  21001. if (value == null) {
  21002. return identity;
  21003. }
  21004. if (typeof value == 'object') {
  21005. return isArray(value)
  21006. ? baseMatchesProperty(value[0], value[1])
  21007. : baseMatches(value);
  21008. }
  21009. return property(value);
  21010. }
  21011. /**
  21012. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21013. *
  21014. * @private
  21015. * @param {Object} object The object to query.
  21016. * @returns {Array} Returns the array of property names.
  21017. */
  21018. function baseKeys(object) {
  21019. if (!isPrototype(object)) {
  21020. return nativeKeys(object);
  21021. }
  21022. var result = [];
  21023. for (var key in Object(object)) {
  21024. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21025. result.push(key);
  21026. }
  21027. }
  21028. return result;
  21029. }
  21030. /**
  21031. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21032. *
  21033. * @private
  21034. * @param {Object} object The object to query.
  21035. * @returns {Array} Returns the array of property names.
  21036. */
  21037. function baseKeysIn(object) {
  21038. if (!isObject(object)) {
  21039. return nativeKeysIn(object);
  21040. }
  21041. var isProto = isPrototype(object),
  21042. result = [];
  21043. for (var key in object) {
  21044. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21045. result.push(key);
  21046. }
  21047. }
  21048. return result;
  21049. }
  21050. /**
  21051. * The base implementation of `_.lt` which doesn't coerce arguments.
  21052. *
  21053. * @private
  21054. * @param {*} value The value to compare.
  21055. * @param {*} other The other value to compare.
  21056. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21057. * else `false`.
  21058. */
  21059. function baseLt(value, other) {
  21060. return value < other;
  21061. }
  21062. /**
  21063. * The base implementation of `_.map` without support for iteratee shorthands.
  21064. *
  21065. * @private
  21066. * @param {Array|Object} collection The collection to iterate over.
  21067. * @param {Function} iteratee The function invoked per iteration.
  21068. * @returns {Array} Returns the new mapped array.
  21069. */
  21070. function baseMap(collection, iteratee) {
  21071. var index = -1,
  21072. result = isArrayLike(collection) ? Array(collection.length) : [];
  21073. baseEach(collection, function(value, key, collection) {
  21074. result[++index] = iteratee(value, key, collection);
  21075. });
  21076. return result;
  21077. }
  21078. /**
  21079. * The base implementation of `_.matches` which doesn't clone `source`.
  21080. *
  21081. * @private
  21082. * @param {Object} source The object of property values to match.
  21083. * @returns {Function} Returns the new spec function.
  21084. */
  21085. function baseMatches(source) {
  21086. var matchData = getMatchData(source);
  21087. if (matchData.length == 1 && matchData[0][2]) {
  21088. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21089. }
  21090. return function(object) {
  21091. return object === source || baseIsMatch(object, source, matchData);
  21092. };
  21093. }
  21094. /**
  21095. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21096. *
  21097. * @private
  21098. * @param {string} path The path of the property to get.
  21099. * @param {*} srcValue The value to match.
  21100. * @returns {Function} Returns the new spec function.
  21101. */
  21102. function baseMatchesProperty(path, srcValue) {
  21103. if (isKey(path) && isStrictComparable(srcValue)) {
  21104. return matchesStrictComparable(toKey(path), srcValue);
  21105. }
  21106. return function(object) {
  21107. var objValue = get(object, path);
  21108. return (objValue === undefined && objValue === srcValue)
  21109. ? hasIn(object, path)
  21110. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21111. };
  21112. }
  21113. /**
  21114. * The base implementation of `_.merge` without support for multiple sources.
  21115. *
  21116. * @private
  21117. * @param {Object} object The destination object.
  21118. * @param {Object} source The source object.
  21119. * @param {number} srcIndex The index of `source`.
  21120. * @param {Function} [customizer] The function to customize merged values.
  21121. * @param {Object} [stack] Tracks traversed source values and their merged
  21122. * counterparts.
  21123. */
  21124. function baseMerge(object, source, srcIndex, customizer, stack) {
  21125. if (object === source) {
  21126. return;
  21127. }
  21128. baseFor(source, function(srcValue, key) {
  21129. stack || (stack = new Stack);
  21130. if (isObject(srcValue)) {
  21131. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21132. }
  21133. else {
  21134. var newValue = customizer
  21135. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21136. : undefined;
  21137. if (newValue === undefined) {
  21138. newValue = srcValue;
  21139. }
  21140. assignMergeValue(object, key, newValue);
  21141. }
  21142. }, keysIn);
  21143. }
  21144. /**
  21145. * A specialized version of `baseMerge` for arrays and objects which performs
  21146. * deep merges and tracks traversed objects enabling objects with circular
  21147. * references to be merged.
  21148. *
  21149. * @private
  21150. * @param {Object} object The destination object.
  21151. * @param {Object} source The source object.
  21152. * @param {string} key The key of the value to merge.
  21153. * @param {number} srcIndex The index of `source`.
  21154. * @param {Function} mergeFunc The function to merge values.
  21155. * @param {Function} [customizer] The function to customize assigned values.
  21156. * @param {Object} [stack] Tracks traversed source values and their merged
  21157. * counterparts.
  21158. */
  21159. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21160. var objValue = safeGet(object, key),
  21161. srcValue = safeGet(source, key),
  21162. stacked = stack.get(srcValue);
  21163. if (stacked) {
  21164. assignMergeValue(object, key, stacked);
  21165. return;
  21166. }
  21167. var newValue = customizer
  21168. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21169. : undefined;
  21170. var isCommon = newValue === undefined;
  21171. if (isCommon) {
  21172. var isArr = isArray(srcValue),
  21173. isBuff = !isArr && isBuffer(srcValue),
  21174. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21175. newValue = srcValue;
  21176. if (isArr || isBuff || isTyped) {
  21177. if (isArray(objValue)) {
  21178. newValue = objValue;
  21179. }
  21180. else if (isArrayLikeObject(objValue)) {
  21181. newValue = copyArray(objValue);
  21182. }
  21183. else if (isBuff) {
  21184. isCommon = false;
  21185. newValue = cloneBuffer(srcValue, true);
  21186. }
  21187. else if (isTyped) {
  21188. isCommon = false;
  21189. newValue = cloneTypedArray(srcValue, true);
  21190. }
  21191. else {
  21192. newValue = [];
  21193. }
  21194. }
  21195. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21196. newValue = objValue;
  21197. if (isArguments(objValue)) {
  21198. newValue = toPlainObject(objValue);
  21199. }
  21200. else if (!isObject(objValue) || isFunction(objValue)) {
  21201. newValue = initCloneObject(srcValue);
  21202. }
  21203. }
  21204. else {
  21205. isCommon = false;
  21206. }
  21207. }
  21208. if (isCommon) {
  21209. // Recursively merge objects and arrays (susceptible to call stack limits).
  21210. stack.set(srcValue, newValue);
  21211. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21212. stack['delete'](srcValue);
  21213. }
  21214. assignMergeValue(object, key, newValue);
  21215. }
  21216. /**
  21217. * The base implementation of `_.nth` which doesn't coerce arguments.
  21218. *
  21219. * @private
  21220. * @param {Array} array The array to query.
  21221. * @param {number} n The index of the element to return.
  21222. * @returns {*} Returns the nth element of `array`.
  21223. */
  21224. function baseNth(array, n) {
  21225. var length = array.length;
  21226. if (!length) {
  21227. return;
  21228. }
  21229. n += n < 0 ? length : 0;
  21230. return isIndex(n, length) ? array[n] : undefined;
  21231. }
  21232. /**
  21233. * The base implementation of `_.orderBy` without param guards.
  21234. *
  21235. * @private
  21236. * @param {Array|Object} collection The collection to iterate over.
  21237. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21238. * @param {string[]} orders The sort orders of `iteratees`.
  21239. * @returns {Array} Returns the new sorted array.
  21240. */
  21241. function baseOrderBy(collection, iteratees, orders) {
  21242. var index = -1;
  21243. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21244. var result = baseMap(collection, function(value, key, collection) {
  21245. var criteria = arrayMap(iteratees, function(iteratee) {
  21246. return iteratee(value);
  21247. });
  21248. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21249. });
  21250. return baseSortBy(result, function(object, other) {
  21251. return compareMultiple(object, other, orders);
  21252. });
  21253. }
  21254. /**
  21255. * The base implementation of `_.pick` without support for individual
  21256. * property identifiers.
  21257. *
  21258. * @private
  21259. * @param {Object} object The source object.
  21260. * @param {string[]} paths The property paths to pick.
  21261. * @returns {Object} Returns the new object.
  21262. */
  21263. function basePick(object, paths) {
  21264. return basePickBy(object, paths, function(value, path) {
  21265. return hasIn(object, path);
  21266. });
  21267. }
  21268. /**
  21269. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21270. *
  21271. * @private
  21272. * @param {Object} object The source object.
  21273. * @param {string[]} paths The property paths to pick.
  21274. * @param {Function} predicate The function invoked per property.
  21275. * @returns {Object} Returns the new object.
  21276. */
  21277. function basePickBy(object, paths, predicate) {
  21278. var index = -1,
  21279. length = paths.length,
  21280. result = {};
  21281. while (++index < length) {
  21282. var path = paths[index],
  21283. value = baseGet(object, path);
  21284. if (predicate(value, path)) {
  21285. baseSet(result, castPath(path, object), value);
  21286. }
  21287. }
  21288. return result;
  21289. }
  21290. /**
  21291. * A specialized version of `baseProperty` which supports deep paths.
  21292. *
  21293. * @private
  21294. * @param {Array|string} path The path of the property to get.
  21295. * @returns {Function} Returns the new accessor function.
  21296. */
  21297. function basePropertyDeep(path) {
  21298. return function(object) {
  21299. return baseGet(object, path);
  21300. };
  21301. }
  21302. /**
  21303. * The base implementation of `_.pullAllBy` without support for iteratee
  21304. * shorthands.
  21305. *
  21306. * @private
  21307. * @param {Array} array The array to modify.
  21308. * @param {Array} values The values to remove.
  21309. * @param {Function} [iteratee] The iteratee invoked per element.
  21310. * @param {Function} [comparator] The comparator invoked per element.
  21311. * @returns {Array} Returns `array`.
  21312. */
  21313. function basePullAll(array, values, iteratee, comparator) {
  21314. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21315. index = -1,
  21316. length = values.length,
  21317. seen = array;
  21318. if (array === values) {
  21319. values = copyArray(values);
  21320. }
  21321. if (iteratee) {
  21322. seen = arrayMap(array, baseUnary(iteratee));
  21323. }
  21324. while (++index < length) {
  21325. var fromIndex = 0,
  21326. value = values[index],
  21327. computed = iteratee ? iteratee(value) : value;
  21328. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21329. if (seen !== array) {
  21330. splice.call(seen, fromIndex, 1);
  21331. }
  21332. splice.call(array, fromIndex, 1);
  21333. }
  21334. }
  21335. return array;
  21336. }
  21337. /**
  21338. * The base implementation of `_.pullAt` without support for individual
  21339. * indexes or capturing the removed elements.
  21340. *
  21341. * @private
  21342. * @param {Array} array The array to modify.
  21343. * @param {number[]} indexes The indexes of elements to remove.
  21344. * @returns {Array} Returns `array`.
  21345. */
  21346. function basePullAt(array, indexes) {
  21347. var length = array ? indexes.length : 0,
  21348. lastIndex = length - 1;
  21349. while (length--) {
  21350. var index = indexes[length];
  21351. if (length == lastIndex || index !== previous) {
  21352. var previous = index;
  21353. if (isIndex(index)) {
  21354. splice.call(array, index, 1);
  21355. } else {
  21356. baseUnset(array, index);
  21357. }
  21358. }
  21359. }
  21360. return array;
  21361. }
  21362. /**
  21363. * The base implementation of `_.random` without support for returning
  21364. * floating-point numbers.
  21365. *
  21366. * @private
  21367. * @param {number} lower The lower bound.
  21368. * @param {number} upper The upper bound.
  21369. * @returns {number} Returns the random number.
  21370. */
  21371. function baseRandom(lower, upper) {
  21372. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21373. }
  21374. /**
  21375. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21376. * coerce arguments.
  21377. *
  21378. * @private
  21379. * @param {number} start The start of the range.
  21380. * @param {number} end The end of the range.
  21381. * @param {number} step The value to increment or decrement by.
  21382. * @param {boolean} [fromRight] Specify iterating from right to left.
  21383. * @returns {Array} Returns the range of numbers.
  21384. */
  21385. function baseRange(start, end, step, fromRight) {
  21386. var index = -1,
  21387. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21388. result = Array(length);
  21389. while (length--) {
  21390. result[fromRight ? length : ++index] = start;
  21391. start += step;
  21392. }
  21393. return result;
  21394. }
  21395. /**
  21396. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21397. *
  21398. * @private
  21399. * @param {string} string The string to repeat.
  21400. * @param {number} n The number of times to repeat the string.
  21401. * @returns {string} Returns the repeated string.
  21402. */
  21403. function baseRepeat(string, n) {
  21404. var result = '';
  21405. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21406. return result;
  21407. }
  21408. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21409. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21410. do {
  21411. if (n % 2) {
  21412. result += string;
  21413. }
  21414. n = nativeFloor(n / 2);
  21415. if (n) {
  21416. string += string;
  21417. }
  21418. } while (n);
  21419. return result;
  21420. }
  21421. /**
  21422. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21423. *
  21424. * @private
  21425. * @param {Function} func The function to apply a rest parameter to.
  21426. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21427. * @returns {Function} Returns the new function.
  21428. */
  21429. function baseRest(func, start) {
  21430. return setToString(overRest(func, start, identity), func + '');
  21431. }
  21432. /**
  21433. * The base implementation of `_.sample`.
  21434. *
  21435. * @private
  21436. * @param {Array|Object} collection The collection to sample.
  21437. * @returns {*} Returns the random element.
  21438. */
  21439. function baseSample(collection) {
  21440. return arraySample(values(collection));
  21441. }
  21442. /**
  21443. * The base implementation of `_.sampleSize` without param guards.
  21444. *
  21445. * @private
  21446. * @param {Array|Object} collection The collection to sample.
  21447. * @param {number} n The number of elements to sample.
  21448. * @returns {Array} Returns the random elements.
  21449. */
  21450. function baseSampleSize(collection, n) {
  21451. var array = values(collection);
  21452. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21453. }
  21454. /**
  21455. * The base implementation of `_.set`.
  21456. *
  21457. * @private
  21458. * @param {Object} object The object to modify.
  21459. * @param {Array|string} path The path of the property to set.
  21460. * @param {*} value The value to set.
  21461. * @param {Function} [customizer] The function to customize path creation.
  21462. * @returns {Object} Returns `object`.
  21463. */
  21464. function baseSet(object, path, value, customizer) {
  21465. if (!isObject(object)) {
  21466. return object;
  21467. }
  21468. path = castPath(path, object);
  21469. var index = -1,
  21470. length = path.length,
  21471. lastIndex = length - 1,
  21472. nested = object;
  21473. while (nested != null && ++index < length) {
  21474. var key = toKey(path[index]),
  21475. newValue = value;
  21476. if (index != lastIndex) {
  21477. var objValue = nested[key];
  21478. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21479. if (newValue === undefined) {
  21480. newValue = isObject(objValue)
  21481. ? objValue
  21482. : (isIndex(path[index + 1]) ? [] : {});
  21483. }
  21484. }
  21485. assignValue(nested, key, newValue);
  21486. nested = nested[key];
  21487. }
  21488. return object;
  21489. }
  21490. /**
  21491. * The base implementation of `setData` without support for hot loop shorting.
  21492. *
  21493. * @private
  21494. * @param {Function} func The function to associate metadata with.
  21495. * @param {*} data The metadata.
  21496. * @returns {Function} Returns `func`.
  21497. */
  21498. var baseSetData = !metaMap ? identity : function(func, data) {
  21499. metaMap.set(func, data);
  21500. return func;
  21501. };
  21502. /**
  21503. * The base implementation of `setToString` without support for hot loop shorting.
  21504. *
  21505. * @private
  21506. * @param {Function} func The function to modify.
  21507. * @param {Function} string The `toString` result.
  21508. * @returns {Function} Returns `func`.
  21509. */
  21510. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21511. return defineProperty(func, 'toString', {
  21512. 'configurable': true,
  21513. 'enumerable': false,
  21514. 'value': constant(string),
  21515. 'writable': true
  21516. });
  21517. };
  21518. /**
  21519. * The base implementation of `_.shuffle`.
  21520. *
  21521. * @private
  21522. * @param {Array|Object} collection The collection to shuffle.
  21523. * @returns {Array} Returns the new shuffled array.
  21524. */
  21525. function baseShuffle(collection) {
  21526. return shuffleSelf(values(collection));
  21527. }
  21528. /**
  21529. * The base implementation of `_.slice` without an iteratee call guard.
  21530. *
  21531. * @private
  21532. * @param {Array} array The array to slice.
  21533. * @param {number} [start=0] The start position.
  21534. * @param {number} [end=array.length] The end position.
  21535. * @returns {Array} Returns the slice of `array`.
  21536. */
  21537. function baseSlice(array, start, end) {
  21538. var index = -1,
  21539. length = array.length;
  21540. if (start < 0) {
  21541. start = -start > length ? 0 : (length + start);
  21542. }
  21543. end = end > length ? length : end;
  21544. if (end < 0) {
  21545. end += length;
  21546. }
  21547. length = start > end ? 0 : ((end - start) >>> 0);
  21548. start >>>= 0;
  21549. var result = Array(length);
  21550. while (++index < length) {
  21551. result[index] = array[index + start];
  21552. }
  21553. return result;
  21554. }
  21555. /**
  21556. * The base implementation of `_.some` without support for iteratee shorthands.
  21557. *
  21558. * @private
  21559. * @param {Array|Object} collection The collection to iterate over.
  21560. * @param {Function} predicate The function invoked per iteration.
  21561. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21562. * else `false`.
  21563. */
  21564. function baseSome(collection, predicate) {
  21565. var result;
  21566. baseEach(collection, function(value, index, collection) {
  21567. result = predicate(value, index, collection);
  21568. return !result;
  21569. });
  21570. return !!result;
  21571. }
  21572. /**
  21573. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21574. * performs a binary search of `array` to determine the index at which `value`
  21575. * should be inserted into `array` in order to maintain its sort order.
  21576. *
  21577. * @private
  21578. * @param {Array} array The sorted array to inspect.
  21579. * @param {*} value The value to evaluate.
  21580. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21581. * @returns {number} Returns the index at which `value` should be inserted
  21582. * into `array`.
  21583. */
  21584. function baseSortedIndex(array, value, retHighest) {
  21585. var low = 0,
  21586. high = array == null ? low : array.length;
  21587. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21588. while (low < high) {
  21589. var mid = (low + high) >>> 1,
  21590. computed = array[mid];
  21591. if (computed !== null && !isSymbol(computed) &&
  21592. (retHighest ? (computed <= value) : (computed < value))) {
  21593. low = mid + 1;
  21594. } else {
  21595. high = mid;
  21596. }
  21597. }
  21598. return high;
  21599. }
  21600. return baseSortedIndexBy(array, value, identity, retHighest);
  21601. }
  21602. /**
  21603. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21604. * which invokes `iteratee` for `value` and each element of `array` to compute
  21605. * their sort ranking. The iteratee is invoked with one argument; (value).
  21606. *
  21607. * @private
  21608. * @param {Array} array The sorted array to inspect.
  21609. * @param {*} value The value to evaluate.
  21610. * @param {Function} iteratee The iteratee invoked per element.
  21611. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21612. * @returns {number} Returns the index at which `value` should be inserted
  21613. * into `array`.
  21614. */
  21615. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21616. value = iteratee(value);
  21617. var low = 0,
  21618. high = array == null ? 0 : array.length,
  21619. valIsNaN = value !== value,
  21620. valIsNull = value === null,
  21621. valIsSymbol = isSymbol(value),
  21622. valIsUndefined = value === undefined;
  21623. while (low < high) {
  21624. var mid = nativeFloor((low + high) / 2),
  21625. computed = iteratee(array[mid]),
  21626. othIsDefined = computed !== undefined,
  21627. othIsNull = computed === null,
  21628. othIsReflexive = computed === computed,
  21629. othIsSymbol = isSymbol(computed);
  21630. if (valIsNaN) {
  21631. var setLow = retHighest || othIsReflexive;
  21632. } else if (valIsUndefined) {
  21633. setLow = othIsReflexive && (retHighest || othIsDefined);
  21634. } else if (valIsNull) {
  21635. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21636. } else if (valIsSymbol) {
  21637. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21638. } else if (othIsNull || othIsSymbol) {
  21639. setLow = false;
  21640. } else {
  21641. setLow = retHighest ? (computed <= value) : (computed < value);
  21642. }
  21643. if (setLow) {
  21644. low = mid + 1;
  21645. } else {
  21646. high = mid;
  21647. }
  21648. }
  21649. return nativeMin(high, MAX_ARRAY_INDEX);
  21650. }
  21651. /**
  21652. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21653. * support for iteratee shorthands.
  21654. *
  21655. * @private
  21656. * @param {Array} array The array to inspect.
  21657. * @param {Function} [iteratee] The iteratee invoked per element.
  21658. * @returns {Array} Returns the new duplicate free array.
  21659. */
  21660. function baseSortedUniq(array, iteratee) {
  21661. var index = -1,
  21662. length = array.length,
  21663. resIndex = 0,
  21664. result = [];
  21665. while (++index < length) {
  21666. var value = array[index],
  21667. computed = iteratee ? iteratee(value) : value;
  21668. if (!index || !eq(computed, seen)) {
  21669. var seen = computed;
  21670. result[resIndex++] = value === 0 ? 0 : value;
  21671. }
  21672. }
  21673. return result;
  21674. }
  21675. /**
  21676. * The base implementation of `_.toNumber` which doesn't ensure correct
  21677. * conversions of binary, hexadecimal, or octal string values.
  21678. *
  21679. * @private
  21680. * @param {*} value The value to process.
  21681. * @returns {number} Returns the number.
  21682. */
  21683. function baseToNumber(value) {
  21684. if (typeof value == 'number') {
  21685. return value;
  21686. }
  21687. if (isSymbol(value)) {
  21688. return NAN;
  21689. }
  21690. return +value;
  21691. }
  21692. /**
  21693. * The base implementation of `_.toString` which doesn't convert nullish
  21694. * values to empty strings.
  21695. *
  21696. * @private
  21697. * @param {*} value The value to process.
  21698. * @returns {string} Returns the string.
  21699. */
  21700. function baseToString(value) {
  21701. // Exit early for strings to avoid a performance hit in some environments.
  21702. if (typeof value == 'string') {
  21703. return value;
  21704. }
  21705. if (isArray(value)) {
  21706. // Recursively convert values (susceptible to call stack limits).
  21707. return arrayMap(value, baseToString) + '';
  21708. }
  21709. if (isSymbol(value)) {
  21710. return symbolToString ? symbolToString.call(value) : '';
  21711. }
  21712. var result = (value + '');
  21713. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21714. }
  21715. /**
  21716. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21717. *
  21718. * @private
  21719. * @param {Array} array The array to inspect.
  21720. * @param {Function} [iteratee] The iteratee invoked per element.
  21721. * @param {Function} [comparator] The comparator invoked per element.
  21722. * @returns {Array} Returns the new duplicate free array.
  21723. */
  21724. function baseUniq(array, iteratee, comparator) {
  21725. var index = -1,
  21726. includes = arrayIncludes,
  21727. length = array.length,
  21728. isCommon = true,
  21729. result = [],
  21730. seen = result;
  21731. if (comparator) {
  21732. isCommon = false;
  21733. includes = arrayIncludesWith;
  21734. }
  21735. else if (length >= LARGE_ARRAY_SIZE) {
  21736. var set = iteratee ? null : createSet(array);
  21737. if (set) {
  21738. return setToArray(set);
  21739. }
  21740. isCommon = false;
  21741. includes = cacheHas;
  21742. seen = new SetCache;
  21743. }
  21744. else {
  21745. seen = iteratee ? [] : result;
  21746. }
  21747. outer:
  21748. while (++index < length) {
  21749. var value = array[index],
  21750. computed = iteratee ? iteratee(value) : value;
  21751. value = (comparator || value !== 0) ? value : 0;
  21752. if (isCommon && computed === computed) {
  21753. var seenIndex = seen.length;
  21754. while (seenIndex--) {
  21755. if (seen[seenIndex] === computed) {
  21756. continue outer;
  21757. }
  21758. }
  21759. if (iteratee) {
  21760. seen.push(computed);
  21761. }
  21762. result.push(value);
  21763. }
  21764. else if (!includes(seen, computed, comparator)) {
  21765. if (seen !== result) {
  21766. seen.push(computed);
  21767. }
  21768. result.push(value);
  21769. }
  21770. }
  21771. return result;
  21772. }
  21773. /**
  21774. * The base implementation of `_.unset`.
  21775. *
  21776. * @private
  21777. * @param {Object} object The object to modify.
  21778. * @param {Array|string} path The property path to unset.
  21779. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21780. */
  21781. function baseUnset(object, path) {
  21782. path = castPath(path, object);
  21783. object = parent(object, path);
  21784. return object == null || delete object[toKey(last(path))];
  21785. }
  21786. /**
  21787. * The base implementation of `_.update`.
  21788. *
  21789. * @private
  21790. * @param {Object} object The object to modify.
  21791. * @param {Array|string} path The path of the property to update.
  21792. * @param {Function} updater The function to produce the updated value.
  21793. * @param {Function} [customizer] The function to customize path creation.
  21794. * @returns {Object} Returns `object`.
  21795. */
  21796. function baseUpdate(object, path, updater, customizer) {
  21797. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21798. }
  21799. /**
  21800. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21801. * without support for iteratee shorthands.
  21802. *
  21803. * @private
  21804. * @param {Array} array The array to query.
  21805. * @param {Function} predicate The function invoked per iteration.
  21806. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21807. * @param {boolean} [fromRight] Specify iterating from right to left.
  21808. * @returns {Array} Returns the slice of `array`.
  21809. */
  21810. function baseWhile(array, predicate, isDrop, fromRight) {
  21811. var length = array.length,
  21812. index = fromRight ? length : -1;
  21813. while ((fromRight ? index-- : ++index < length) &&
  21814. predicate(array[index], index, array)) {}
  21815. return isDrop
  21816. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21817. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21818. }
  21819. /**
  21820. * The base implementation of `wrapperValue` which returns the result of
  21821. * performing a sequence of actions on the unwrapped `value`, where each
  21822. * successive action is supplied the return value of the previous.
  21823. *
  21824. * @private
  21825. * @param {*} value The unwrapped value.
  21826. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21827. * @returns {*} Returns the resolved value.
  21828. */
  21829. function baseWrapperValue(value, actions) {
  21830. var result = value;
  21831. if (result instanceof LazyWrapper) {
  21832. result = result.value();
  21833. }
  21834. return arrayReduce(actions, function(result, action) {
  21835. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21836. }, result);
  21837. }
  21838. /**
  21839. * The base implementation of methods like `_.xor`, without support for
  21840. * iteratee shorthands, that accepts an array of arrays to inspect.
  21841. *
  21842. * @private
  21843. * @param {Array} arrays The arrays to inspect.
  21844. * @param {Function} [iteratee] The iteratee invoked per element.
  21845. * @param {Function} [comparator] The comparator invoked per element.
  21846. * @returns {Array} Returns the new array of values.
  21847. */
  21848. function baseXor(arrays, iteratee, comparator) {
  21849. var length = arrays.length;
  21850. if (length < 2) {
  21851. return length ? baseUniq(arrays[0]) : [];
  21852. }
  21853. var index = -1,
  21854. result = Array(length);
  21855. while (++index < length) {
  21856. var array = arrays[index],
  21857. othIndex = -1;
  21858. while (++othIndex < length) {
  21859. if (othIndex != index) {
  21860. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21861. }
  21862. }
  21863. }
  21864. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21865. }
  21866. /**
  21867. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21868. *
  21869. * @private
  21870. * @param {Array} props The property identifiers.
  21871. * @param {Array} values The property values.
  21872. * @param {Function} assignFunc The function to assign values.
  21873. * @returns {Object} Returns the new object.
  21874. */
  21875. function baseZipObject(props, values, assignFunc) {
  21876. var index = -1,
  21877. length = props.length,
  21878. valsLength = values.length,
  21879. result = {};
  21880. while (++index < length) {
  21881. var value = index < valsLength ? values[index] : undefined;
  21882. assignFunc(result, props[index], value);
  21883. }
  21884. return result;
  21885. }
  21886. /**
  21887. * Casts `value` to an empty array if it's not an array like object.
  21888. *
  21889. * @private
  21890. * @param {*} value The value to inspect.
  21891. * @returns {Array|Object} Returns the cast array-like object.
  21892. */
  21893. function castArrayLikeObject(value) {
  21894. return isArrayLikeObject(value) ? value : [];
  21895. }
  21896. /**
  21897. * Casts `value` to `identity` if it's not a function.
  21898. *
  21899. * @private
  21900. * @param {*} value The value to inspect.
  21901. * @returns {Function} Returns cast function.
  21902. */
  21903. function castFunction(value) {
  21904. return typeof value == 'function' ? value : identity;
  21905. }
  21906. /**
  21907. * Casts `value` to a path array if it's not one.
  21908. *
  21909. * @private
  21910. * @param {*} value The value to inspect.
  21911. * @param {Object} [object] The object to query keys on.
  21912. * @returns {Array} Returns the cast property path array.
  21913. */
  21914. function castPath(value, object) {
  21915. if (isArray(value)) {
  21916. return value;
  21917. }
  21918. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21919. }
  21920. /**
  21921. * A `baseRest` alias which can be replaced with `identity` by module
  21922. * replacement plugins.
  21923. *
  21924. * @private
  21925. * @type {Function}
  21926. * @param {Function} func The function to apply a rest parameter to.
  21927. * @returns {Function} Returns the new function.
  21928. */
  21929. var castRest = baseRest;
  21930. /**
  21931. * Casts `array` to a slice if it's needed.
  21932. *
  21933. * @private
  21934. * @param {Array} array The array to inspect.
  21935. * @param {number} start The start position.
  21936. * @param {number} [end=array.length] The end position.
  21937. * @returns {Array} Returns the cast slice.
  21938. */
  21939. function castSlice(array, start, end) {
  21940. var length = array.length;
  21941. end = end === undefined ? length : end;
  21942. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21943. }
  21944. /**
  21945. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21946. *
  21947. * @private
  21948. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21949. */
  21950. var clearTimeout = ctxClearTimeout || function(id) {
  21951. return root.clearTimeout(id);
  21952. };
  21953. /**
  21954. * Creates a clone of `buffer`.
  21955. *
  21956. * @private
  21957. * @param {Buffer} buffer The buffer to clone.
  21958. * @param {boolean} [isDeep] Specify a deep clone.
  21959. * @returns {Buffer} Returns the cloned buffer.
  21960. */
  21961. function cloneBuffer(buffer, isDeep) {
  21962. if (isDeep) {
  21963. return buffer.slice();
  21964. }
  21965. var length = buffer.length,
  21966. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21967. buffer.copy(result);
  21968. return result;
  21969. }
  21970. /**
  21971. * Creates a clone of `arrayBuffer`.
  21972. *
  21973. * @private
  21974. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  21975. * @returns {ArrayBuffer} Returns the cloned array buffer.
  21976. */
  21977. function cloneArrayBuffer(arrayBuffer) {
  21978. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  21979. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  21980. return result;
  21981. }
  21982. /**
  21983. * Creates a clone of `dataView`.
  21984. *
  21985. * @private
  21986. * @param {Object} dataView The data view to clone.
  21987. * @param {boolean} [isDeep] Specify a deep clone.
  21988. * @returns {Object} Returns the cloned data view.
  21989. */
  21990. function cloneDataView(dataView, isDeep) {
  21991. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  21992. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  21993. }
  21994. /**
  21995. * Creates a clone of `regexp`.
  21996. *
  21997. * @private
  21998. * @param {Object} regexp The regexp to clone.
  21999. * @returns {Object} Returns the cloned regexp.
  22000. */
  22001. function cloneRegExp(regexp) {
  22002. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22003. result.lastIndex = regexp.lastIndex;
  22004. return result;
  22005. }
  22006. /**
  22007. * Creates a clone of the `symbol` object.
  22008. *
  22009. * @private
  22010. * @param {Object} symbol The symbol object to clone.
  22011. * @returns {Object} Returns the cloned symbol object.
  22012. */
  22013. function cloneSymbol(symbol) {
  22014. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22015. }
  22016. /**
  22017. * Creates a clone of `typedArray`.
  22018. *
  22019. * @private
  22020. * @param {Object} typedArray The typed array to clone.
  22021. * @param {boolean} [isDeep] Specify a deep clone.
  22022. * @returns {Object} Returns the cloned typed array.
  22023. */
  22024. function cloneTypedArray(typedArray, isDeep) {
  22025. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22026. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22027. }
  22028. /**
  22029. * Compares values to sort them in ascending order.
  22030. *
  22031. * @private
  22032. * @param {*} value The value to compare.
  22033. * @param {*} other The other value to compare.
  22034. * @returns {number} Returns the sort order indicator for `value`.
  22035. */
  22036. function compareAscending(value, other) {
  22037. if (value !== other) {
  22038. var valIsDefined = value !== undefined,
  22039. valIsNull = value === null,
  22040. valIsReflexive = value === value,
  22041. valIsSymbol = isSymbol(value);
  22042. var othIsDefined = other !== undefined,
  22043. othIsNull = other === null,
  22044. othIsReflexive = other === other,
  22045. othIsSymbol = isSymbol(other);
  22046. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22047. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22048. (valIsNull && othIsDefined && othIsReflexive) ||
  22049. (!valIsDefined && othIsReflexive) ||
  22050. !valIsReflexive) {
  22051. return 1;
  22052. }
  22053. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22054. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22055. (othIsNull && valIsDefined && valIsReflexive) ||
  22056. (!othIsDefined && valIsReflexive) ||
  22057. !othIsReflexive) {
  22058. return -1;
  22059. }
  22060. }
  22061. return 0;
  22062. }
  22063. /**
  22064. * Used by `_.orderBy` to compare multiple properties of a value to another
  22065. * and stable sort them.
  22066. *
  22067. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22068. * specify an order of "desc" for descending or "asc" for ascending sort order
  22069. * of corresponding values.
  22070. *
  22071. * @private
  22072. * @param {Object} object The object to compare.
  22073. * @param {Object} other The other object to compare.
  22074. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22075. * @returns {number} Returns the sort order indicator for `object`.
  22076. */
  22077. function compareMultiple(object, other, orders) {
  22078. var index = -1,
  22079. objCriteria = object.criteria,
  22080. othCriteria = other.criteria,
  22081. length = objCriteria.length,
  22082. ordersLength = orders.length;
  22083. while (++index < length) {
  22084. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22085. if (result) {
  22086. if (index >= ordersLength) {
  22087. return result;
  22088. }
  22089. var order = orders[index];
  22090. return result * (order == 'desc' ? -1 : 1);
  22091. }
  22092. }
  22093. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22094. // that causes it, under certain circumstances, to provide the same value for
  22095. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22096. // for more details.
  22097. //
  22098. // This also ensures a stable sort in V8 and other engines.
  22099. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22100. return object.index - other.index;
  22101. }
  22102. /**
  22103. * Creates an array that is the composition of partially applied arguments,
  22104. * placeholders, and provided arguments into a single array of arguments.
  22105. *
  22106. * @private
  22107. * @param {Array} args The provided arguments.
  22108. * @param {Array} partials The arguments to prepend to those provided.
  22109. * @param {Array} holders The `partials` placeholder indexes.
  22110. * @params {boolean} [isCurried] Specify composing for a curried function.
  22111. * @returns {Array} Returns the new array of composed arguments.
  22112. */
  22113. function composeArgs(args, partials, holders, isCurried) {
  22114. var argsIndex = -1,
  22115. argsLength = args.length,
  22116. holdersLength = holders.length,
  22117. leftIndex = -1,
  22118. leftLength = partials.length,
  22119. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22120. result = Array(leftLength + rangeLength),
  22121. isUncurried = !isCurried;
  22122. while (++leftIndex < leftLength) {
  22123. result[leftIndex] = partials[leftIndex];
  22124. }
  22125. while (++argsIndex < holdersLength) {
  22126. if (isUncurried || argsIndex < argsLength) {
  22127. result[holders[argsIndex]] = args[argsIndex];
  22128. }
  22129. }
  22130. while (rangeLength--) {
  22131. result[leftIndex++] = args[argsIndex++];
  22132. }
  22133. return result;
  22134. }
  22135. /**
  22136. * This function is like `composeArgs` except that the arguments composition
  22137. * is tailored for `_.partialRight`.
  22138. *
  22139. * @private
  22140. * @param {Array} args The provided arguments.
  22141. * @param {Array} partials The arguments to append to those provided.
  22142. * @param {Array} holders The `partials` placeholder indexes.
  22143. * @params {boolean} [isCurried] Specify composing for a curried function.
  22144. * @returns {Array} Returns the new array of composed arguments.
  22145. */
  22146. function composeArgsRight(args, partials, holders, isCurried) {
  22147. var argsIndex = -1,
  22148. argsLength = args.length,
  22149. holdersIndex = -1,
  22150. holdersLength = holders.length,
  22151. rightIndex = -1,
  22152. rightLength = partials.length,
  22153. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22154. result = Array(rangeLength + rightLength),
  22155. isUncurried = !isCurried;
  22156. while (++argsIndex < rangeLength) {
  22157. result[argsIndex] = args[argsIndex];
  22158. }
  22159. var offset = argsIndex;
  22160. while (++rightIndex < rightLength) {
  22161. result[offset + rightIndex] = partials[rightIndex];
  22162. }
  22163. while (++holdersIndex < holdersLength) {
  22164. if (isUncurried || argsIndex < argsLength) {
  22165. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22166. }
  22167. }
  22168. return result;
  22169. }
  22170. /**
  22171. * Copies the values of `source` to `array`.
  22172. *
  22173. * @private
  22174. * @param {Array} source The array to copy values from.
  22175. * @param {Array} [array=[]] The array to copy values to.
  22176. * @returns {Array} Returns `array`.
  22177. */
  22178. function copyArray(source, array) {
  22179. var index = -1,
  22180. length = source.length;
  22181. array || (array = Array(length));
  22182. while (++index < length) {
  22183. array[index] = source[index];
  22184. }
  22185. return array;
  22186. }
  22187. /**
  22188. * Copies properties of `source` to `object`.
  22189. *
  22190. * @private
  22191. * @param {Object} source The object to copy properties from.
  22192. * @param {Array} props The property identifiers to copy.
  22193. * @param {Object} [object={}] The object to copy properties to.
  22194. * @param {Function} [customizer] The function to customize copied values.
  22195. * @returns {Object} Returns `object`.
  22196. */
  22197. function copyObject(source, props, object, customizer) {
  22198. var isNew = !object;
  22199. object || (object = {});
  22200. var index = -1,
  22201. length = props.length;
  22202. while (++index < length) {
  22203. var key = props[index];
  22204. var newValue = customizer
  22205. ? customizer(object[key], source[key], key, object, source)
  22206. : undefined;
  22207. if (newValue === undefined) {
  22208. newValue = source[key];
  22209. }
  22210. if (isNew) {
  22211. baseAssignValue(object, key, newValue);
  22212. } else {
  22213. assignValue(object, key, newValue);
  22214. }
  22215. }
  22216. return object;
  22217. }
  22218. /**
  22219. * Copies own symbols of `source` to `object`.
  22220. *
  22221. * @private
  22222. * @param {Object} source The object to copy symbols from.
  22223. * @param {Object} [object={}] The object to copy symbols to.
  22224. * @returns {Object} Returns `object`.
  22225. */
  22226. function copySymbols(source, object) {
  22227. return copyObject(source, getSymbols(source), object);
  22228. }
  22229. /**
  22230. * Copies own and inherited symbols of `source` to `object`.
  22231. *
  22232. * @private
  22233. * @param {Object} source The object to copy symbols from.
  22234. * @param {Object} [object={}] The object to copy symbols to.
  22235. * @returns {Object} Returns `object`.
  22236. */
  22237. function copySymbolsIn(source, object) {
  22238. return copyObject(source, getSymbolsIn(source), object);
  22239. }
  22240. /**
  22241. * Creates a function like `_.groupBy`.
  22242. *
  22243. * @private
  22244. * @param {Function} setter The function to set accumulator values.
  22245. * @param {Function} [initializer] The accumulator object initializer.
  22246. * @returns {Function} Returns the new aggregator function.
  22247. */
  22248. function createAggregator(setter, initializer) {
  22249. return function(collection, iteratee) {
  22250. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22251. accumulator = initializer ? initializer() : {};
  22252. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22253. };
  22254. }
  22255. /**
  22256. * Creates a function like `_.assign`.
  22257. *
  22258. * @private
  22259. * @param {Function} assigner The function to assign values.
  22260. * @returns {Function} Returns the new assigner function.
  22261. */
  22262. function createAssigner(assigner) {
  22263. return baseRest(function(object, sources) {
  22264. var index = -1,
  22265. length = sources.length,
  22266. customizer = length > 1 ? sources[length - 1] : undefined,
  22267. guard = length > 2 ? sources[2] : undefined;
  22268. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22269. ? (length--, customizer)
  22270. : undefined;
  22271. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22272. customizer = length < 3 ? undefined : customizer;
  22273. length = 1;
  22274. }
  22275. object = Object(object);
  22276. while (++index < length) {
  22277. var source = sources[index];
  22278. if (source) {
  22279. assigner(object, source, index, customizer);
  22280. }
  22281. }
  22282. return object;
  22283. });
  22284. }
  22285. /**
  22286. * Creates a `baseEach` or `baseEachRight` function.
  22287. *
  22288. * @private
  22289. * @param {Function} eachFunc The function to iterate over a collection.
  22290. * @param {boolean} [fromRight] Specify iterating from right to left.
  22291. * @returns {Function} Returns the new base function.
  22292. */
  22293. function createBaseEach(eachFunc, fromRight) {
  22294. return function(collection, iteratee) {
  22295. if (collection == null) {
  22296. return collection;
  22297. }
  22298. if (!isArrayLike(collection)) {
  22299. return eachFunc(collection, iteratee);
  22300. }
  22301. var length = collection.length,
  22302. index = fromRight ? length : -1,
  22303. iterable = Object(collection);
  22304. while ((fromRight ? index-- : ++index < length)) {
  22305. if (iteratee(iterable[index], index, iterable) === false) {
  22306. break;
  22307. }
  22308. }
  22309. return collection;
  22310. };
  22311. }
  22312. /**
  22313. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22314. *
  22315. * @private
  22316. * @param {boolean} [fromRight] Specify iterating from right to left.
  22317. * @returns {Function} Returns the new base function.
  22318. */
  22319. function createBaseFor(fromRight) {
  22320. return function(object, iteratee, keysFunc) {
  22321. var index = -1,
  22322. iterable = Object(object),
  22323. props = keysFunc(object),
  22324. length = props.length;
  22325. while (length--) {
  22326. var key = props[fromRight ? length : ++index];
  22327. if (iteratee(iterable[key], key, iterable) === false) {
  22328. break;
  22329. }
  22330. }
  22331. return object;
  22332. };
  22333. }
  22334. /**
  22335. * Creates a function that wraps `func` to invoke it with the optional `this`
  22336. * binding of `thisArg`.
  22337. *
  22338. * @private
  22339. * @param {Function} func The function to wrap.
  22340. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22341. * @param {*} [thisArg] The `this` binding of `func`.
  22342. * @returns {Function} Returns the new wrapped function.
  22343. */
  22344. function createBind(func, bitmask, thisArg) {
  22345. var isBind = bitmask & WRAP_BIND_FLAG,
  22346. Ctor = createCtor(func);
  22347. function wrapper() {
  22348. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22349. return fn.apply(isBind ? thisArg : this, arguments);
  22350. }
  22351. return wrapper;
  22352. }
  22353. /**
  22354. * Creates a function like `_.lowerFirst`.
  22355. *
  22356. * @private
  22357. * @param {string} methodName The name of the `String` case method to use.
  22358. * @returns {Function} Returns the new case function.
  22359. */
  22360. function createCaseFirst(methodName) {
  22361. return function(string) {
  22362. string = toString(string);
  22363. var strSymbols = hasUnicode(string)
  22364. ? stringToArray(string)
  22365. : undefined;
  22366. var chr = strSymbols
  22367. ? strSymbols[0]
  22368. : string.charAt(0);
  22369. var trailing = strSymbols
  22370. ? castSlice(strSymbols, 1).join('')
  22371. : string.slice(1);
  22372. return chr[methodName]() + trailing;
  22373. };
  22374. }
  22375. /**
  22376. * Creates a function like `_.camelCase`.
  22377. *
  22378. * @private
  22379. * @param {Function} callback The function to combine each word.
  22380. * @returns {Function} Returns the new compounder function.
  22381. */
  22382. function createCompounder(callback) {
  22383. return function(string) {
  22384. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22385. };
  22386. }
  22387. /**
  22388. * Creates a function that produces an instance of `Ctor` regardless of
  22389. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22390. *
  22391. * @private
  22392. * @param {Function} Ctor The constructor to wrap.
  22393. * @returns {Function} Returns the new wrapped function.
  22394. */
  22395. function createCtor(Ctor) {
  22396. return function() {
  22397. // Use a `switch` statement to work with class constructors. See
  22398. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22399. // for more details.
  22400. var args = arguments;
  22401. switch (args.length) {
  22402. case 0: return new Ctor;
  22403. case 1: return new Ctor(args[0]);
  22404. case 2: return new Ctor(args[0], args[1]);
  22405. case 3: return new Ctor(args[0], args[1], args[2]);
  22406. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22407. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22408. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22409. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22410. }
  22411. var thisBinding = baseCreate(Ctor.prototype),
  22412. result = Ctor.apply(thisBinding, args);
  22413. // Mimic the constructor's `return` behavior.
  22414. // See https://es5.github.io/#x13.2.2 for more details.
  22415. return isObject(result) ? result : thisBinding;
  22416. };
  22417. }
  22418. /**
  22419. * Creates a function that wraps `func` to enable currying.
  22420. *
  22421. * @private
  22422. * @param {Function} func The function to wrap.
  22423. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22424. * @param {number} arity The arity of `func`.
  22425. * @returns {Function} Returns the new wrapped function.
  22426. */
  22427. function createCurry(func, bitmask, arity) {
  22428. var Ctor = createCtor(func);
  22429. function wrapper() {
  22430. var length = arguments.length,
  22431. args = Array(length),
  22432. index = length,
  22433. placeholder = getHolder(wrapper);
  22434. while (index--) {
  22435. args[index] = arguments[index];
  22436. }
  22437. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22438. ? []
  22439. : replaceHolders(args, placeholder);
  22440. length -= holders.length;
  22441. if (length < arity) {
  22442. return createRecurry(
  22443. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22444. args, holders, undefined, undefined, arity - length);
  22445. }
  22446. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22447. return apply(fn, this, args);
  22448. }
  22449. return wrapper;
  22450. }
  22451. /**
  22452. * Creates a `_.find` or `_.findLast` function.
  22453. *
  22454. * @private
  22455. * @param {Function} findIndexFunc The function to find the collection index.
  22456. * @returns {Function} Returns the new find function.
  22457. */
  22458. function createFind(findIndexFunc) {
  22459. return function(collection, predicate, fromIndex) {
  22460. var iterable = Object(collection);
  22461. if (!isArrayLike(collection)) {
  22462. var iteratee = getIteratee(predicate, 3);
  22463. collection = keys(collection);
  22464. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22465. }
  22466. var index = findIndexFunc(collection, predicate, fromIndex);
  22467. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22468. };
  22469. }
  22470. /**
  22471. * Creates a `_.flow` or `_.flowRight` function.
  22472. *
  22473. * @private
  22474. * @param {boolean} [fromRight] Specify iterating from right to left.
  22475. * @returns {Function} Returns the new flow function.
  22476. */
  22477. function createFlow(fromRight) {
  22478. return flatRest(function(funcs) {
  22479. var length = funcs.length,
  22480. index = length,
  22481. prereq = LodashWrapper.prototype.thru;
  22482. if (fromRight) {
  22483. funcs.reverse();
  22484. }
  22485. while (index--) {
  22486. var func = funcs[index];
  22487. if (typeof func != 'function') {
  22488. throw new TypeError(FUNC_ERROR_TEXT);
  22489. }
  22490. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22491. var wrapper = new LodashWrapper([], true);
  22492. }
  22493. }
  22494. index = wrapper ? index : length;
  22495. while (++index < length) {
  22496. func = funcs[index];
  22497. var funcName = getFuncName(func),
  22498. data = funcName == 'wrapper' ? getData(func) : undefined;
  22499. if (data && isLaziable(data[0]) &&
  22500. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22501. !data[4].length && data[9] == 1
  22502. ) {
  22503. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22504. } else {
  22505. wrapper = (func.length == 1 && isLaziable(func))
  22506. ? wrapper[funcName]()
  22507. : wrapper.thru(func);
  22508. }
  22509. }
  22510. return function() {
  22511. var args = arguments,
  22512. value = args[0];
  22513. if (wrapper && args.length == 1 && isArray(value)) {
  22514. return wrapper.plant(value).value();
  22515. }
  22516. var index = 0,
  22517. result = length ? funcs[index].apply(this, args) : value;
  22518. while (++index < length) {
  22519. result = funcs[index].call(this, result);
  22520. }
  22521. return result;
  22522. };
  22523. });
  22524. }
  22525. /**
  22526. * Creates a function that wraps `func` to invoke it with optional `this`
  22527. * binding of `thisArg`, partial application, and currying.
  22528. *
  22529. * @private
  22530. * @param {Function|string} func The function or method name to wrap.
  22531. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22532. * @param {*} [thisArg] The `this` binding of `func`.
  22533. * @param {Array} [partials] The arguments to prepend to those provided to
  22534. * the new function.
  22535. * @param {Array} [holders] The `partials` placeholder indexes.
  22536. * @param {Array} [partialsRight] The arguments to append to those provided
  22537. * to the new function.
  22538. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22539. * @param {Array} [argPos] The argument positions of the new function.
  22540. * @param {number} [ary] The arity cap of `func`.
  22541. * @param {number} [arity] The arity of `func`.
  22542. * @returns {Function} Returns the new wrapped function.
  22543. */
  22544. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22545. var isAry = bitmask & WRAP_ARY_FLAG,
  22546. isBind = bitmask & WRAP_BIND_FLAG,
  22547. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22548. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22549. isFlip = bitmask & WRAP_FLIP_FLAG,
  22550. Ctor = isBindKey ? undefined : createCtor(func);
  22551. function wrapper() {
  22552. var length = arguments.length,
  22553. args = Array(length),
  22554. index = length;
  22555. while (index--) {
  22556. args[index] = arguments[index];
  22557. }
  22558. if (isCurried) {
  22559. var placeholder = getHolder(wrapper),
  22560. holdersCount = countHolders(args, placeholder);
  22561. }
  22562. if (partials) {
  22563. args = composeArgs(args, partials, holders, isCurried);
  22564. }
  22565. if (partialsRight) {
  22566. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22567. }
  22568. length -= holdersCount;
  22569. if (isCurried && length < arity) {
  22570. var newHolders = replaceHolders(args, placeholder);
  22571. return createRecurry(
  22572. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22573. args, newHolders, argPos, ary, arity - length
  22574. );
  22575. }
  22576. var thisBinding = isBind ? thisArg : this,
  22577. fn = isBindKey ? thisBinding[func] : func;
  22578. length = args.length;
  22579. if (argPos) {
  22580. args = reorder(args, argPos);
  22581. } else if (isFlip && length > 1) {
  22582. args.reverse();
  22583. }
  22584. if (isAry && ary < length) {
  22585. args.length = ary;
  22586. }
  22587. if (this && this !== root && this instanceof wrapper) {
  22588. fn = Ctor || createCtor(fn);
  22589. }
  22590. return fn.apply(thisBinding, args);
  22591. }
  22592. return wrapper;
  22593. }
  22594. /**
  22595. * Creates a function like `_.invertBy`.
  22596. *
  22597. * @private
  22598. * @param {Function} setter The function to set accumulator values.
  22599. * @param {Function} toIteratee The function to resolve iteratees.
  22600. * @returns {Function} Returns the new inverter function.
  22601. */
  22602. function createInverter(setter, toIteratee) {
  22603. return function(object, iteratee) {
  22604. return baseInverter(object, setter, toIteratee(iteratee), {});
  22605. };
  22606. }
  22607. /**
  22608. * Creates a function that performs a mathematical operation on two values.
  22609. *
  22610. * @private
  22611. * @param {Function} operator The function to perform the operation.
  22612. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22613. * @returns {Function} Returns the new mathematical operation function.
  22614. */
  22615. function createMathOperation(operator, defaultValue) {
  22616. return function(value, other) {
  22617. var result;
  22618. if (value === undefined && other === undefined) {
  22619. return defaultValue;
  22620. }
  22621. if (value !== undefined) {
  22622. result = value;
  22623. }
  22624. if (other !== undefined) {
  22625. if (result === undefined) {
  22626. return other;
  22627. }
  22628. if (typeof value == 'string' || typeof other == 'string') {
  22629. value = baseToString(value);
  22630. other = baseToString(other);
  22631. } else {
  22632. value = baseToNumber(value);
  22633. other = baseToNumber(other);
  22634. }
  22635. result = operator(value, other);
  22636. }
  22637. return result;
  22638. };
  22639. }
  22640. /**
  22641. * Creates a function like `_.over`.
  22642. *
  22643. * @private
  22644. * @param {Function} arrayFunc The function to iterate over iteratees.
  22645. * @returns {Function} Returns the new over function.
  22646. */
  22647. function createOver(arrayFunc) {
  22648. return flatRest(function(iteratees) {
  22649. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22650. return baseRest(function(args) {
  22651. var thisArg = this;
  22652. return arrayFunc(iteratees, function(iteratee) {
  22653. return apply(iteratee, thisArg, args);
  22654. });
  22655. });
  22656. });
  22657. }
  22658. /**
  22659. * Creates the padding for `string` based on `length`. The `chars` string
  22660. * is truncated if the number of characters exceeds `length`.
  22661. *
  22662. * @private
  22663. * @param {number} length The padding length.
  22664. * @param {string} [chars=' '] The string used as padding.
  22665. * @returns {string} Returns the padding for `string`.
  22666. */
  22667. function createPadding(length, chars) {
  22668. chars = chars === undefined ? ' ' : baseToString(chars);
  22669. var charsLength = chars.length;
  22670. if (charsLength < 2) {
  22671. return charsLength ? baseRepeat(chars, length) : chars;
  22672. }
  22673. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22674. return hasUnicode(chars)
  22675. ? castSlice(stringToArray(result), 0, length).join('')
  22676. : result.slice(0, length);
  22677. }
  22678. /**
  22679. * Creates a function that wraps `func` to invoke it with the `this` binding
  22680. * of `thisArg` and `partials` prepended to the arguments it receives.
  22681. *
  22682. * @private
  22683. * @param {Function} func The function to wrap.
  22684. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22685. * @param {*} thisArg The `this` binding of `func`.
  22686. * @param {Array} partials The arguments to prepend to those provided to
  22687. * the new function.
  22688. * @returns {Function} Returns the new wrapped function.
  22689. */
  22690. function createPartial(func, bitmask, thisArg, partials) {
  22691. var isBind = bitmask & WRAP_BIND_FLAG,
  22692. Ctor = createCtor(func);
  22693. function wrapper() {
  22694. var argsIndex = -1,
  22695. argsLength = arguments.length,
  22696. leftIndex = -1,
  22697. leftLength = partials.length,
  22698. args = Array(leftLength + argsLength),
  22699. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22700. while (++leftIndex < leftLength) {
  22701. args[leftIndex] = partials[leftIndex];
  22702. }
  22703. while (argsLength--) {
  22704. args[leftIndex++] = arguments[++argsIndex];
  22705. }
  22706. return apply(fn, isBind ? thisArg : this, args);
  22707. }
  22708. return wrapper;
  22709. }
  22710. /**
  22711. * Creates a `_.range` or `_.rangeRight` function.
  22712. *
  22713. * @private
  22714. * @param {boolean} [fromRight] Specify iterating from right to left.
  22715. * @returns {Function} Returns the new range function.
  22716. */
  22717. function createRange(fromRight) {
  22718. return function(start, end, step) {
  22719. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22720. end = step = undefined;
  22721. }
  22722. // Ensure the sign of `-0` is preserved.
  22723. start = toFinite(start);
  22724. if (end === undefined) {
  22725. end = start;
  22726. start = 0;
  22727. } else {
  22728. end = toFinite(end);
  22729. }
  22730. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22731. return baseRange(start, end, step, fromRight);
  22732. };
  22733. }
  22734. /**
  22735. * Creates a function that performs a relational operation on two values.
  22736. *
  22737. * @private
  22738. * @param {Function} operator The function to perform the operation.
  22739. * @returns {Function} Returns the new relational operation function.
  22740. */
  22741. function createRelationalOperation(operator) {
  22742. return function(value, other) {
  22743. if (!(typeof value == 'string' && typeof other == 'string')) {
  22744. value = toNumber(value);
  22745. other = toNumber(other);
  22746. }
  22747. return operator(value, other);
  22748. };
  22749. }
  22750. /**
  22751. * Creates a function that wraps `func` to continue currying.
  22752. *
  22753. * @private
  22754. * @param {Function} func The function to wrap.
  22755. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22756. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22757. * @param {*} placeholder The placeholder value.
  22758. * @param {*} [thisArg] The `this` binding of `func`.
  22759. * @param {Array} [partials] The arguments to prepend to those provided to
  22760. * the new function.
  22761. * @param {Array} [holders] The `partials` placeholder indexes.
  22762. * @param {Array} [argPos] The argument positions of the new function.
  22763. * @param {number} [ary] The arity cap of `func`.
  22764. * @param {number} [arity] The arity of `func`.
  22765. * @returns {Function} Returns the new wrapped function.
  22766. */
  22767. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22768. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22769. newHolders = isCurry ? holders : undefined,
  22770. newHoldersRight = isCurry ? undefined : holders,
  22771. newPartials = isCurry ? partials : undefined,
  22772. newPartialsRight = isCurry ? undefined : partials;
  22773. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22774. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22775. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22776. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22777. }
  22778. var newData = [
  22779. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22780. newHoldersRight, argPos, ary, arity
  22781. ];
  22782. var result = wrapFunc.apply(undefined, newData);
  22783. if (isLaziable(func)) {
  22784. setData(result, newData);
  22785. }
  22786. result.placeholder = placeholder;
  22787. return setWrapToString(result, func, bitmask);
  22788. }
  22789. /**
  22790. * Creates a function like `_.round`.
  22791. *
  22792. * @private
  22793. * @param {string} methodName The name of the `Math` method to use when rounding.
  22794. * @returns {Function} Returns the new round function.
  22795. */
  22796. function createRound(methodName) {
  22797. var func = Math[methodName];
  22798. return function(number, precision) {
  22799. number = toNumber(number);
  22800. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22801. if (precision && nativeIsFinite(number)) {
  22802. // Shift with exponential notation to avoid floating-point issues.
  22803. // See [MDN](https://mdn.io/round#Examples) for more details.
  22804. var pair = (toString(number) + 'e').split('e'),
  22805. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22806. pair = (toString(value) + 'e').split('e');
  22807. return +(pair[0] + 'e' + (+pair[1] - precision));
  22808. }
  22809. return func(number);
  22810. };
  22811. }
  22812. /**
  22813. * Creates a set object of `values`.
  22814. *
  22815. * @private
  22816. * @param {Array} values The values to add to the set.
  22817. * @returns {Object} Returns the new set.
  22818. */
  22819. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22820. return new Set(values);
  22821. };
  22822. /**
  22823. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22824. *
  22825. * @private
  22826. * @param {Function} keysFunc The function to get the keys of a given object.
  22827. * @returns {Function} Returns the new pairs function.
  22828. */
  22829. function createToPairs(keysFunc) {
  22830. return function(object) {
  22831. var tag = getTag(object);
  22832. if (tag == mapTag) {
  22833. return mapToArray(object);
  22834. }
  22835. if (tag == setTag) {
  22836. return setToPairs(object);
  22837. }
  22838. return baseToPairs(object, keysFunc(object));
  22839. };
  22840. }
  22841. /**
  22842. * Creates a function that either curries or invokes `func` with optional
  22843. * `this` binding and partially applied arguments.
  22844. *
  22845. * @private
  22846. * @param {Function|string} func The function or method name to wrap.
  22847. * @param {number} bitmask The bitmask flags.
  22848. * 1 - `_.bind`
  22849. * 2 - `_.bindKey`
  22850. * 4 - `_.curry` or `_.curryRight` of a bound function
  22851. * 8 - `_.curry`
  22852. * 16 - `_.curryRight`
  22853. * 32 - `_.partial`
  22854. * 64 - `_.partialRight`
  22855. * 128 - `_.rearg`
  22856. * 256 - `_.ary`
  22857. * 512 - `_.flip`
  22858. * @param {*} [thisArg] The `this` binding of `func`.
  22859. * @param {Array} [partials] The arguments to be partially applied.
  22860. * @param {Array} [holders] The `partials` placeholder indexes.
  22861. * @param {Array} [argPos] The argument positions of the new function.
  22862. * @param {number} [ary] The arity cap of `func`.
  22863. * @param {number} [arity] The arity of `func`.
  22864. * @returns {Function} Returns the new wrapped function.
  22865. */
  22866. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22867. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22868. if (!isBindKey && typeof func != 'function') {
  22869. throw new TypeError(FUNC_ERROR_TEXT);
  22870. }
  22871. var length = partials ? partials.length : 0;
  22872. if (!length) {
  22873. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22874. partials = holders = undefined;
  22875. }
  22876. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22877. arity = arity === undefined ? arity : toInteger(arity);
  22878. length -= holders ? holders.length : 0;
  22879. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22880. var partialsRight = partials,
  22881. holdersRight = holders;
  22882. partials = holders = undefined;
  22883. }
  22884. var data = isBindKey ? undefined : getData(func);
  22885. var newData = [
  22886. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22887. argPos, ary, arity
  22888. ];
  22889. if (data) {
  22890. mergeData(newData, data);
  22891. }
  22892. func = newData[0];
  22893. bitmask = newData[1];
  22894. thisArg = newData[2];
  22895. partials = newData[3];
  22896. holders = newData[4];
  22897. arity = newData[9] = newData[9] === undefined
  22898. ? (isBindKey ? 0 : func.length)
  22899. : nativeMax(newData[9] - length, 0);
  22900. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22901. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22902. }
  22903. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22904. var result = createBind(func, bitmask, thisArg);
  22905. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22906. result = createCurry(func, bitmask, arity);
  22907. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22908. result = createPartial(func, bitmask, thisArg, partials);
  22909. } else {
  22910. result = createHybrid.apply(undefined, newData);
  22911. }
  22912. var setter = data ? baseSetData : setData;
  22913. return setWrapToString(setter(result, newData), func, bitmask);
  22914. }
  22915. /**
  22916. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22917. * of source objects to the destination object for all destination properties
  22918. * that resolve to `undefined`.
  22919. *
  22920. * @private
  22921. * @param {*} objValue The destination value.
  22922. * @param {*} srcValue The source value.
  22923. * @param {string} key The key of the property to assign.
  22924. * @param {Object} object The parent object of `objValue`.
  22925. * @returns {*} Returns the value to assign.
  22926. */
  22927. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22928. if (objValue === undefined ||
  22929. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22930. return srcValue;
  22931. }
  22932. return objValue;
  22933. }
  22934. /**
  22935. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22936. * objects into destination objects that are passed thru.
  22937. *
  22938. * @private
  22939. * @param {*} objValue The destination value.
  22940. * @param {*} srcValue The source value.
  22941. * @param {string} key The key of the property to merge.
  22942. * @param {Object} object The parent object of `objValue`.
  22943. * @param {Object} source The parent object of `srcValue`.
  22944. * @param {Object} [stack] Tracks traversed source values and their merged
  22945. * counterparts.
  22946. * @returns {*} Returns the value to assign.
  22947. */
  22948. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22949. if (isObject(objValue) && isObject(srcValue)) {
  22950. // Recursively merge objects and arrays (susceptible to call stack limits).
  22951. stack.set(srcValue, objValue);
  22952. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22953. stack['delete'](srcValue);
  22954. }
  22955. return objValue;
  22956. }
  22957. /**
  22958. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22959. * objects.
  22960. *
  22961. * @private
  22962. * @param {*} value The value to inspect.
  22963. * @param {string} key The key of the property to inspect.
  22964. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22965. */
  22966. function customOmitClone(value) {
  22967. return isPlainObject(value) ? undefined : value;
  22968. }
  22969. /**
  22970. * A specialized version of `baseIsEqualDeep` for arrays with support for
  22971. * partial deep comparisons.
  22972. *
  22973. * @private
  22974. * @param {Array} array The array to compare.
  22975. * @param {Array} other The other array to compare.
  22976. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22977. * @param {Function} customizer The function to customize comparisons.
  22978. * @param {Function} equalFunc The function to determine equivalents of values.
  22979. * @param {Object} stack Tracks traversed `array` and `other` objects.
  22980. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  22981. */
  22982. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  22983. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  22984. arrLength = array.length,
  22985. othLength = other.length;
  22986. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  22987. return false;
  22988. }
  22989. // Assume cyclic values are equal.
  22990. var stacked = stack.get(array);
  22991. if (stacked && stack.get(other)) {
  22992. return stacked == other;
  22993. }
  22994. var index = -1,
  22995. result = true,
  22996. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  22997. stack.set(array, other);
  22998. stack.set(other, array);
  22999. // Ignore non-index properties.
  23000. while (++index < arrLength) {
  23001. var arrValue = array[index],
  23002. othValue = other[index];
  23003. if (customizer) {
  23004. var compared = isPartial
  23005. ? customizer(othValue, arrValue, index, other, array, stack)
  23006. : customizer(arrValue, othValue, index, array, other, stack);
  23007. }
  23008. if (compared !== undefined) {
  23009. if (compared) {
  23010. continue;
  23011. }
  23012. result = false;
  23013. break;
  23014. }
  23015. // Recursively compare arrays (susceptible to call stack limits).
  23016. if (seen) {
  23017. if (!arraySome(other, function(othValue, othIndex) {
  23018. if (!cacheHas(seen, othIndex) &&
  23019. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23020. return seen.push(othIndex);
  23021. }
  23022. })) {
  23023. result = false;
  23024. break;
  23025. }
  23026. } else if (!(
  23027. arrValue === othValue ||
  23028. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23029. )) {
  23030. result = false;
  23031. break;
  23032. }
  23033. }
  23034. stack['delete'](array);
  23035. stack['delete'](other);
  23036. return result;
  23037. }
  23038. /**
  23039. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23040. * the same `toStringTag`.
  23041. *
  23042. * **Note:** This function only supports comparing values with tags of
  23043. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23044. *
  23045. * @private
  23046. * @param {Object} object The object to compare.
  23047. * @param {Object} other The other object to compare.
  23048. * @param {string} tag The `toStringTag` of the objects to compare.
  23049. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23050. * @param {Function} customizer The function to customize comparisons.
  23051. * @param {Function} equalFunc The function to determine equivalents of values.
  23052. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23053. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23054. */
  23055. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23056. switch (tag) {
  23057. case dataViewTag:
  23058. if ((object.byteLength != other.byteLength) ||
  23059. (object.byteOffset != other.byteOffset)) {
  23060. return false;
  23061. }
  23062. object = object.buffer;
  23063. other = other.buffer;
  23064. case arrayBufferTag:
  23065. if ((object.byteLength != other.byteLength) ||
  23066. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23067. return false;
  23068. }
  23069. return true;
  23070. case boolTag:
  23071. case dateTag:
  23072. case numberTag:
  23073. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23074. // Invalid dates are coerced to `NaN`.
  23075. return eq(+object, +other);
  23076. case errorTag:
  23077. return object.name == other.name && object.message == other.message;
  23078. case regexpTag:
  23079. case stringTag:
  23080. // Coerce regexes to strings and treat strings, primitives and objects,
  23081. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23082. // for more details.
  23083. return object == (other + '');
  23084. case mapTag:
  23085. var convert = mapToArray;
  23086. case setTag:
  23087. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23088. convert || (convert = setToArray);
  23089. if (object.size != other.size && !isPartial) {
  23090. return false;
  23091. }
  23092. // Assume cyclic values are equal.
  23093. var stacked = stack.get(object);
  23094. if (stacked) {
  23095. return stacked == other;
  23096. }
  23097. bitmask |= COMPARE_UNORDERED_FLAG;
  23098. // Recursively compare objects (susceptible to call stack limits).
  23099. stack.set(object, other);
  23100. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23101. stack['delete'](object);
  23102. return result;
  23103. case symbolTag:
  23104. if (symbolValueOf) {
  23105. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23106. }
  23107. }
  23108. return false;
  23109. }
  23110. /**
  23111. * A specialized version of `baseIsEqualDeep` for objects with support for
  23112. * partial deep comparisons.
  23113. *
  23114. * @private
  23115. * @param {Object} object The object to compare.
  23116. * @param {Object} other The other object to compare.
  23117. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23118. * @param {Function} customizer The function to customize comparisons.
  23119. * @param {Function} equalFunc The function to determine equivalents of values.
  23120. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23121. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23122. */
  23123. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23124. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23125. objProps = getAllKeys(object),
  23126. objLength = objProps.length,
  23127. othProps = getAllKeys(other),
  23128. othLength = othProps.length;
  23129. if (objLength != othLength && !isPartial) {
  23130. return false;
  23131. }
  23132. var index = objLength;
  23133. while (index--) {
  23134. var key = objProps[index];
  23135. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23136. return false;
  23137. }
  23138. }
  23139. // Assume cyclic values are equal.
  23140. var stacked = stack.get(object);
  23141. if (stacked && stack.get(other)) {
  23142. return stacked == other;
  23143. }
  23144. var result = true;
  23145. stack.set(object, other);
  23146. stack.set(other, object);
  23147. var skipCtor = isPartial;
  23148. while (++index < objLength) {
  23149. key = objProps[index];
  23150. var objValue = object[key],
  23151. othValue = other[key];
  23152. if (customizer) {
  23153. var compared = isPartial
  23154. ? customizer(othValue, objValue, key, other, object, stack)
  23155. : customizer(objValue, othValue, key, object, other, stack);
  23156. }
  23157. // Recursively compare objects (susceptible to call stack limits).
  23158. if (!(compared === undefined
  23159. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23160. : compared
  23161. )) {
  23162. result = false;
  23163. break;
  23164. }
  23165. skipCtor || (skipCtor = key == 'constructor');
  23166. }
  23167. if (result && !skipCtor) {
  23168. var objCtor = object.constructor,
  23169. othCtor = other.constructor;
  23170. // Non `Object` object instances with different constructors are not equal.
  23171. if (objCtor != othCtor &&
  23172. ('constructor' in object && 'constructor' in other) &&
  23173. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23174. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23175. result = false;
  23176. }
  23177. }
  23178. stack['delete'](object);
  23179. stack['delete'](other);
  23180. return result;
  23181. }
  23182. /**
  23183. * A specialized version of `baseRest` which flattens the rest array.
  23184. *
  23185. * @private
  23186. * @param {Function} func The function to apply a rest parameter to.
  23187. * @returns {Function} Returns the new function.
  23188. */
  23189. function flatRest(func) {
  23190. return setToString(overRest(func, undefined, flatten), func + '');
  23191. }
  23192. /**
  23193. * Creates an array of own enumerable property names and symbols of `object`.
  23194. *
  23195. * @private
  23196. * @param {Object} object The object to query.
  23197. * @returns {Array} Returns the array of property names and symbols.
  23198. */
  23199. function getAllKeys(object) {
  23200. return baseGetAllKeys(object, keys, getSymbols);
  23201. }
  23202. /**
  23203. * Creates an array of own and inherited enumerable property names and
  23204. * symbols of `object`.
  23205. *
  23206. * @private
  23207. * @param {Object} object The object to query.
  23208. * @returns {Array} Returns the array of property names and symbols.
  23209. */
  23210. function getAllKeysIn(object) {
  23211. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23212. }
  23213. /**
  23214. * Gets metadata for `func`.
  23215. *
  23216. * @private
  23217. * @param {Function} func The function to query.
  23218. * @returns {*} Returns the metadata for `func`.
  23219. */
  23220. var getData = !metaMap ? noop : function(func) {
  23221. return metaMap.get(func);
  23222. };
  23223. /**
  23224. * Gets the name of `func`.
  23225. *
  23226. * @private
  23227. * @param {Function} func The function to query.
  23228. * @returns {string} Returns the function name.
  23229. */
  23230. function getFuncName(func) {
  23231. var result = (func.name + ''),
  23232. array = realNames[result],
  23233. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23234. while (length--) {
  23235. var data = array[length],
  23236. otherFunc = data.func;
  23237. if (otherFunc == null || otherFunc == func) {
  23238. return data.name;
  23239. }
  23240. }
  23241. return result;
  23242. }
  23243. /**
  23244. * Gets the argument placeholder value for `func`.
  23245. *
  23246. * @private
  23247. * @param {Function} func The function to inspect.
  23248. * @returns {*} Returns the placeholder value.
  23249. */
  23250. function getHolder(func) {
  23251. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23252. return object.placeholder;
  23253. }
  23254. /**
  23255. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23256. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23257. * If arguments are provided, the chosen function is invoked with them and
  23258. * its result is returned.
  23259. *
  23260. * @private
  23261. * @param {*} [value] The value to convert to an iteratee.
  23262. * @param {number} [arity] The arity of the created iteratee.
  23263. * @returns {Function} Returns the chosen function or its result.
  23264. */
  23265. function getIteratee() {
  23266. var result = lodash.iteratee || iteratee;
  23267. result = result === iteratee ? baseIteratee : result;
  23268. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23269. }
  23270. /**
  23271. * Gets the data for `map`.
  23272. *
  23273. * @private
  23274. * @param {Object} map The map to query.
  23275. * @param {string} key The reference key.
  23276. * @returns {*} Returns the map data.
  23277. */
  23278. function getMapData(map, key) {
  23279. var data = map.__data__;
  23280. return isKeyable(key)
  23281. ? data[typeof key == 'string' ? 'string' : 'hash']
  23282. : data.map;
  23283. }
  23284. /**
  23285. * Gets the property names, values, and compare flags of `object`.
  23286. *
  23287. * @private
  23288. * @param {Object} object The object to query.
  23289. * @returns {Array} Returns the match data of `object`.
  23290. */
  23291. function getMatchData(object) {
  23292. var result = keys(object),
  23293. length = result.length;
  23294. while (length--) {
  23295. var key = result[length],
  23296. value = object[key];
  23297. result[length] = [key, value, isStrictComparable(value)];
  23298. }
  23299. return result;
  23300. }
  23301. /**
  23302. * Gets the native function at `key` of `object`.
  23303. *
  23304. * @private
  23305. * @param {Object} object The object to query.
  23306. * @param {string} key The key of the method to get.
  23307. * @returns {*} Returns the function if it's native, else `undefined`.
  23308. */
  23309. function getNative(object, key) {
  23310. var value = getValue(object, key);
  23311. return baseIsNative(value) ? value : undefined;
  23312. }
  23313. /**
  23314. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23315. *
  23316. * @private
  23317. * @param {*} value The value to query.
  23318. * @returns {string} Returns the raw `toStringTag`.
  23319. */
  23320. function getRawTag(value) {
  23321. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23322. tag = value[symToStringTag];
  23323. try {
  23324. value[symToStringTag] = undefined;
  23325. var unmasked = true;
  23326. } catch (e) {}
  23327. var result = nativeObjectToString.call(value);
  23328. if (unmasked) {
  23329. if (isOwn) {
  23330. value[symToStringTag] = tag;
  23331. } else {
  23332. delete value[symToStringTag];
  23333. }
  23334. }
  23335. return result;
  23336. }
  23337. /**
  23338. * Creates an array of the own enumerable symbols of `object`.
  23339. *
  23340. * @private
  23341. * @param {Object} object The object to query.
  23342. * @returns {Array} Returns the array of symbols.
  23343. */
  23344. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23345. if (object == null) {
  23346. return [];
  23347. }
  23348. object = Object(object);
  23349. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23350. return propertyIsEnumerable.call(object, symbol);
  23351. });
  23352. };
  23353. /**
  23354. * Creates an array of the own and inherited enumerable symbols of `object`.
  23355. *
  23356. * @private
  23357. * @param {Object} object The object to query.
  23358. * @returns {Array} Returns the array of symbols.
  23359. */
  23360. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23361. var result = [];
  23362. while (object) {
  23363. arrayPush(result, getSymbols(object));
  23364. object = getPrototype(object);
  23365. }
  23366. return result;
  23367. };
  23368. /**
  23369. * Gets the `toStringTag` of `value`.
  23370. *
  23371. * @private
  23372. * @param {*} value The value to query.
  23373. * @returns {string} Returns the `toStringTag`.
  23374. */
  23375. var getTag = baseGetTag;
  23376. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23377. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23378. (Map && getTag(new Map) != mapTag) ||
  23379. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23380. (Set && getTag(new Set) != setTag) ||
  23381. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23382. getTag = function(value) {
  23383. var result = baseGetTag(value),
  23384. Ctor = result == objectTag ? value.constructor : undefined,
  23385. ctorString = Ctor ? toSource(Ctor) : '';
  23386. if (ctorString) {
  23387. switch (ctorString) {
  23388. case dataViewCtorString: return dataViewTag;
  23389. case mapCtorString: return mapTag;
  23390. case promiseCtorString: return promiseTag;
  23391. case setCtorString: return setTag;
  23392. case weakMapCtorString: return weakMapTag;
  23393. }
  23394. }
  23395. return result;
  23396. };
  23397. }
  23398. /**
  23399. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23400. *
  23401. * @private
  23402. * @param {number} start The start of the view.
  23403. * @param {number} end The end of the view.
  23404. * @param {Array} transforms The transformations to apply to the view.
  23405. * @returns {Object} Returns an object containing the `start` and `end`
  23406. * positions of the view.
  23407. */
  23408. function getView(start, end, transforms) {
  23409. var index = -1,
  23410. length = transforms.length;
  23411. while (++index < length) {
  23412. var data = transforms[index],
  23413. size = data.size;
  23414. switch (data.type) {
  23415. case 'drop': start += size; break;
  23416. case 'dropRight': end -= size; break;
  23417. case 'take': end = nativeMin(end, start + size); break;
  23418. case 'takeRight': start = nativeMax(start, end - size); break;
  23419. }
  23420. }
  23421. return { 'start': start, 'end': end };
  23422. }
  23423. /**
  23424. * Extracts wrapper details from the `source` body comment.
  23425. *
  23426. * @private
  23427. * @param {string} source The source to inspect.
  23428. * @returns {Array} Returns the wrapper details.
  23429. */
  23430. function getWrapDetails(source) {
  23431. var match = source.match(reWrapDetails);
  23432. return match ? match[1].split(reSplitDetails) : [];
  23433. }
  23434. /**
  23435. * Checks if `path` exists on `object`.
  23436. *
  23437. * @private
  23438. * @param {Object} object The object to query.
  23439. * @param {Array|string} path The path to check.
  23440. * @param {Function} hasFunc The function to check properties.
  23441. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23442. */
  23443. function hasPath(object, path, hasFunc) {
  23444. path = castPath(path, object);
  23445. var index = -1,
  23446. length = path.length,
  23447. result = false;
  23448. while (++index < length) {
  23449. var key = toKey(path[index]);
  23450. if (!(result = object != null && hasFunc(object, key))) {
  23451. break;
  23452. }
  23453. object = object[key];
  23454. }
  23455. if (result || ++index != length) {
  23456. return result;
  23457. }
  23458. length = object == null ? 0 : object.length;
  23459. return !!length && isLength(length) && isIndex(key, length) &&
  23460. (isArray(object) || isArguments(object));
  23461. }
  23462. /**
  23463. * Initializes an array clone.
  23464. *
  23465. * @private
  23466. * @param {Array} array The array to clone.
  23467. * @returns {Array} Returns the initialized clone.
  23468. */
  23469. function initCloneArray(array) {
  23470. var length = array.length,
  23471. result = new array.constructor(length);
  23472. // Add properties assigned by `RegExp#exec`.
  23473. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23474. result.index = array.index;
  23475. result.input = array.input;
  23476. }
  23477. return result;
  23478. }
  23479. /**
  23480. * Initializes an object clone.
  23481. *
  23482. * @private
  23483. * @param {Object} object The object to clone.
  23484. * @returns {Object} Returns the initialized clone.
  23485. */
  23486. function initCloneObject(object) {
  23487. return (typeof object.constructor == 'function' && !isPrototype(object))
  23488. ? baseCreate(getPrototype(object))
  23489. : {};
  23490. }
  23491. /**
  23492. * Initializes an object clone based on its `toStringTag`.
  23493. *
  23494. * **Note:** This function only supports cloning values with tags of
  23495. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23496. *
  23497. * @private
  23498. * @param {Object} object The object to clone.
  23499. * @param {string} tag The `toStringTag` of the object to clone.
  23500. * @param {boolean} [isDeep] Specify a deep clone.
  23501. * @returns {Object} Returns the initialized clone.
  23502. */
  23503. function initCloneByTag(object, tag, isDeep) {
  23504. var Ctor = object.constructor;
  23505. switch (tag) {
  23506. case arrayBufferTag:
  23507. return cloneArrayBuffer(object);
  23508. case boolTag:
  23509. case dateTag:
  23510. return new Ctor(+object);
  23511. case dataViewTag:
  23512. return cloneDataView(object, isDeep);
  23513. case float32Tag: case float64Tag:
  23514. case int8Tag: case int16Tag: case int32Tag:
  23515. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23516. return cloneTypedArray(object, isDeep);
  23517. case mapTag:
  23518. return new Ctor;
  23519. case numberTag:
  23520. case stringTag:
  23521. return new Ctor(object);
  23522. case regexpTag:
  23523. return cloneRegExp(object);
  23524. case setTag:
  23525. return new Ctor;
  23526. case symbolTag:
  23527. return cloneSymbol(object);
  23528. }
  23529. }
  23530. /**
  23531. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23532. *
  23533. * @private
  23534. * @param {string} source The source to modify.
  23535. * @returns {Array} details The details to insert.
  23536. * @returns {string} Returns the modified source.
  23537. */
  23538. function insertWrapDetails(source, details) {
  23539. var length = details.length;
  23540. if (!length) {
  23541. return source;
  23542. }
  23543. var lastIndex = length - 1;
  23544. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23545. details = details.join(length > 2 ? ', ' : ' ');
  23546. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23547. }
  23548. /**
  23549. * Checks if `value` is a flattenable `arguments` object or array.
  23550. *
  23551. * @private
  23552. * @param {*} value The value to check.
  23553. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23554. */
  23555. function isFlattenable(value) {
  23556. return isArray(value) || isArguments(value) ||
  23557. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23558. }
  23559. /**
  23560. * Checks if `value` is a valid array-like index.
  23561. *
  23562. * @private
  23563. * @param {*} value The value to check.
  23564. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23565. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23566. */
  23567. function isIndex(value, length) {
  23568. var type = typeof value;
  23569. length = length == null ? MAX_SAFE_INTEGER : length;
  23570. return !!length &&
  23571. (type == 'number' ||
  23572. (type != 'symbol' && reIsUint.test(value))) &&
  23573. (value > -1 && value % 1 == 0 && value < length);
  23574. }
  23575. /**
  23576. * Checks if the given arguments are from an iteratee call.
  23577. *
  23578. * @private
  23579. * @param {*} value The potential iteratee value argument.
  23580. * @param {*} index The potential iteratee index or key argument.
  23581. * @param {*} object The potential iteratee object argument.
  23582. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23583. * else `false`.
  23584. */
  23585. function isIterateeCall(value, index, object) {
  23586. if (!isObject(object)) {
  23587. return false;
  23588. }
  23589. var type = typeof index;
  23590. if (type == 'number'
  23591. ? (isArrayLike(object) && isIndex(index, object.length))
  23592. : (type == 'string' && index in object)
  23593. ) {
  23594. return eq(object[index], value);
  23595. }
  23596. return false;
  23597. }
  23598. /**
  23599. * Checks if `value` is a property name and not a property path.
  23600. *
  23601. * @private
  23602. * @param {*} value The value to check.
  23603. * @param {Object} [object] The object to query keys on.
  23604. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23605. */
  23606. function isKey(value, object) {
  23607. if (isArray(value)) {
  23608. return false;
  23609. }
  23610. var type = typeof value;
  23611. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23612. value == null || isSymbol(value)) {
  23613. return true;
  23614. }
  23615. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23616. (object != null && value in Object(object));
  23617. }
  23618. /**
  23619. * Checks if `value` is suitable for use as unique object key.
  23620. *
  23621. * @private
  23622. * @param {*} value The value to check.
  23623. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23624. */
  23625. function isKeyable(value) {
  23626. var type = typeof value;
  23627. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23628. ? (value !== '__proto__')
  23629. : (value === null);
  23630. }
  23631. /**
  23632. * Checks if `func` has a lazy counterpart.
  23633. *
  23634. * @private
  23635. * @param {Function} func The function to check.
  23636. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23637. * else `false`.
  23638. */
  23639. function isLaziable(func) {
  23640. var funcName = getFuncName(func),
  23641. other = lodash[funcName];
  23642. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23643. return false;
  23644. }
  23645. if (func === other) {
  23646. return true;
  23647. }
  23648. var data = getData(other);
  23649. return !!data && func === data[0];
  23650. }
  23651. /**
  23652. * Checks if `func` has its source masked.
  23653. *
  23654. * @private
  23655. * @param {Function} func The function to check.
  23656. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23657. */
  23658. function isMasked(func) {
  23659. return !!maskSrcKey && (maskSrcKey in func);
  23660. }
  23661. /**
  23662. * Checks if `func` is capable of being masked.
  23663. *
  23664. * @private
  23665. * @param {*} value The value to check.
  23666. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23667. */
  23668. var isMaskable = coreJsData ? isFunction : stubFalse;
  23669. /**
  23670. * Checks if `value` is likely a prototype object.
  23671. *
  23672. * @private
  23673. * @param {*} value The value to check.
  23674. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23675. */
  23676. function isPrototype(value) {
  23677. var Ctor = value && value.constructor,
  23678. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23679. return value === proto;
  23680. }
  23681. /**
  23682. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23683. *
  23684. * @private
  23685. * @param {*} value The value to check.
  23686. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23687. * equality comparisons, else `false`.
  23688. */
  23689. function isStrictComparable(value) {
  23690. return value === value && !isObject(value);
  23691. }
  23692. /**
  23693. * A specialized version of `matchesProperty` for source values suitable
  23694. * for strict equality comparisons, i.e. `===`.
  23695. *
  23696. * @private
  23697. * @param {string} key The key of the property to get.
  23698. * @param {*} srcValue The value to match.
  23699. * @returns {Function} Returns the new spec function.
  23700. */
  23701. function matchesStrictComparable(key, srcValue) {
  23702. return function(object) {
  23703. if (object == null) {
  23704. return false;
  23705. }
  23706. return object[key] === srcValue &&
  23707. (srcValue !== undefined || (key in Object(object)));
  23708. };
  23709. }
  23710. /**
  23711. * A specialized version of `_.memoize` which clears the memoized function's
  23712. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23713. *
  23714. * @private
  23715. * @param {Function} func The function to have its output memoized.
  23716. * @returns {Function} Returns the new memoized function.
  23717. */
  23718. function memoizeCapped(func) {
  23719. var result = memoize(func, function(key) {
  23720. if (cache.size === MAX_MEMOIZE_SIZE) {
  23721. cache.clear();
  23722. }
  23723. return key;
  23724. });
  23725. var cache = result.cache;
  23726. return result;
  23727. }
  23728. /**
  23729. * Merges the function metadata of `source` into `data`.
  23730. *
  23731. * Merging metadata reduces the number of wrappers used to invoke a function.
  23732. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23733. * may be applied regardless of execution order. Methods like `_.ary` and
  23734. * `_.rearg` modify function arguments, making the order in which they are
  23735. * executed important, preventing the merging of metadata. However, we make
  23736. * an exception for a safe combined case where curried functions have `_.ary`
  23737. * and or `_.rearg` applied.
  23738. *
  23739. * @private
  23740. * @param {Array} data The destination metadata.
  23741. * @param {Array} source The source metadata.
  23742. * @returns {Array} Returns `data`.
  23743. */
  23744. function mergeData(data, source) {
  23745. var bitmask = data[1],
  23746. srcBitmask = source[1],
  23747. newBitmask = bitmask | srcBitmask,
  23748. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23749. var isCombo =
  23750. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23751. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23752. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23753. // Exit early if metadata can't be merged.
  23754. if (!(isCommon || isCombo)) {
  23755. return data;
  23756. }
  23757. // Use source `thisArg` if available.
  23758. if (srcBitmask & WRAP_BIND_FLAG) {
  23759. data[2] = source[2];
  23760. // Set when currying a bound function.
  23761. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23762. }
  23763. // Compose partial arguments.
  23764. var value = source[3];
  23765. if (value) {
  23766. var partials = data[3];
  23767. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23768. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23769. }
  23770. // Compose partial right arguments.
  23771. value = source[5];
  23772. if (value) {
  23773. partials = data[5];
  23774. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23775. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23776. }
  23777. // Use source `argPos` if available.
  23778. value = source[7];
  23779. if (value) {
  23780. data[7] = value;
  23781. }
  23782. // Use source `ary` if it's smaller.
  23783. if (srcBitmask & WRAP_ARY_FLAG) {
  23784. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23785. }
  23786. // Use source `arity` if one is not provided.
  23787. if (data[9] == null) {
  23788. data[9] = source[9];
  23789. }
  23790. // Use source `func` and merge bitmasks.
  23791. data[0] = source[0];
  23792. data[1] = newBitmask;
  23793. return data;
  23794. }
  23795. /**
  23796. * This function is like
  23797. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23798. * except that it includes inherited enumerable properties.
  23799. *
  23800. * @private
  23801. * @param {Object} object The object to query.
  23802. * @returns {Array} Returns the array of property names.
  23803. */
  23804. function nativeKeysIn(object) {
  23805. var result = [];
  23806. if (object != null) {
  23807. for (var key in Object(object)) {
  23808. result.push(key);
  23809. }
  23810. }
  23811. return result;
  23812. }
  23813. /**
  23814. * Converts `value` to a string using `Object.prototype.toString`.
  23815. *
  23816. * @private
  23817. * @param {*} value The value to convert.
  23818. * @returns {string} Returns the converted string.
  23819. */
  23820. function objectToString(value) {
  23821. return nativeObjectToString.call(value);
  23822. }
  23823. /**
  23824. * A specialized version of `baseRest` which transforms the rest array.
  23825. *
  23826. * @private
  23827. * @param {Function} func The function to apply a rest parameter to.
  23828. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23829. * @param {Function} transform The rest array transform.
  23830. * @returns {Function} Returns the new function.
  23831. */
  23832. function overRest(func, start, transform) {
  23833. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23834. return function() {
  23835. var args = arguments,
  23836. index = -1,
  23837. length = nativeMax(args.length - start, 0),
  23838. array = Array(length);
  23839. while (++index < length) {
  23840. array[index] = args[start + index];
  23841. }
  23842. index = -1;
  23843. var otherArgs = Array(start + 1);
  23844. while (++index < start) {
  23845. otherArgs[index] = args[index];
  23846. }
  23847. otherArgs[start] = transform(array);
  23848. return apply(func, this, otherArgs);
  23849. };
  23850. }
  23851. /**
  23852. * Gets the parent value at `path` of `object`.
  23853. *
  23854. * @private
  23855. * @param {Object} object The object to query.
  23856. * @param {Array} path The path to get the parent value of.
  23857. * @returns {*} Returns the parent value.
  23858. */
  23859. function parent(object, path) {
  23860. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23861. }
  23862. /**
  23863. * Reorder `array` according to the specified indexes where the element at
  23864. * the first index is assigned as the first element, the element at
  23865. * the second index is assigned as the second element, and so on.
  23866. *
  23867. * @private
  23868. * @param {Array} array The array to reorder.
  23869. * @param {Array} indexes The arranged array indexes.
  23870. * @returns {Array} Returns `array`.
  23871. */
  23872. function reorder(array, indexes) {
  23873. var arrLength = array.length,
  23874. length = nativeMin(indexes.length, arrLength),
  23875. oldArray = copyArray(array);
  23876. while (length--) {
  23877. var index = indexes[length];
  23878. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23879. }
  23880. return array;
  23881. }
  23882. /**
  23883. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23884. *
  23885. * @private
  23886. * @param {Object} object The object to query.
  23887. * @param {string} key The key of the property to get.
  23888. * @returns {*} Returns the property value.
  23889. */
  23890. function safeGet(object, key) {
  23891. if (key === 'constructor' && typeof object[key] === 'function') {
  23892. return;
  23893. }
  23894. if (key == '__proto__') {
  23895. return;
  23896. }
  23897. return object[key];
  23898. }
  23899. /**
  23900. * Sets metadata for `func`.
  23901. *
  23902. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23903. * period of time, it will trip its breaker and transition to an identity
  23904. * function to avoid garbage collection pauses in V8. See
  23905. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23906. * for more details.
  23907. *
  23908. * @private
  23909. * @param {Function} func The function to associate metadata with.
  23910. * @param {*} data The metadata.
  23911. * @returns {Function} Returns `func`.
  23912. */
  23913. var setData = shortOut(baseSetData);
  23914. /**
  23915. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23916. *
  23917. * @private
  23918. * @param {Function} func The function to delay.
  23919. * @param {number} wait The number of milliseconds to delay invocation.
  23920. * @returns {number|Object} Returns the timer id or timeout object.
  23921. */
  23922. var setTimeout = ctxSetTimeout || function(func, wait) {
  23923. return root.setTimeout(func, wait);
  23924. };
  23925. /**
  23926. * Sets the `toString` method of `func` to return `string`.
  23927. *
  23928. * @private
  23929. * @param {Function} func The function to modify.
  23930. * @param {Function} string The `toString` result.
  23931. * @returns {Function} Returns `func`.
  23932. */
  23933. var setToString = shortOut(baseSetToString);
  23934. /**
  23935. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23936. * with wrapper details in a comment at the top of the source body.
  23937. *
  23938. * @private
  23939. * @param {Function} wrapper The function to modify.
  23940. * @param {Function} reference The reference function.
  23941. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23942. * @returns {Function} Returns `wrapper`.
  23943. */
  23944. function setWrapToString(wrapper, reference, bitmask) {
  23945. var source = (reference + '');
  23946. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23947. }
  23948. /**
  23949. * Creates a function that'll short out and invoke `identity` instead
  23950. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23951. * milliseconds.
  23952. *
  23953. * @private
  23954. * @param {Function} func The function to restrict.
  23955. * @returns {Function} Returns the new shortable function.
  23956. */
  23957. function shortOut(func) {
  23958. var count = 0,
  23959. lastCalled = 0;
  23960. return function() {
  23961. var stamp = nativeNow(),
  23962. remaining = HOT_SPAN - (stamp - lastCalled);
  23963. lastCalled = stamp;
  23964. if (remaining > 0) {
  23965. if (++count >= HOT_COUNT) {
  23966. return arguments[0];
  23967. }
  23968. } else {
  23969. count = 0;
  23970. }
  23971. return func.apply(undefined, arguments);
  23972. };
  23973. }
  23974. /**
  23975. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  23976. *
  23977. * @private
  23978. * @param {Array} array The array to shuffle.
  23979. * @param {number} [size=array.length] The size of `array`.
  23980. * @returns {Array} Returns `array`.
  23981. */
  23982. function shuffleSelf(array, size) {
  23983. var index = -1,
  23984. length = array.length,
  23985. lastIndex = length - 1;
  23986. size = size === undefined ? length : size;
  23987. while (++index < size) {
  23988. var rand = baseRandom(index, lastIndex),
  23989. value = array[rand];
  23990. array[rand] = array[index];
  23991. array[index] = value;
  23992. }
  23993. array.length = size;
  23994. return array;
  23995. }
  23996. /**
  23997. * Converts `string` to a property path array.
  23998. *
  23999. * @private
  24000. * @param {string} string The string to convert.
  24001. * @returns {Array} Returns the property path array.
  24002. */
  24003. var stringToPath = memoizeCapped(function(string) {
  24004. var result = [];
  24005. if (string.charCodeAt(0) === 46 /* . */) {
  24006. result.push('');
  24007. }
  24008. string.replace(rePropName, function(match, number, quote, subString) {
  24009. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24010. });
  24011. return result;
  24012. });
  24013. /**
  24014. * Converts `value` to a string key if it's not a string or symbol.
  24015. *
  24016. * @private
  24017. * @param {*} value The value to inspect.
  24018. * @returns {string|symbol} Returns the key.
  24019. */
  24020. function toKey(value) {
  24021. if (typeof value == 'string' || isSymbol(value)) {
  24022. return value;
  24023. }
  24024. var result = (value + '');
  24025. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24026. }
  24027. /**
  24028. * Converts `func` to its source code.
  24029. *
  24030. * @private
  24031. * @param {Function} func The function to convert.
  24032. * @returns {string} Returns the source code.
  24033. */
  24034. function toSource(func) {
  24035. if (func != null) {
  24036. try {
  24037. return funcToString.call(func);
  24038. } catch (e) {}
  24039. try {
  24040. return (func + '');
  24041. } catch (e) {}
  24042. }
  24043. return '';
  24044. }
  24045. /**
  24046. * Updates wrapper `details` based on `bitmask` flags.
  24047. *
  24048. * @private
  24049. * @returns {Array} details The details to modify.
  24050. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24051. * @returns {Array} Returns `details`.
  24052. */
  24053. function updateWrapDetails(details, bitmask) {
  24054. arrayEach(wrapFlags, function(pair) {
  24055. var value = '_.' + pair[0];
  24056. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24057. details.push(value);
  24058. }
  24059. });
  24060. return details.sort();
  24061. }
  24062. /**
  24063. * Creates a clone of `wrapper`.
  24064. *
  24065. * @private
  24066. * @param {Object} wrapper The wrapper to clone.
  24067. * @returns {Object} Returns the cloned wrapper.
  24068. */
  24069. function wrapperClone(wrapper) {
  24070. if (wrapper instanceof LazyWrapper) {
  24071. return wrapper.clone();
  24072. }
  24073. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24074. result.__actions__ = copyArray(wrapper.__actions__);
  24075. result.__index__ = wrapper.__index__;
  24076. result.__values__ = wrapper.__values__;
  24077. return result;
  24078. }
  24079. /*------------------------------------------------------------------------*/
  24080. /**
  24081. * Creates an array of elements split into groups the length of `size`.
  24082. * If `array` can't be split evenly, the final chunk will be the remaining
  24083. * elements.
  24084. *
  24085. * @static
  24086. * @memberOf _
  24087. * @since 3.0.0
  24088. * @category Array
  24089. * @param {Array} array The array to process.
  24090. * @param {number} [size=1] The length of each chunk
  24091. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24092. * @returns {Array} Returns the new array of chunks.
  24093. * @example
  24094. *
  24095. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24096. * // => [['a', 'b'], ['c', 'd']]
  24097. *
  24098. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24099. * // => [['a', 'b', 'c'], ['d']]
  24100. */
  24101. function chunk(array, size, guard) {
  24102. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24103. size = 1;
  24104. } else {
  24105. size = nativeMax(toInteger(size), 0);
  24106. }
  24107. var length = array == null ? 0 : array.length;
  24108. if (!length || size < 1) {
  24109. return [];
  24110. }
  24111. var index = 0,
  24112. resIndex = 0,
  24113. result = Array(nativeCeil(length / size));
  24114. while (index < length) {
  24115. result[resIndex++] = baseSlice(array, index, (index += size));
  24116. }
  24117. return result;
  24118. }
  24119. /**
  24120. * Creates an array with all falsey values removed. The values `false`, `null`,
  24121. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24122. *
  24123. * @static
  24124. * @memberOf _
  24125. * @since 0.1.0
  24126. * @category Array
  24127. * @param {Array} array The array to compact.
  24128. * @returns {Array} Returns the new array of filtered values.
  24129. * @example
  24130. *
  24131. * _.compact([0, 1, false, 2, '', 3]);
  24132. * // => [1, 2, 3]
  24133. */
  24134. function compact(array) {
  24135. var index = -1,
  24136. length = array == null ? 0 : array.length,
  24137. resIndex = 0,
  24138. result = [];
  24139. while (++index < length) {
  24140. var value = array[index];
  24141. if (value) {
  24142. result[resIndex++] = value;
  24143. }
  24144. }
  24145. return result;
  24146. }
  24147. /**
  24148. * Creates a new array concatenating `array` with any additional arrays
  24149. * and/or values.
  24150. *
  24151. * @static
  24152. * @memberOf _
  24153. * @since 4.0.0
  24154. * @category Array
  24155. * @param {Array} array The array to concatenate.
  24156. * @param {...*} [values] The values to concatenate.
  24157. * @returns {Array} Returns the new concatenated array.
  24158. * @example
  24159. *
  24160. * var array = [1];
  24161. * var other = _.concat(array, 2, [3], [[4]]);
  24162. *
  24163. * console.log(other);
  24164. * // => [1, 2, 3, [4]]
  24165. *
  24166. * console.log(array);
  24167. * // => [1]
  24168. */
  24169. function concat() {
  24170. var length = arguments.length;
  24171. if (!length) {
  24172. return [];
  24173. }
  24174. var args = Array(length - 1),
  24175. array = arguments[0],
  24176. index = length;
  24177. while (index--) {
  24178. args[index - 1] = arguments[index];
  24179. }
  24180. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24181. }
  24182. /**
  24183. * Creates an array of `array` values not included in the other given arrays
  24184. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24185. * for equality comparisons. The order and references of result values are
  24186. * determined by the first array.
  24187. *
  24188. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24189. *
  24190. * @static
  24191. * @memberOf _
  24192. * @since 0.1.0
  24193. * @category Array
  24194. * @param {Array} array The array to inspect.
  24195. * @param {...Array} [values] The values to exclude.
  24196. * @returns {Array} Returns the new array of filtered values.
  24197. * @see _.without, _.xor
  24198. * @example
  24199. *
  24200. * _.difference([2, 1], [2, 3]);
  24201. * // => [1]
  24202. */
  24203. var difference = baseRest(function(array, values) {
  24204. return isArrayLikeObject(array)
  24205. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24206. : [];
  24207. });
  24208. /**
  24209. * This method is like `_.difference` except that it accepts `iteratee` which
  24210. * is invoked for each element of `array` and `values` to generate the criterion
  24211. * by which they're compared. The order and references of result values are
  24212. * determined by the first array. The iteratee is invoked with one argument:
  24213. * (value).
  24214. *
  24215. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24216. *
  24217. * @static
  24218. * @memberOf _
  24219. * @since 4.0.0
  24220. * @category Array
  24221. * @param {Array} array The array to inspect.
  24222. * @param {...Array} [values] The values to exclude.
  24223. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24224. * @returns {Array} Returns the new array of filtered values.
  24225. * @example
  24226. *
  24227. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24228. * // => [1.2]
  24229. *
  24230. * // The `_.property` iteratee shorthand.
  24231. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24232. * // => [{ 'x': 2 }]
  24233. */
  24234. var differenceBy = baseRest(function(array, values) {
  24235. var iteratee = last(values);
  24236. if (isArrayLikeObject(iteratee)) {
  24237. iteratee = undefined;
  24238. }
  24239. return isArrayLikeObject(array)
  24240. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24241. : [];
  24242. });
  24243. /**
  24244. * This method is like `_.difference` except that it accepts `comparator`
  24245. * which is invoked to compare elements of `array` to `values`. The order and
  24246. * references of result values are determined by the first array. The comparator
  24247. * is invoked with two arguments: (arrVal, othVal).
  24248. *
  24249. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24250. *
  24251. * @static
  24252. * @memberOf _
  24253. * @since 4.0.0
  24254. * @category Array
  24255. * @param {Array} array The array to inspect.
  24256. * @param {...Array} [values] The values to exclude.
  24257. * @param {Function} [comparator] The comparator invoked per element.
  24258. * @returns {Array} Returns the new array of filtered values.
  24259. * @example
  24260. *
  24261. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24262. *
  24263. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24264. * // => [{ 'x': 2, 'y': 1 }]
  24265. */
  24266. var differenceWith = baseRest(function(array, values) {
  24267. var comparator = last(values);
  24268. if (isArrayLikeObject(comparator)) {
  24269. comparator = undefined;
  24270. }
  24271. return isArrayLikeObject(array)
  24272. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24273. : [];
  24274. });
  24275. /**
  24276. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24277. *
  24278. * @static
  24279. * @memberOf _
  24280. * @since 0.5.0
  24281. * @category Array
  24282. * @param {Array} array The array to query.
  24283. * @param {number} [n=1] The number of elements to drop.
  24284. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24285. * @returns {Array} Returns the slice of `array`.
  24286. * @example
  24287. *
  24288. * _.drop([1, 2, 3]);
  24289. * // => [2, 3]
  24290. *
  24291. * _.drop([1, 2, 3], 2);
  24292. * // => [3]
  24293. *
  24294. * _.drop([1, 2, 3], 5);
  24295. * // => []
  24296. *
  24297. * _.drop([1, 2, 3], 0);
  24298. * // => [1, 2, 3]
  24299. */
  24300. function drop(array, n, guard) {
  24301. var length = array == null ? 0 : array.length;
  24302. if (!length) {
  24303. return [];
  24304. }
  24305. n = (guard || n === undefined) ? 1 : toInteger(n);
  24306. return baseSlice(array, n < 0 ? 0 : n, length);
  24307. }
  24308. /**
  24309. * Creates a slice of `array` with `n` elements dropped from the end.
  24310. *
  24311. * @static
  24312. * @memberOf _
  24313. * @since 3.0.0
  24314. * @category Array
  24315. * @param {Array} array The array to query.
  24316. * @param {number} [n=1] The number of elements to drop.
  24317. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24318. * @returns {Array} Returns the slice of `array`.
  24319. * @example
  24320. *
  24321. * _.dropRight([1, 2, 3]);
  24322. * // => [1, 2]
  24323. *
  24324. * _.dropRight([1, 2, 3], 2);
  24325. * // => [1]
  24326. *
  24327. * _.dropRight([1, 2, 3], 5);
  24328. * // => []
  24329. *
  24330. * _.dropRight([1, 2, 3], 0);
  24331. * // => [1, 2, 3]
  24332. */
  24333. function dropRight(array, n, guard) {
  24334. var length = array == null ? 0 : array.length;
  24335. if (!length) {
  24336. return [];
  24337. }
  24338. n = (guard || n === undefined) ? 1 : toInteger(n);
  24339. n = length - n;
  24340. return baseSlice(array, 0, n < 0 ? 0 : n);
  24341. }
  24342. /**
  24343. * Creates a slice of `array` excluding elements dropped from the end.
  24344. * Elements are dropped until `predicate` returns falsey. The predicate is
  24345. * invoked with three arguments: (value, index, array).
  24346. *
  24347. * @static
  24348. * @memberOf _
  24349. * @since 3.0.0
  24350. * @category Array
  24351. * @param {Array} array The array to query.
  24352. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24353. * @returns {Array} Returns the slice of `array`.
  24354. * @example
  24355. *
  24356. * var users = [
  24357. * { 'user': 'barney', 'active': true },
  24358. * { 'user': 'fred', 'active': false },
  24359. * { 'user': 'pebbles', 'active': false }
  24360. * ];
  24361. *
  24362. * _.dropRightWhile(users, function(o) { return !o.active; });
  24363. * // => objects for ['barney']
  24364. *
  24365. * // The `_.matches` iteratee shorthand.
  24366. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24367. * // => objects for ['barney', 'fred']
  24368. *
  24369. * // The `_.matchesProperty` iteratee shorthand.
  24370. * _.dropRightWhile(users, ['active', false]);
  24371. * // => objects for ['barney']
  24372. *
  24373. * // The `_.property` iteratee shorthand.
  24374. * _.dropRightWhile(users, 'active');
  24375. * // => objects for ['barney', 'fred', 'pebbles']
  24376. */
  24377. function dropRightWhile(array, predicate) {
  24378. return (array && array.length)
  24379. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24380. : [];
  24381. }
  24382. /**
  24383. * Creates a slice of `array` excluding elements dropped from the beginning.
  24384. * Elements are dropped until `predicate` returns falsey. The predicate is
  24385. * invoked with three arguments: (value, index, array).
  24386. *
  24387. * @static
  24388. * @memberOf _
  24389. * @since 3.0.0
  24390. * @category Array
  24391. * @param {Array} array The array to query.
  24392. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24393. * @returns {Array} Returns the slice of `array`.
  24394. * @example
  24395. *
  24396. * var users = [
  24397. * { 'user': 'barney', 'active': false },
  24398. * { 'user': 'fred', 'active': false },
  24399. * { 'user': 'pebbles', 'active': true }
  24400. * ];
  24401. *
  24402. * _.dropWhile(users, function(o) { return !o.active; });
  24403. * // => objects for ['pebbles']
  24404. *
  24405. * // The `_.matches` iteratee shorthand.
  24406. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24407. * // => objects for ['fred', 'pebbles']
  24408. *
  24409. * // The `_.matchesProperty` iteratee shorthand.
  24410. * _.dropWhile(users, ['active', false]);
  24411. * // => objects for ['pebbles']
  24412. *
  24413. * // The `_.property` iteratee shorthand.
  24414. * _.dropWhile(users, 'active');
  24415. * // => objects for ['barney', 'fred', 'pebbles']
  24416. */
  24417. function dropWhile(array, predicate) {
  24418. return (array && array.length)
  24419. ? baseWhile(array, getIteratee(predicate, 3), true)
  24420. : [];
  24421. }
  24422. /**
  24423. * Fills elements of `array` with `value` from `start` up to, but not
  24424. * including, `end`.
  24425. *
  24426. * **Note:** This method mutates `array`.
  24427. *
  24428. * @static
  24429. * @memberOf _
  24430. * @since 3.2.0
  24431. * @category Array
  24432. * @param {Array} array The array to fill.
  24433. * @param {*} value The value to fill `array` with.
  24434. * @param {number} [start=0] The start position.
  24435. * @param {number} [end=array.length] The end position.
  24436. * @returns {Array} Returns `array`.
  24437. * @example
  24438. *
  24439. * var array = [1, 2, 3];
  24440. *
  24441. * _.fill(array, 'a');
  24442. * console.log(array);
  24443. * // => ['a', 'a', 'a']
  24444. *
  24445. * _.fill(Array(3), 2);
  24446. * // => [2, 2, 2]
  24447. *
  24448. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24449. * // => [4, '*', '*', 10]
  24450. */
  24451. function fill(array, value, start, end) {
  24452. var length = array == null ? 0 : array.length;
  24453. if (!length) {
  24454. return [];
  24455. }
  24456. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24457. start = 0;
  24458. end = length;
  24459. }
  24460. return baseFill(array, value, start, end);
  24461. }
  24462. /**
  24463. * This method is like `_.find` except that it returns the index of the first
  24464. * element `predicate` returns truthy for instead of the element itself.
  24465. *
  24466. * @static
  24467. * @memberOf _
  24468. * @since 1.1.0
  24469. * @category Array
  24470. * @param {Array} array The array to inspect.
  24471. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24472. * @param {number} [fromIndex=0] The index to search from.
  24473. * @returns {number} Returns the index of the found element, else `-1`.
  24474. * @example
  24475. *
  24476. * var users = [
  24477. * { 'user': 'barney', 'active': false },
  24478. * { 'user': 'fred', 'active': false },
  24479. * { 'user': 'pebbles', 'active': true }
  24480. * ];
  24481. *
  24482. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24483. * // => 0
  24484. *
  24485. * // The `_.matches` iteratee shorthand.
  24486. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24487. * // => 1
  24488. *
  24489. * // The `_.matchesProperty` iteratee shorthand.
  24490. * _.findIndex(users, ['active', false]);
  24491. * // => 0
  24492. *
  24493. * // The `_.property` iteratee shorthand.
  24494. * _.findIndex(users, 'active');
  24495. * // => 2
  24496. */
  24497. function findIndex(array, predicate, fromIndex) {
  24498. var length = array == null ? 0 : array.length;
  24499. if (!length) {
  24500. return -1;
  24501. }
  24502. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24503. if (index < 0) {
  24504. index = nativeMax(length + index, 0);
  24505. }
  24506. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24507. }
  24508. /**
  24509. * This method is like `_.findIndex` except that it iterates over elements
  24510. * of `collection` from right to left.
  24511. *
  24512. * @static
  24513. * @memberOf _
  24514. * @since 2.0.0
  24515. * @category Array
  24516. * @param {Array} array The array to inspect.
  24517. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24518. * @param {number} [fromIndex=array.length-1] The index to search from.
  24519. * @returns {number} Returns the index of the found element, else `-1`.
  24520. * @example
  24521. *
  24522. * var users = [
  24523. * { 'user': 'barney', 'active': true },
  24524. * { 'user': 'fred', 'active': false },
  24525. * { 'user': 'pebbles', 'active': false }
  24526. * ];
  24527. *
  24528. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24529. * // => 2
  24530. *
  24531. * // The `_.matches` iteratee shorthand.
  24532. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24533. * // => 0
  24534. *
  24535. * // The `_.matchesProperty` iteratee shorthand.
  24536. * _.findLastIndex(users, ['active', false]);
  24537. * // => 2
  24538. *
  24539. * // The `_.property` iteratee shorthand.
  24540. * _.findLastIndex(users, 'active');
  24541. * // => 0
  24542. */
  24543. function findLastIndex(array, predicate, fromIndex) {
  24544. var length = array == null ? 0 : array.length;
  24545. if (!length) {
  24546. return -1;
  24547. }
  24548. var index = length - 1;
  24549. if (fromIndex !== undefined) {
  24550. index = toInteger(fromIndex);
  24551. index = fromIndex < 0
  24552. ? nativeMax(length + index, 0)
  24553. : nativeMin(index, length - 1);
  24554. }
  24555. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24556. }
  24557. /**
  24558. * Flattens `array` a single level deep.
  24559. *
  24560. * @static
  24561. * @memberOf _
  24562. * @since 0.1.0
  24563. * @category Array
  24564. * @param {Array} array The array to flatten.
  24565. * @returns {Array} Returns the new flattened array.
  24566. * @example
  24567. *
  24568. * _.flatten([1, [2, [3, [4]], 5]]);
  24569. * // => [1, 2, [3, [4]], 5]
  24570. */
  24571. function flatten(array) {
  24572. var length = array == null ? 0 : array.length;
  24573. return length ? baseFlatten(array, 1) : [];
  24574. }
  24575. /**
  24576. * Recursively flattens `array`.
  24577. *
  24578. * @static
  24579. * @memberOf _
  24580. * @since 3.0.0
  24581. * @category Array
  24582. * @param {Array} array The array to flatten.
  24583. * @returns {Array} Returns the new flattened array.
  24584. * @example
  24585. *
  24586. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24587. * // => [1, 2, 3, 4, 5]
  24588. */
  24589. function flattenDeep(array) {
  24590. var length = array == null ? 0 : array.length;
  24591. return length ? baseFlatten(array, INFINITY) : [];
  24592. }
  24593. /**
  24594. * Recursively flatten `array` up to `depth` times.
  24595. *
  24596. * @static
  24597. * @memberOf _
  24598. * @since 4.4.0
  24599. * @category Array
  24600. * @param {Array} array The array to flatten.
  24601. * @param {number} [depth=1] The maximum recursion depth.
  24602. * @returns {Array} Returns the new flattened array.
  24603. * @example
  24604. *
  24605. * var array = [1, [2, [3, [4]], 5]];
  24606. *
  24607. * _.flattenDepth(array, 1);
  24608. * // => [1, 2, [3, [4]], 5]
  24609. *
  24610. * _.flattenDepth(array, 2);
  24611. * // => [1, 2, 3, [4], 5]
  24612. */
  24613. function flattenDepth(array, depth) {
  24614. var length = array == null ? 0 : array.length;
  24615. if (!length) {
  24616. return [];
  24617. }
  24618. depth = depth === undefined ? 1 : toInteger(depth);
  24619. return baseFlatten(array, depth);
  24620. }
  24621. /**
  24622. * The inverse of `_.toPairs`; this method returns an object composed
  24623. * from key-value `pairs`.
  24624. *
  24625. * @static
  24626. * @memberOf _
  24627. * @since 4.0.0
  24628. * @category Array
  24629. * @param {Array} pairs The key-value pairs.
  24630. * @returns {Object} Returns the new object.
  24631. * @example
  24632. *
  24633. * _.fromPairs([['a', 1], ['b', 2]]);
  24634. * // => { 'a': 1, 'b': 2 }
  24635. */
  24636. function fromPairs(pairs) {
  24637. var index = -1,
  24638. length = pairs == null ? 0 : pairs.length,
  24639. result = {};
  24640. while (++index < length) {
  24641. var pair = pairs[index];
  24642. result[pair[0]] = pair[1];
  24643. }
  24644. return result;
  24645. }
  24646. /**
  24647. * Gets the first element of `array`.
  24648. *
  24649. * @static
  24650. * @memberOf _
  24651. * @since 0.1.0
  24652. * @alias first
  24653. * @category Array
  24654. * @param {Array} array The array to query.
  24655. * @returns {*} Returns the first element of `array`.
  24656. * @example
  24657. *
  24658. * _.head([1, 2, 3]);
  24659. * // => 1
  24660. *
  24661. * _.head([]);
  24662. * // => undefined
  24663. */
  24664. function head(array) {
  24665. return (array && array.length) ? array[0] : undefined;
  24666. }
  24667. /**
  24668. * Gets the index at which the first occurrence of `value` is found in `array`
  24669. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24670. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24671. * offset from the end of `array`.
  24672. *
  24673. * @static
  24674. * @memberOf _
  24675. * @since 0.1.0
  24676. * @category Array
  24677. * @param {Array} array The array to inspect.
  24678. * @param {*} value The value to search for.
  24679. * @param {number} [fromIndex=0] The index to search from.
  24680. * @returns {number} Returns the index of the matched value, else `-1`.
  24681. * @example
  24682. *
  24683. * _.indexOf([1, 2, 1, 2], 2);
  24684. * // => 1
  24685. *
  24686. * // Search from the `fromIndex`.
  24687. * _.indexOf([1, 2, 1, 2], 2, 2);
  24688. * // => 3
  24689. */
  24690. function indexOf(array, value, fromIndex) {
  24691. var length = array == null ? 0 : array.length;
  24692. if (!length) {
  24693. return -1;
  24694. }
  24695. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24696. if (index < 0) {
  24697. index = nativeMax(length + index, 0);
  24698. }
  24699. return baseIndexOf(array, value, index);
  24700. }
  24701. /**
  24702. * Gets all but the last element of `array`.
  24703. *
  24704. * @static
  24705. * @memberOf _
  24706. * @since 0.1.0
  24707. * @category Array
  24708. * @param {Array} array The array to query.
  24709. * @returns {Array} Returns the slice of `array`.
  24710. * @example
  24711. *
  24712. * _.initial([1, 2, 3]);
  24713. * // => [1, 2]
  24714. */
  24715. function initial(array) {
  24716. var length = array == null ? 0 : array.length;
  24717. return length ? baseSlice(array, 0, -1) : [];
  24718. }
  24719. /**
  24720. * Creates an array of unique values that are included in all given arrays
  24721. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24722. * for equality comparisons. The order and references of result values are
  24723. * determined by the first array.
  24724. *
  24725. * @static
  24726. * @memberOf _
  24727. * @since 0.1.0
  24728. * @category Array
  24729. * @param {...Array} [arrays] The arrays to inspect.
  24730. * @returns {Array} Returns the new array of intersecting values.
  24731. * @example
  24732. *
  24733. * _.intersection([2, 1], [2, 3]);
  24734. * // => [2]
  24735. */
  24736. var intersection = baseRest(function(arrays) {
  24737. var mapped = arrayMap(arrays, castArrayLikeObject);
  24738. return (mapped.length && mapped[0] === arrays[0])
  24739. ? baseIntersection(mapped)
  24740. : [];
  24741. });
  24742. /**
  24743. * This method is like `_.intersection` except that it accepts `iteratee`
  24744. * which is invoked for each element of each `arrays` to generate the criterion
  24745. * by which they're compared. The order and references of result values are
  24746. * determined by the first array. The iteratee is invoked with one argument:
  24747. * (value).
  24748. *
  24749. * @static
  24750. * @memberOf _
  24751. * @since 4.0.0
  24752. * @category Array
  24753. * @param {...Array} [arrays] The arrays to inspect.
  24754. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24755. * @returns {Array} Returns the new array of intersecting values.
  24756. * @example
  24757. *
  24758. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24759. * // => [2.1]
  24760. *
  24761. * // The `_.property` iteratee shorthand.
  24762. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24763. * // => [{ 'x': 1 }]
  24764. */
  24765. var intersectionBy = baseRest(function(arrays) {
  24766. var iteratee = last(arrays),
  24767. mapped = arrayMap(arrays, castArrayLikeObject);
  24768. if (iteratee === last(mapped)) {
  24769. iteratee = undefined;
  24770. } else {
  24771. mapped.pop();
  24772. }
  24773. return (mapped.length && mapped[0] === arrays[0])
  24774. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24775. : [];
  24776. });
  24777. /**
  24778. * This method is like `_.intersection` except that it accepts `comparator`
  24779. * which is invoked to compare elements of `arrays`. The order and references
  24780. * of result values are determined by the first array. The comparator is
  24781. * invoked with two arguments: (arrVal, othVal).
  24782. *
  24783. * @static
  24784. * @memberOf _
  24785. * @since 4.0.0
  24786. * @category Array
  24787. * @param {...Array} [arrays] The arrays to inspect.
  24788. * @param {Function} [comparator] The comparator invoked per element.
  24789. * @returns {Array} Returns the new array of intersecting values.
  24790. * @example
  24791. *
  24792. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24793. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24794. *
  24795. * _.intersectionWith(objects, others, _.isEqual);
  24796. * // => [{ 'x': 1, 'y': 2 }]
  24797. */
  24798. var intersectionWith = baseRest(function(arrays) {
  24799. var comparator = last(arrays),
  24800. mapped = arrayMap(arrays, castArrayLikeObject);
  24801. comparator = typeof comparator == 'function' ? comparator : undefined;
  24802. if (comparator) {
  24803. mapped.pop();
  24804. }
  24805. return (mapped.length && mapped[0] === arrays[0])
  24806. ? baseIntersection(mapped, undefined, comparator)
  24807. : [];
  24808. });
  24809. /**
  24810. * Converts all elements in `array` into a string separated by `separator`.
  24811. *
  24812. * @static
  24813. * @memberOf _
  24814. * @since 4.0.0
  24815. * @category Array
  24816. * @param {Array} array The array to convert.
  24817. * @param {string} [separator=','] The element separator.
  24818. * @returns {string} Returns the joined string.
  24819. * @example
  24820. *
  24821. * _.join(['a', 'b', 'c'], '~');
  24822. * // => 'a~b~c'
  24823. */
  24824. function join(array, separator) {
  24825. return array == null ? '' : nativeJoin.call(array, separator);
  24826. }
  24827. /**
  24828. * Gets the last element of `array`.
  24829. *
  24830. * @static
  24831. * @memberOf _
  24832. * @since 0.1.0
  24833. * @category Array
  24834. * @param {Array} array The array to query.
  24835. * @returns {*} Returns the last element of `array`.
  24836. * @example
  24837. *
  24838. * _.last([1, 2, 3]);
  24839. * // => 3
  24840. */
  24841. function last(array) {
  24842. var length = array == null ? 0 : array.length;
  24843. return length ? array[length - 1] : undefined;
  24844. }
  24845. /**
  24846. * This method is like `_.indexOf` except that it iterates over elements of
  24847. * `array` from right to left.
  24848. *
  24849. * @static
  24850. * @memberOf _
  24851. * @since 0.1.0
  24852. * @category Array
  24853. * @param {Array} array The array to inspect.
  24854. * @param {*} value The value to search for.
  24855. * @param {number} [fromIndex=array.length-1] The index to search from.
  24856. * @returns {number} Returns the index of the matched value, else `-1`.
  24857. * @example
  24858. *
  24859. * _.lastIndexOf([1, 2, 1, 2], 2);
  24860. * // => 3
  24861. *
  24862. * // Search from the `fromIndex`.
  24863. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24864. * // => 1
  24865. */
  24866. function lastIndexOf(array, value, fromIndex) {
  24867. var length = array == null ? 0 : array.length;
  24868. if (!length) {
  24869. return -1;
  24870. }
  24871. var index = length;
  24872. if (fromIndex !== undefined) {
  24873. index = toInteger(fromIndex);
  24874. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24875. }
  24876. return value === value
  24877. ? strictLastIndexOf(array, value, index)
  24878. : baseFindIndex(array, baseIsNaN, index, true);
  24879. }
  24880. /**
  24881. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24882. * element from the end is returned.
  24883. *
  24884. * @static
  24885. * @memberOf _
  24886. * @since 4.11.0
  24887. * @category Array
  24888. * @param {Array} array The array to query.
  24889. * @param {number} [n=0] The index of the element to return.
  24890. * @returns {*} Returns the nth element of `array`.
  24891. * @example
  24892. *
  24893. * var array = ['a', 'b', 'c', 'd'];
  24894. *
  24895. * _.nth(array, 1);
  24896. * // => 'b'
  24897. *
  24898. * _.nth(array, -2);
  24899. * // => 'c';
  24900. */
  24901. function nth(array, n) {
  24902. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24903. }
  24904. /**
  24905. * Removes all given values from `array` using
  24906. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24907. * for equality comparisons.
  24908. *
  24909. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24910. * to remove elements from an array by predicate.
  24911. *
  24912. * @static
  24913. * @memberOf _
  24914. * @since 2.0.0
  24915. * @category Array
  24916. * @param {Array} array The array to modify.
  24917. * @param {...*} [values] The values to remove.
  24918. * @returns {Array} Returns `array`.
  24919. * @example
  24920. *
  24921. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24922. *
  24923. * _.pull(array, 'a', 'c');
  24924. * console.log(array);
  24925. * // => ['b', 'b']
  24926. */
  24927. var pull = baseRest(pullAll);
  24928. /**
  24929. * This method is like `_.pull` except that it accepts an array of values to remove.
  24930. *
  24931. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24932. *
  24933. * @static
  24934. * @memberOf _
  24935. * @since 4.0.0
  24936. * @category Array
  24937. * @param {Array} array The array to modify.
  24938. * @param {Array} values The values to remove.
  24939. * @returns {Array} Returns `array`.
  24940. * @example
  24941. *
  24942. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24943. *
  24944. * _.pullAll(array, ['a', 'c']);
  24945. * console.log(array);
  24946. * // => ['b', 'b']
  24947. */
  24948. function pullAll(array, values) {
  24949. return (array && array.length && values && values.length)
  24950. ? basePullAll(array, values)
  24951. : array;
  24952. }
  24953. /**
  24954. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24955. * invoked for each element of `array` and `values` to generate the criterion
  24956. * by which they're compared. The iteratee is invoked with one argument: (value).
  24957. *
  24958. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24959. *
  24960. * @static
  24961. * @memberOf _
  24962. * @since 4.0.0
  24963. * @category Array
  24964. * @param {Array} array The array to modify.
  24965. * @param {Array} values The values to remove.
  24966. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24967. * @returns {Array} Returns `array`.
  24968. * @example
  24969. *
  24970. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  24971. *
  24972. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  24973. * console.log(array);
  24974. * // => [{ 'x': 2 }]
  24975. */
  24976. function pullAllBy(array, values, iteratee) {
  24977. return (array && array.length && values && values.length)
  24978. ? basePullAll(array, values, getIteratee(iteratee, 2))
  24979. : array;
  24980. }
  24981. /**
  24982. * This method is like `_.pullAll` except that it accepts `comparator` which
  24983. * is invoked to compare elements of `array` to `values`. The comparator is
  24984. * invoked with two arguments: (arrVal, othVal).
  24985. *
  24986. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  24987. *
  24988. * @static
  24989. * @memberOf _
  24990. * @since 4.6.0
  24991. * @category Array
  24992. * @param {Array} array The array to modify.
  24993. * @param {Array} values The values to remove.
  24994. * @param {Function} [comparator] The comparator invoked per element.
  24995. * @returns {Array} Returns `array`.
  24996. * @example
  24997. *
  24998. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  24999. *
  25000. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25001. * console.log(array);
  25002. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25003. */
  25004. function pullAllWith(array, values, comparator) {
  25005. return (array && array.length && values && values.length)
  25006. ? basePullAll(array, values, undefined, comparator)
  25007. : array;
  25008. }
  25009. /**
  25010. * Removes elements from `array` corresponding to `indexes` and returns an
  25011. * array of removed elements.
  25012. *
  25013. * **Note:** Unlike `_.at`, this method mutates `array`.
  25014. *
  25015. * @static
  25016. * @memberOf _
  25017. * @since 3.0.0
  25018. * @category Array
  25019. * @param {Array} array The array to modify.
  25020. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25021. * @returns {Array} Returns the new array of removed elements.
  25022. * @example
  25023. *
  25024. * var array = ['a', 'b', 'c', 'd'];
  25025. * var pulled = _.pullAt(array, [1, 3]);
  25026. *
  25027. * console.log(array);
  25028. * // => ['a', 'c']
  25029. *
  25030. * console.log(pulled);
  25031. * // => ['b', 'd']
  25032. */
  25033. var pullAt = flatRest(function(array, indexes) {
  25034. var length = array == null ? 0 : array.length,
  25035. result = baseAt(array, indexes);
  25036. basePullAt(array, arrayMap(indexes, function(index) {
  25037. return isIndex(index, length) ? +index : index;
  25038. }).sort(compareAscending));
  25039. return result;
  25040. });
  25041. /**
  25042. * Removes all elements from `array` that `predicate` returns truthy for
  25043. * and returns an array of the removed elements. The predicate is invoked
  25044. * with three arguments: (value, index, array).
  25045. *
  25046. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25047. * to pull elements from an array by value.
  25048. *
  25049. * @static
  25050. * @memberOf _
  25051. * @since 2.0.0
  25052. * @category Array
  25053. * @param {Array} array The array to modify.
  25054. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25055. * @returns {Array} Returns the new array of removed elements.
  25056. * @example
  25057. *
  25058. * var array = [1, 2, 3, 4];
  25059. * var evens = _.remove(array, function(n) {
  25060. * return n % 2 == 0;
  25061. * });
  25062. *
  25063. * console.log(array);
  25064. * // => [1, 3]
  25065. *
  25066. * console.log(evens);
  25067. * // => [2, 4]
  25068. */
  25069. function remove(array, predicate) {
  25070. var result = [];
  25071. if (!(array && array.length)) {
  25072. return result;
  25073. }
  25074. var index = -1,
  25075. indexes = [],
  25076. length = array.length;
  25077. predicate = getIteratee(predicate, 3);
  25078. while (++index < length) {
  25079. var value = array[index];
  25080. if (predicate(value, index, array)) {
  25081. result.push(value);
  25082. indexes.push(index);
  25083. }
  25084. }
  25085. basePullAt(array, indexes);
  25086. return result;
  25087. }
  25088. /**
  25089. * Reverses `array` so that the first element becomes the last, the second
  25090. * element becomes the second to last, and so on.
  25091. *
  25092. * **Note:** This method mutates `array` and is based on
  25093. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25094. *
  25095. * @static
  25096. * @memberOf _
  25097. * @since 4.0.0
  25098. * @category Array
  25099. * @param {Array} array The array to modify.
  25100. * @returns {Array} Returns `array`.
  25101. * @example
  25102. *
  25103. * var array = [1, 2, 3];
  25104. *
  25105. * _.reverse(array);
  25106. * // => [3, 2, 1]
  25107. *
  25108. * console.log(array);
  25109. * // => [3, 2, 1]
  25110. */
  25111. function reverse(array) {
  25112. return array == null ? array : nativeReverse.call(array);
  25113. }
  25114. /**
  25115. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25116. *
  25117. * **Note:** This method is used instead of
  25118. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25119. * returned.
  25120. *
  25121. * @static
  25122. * @memberOf _
  25123. * @since 3.0.0
  25124. * @category Array
  25125. * @param {Array} array The array to slice.
  25126. * @param {number} [start=0] The start position.
  25127. * @param {number} [end=array.length] The end position.
  25128. * @returns {Array} Returns the slice of `array`.
  25129. */
  25130. function slice(array, start, end) {
  25131. var length = array == null ? 0 : array.length;
  25132. if (!length) {
  25133. return [];
  25134. }
  25135. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25136. start = 0;
  25137. end = length;
  25138. }
  25139. else {
  25140. start = start == null ? 0 : toInteger(start);
  25141. end = end === undefined ? length : toInteger(end);
  25142. }
  25143. return baseSlice(array, start, end);
  25144. }
  25145. /**
  25146. * Uses a binary search to determine the lowest index at which `value`
  25147. * should be inserted into `array` in order to maintain its sort order.
  25148. *
  25149. * @static
  25150. * @memberOf _
  25151. * @since 0.1.0
  25152. * @category Array
  25153. * @param {Array} array The sorted array to inspect.
  25154. * @param {*} value The value to evaluate.
  25155. * @returns {number} Returns the index at which `value` should be inserted
  25156. * into `array`.
  25157. * @example
  25158. *
  25159. * _.sortedIndex([30, 50], 40);
  25160. * // => 1
  25161. */
  25162. function sortedIndex(array, value) {
  25163. return baseSortedIndex(array, value);
  25164. }
  25165. /**
  25166. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25167. * which is invoked for `value` and each element of `array` to compute their
  25168. * sort ranking. The iteratee is invoked with one argument: (value).
  25169. *
  25170. * @static
  25171. * @memberOf _
  25172. * @since 4.0.0
  25173. * @category Array
  25174. * @param {Array} array The sorted array to inspect.
  25175. * @param {*} value The value to evaluate.
  25176. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25177. * @returns {number} Returns the index at which `value` should be inserted
  25178. * into `array`.
  25179. * @example
  25180. *
  25181. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25182. *
  25183. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25184. * // => 0
  25185. *
  25186. * // The `_.property` iteratee shorthand.
  25187. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25188. * // => 0
  25189. */
  25190. function sortedIndexBy(array, value, iteratee) {
  25191. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25192. }
  25193. /**
  25194. * This method is like `_.indexOf` except that it performs a binary
  25195. * search on a sorted `array`.
  25196. *
  25197. * @static
  25198. * @memberOf _
  25199. * @since 4.0.0
  25200. * @category Array
  25201. * @param {Array} array The array to inspect.
  25202. * @param {*} value The value to search for.
  25203. * @returns {number} Returns the index of the matched value, else `-1`.
  25204. * @example
  25205. *
  25206. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25207. * // => 1
  25208. */
  25209. function sortedIndexOf(array, value) {
  25210. var length = array == null ? 0 : array.length;
  25211. if (length) {
  25212. var index = baseSortedIndex(array, value);
  25213. if (index < length && eq(array[index], value)) {
  25214. return index;
  25215. }
  25216. }
  25217. return -1;
  25218. }
  25219. /**
  25220. * This method is like `_.sortedIndex` except that it returns the highest
  25221. * index at which `value` should be inserted into `array` in order to
  25222. * maintain its sort order.
  25223. *
  25224. * @static
  25225. * @memberOf _
  25226. * @since 3.0.0
  25227. * @category Array
  25228. * @param {Array} array The sorted array to inspect.
  25229. * @param {*} value The value to evaluate.
  25230. * @returns {number} Returns the index at which `value` should be inserted
  25231. * into `array`.
  25232. * @example
  25233. *
  25234. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25235. * // => 4
  25236. */
  25237. function sortedLastIndex(array, value) {
  25238. return baseSortedIndex(array, value, true);
  25239. }
  25240. /**
  25241. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25242. * which is invoked for `value` and each element of `array` to compute their
  25243. * sort ranking. The iteratee is invoked with one argument: (value).
  25244. *
  25245. * @static
  25246. * @memberOf _
  25247. * @since 4.0.0
  25248. * @category Array
  25249. * @param {Array} array The sorted array to inspect.
  25250. * @param {*} value The value to evaluate.
  25251. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25252. * @returns {number} Returns the index at which `value` should be inserted
  25253. * into `array`.
  25254. * @example
  25255. *
  25256. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25257. *
  25258. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25259. * // => 1
  25260. *
  25261. * // The `_.property` iteratee shorthand.
  25262. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25263. * // => 1
  25264. */
  25265. function sortedLastIndexBy(array, value, iteratee) {
  25266. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25267. }
  25268. /**
  25269. * This method is like `_.lastIndexOf` except that it performs a binary
  25270. * search on a sorted `array`.
  25271. *
  25272. * @static
  25273. * @memberOf _
  25274. * @since 4.0.0
  25275. * @category Array
  25276. * @param {Array} array The array to inspect.
  25277. * @param {*} value The value to search for.
  25278. * @returns {number} Returns the index of the matched value, else `-1`.
  25279. * @example
  25280. *
  25281. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25282. * // => 3
  25283. */
  25284. function sortedLastIndexOf(array, value) {
  25285. var length = array == null ? 0 : array.length;
  25286. if (length) {
  25287. var index = baseSortedIndex(array, value, true) - 1;
  25288. if (eq(array[index], value)) {
  25289. return index;
  25290. }
  25291. }
  25292. return -1;
  25293. }
  25294. /**
  25295. * This method is like `_.uniq` except that it's designed and optimized
  25296. * for sorted arrays.
  25297. *
  25298. * @static
  25299. * @memberOf _
  25300. * @since 4.0.0
  25301. * @category Array
  25302. * @param {Array} array The array to inspect.
  25303. * @returns {Array} Returns the new duplicate free array.
  25304. * @example
  25305. *
  25306. * _.sortedUniq([1, 1, 2]);
  25307. * // => [1, 2]
  25308. */
  25309. function sortedUniq(array) {
  25310. return (array && array.length)
  25311. ? baseSortedUniq(array)
  25312. : [];
  25313. }
  25314. /**
  25315. * This method is like `_.uniqBy` except that it's designed and optimized
  25316. * for sorted arrays.
  25317. *
  25318. * @static
  25319. * @memberOf _
  25320. * @since 4.0.0
  25321. * @category Array
  25322. * @param {Array} array The array to inspect.
  25323. * @param {Function} [iteratee] The iteratee invoked per element.
  25324. * @returns {Array} Returns the new duplicate free array.
  25325. * @example
  25326. *
  25327. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25328. * // => [1.1, 2.3]
  25329. */
  25330. function sortedUniqBy(array, iteratee) {
  25331. return (array && array.length)
  25332. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25333. : [];
  25334. }
  25335. /**
  25336. * Gets all but the first element of `array`.
  25337. *
  25338. * @static
  25339. * @memberOf _
  25340. * @since 4.0.0
  25341. * @category Array
  25342. * @param {Array} array The array to query.
  25343. * @returns {Array} Returns the slice of `array`.
  25344. * @example
  25345. *
  25346. * _.tail([1, 2, 3]);
  25347. * // => [2, 3]
  25348. */
  25349. function tail(array) {
  25350. var length = array == null ? 0 : array.length;
  25351. return length ? baseSlice(array, 1, length) : [];
  25352. }
  25353. /**
  25354. * Creates a slice of `array` with `n` elements taken from the beginning.
  25355. *
  25356. * @static
  25357. * @memberOf _
  25358. * @since 0.1.0
  25359. * @category Array
  25360. * @param {Array} array The array to query.
  25361. * @param {number} [n=1] The number of elements to take.
  25362. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25363. * @returns {Array} Returns the slice of `array`.
  25364. * @example
  25365. *
  25366. * _.take([1, 2, 3]);
  25367. * // => [1]
  25368. *
  25369. * _.take([1, 2, 3], 2);
  25370. * // => [1, 2]
  25371. *
  25372. * _.take([1, 2, 3], 5);
  25373. * // => [1, 2, 3]
  25374. *
  25375. * _.take([1, 2, 3], 0);
  25376. * // => []
  25377. */
  25378. function take(array, n, guard) {
  25379. if (!(array && array.length)) {
  25380. return [];
  25381. }
  25382. n = (guard || n === undefined) ? 1 : toInteger(n);
  25383. return baseSlice(array, 0, n < 0 ? 0 : n);
  25384. }
  25385. /**
  25386. * Creates a slice of `array` with `n` elements taken from the end.
  25387. *
  25388. * @static
  25389. * @memberOf _
  25390. * @since 3.0.0
  25391. * @category Array
  25392. * @param {Array} array The array to query.
  25393. * @param {number} [n=1] The number of elements to take.
  25394. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25395. * @returns {Array} Returns the slice of `array`.
  25396. * @example
  25397. *
  25398. * _.takeRight([1, 2, 3]);
  25399. * // => [3]
  25400. *
  25401. * _.takeRight([1, 2, 3], 2);
  25402. * // => [2, 3]
  25403. *
  25404. * _.takeRight([1, 2, 3], 5);
  25405. * // => [1, 2, 3]
  25406. *
  25407. * _.takeRight([1, 2, 3], 0);
  25408. * // => []
  25409. */
  25410. function takeRight(array, n, guard) {
  25411. var length = array == null ? 0 : array.length;
  25412. if (!length) {
  25413. return [];
  25414. }
  25415. n = (guard || n === undefined) ? 1 : toInteger(n);
  25416. n = length - n;
  25417. return baseSlice(array, n < 0 ? 0 : n, length);
  25418. }
  25419. /**
  25420. * Creates a slice of `array` with elements taken from the end. Elements are
  25421. * taken until `predicate` returns falsey. The predicate is invoked with
  25422. * three arguments: (value, index, array).
  25423. *
  25424. * @static
  25425. * @memberOf _
  25426. * @since 3.0.0
  25427. * @category Array
  25428. * @param {Array} array The array to query.
  25429. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25430. * @returns {Array} Returns the slice of `array`.
  25431. * @example
  25432. *
  25433. * var users = [
  25434. * { 'user': 'barney', 'active': true },
  25435. * { 'user': 'fred', 'active': false },
  25436. * { 'user': 'pebbles', 'active': false }
  25437. * ];
  25438. *
  25439. * _.takeRightWhile(users, function(o) { return !o.active; });
  25440. * // => objects for ['fred', 'pebbles']
  25441. *
  25442. * // The `_.matches` iteratee shorthand.
  25443. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25444. * // => objects for ['pebbles']
  25445. *
  25446. * // The `_.matchesProperty` iteratee shorthand.
  25447. * _.takeRightWhile(users, ['active', false]);
  25448. * // => objects for ['fred', 'pebbles']
  25449. *
  25450. * // The `_.property` iteratee shorthand.
  25451. * _.takeRightWhile(users, 'active');
  25452. * // => []
  25453. */
  25454. function takeRightWhile(array, predicate) {
  25455. return (array && array.length)
  25456. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25457. : [];
  25458. }
  25459. /**
  25460. * Creates a slice of `array` with elements taken from the beginning. Elements
  25461. * are taken until `predicate` returns falsey. The predicate is invoked with
  25462. * three arguments: (value, index, array).
  25463. *
  25464. * @static
  25465. * @memberOf _
  25466. * @since 3.0.0
  25467. * @category Array
  25468. * @param {Array} array The array to query.
  25469. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25470. * @returns {Array} Returns the slice of `array`.
  25471. * @example
  25472. *
  25473. * var users = [
  25474. * { 'user': 'barney', 'active': false },
  25475. * { 'user': 'fred', 'active': false },
  25476. * { 'user': 'pebbles', 'active': true }
  25477. * ];
  25478. *
  25479. * _.takeWhile(users, function(o) { return !o.active; });
  25480. * // => objects for ['barney', 'fred']
  25481. *
  25482. * // The `_.matches` iteratee shorthand.
  25483. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25484. * // => objects for ['barney']
  25485. *
  25486. * // The `_.matchesProperty` iteratee shorthand.
  25487. * _.takeWhile(users, ['active', false]);
  25488. * // => objects for ['barney', 'fred']
  25489. *
  25490. * // The `_.property` iteratee shorthand.
  25491. * _.takeWhile(users, 'active');
  25492. * // => []
  25493. */
  25494. function takeWhile(array, predicate) {
  25495. return (array && array.length)
  25496. ? baseWhile(array, getIteratee(predicate, 3))
  25497. : [];
  25498. }
  25499. /**
  25500. * Creates an array of unique values, in order, from all given arrays using
  25501. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25502. * for equality comparisons.
  25503. *
  25504. * @static
  25505. * @memberOf _
  25506. * @since 0.1.0
  25507. * @category Array
  25508. * @param {...Array} [arrays] The arrays to inspect.
  25509. * @returns {Array} Returns the new array of combined values.
  25510. * @example
  25511. *
  25512. * _.union([2], [1, 2]);
  25513. * // => [2, 1]
  25514. */
  25515. var union = baseRest(function(arrays) {
  25516. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25517. });
  25518. /**
  25519. * This method is like `_.union` except that it accepts `iteratee` which is
  25520. * invoked for each element of each `arrays` to generate the criterion by
  25521. * which uniqueness is computed. Result values are chosen from the first
  25522. * array in which the value occurs. The iteratee is invoked with one argument:
  25523. * (value).
  25524. *
  25525. * @static
  25526. * @memberOf _
  25527. * @since 4.0.0
  25528. * @category Array
  25529. * @param {...Array} [arrays] The arrays to inspect.
  25530. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25531. * @returns {Array} Returns the new array of combined values.
  25532. * @example
  25533. *
  25534. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25535. * // => [2.1, 1.2]
  25536. *
  25537. * // The `_.property` iteratee shorthand.
  25538. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25539. * // => [{ 'x': 1 }, { 'x': 2 }]
  25540. */
  25541. var unionBy = baseRest(function(arrays) {
  25542. var iteratee = last(arrays);
  25543. if (isArrayLikeObject(iteratee)) {
  25544. iteratee = undefined;
  25545. }
  25546. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25547. });
  25548. /**
  25549. * This method is like `_.union` except that it accepts `comparator` which
  25550. * is invoked to compare elements of `arrays`. Result values are chosen from
  25551. * the first array in which the value occurs. The comparator is invoked
  25552. * with two arguments: (arrVal, othVal).
  25553. *
  25554. * @static
  25555. * @memberOf _
  25556. * @since 4.0.0
  25557. * @category Array
  25558. * @param {...Array} [arrays] The arrays to inspect.
  25559. * @param {Function} [comparator] The comparator invoked per element.
  25560. * @returns {Array} Returns the new array of combined values.
  25561. * @example
  25562. *
  25563. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25564. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25565. *
  25566. * _.unionWith(objects, others, _.isEqual);
  25567. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25568. */
  25569. var unionWith = baseRest(function(arrays) {
  25570. var comparator = last(arrays);
  25571. comparator = typeof comparator == 'function' ? comparator : undefined;
  25572. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25573. });
  25574. /**
  25575. * Creates a duplicate-free version of an array, using
  25576. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25577. * for equality comparisons, in which only the first occurrence of each element
  25578. * is kept. The order of result values is determined by the order they occur
  25579. * in the array.
  25580. *
  25581. * @static
  25582. * @memberOf _
  25583. * @since 0.1.0
  25584. * @category Array
  25585. * @param {Array} array The array to inspect.
  25586. * @returns {Array} Returns the new duplicate free array.
  25587. * @example
  25588. *
  25589. * _.uniq([2, 1, 2]);
  25590. * // => [2, 1]
  25591. */
  25592. function uniq(array) {
  25593. return (array && array.length) ? baseUniq(array) : [];
  25594. }
  25595. /**
  25596. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25597. * invoked for each element in `array` to generate the criterion by which
  25598. * uniqueness is computed. The order of result values is determined by the
  25599. * order they occur in the array. The iteratee is invoked with one argument:
  25600. * (value).
  25601. *
  25602. * @static
  25603. * @memberOf _
  25604. * @since 4.0.0
  25605. * @category Array
  25606. * @param {Array} array The array to inspect.
  25607. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25608. * @returns {Array} Returns the new duplicate free array.
  25609. * @example
  25610. *
  25611. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25612. * // => [2.1, 1.2]
  25613. *
  25614. * // The `_.property` iteratee shorthand.
  25615. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25616. * // => [{ 'x': 1 }, { 'x': 2 }]
  25617. */
  25618. function uniqBy(array, iteratee) {
  25619. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25620. }
  25621. /**
  25622. * This method is like `_.uniq` except that it accepts `comparator` which
  25623. * is invoked to compare elements of `array`. The order of result values is
  25624. * determined by the order they occur in the array.The comparator is invoked
  25625. * with two arguments: (arrVal, othVal).
  25626. *
  25627. * @static
  25628. * @memberOf _
  25629. * @since 4.0.0
  25630. * @category Array
  25631. * @param {Array} array The array to inspect.
  25632. * @param {Function} [comparator] The comparator invoked per element.
  25633. * @returns {Array} Returns the new duplicate free array.
  25634. * @example
  25635. *
  25636. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25637. *
  25638. * _.uniqWith(objects, _.isEqual);
  25639. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25640. */
  25641. function uniqWith(array, comparator) {
  25642. comparator = typeof comparator == 'function' ? comparator : undefined;
  25643. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25644. }
  25645. /**
  25646. * This method is like `_.zip` except that it accepts an array of grouped
  25647. * elements and creates an array regrouping the elements to their pre-zip
  25648. * configuration.
  25649. *
  25650. * @static
  25651. * @memberOf _
  25652. * @since 1.2.0
  25653. * @category Array
  25654. * @param {Array} array The array of grouped elements to process.
  25655. * @returns {Array} Returns the new array of regrouped elements.
  25656. * @example
  25657. *
  25658. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25659. * // => [['a', 1, true], ['b', 2, false]]
  25660. *
  25661. * _.unzip(zipped);
  25662. * // => [['a', 'b'], [1, 2], [true, false]]
  25663. */
  25664. function unzip(array) {
  25665. if (!(array && array.length)) {
  25666. return [];
  25667. }
  25668. var length = 0;
  25669. array = arrayFilter(array, function(group) {
  25670. if (isArrayLikeObject(group)) {
  25671. length = nativeMax(group.length, length);
  25672. return true;
  25673. }
  25674. });
  25675. return baseTimes(length, function(index) {
  25676. return arrayMap(array, baseProperty(index));
  25677. });
  25678. }
  25679. /**
  25680. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25681. * how regrouped values should be combined. The iteratee is invoked with the
  25682. * elements of each group: (...group).
  25683. *
  25684. * @static
  25685. * @memberOf _
  25686. * @since 3.8.0
  25687. * @category Array
  25688. * @param {Array} array The array of grouped elements to process.
  25689. * @param {Function} [iteratee=_.identity] The function to combine
  25690. * regrouped values.
  25691. * @returns {Array} Returns the new array of regrouped elements.
  25692. * @example
  25693. *
  25694. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25695. * // => [[1, 10, 100], [2, 20, 200]]
  25696. *
  25697. * _.unzipWith(zipped, _.add);
  25698. * // => [3, 30, 300]
  25699. */
  25700. function unzipWith(array, iteratee) {
  25701. if (!(array && array.length)) {
  25702. return [];
  25703. }
  25704. var result = unzip(array);
  25705. if (iteratee == null) {
  25706. return result;
  25707. }
  25708. return arrayMap(result, function(group) {
  25709. return apply(iteratee, undefined, group);
  25710. });
  25711. }
  25712. /**
  25713. * Creates an array excluding all given values using
  25714. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25715. * for equality comparisons.
  25716. *
  25717. * **Note:** Unlike `_.pull`, this method returns a new array.
  25718. *
  25719. * @static
  25720. * @memberOf _
  25721. * @since 0.1.0
  25722. * @category Array
  25723. * @param {Array} array The array to inspect.
  25724. * @param {...*} [values] The values to exclude.
  25725. * @returns {Array} Returns the new array of filtered values.
  25726. * @see _.difference, _.xor
  25727. * @example
  25728. *
  25729. * _.without([2, 1, 2, 3], 1, 2);
  25730. * // => [3]
  25731. */
  25732. var without = baseRest(function(array, values) {
  25733. return isArrayLikeObject(array)
  25734. ? baseDifference(array, values)
  25735. : [];
  25736. });
  25737. /**
  25738. * Creates an array of unique values that is the
  25739. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25740. * of the given arrays. The order of result values is determined by the order
  25741. * they occur in the arrays.
  25742. *
  25743. * @static
  25744. * @memberOf _
  25745. * @since 2.4.0
  25746. * @category Array
  25747. * @param {...Array} [arrays] The arrays to inspect.
  25748. * @returns {Array} Returns the new array of filtered values.
  25749. * @see _.difference, _.without
  25750. * @example
  25751. *
  25752. * _.xor([2, 1], [2, 3]);
  25753. * // => [1, 3]
  25754. */
  25755. var xor = baseRest(function(arrays) {
  25756. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25757. });
  25758. /**
  25759. * This method is like `_.xor` except that it accepts `iteratee` which is
  25760. * invoked for each element of each `arrays` to generate the criterion by
  25761. * which by which they're compared. The order of result values is determined
  25762. * by the order they occur in the arrays. The iteratee is invoked with one
  25763. * argument: (value).
  25764. *
  25765. * @static
  25766. * @memberOf _
  25767. * @since 4.0.0
  25768. * @category Array
  25769. * @param {...Array} [arrays] The arrays to inspect.
  25770. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25771. * @returns {Array} Returns the new array of filtered values.
  25772. * @example
  25773. *
  25774. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25775. * // => [1.2, 3.4]
  25776. *
  25777. * // The `_.property` iteratee shorthand.
  25778. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25779. * // => [{ 'x': 2 }]
  25780. */
  25781. var xorBy = baseRest(function(arrays) {
  25782. var iteratee = last(arrays);
  25783. if (isArrayLikeObject(iteratee)) {
  25784. iteratee = undefined;
  25785. }
  25786. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25787. });
  25788. /**
  25789. * This method is like `_.xor` except that it accepts `comparator` which is
  25790. * invoked to compare elements of `arrays`. The order of result values is
  25791. * determined by the order they occur in the arrays. The comparator is invoked
  25792. * with two arguments: (arrVal, othVal).
  25793. *
  25794. * @static
  25795. * @memberOf _
  25796. * @since 4.0.0
  25797. * @category Array
  25798. * @param {...Array} [arrays] The arrays to inspect.
  25799. * @param {Function} [comparator] The comparator invoked per element.
  25800. * @returns {Array} Returns the new array of filtered values.
  25801. * @example
  25802. *
  25803. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25804. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25805. *
  25806. * _.xorWith(objects, others, _.isEqual);
  25807. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25808. */
  25809. var xorWith = baseRest(function(arrays) {
  25810. var comparator = last(arrays);
  25811. comparator = typeof comparator == 'function' ? comparator : undefined;
  25812. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25813. });
  25814. /**
  25815. * Creates an array of grouped elements, the first of which contains the
  25816. * first elements of the given arrays, the second of which contains the
  25817. * second elements of the given arrays, and so on.
  25818. *
  25819. * @static
  25820. * @memberOf _
  25821. * @since 0.1.0
  25822. * @category Array
  25823. * @param {...Array} [arrays] The arrays to process.
  25824. * @returns {Array} Returns the new array of grouped elements.
  25825. * @example
  25826. *
  25827. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25828. * // => [['a', 1, true], ['b', 2, false]]
  25829. */
  25830. var zip = baseRest(unzip);
  25831. /**
  25832. * This method is like `_.fromPairs` except that it accepts two arrays,
  25833. * one of property identifiers and one of corresponding values.
  25834. *
  25835. * @static
  25836. * @memberOf _
  25837. * @since 0.4.0
  25838. * @category Array
  25839. * @param {Array} [props=[]] The property identifiers.
  25840. * @param {Array} [values=[]] The property values.
  25841. * @returns {Object} Returns the new object.
  25842. * @example
  25843. *
  25844. * _.zipObject(['a', 'b'], [1, 2]);
  25845. * // => { 'a': 1, 'b': 2 }
  25846. */
  25847. function zipObject(props, values) {
  25848. return baseZipObject(props || [], values || [], assignValue);
  25849. }
  25850. /**
  25851. * This method is like `_.zipObject` except that it supports property paths.
  25852. *
  25853. * @static
  25854. * @memberOf _
  25855. * @since 4.1.0
  25856. * @category Array
  25857. * @param {Array} [props=[]] The property identifiers.
  25858. * @param {Array} [values=[]] The property values.
  25859. * @returns {Object} Returns the new object.
  25860. * @example
  25861. *
  25862. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25863. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25864. */
  25865. function zipObjectDeep(props, values) {
  25866. return baseZipObject(props || [], values || [], baseSet);
  25867. }
  25868. /**
  25869. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25870. * how grouped values should be combined. The iteratee is invoked with the
  25871. * elements of each group: (...group).
  25872. *
  25873. * @static
  25874. * @memberOf _
  25875. * @since 3.8.0
  25876. * @category Array
  25877. * @param {...Array} [arrays] The arrays to process.
  25878. * @param {Function} [iteratee=_.identity] The function to combine
  25879. * grouped values.
  25880. * @returns {Array} Returns the new array of grouped elements.
  25881. * @example
  25882. *
  25883. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25884. * return a + b + c;
  25885. * });
  25886. * // => [111, 222]
  25887. */
  25888. var zipWith = baseRest(function(arrays) {
  25889. var length = arrays.length,
  25890. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25891. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25892. return unzipWith(arrays, iteratee);
  25893. });
  25894. /*------------------------------------------------------------------------*/
  25895. /**
  25896. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25897. * chain sequences enabled. The result of such sequences must be unwrapped
  25898. * with `_#value`.
  25899. *
  25900. * @static
  25901. * @memberOf _
  25902. * @since 1.3.0
  25903. * @category Seq
  25904. * @param {*} value The value to wrap.
  25905. * @returns {Object} Returns the new `lodash` wrapper instance.
  25906. * @example
  25907. *
  25908. * var users = [
  25909. * { 'user': 'barney', 'age': 36 },
  25910. * { 'user': 'fred', 'age': 40 },
  25911. * { 'user': 'pebbles', 'age': 1 }
  25912. * ];
  25913. *
  25914. * var youngest = _
  25915. * .chain(users)
  25916. * .sortBy('age')
  25917. * .map(function(o) {
  25918. * return o.user + ' is ' + o.age;
  25919. * })
  25920. * .head()
  25921. * .value();
  25922. * // => 'pebbles is 1'
  25923. */
  25924. function chain(value) {
  25925. var result = lodash(value);
  25926. result.__chain__ = true;
  25927. return result;
  25928. }
  25929. /**
  25930. * This method invokes `interceptor` and returns `value`. The interceptor
  25931. * is invoked with one argument; (value). The purpose of this method is to
  25932. * "tap into" a method chain sequence in order to modify intermediate results.
  25933. *
  25934. * @static
  25935. * @memberOf _
  25936. * @since 0.1.0
  25937. * @category Seq
  25938. * @param {*} value The value to provide to `interceptor`.
  25939. * @param {Function} interceptor The function to invoke.
  25940. * @returns {*} Returns `value`.
  25941. * @example
  25942. *
  25943. * _([1, 2, 3])
  25944. * .tap(function(array) {
  25945. * // Mutate input array.
  25946. * array.pop();
  25947. * })
  25948. * .reverse()
  25949. * .value();
  25950. * // => [2, 1]
  25951. */
  25952. function tap(value, interceptor) {
  25953. interceptor(value);
  25954. return value;
  25955. }
  25956. /**
  25957. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25958. * The purpose of this method is to "pass thru" values replacing intermediate
  25959. * results in a method chain sequence.
  25960. *
  25961. * @static
  25962. * @memberOf _
  25963. * @since 3.0.0
  25964. * @category Seq
  25965. * @param {*} value The value to provide to `interceptor`.
  25966. * @param {Function} interceptor The function to invoke.
  25967. * @returns {*} Returns the result of `interceptor`.
  25968. * @example
  25969. *
  25970. * _(' abc ')
  25971. * .chain()
  25972. * .trim()
  25973. * .thru(function(value) {
  25974. * return [value];
  25975. * })
  25976. * .value();
  25977. * // => ['abc']
  25978. */
  25979. function thru(value, interceptor) {
  25980. return interceptor(value);
  25981. }
  25982. /**
  25983. * This method is the wrapper version of `_.at`.
  25984. *
  25985. * @name at
  25986. * @memberOf _
  25987. * @since 1.0.0
  25988. * @category Seq
  25989. * @param {...(string|string[])} [paths] The property paths to pick.
  25990. * @returns {Object} Returns the new `lodash` wrapper instance.
  25991. * @example
  25992. *
  25993. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25994. *
  25995. * _(object).at(['a[0].b.c', 'a[1]']).value();
  25996. * // => [3, 4]
  25997. */
  25998. var wrapperAt = flatRest(function(paths) {
  25999. var length = paths.length,
  26000. start = length ? paths[0] : 0,
  26001. value = this.__wrapped__,
  26002. interceptor = function(object) { return baseAt(object, paths); };
  26003. if (length > 1 || this.__actions__.length ||
  26004. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26005. return this.thru(interceptor);
  26006. }
  26007. value = value.slice(start, +start + (length ? 1 : 0));
  26008. value.__actions__.push({
  26009. 'func': thru,
  26010. 'args': [interceptor],
  26011. 'thisArg': undefined
  26012. });
  26013. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26014. if (length && !array.length) {
  26015. array.push(undefined);
  26016. }
  26017. return array;
  26018. });
  26019. });
  26020. /**
  26021. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26022. *
  26023. * @name chain
  26024. * @memberOf _
  26025. * @since 0.1.0
  26026. * @category Seq
  26027. * @returns {Object} Returns the new `lodash` wrapper instance.
  26028. * @example
  26029. *
  26030. * var users = [
  26031. * { 'user': 'barney', 'age': 36 },
  26032. * { 'user': 'fred', 'age': 40 }
  26033. * ];
  26034. *
  26035. * // A sequence without explicit chaining.
  26036. * _(users).head();
  26037. * // => { 'user': 'barney', 'age': 36 }
  26038. *
  26039. * // A sequence with explicit chaining.
  26040. * _(users)
  26041. * .chain()
  26042. * .head()
  26043. * .pick('user')
  26044. * .value();
  26045. * // => { 'user': 'barney' }
  26046. */
  26047. function wrapperChain() {
  26048. return chain(this);
  26049. }
  26050. /**
  26051. * Executes the chain sequence and returns the wrapped result.
  26052. *
  26053. * @name commit
  26054. * @memberOf _
  26055. * @since 3.2.0
  26056. * @category Seq
  26057. * @returns {Object} Returns the new `lodash` wrapper instance.
  26058. * @example
  26059. *
  26060. * var array = [1, 2];
  26061. * var wrapped = _(array).push(3);
  26062. *
  26063. * console.log(array);
  26064. * // => [1, 2]
  26065. *
  26066. * wrapped = wrapped.commit();
  26067. * console.log(array);
  26068. * // => [1, 2, 3]
  26069. *
  26070. * wrapped.last();
  26071. * // => 3
  26072. *
  26073. * console.log(array);
  26074. * // => [1, 2, 3]
  26075. */
  26076. function wrapperCommit() {
  26077. return new LodashWrapper(this.value(), this.__chain__);
  26078. }
  26079. /**
  26080. * Gets the next value on a wrapped object following the
  26081. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26082. *
  26083. * @name next
  26084. * @memberOf _
  26085. * @since 4.0.0
  26086. * @category Seq
  26087. * @returns {Object} Returns the next iterator value.
  26088. * @example
  26089. *
  26090. * var wrapped = _([1, 2]);
  26091. *
  26092. * wrapped.next();
  26093. * // => { 'done': false, 'value': 1 }
  26094. *
  26095. * wrapped.next();
  26096. * // => { 'done': false, 'value': 2 }
  26097. *
  26098. * wrapped.next();
  26099. * // => { 'done': true, 'value': undefined }
  26100. */
  26101. function wrapperNext() {
  26102. if (this.__values__ === undefined) {
  26103. this.__values__ = toArray(this.value());
  26104. }
  26105. var done = this.__index__ >= this.__values__.length,
  26106. value = done ? undefined : this.__values__[this.__index__++];
  26107. return { 'done': done, 'value': value };
  26108. }
  26109. /**
  26110. * Enables the wrapper to be iterable.
  26111. *
  26112. * @name Symbol.iterator
  26113. * @memberOf _
  26114. * @since 4.0.0
  26115. * @category Seq
  26116. * @returns {Object} Returns the wrapper object.
  26117. * @example
  26118. *
  26119. * var wrapped = _([1, 2]);
  26120. *
  26121. * wrapped[Symbol.iterator]() === wrapped;
  26122. * // => true
  26123. *
  26124. * Array.from(wrapped);
  26125. * // => [1, 2]
  26126. */
  26127. function wrapperToIterator() {
  26128. return this;
  26129. }
  26130. /**
  26131. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26132. *
  26133. * @name plant
  26134. * @memberOf _
  26135. * @since 3.2.0
  26136. * @category Seq
  26137. * @param {*} value The value to plant.
  26138. * @returns {Object} Returns the new `lodash` wrapper instance.
  26139. * @example
  26140. *
  26141. * function square(n) {
  26142. * return n * n;
  26143. * }
  26144. *
  26145. * var wrapped = _([1, 2]).map(square);
  26146. * var other = wrapped.plant([3, 4]);
  26147. *
  26148. * other.value();
  26149. * // => [9, 16]
  26150. *
  26151. * wrapped.value();
  26152. * // => [1, 4]
  26153. */
  26154. function wrapperPlant(value) {
  26155. var result,
  26156. parent = this;
  26157. while (parent instanceof baseLodash) {
  26158. var clone = wrapperClone(parent);
  26159. clone.__index__ = 0;
  26160. clone.__values__ = undefined;
  26161. if (result) {
  26162. previous.__wrapped__ = clone;
  26163. } else {
  26164. result = clone;
  26165. }
  26166. var previous = clone;
  26167. parent = parent.__wrapped__;
  26168. }
  26169. previous.__wrapped__ = value;
  26170. return result;
  26171. }
  26172. /**
  26173. * This method is the wrapper version of `_.reverse`.
  26174. *
  26175. * **Note:** This method mutates the wrapped array.
  26176. *
  26177. * @name reverse
  26178. * @memberOf _
  26179. * @since 0.1.0
  26180. * @category Seq
  26181. * @returns {Object} Returns the new `lodash` wrapper instance.
  26182. * @example
  26183. *
  26184. * var array = [1, 2, 3];
  26185. *
  26186. * _(array).reverse().value()
  26187. * // => [3, 2, 1]
  26188. *
  26189. * console.log(array);
  26190. * // => [3, 2, 1]
  26191. */
  26192. function wrapperReverse() {
  26193. var value = this.__wrapped__;
  26194. if (value instanceof LazyWrapper) {
  26195. var wrapped = value;
  26196. if (this.__actions__.length) {
  26197. wrapped = new LazyWrapper(this);
  26198. }
  26199. wrapped = wrapped.reverse();
  26200. wrapped.__actions__.push({
  26201. 'func': thru,
  26202. 'args': [reverse],
  26203. 'thisArg': undefined
  26204. });
  26205. return new LodashWrapper(wrapped, this.__chain__);
  26206. }
  26207. return this.thru(reverse);
  26208. }
  26209. /**
  26210. * Executes the chain sequence to resolve the unwrapped value.
  26211. *
  26212. * @name value
  26213. * @memberOf _
  26214. * @since 0.1.0
  26215. * @alias toJSON, valueOf
  26216. * @category Seq
  26217. * @returns {*} Returns the resolved unwrapped value.
  26218. * @example
  26219. *
  26220. * _([1, 2, 3]).value();
  26221. * // => [1, 2, 3]
  26222. */
  26223. function wrapperValue() {
  26224. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26225. }
  26226. /*------------------------------------------------------------------------*/
  26227. /**
  26228. * Creates an object composed of keys generated from the results of running
  26229. * each element of `collection` thru `iteratee`. The corresponding value of
  26230. * each key is the number of times the key was returned by `iteratee`. The
  26231. * iteratee is invoked with one argument: (value).
  26232. *
  26233. * @static
  26234. * @memberOf _
  26235. * @since 0.5.0
  26236. * @category Collection
  26237. * @param {Array|Object} collection The collection to iterate over.
  26238. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26239. * @returns {Object} Returns the composed aggregate object.
  26240. * @example
  26241. *
  26242. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26243. * // => { '4': 1, '6': 2 }
  26244. *
  26245. * // The `_.property` iteratee shorthand.
  26246. * _.countBy(['one', 'two', 'three'], 'length');
  26247. * // => { '3': 2, '5': 1 }
  26248. */
  26249. var countBy = createAggregator(function(result, value, key) {
  26250. if (hasOwnProperty.call(result, key)) {
  26251. ++result[key];
  26252. } else {
  26253. baseAssignValue(result, key, 1);
  26254. }
  26255. });
  26256. /**
  26257. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26258. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26259. * invoked with three arguments: (value, index|key, collection).
  26260. *
  26261. * **Note:** This method returns `true` for
  26262. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26263. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26264. * elements of empty collections.
  26265. *
  26266. * @static
  26267. * @memberOf _
  26268. * @since 0.1.0
  26269. * @category Collection
  26270. * @param {Array|Object} collection The collection to iterate over.
  26271. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26272. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26273. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26274. * else `false`.
  26275. * @example
  26276. *
  26277. * _.every([true, 1, null, 'yes'], Boolean);
  26278. * // => false
  26279. *
  26280. * var users = [
  26281. * { 'user': 'barney', 'age': 36, 'active': false },
  26282. * { 'user': 'fred', 'age': 40, 'active': false }
  26283. * ];
  26284. *
  26285. * // The `_.matches` iteratee shorthand.
  26286. * _.every(users, { 'user': 'barney', 'active': false });
  26287. * // => false
  26288. *
  26289. * // The `_.matchesProperty` iteratee shorthand.
  26290. * _.every(users, ['active', false]);
  26291. * // => true
  26292. *
  26293. * // The `_.property` iteratee shorthand.
  26294. * _.every(users, 'active');
  26295. * // => false
  26296. */
  26297. function every(collection, predicate, guard) {
  26298. var func = isArray(collection) ? arrayEvery : baseEvery;
  26299. if (guard && isIterateeCall(collection, predicate, guard)) {
  26300. predicate = undefined;
  26301. }
  26302. return func(collection, getIteratee(predicate, 3));
  26303. }
  26304. /**
  26305. * Iterates over elements of `collection`, returning an array of all elements
  26306. * `predicate` returns truthy for. The predicate is invoked with three
  26307. * arguments: (value, index|key, collection).
  26308. *
  26309. * **Note:** Unlike `_.remove`, this method returns a new array.
  26310. *
  26311. * @static
  26312. * @memberOf _
  26313. * @since 0.1.0
  26314. * @category Collection
  26315. * @param {Array|Object} collection The collection to iterate over.
  26316. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26317. * @returns {Array} Returns the new filtered array.
  26318. * @see _.reject
  26319. * @example
  26320. *
  26321. * var users = [
  26322. * { 'user': 'barney', 'age': 36, 'active': true },
  26323. * { 'user': 'fred', 'age': 40, 'active': false }
  26324. * ];
  26325. *
  26326. * _.filter(users, function(o) { return !o.active; });
  26327. * // => objects for ['fred']
  26328. *
  26329. * // The `_.matches` iteratee shorthand.
  26330. * _.filter(users, { 'age': 36, 'active': true });
  26331. * // => objects for ['barney']
  26332. *
  26333. * // The `_.matchesProperty` iteratee shorthand.
  26334. * _.filter(users, ['active', false]);
  26335. * // => objects for ['fred']
  26336. *
  26337. * // The `_.property` iteratee shorthand.
  26338. * _.filter(users, 'active');
  26339. * // => objects for ['barney']
  26340. */
  26341. function filter(collection, predicate) {
  26342. var func = isArray(collection) ? arrayFilter : baseFilter;
  26343. return func(collection, getIteratee(predicate, 3));
  26344. }
  26345. /**
  26346. * Iterates over elements of `collection`, returning the first element
  26347. * `predicate` returns truthy for. The predicate is invoked with three
  26348. * arguments: (value, index|key, collection).
  26349. *
  26350. * @static
  26351. * @memberOf _
  26352. * @since 0.1.0
  26353. * @category Collection
  26354. * @param {Array|Object} collection The collection to inspect.
  26355. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26356. * @param {number} [fromIndex=0] The index to search from.
  26357. * @returns {*} Returns the matched element, else `undefined`.
  26358. * @example
  26359. *
  26360. * var users = [
  26361. * { 'user': 'barney', 'age': 36, 'active': true },
  26362. * { 'user': 'fred', 'age': 40, 'active': false },
  26363. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26364. * ];
  26365. *
  26366. * _.find(users, function(o) { return o.age < 40; });
  26367. * // => object for 'barney'
  26368. *
  26369. * // The `_.matches` iteratee shorthand.
  26370. * _.find(users, { 'age': 1, 'active': true });
  26371. * // => object for 'pebbles'
  26372. *
  26373. * // The `_.matchesProperty` iteratee shorthand.
  26374. * _.find(users, ['active', false]);
  26375. * // => object for 'fred'
  26376. *
  26377. * // The `_.property` iteratee shorthand.
  26378. * _.find(users, 'active');
  26379. * // => object for 'barney'
  26380. */
  26381. var find = createFind(findIndex);
  26382. /**
  26383. * This method is like `_.find` except that it iterates over elements of
  26384. * `collection` from right to left.
  26385. *
  26386. * @static
  26387. * @memberOf _
  26388. * @since 2.0.0
  26389. * @category Collection
  26390. * @param {Array|Object} collection The collection to inspect.
  26391. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26392. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26393. * @returns {*} Returns the matched element, else `undefined`.
  26394. * @example
  26395. *
  26396. * _.findLast([1, 2, 3, 4], function(n) {
  26397. * return n % 2 == 1;
  26398. * });
  26399. * // => 3
  26400. */
  26401. var findLast = createFind(findLastIndex);
  26402. /**
  26403. * Creates a flattened array of values by running each element in `collection`
  26404. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26405. * with three arguments: (value, index|key, collection).
  26406. *
  26407. * @static
  26408. * @memberOf _
  26409. * @since 4.0.0
  26410. * @category Collection
  26411. * @param {Array|Object} collection The collection to iterate over.
  26412. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26413. * @returns {Array} Returns the new flattened array.
  26414. * @example
  26415. *
  26416. * function duplicate(n) {
  26417. * return [n, n];
  26418. * }
  26419. *
  26420. * _.flatMap([1, 2], duplicate);
  26421. * // => [1, 1, 2, 2]
  26422. */
  26423. function flatMap(collection, iteratee) {
  26424. return baseFlatten(map(collection, iteratee), 1);
  26425. }
  26426. /**
  26427. * This method is like `_.flatMap` except that it recursively flattens the
  26428. * mapped results.
  26429. *
  26430. * @static
  26431. * @memberOf _
  26432. * @since 4.7.0
  26433. * @category Collection
  26434. * @param {Array|Object} collection The collection to iterate over.
  26435. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26436. * @returns {Array} Returns the new flattened array.
  26437. * @example
  26438. *
  26439. * function duplicate(n) {
  26440. * return [[[n, n]]];
  26441. * }
  26442. *
  26443. * _.flatMapDeep([1, 2], duplicate);
  26444. * // => [1, 1, 2, 2]
  26445. */
  26446. function flatMapDeep(collection, iteratee) {
  26447. return baseFlatten(map(collection, iteratee), INFINITY);
  26448. }
  26449. /**
  26450. * This method is like `_.flatMap` except that it recursively flattens the
  26451. * mapped results up to `depth` times.
  26452. *
  26453. * @static
  26454. * @memberOf _
  26455. * @since 4.7.0
  26456. * @category Collection
  26457. * @param {Array|Object} collection The collection to iterate over.
  26458. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26459. * @param {number} [depth=1] The maximum recursion depth.
  26460. * @returns {Array} Returns the new flattened array.
  26461. * @example
  26462. *
  26463. * function duplicate(n) {
  26464. * return [[[n, n]]];
  26465. * }
  26466. *
  26467. * _.flatMapDepth([1, 2], duplicate, 2);
  26468. * // => [[1, 1], [2, 2]]
  26469. */
  26470. function flatMapDepth(collection, iteratee, depth) {
  26471. depth = depth === undefined ? 1 : toInteger(depth);
  26472. return baseFlatten(map(collection, iteratee), depth);
  26473. }
  26474. /**
  26475. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26476. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26477. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26478. *
  26479. * **Note:** As with other "Collections" methods, objects with a "length"
  26480. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26481. * or `_.forOwn` for object iteration.
  26482. *
  26483. * @static
  26484. * @memberOf _
  26485. * @since 0.1.0
  26486. * @alias each
  26487. * @category Collection
  26488. * @param {Array|Object} collection The collection to iterate over.
  26489. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26490. * @returns {Array|Object} Returns `collection`.
  26491. * @see _.forEachRight
  26492. * @example
  26493. *
  26494. * _.forEach([1, 2], function(value) {
  26495. * console.log(value);
  26496. * });
  26497. * // => Logs `1` then `2`.
  26498. *
  26499. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26500. * console.log(key);
  26501. * });
  26502. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26503. */
  26504. function forEach(collection, iteratee) {
  26505. var func = isArray(collection) ? arrayEach : baseEach;
  26506. return func(collection, getIteratee(iteratee, 3));
  26507. }
  26508. /**
  26509. * This method is like `_.forEach` except that it iterates over elements of
  26510. * `collection` from right to left.
  26511. *
  26512. * @static
  26513. * @memberOf _
  26514. * @since 2.0.0
  26515. * @alias eachRight
  26516. * @category Collection
  26517. * @param {Array|Object} collection The collection to iterate over.
  26518. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26519. * @returns {Array|Object} Returns `collection`.
  26520. * @see _.forEach
  26521. * @example
  26522. *
  26523. * _.forEachRight([1, 2], function(value) {
  26524. * console.log(value);
  26525. * });
  26526. * // => Logs `2` then `1`.
  26527. */
  26528. function forEachRight(collection, iteratee) {
  26529. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26530. return func(collection, getIteratee(iteratee, 3));
  26531. }
  26532. /**
  26533. * Creates an object composed of keys generated from the results of running
  26534. * each element of `collection` thru `iteratee`. The order of grouped values
  26535. * is determined by the order they occur in `collection`. The corresponding
  26536. * value of each key is an array of elements responsible for generating the
  26537. * key. The iteratee is invoked with one argument: (value).
  26538. *
  26539. * @static
  26540. * @memberOf _
  26541. * @since 0.1.0
  26542. * @category Collection
  26543. * @param {Array|Object} collection The collection to iterate over.
  26544. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26545. * @returns {Object} Returns the composed aggregate object.
  26546. * @example
  26547. *
  26548. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26549. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26550. *
  26551. * // The `_.property` iteratee shorthand.
  26552. * _.groupBy(['one', 'two', 'three'], 'length');
  26553. * // => { '3': ['one', 'two'], '5': ['three'] }
  26554. */
  26555. var groupBy = createAggregator(function(result, value, key) {
  26556. if (hasOwnProperty.call(result, key)) {
  26557. result[key].push(value);
  26558. } else {
  26559. baseAssignValue(result, key, [value]);
  26560. }
  26561. });
  26562. /**
  26563. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26564. * checked for a substring of `value`, otherwise
  26565. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26566. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26567. * the offset from the end of `collection`.
  26568. *
  26569. * @static
  26570. * @memberOf _
  26571. * @since 0.1.0
  26572. * @category Collection
  26573. * @param {Array|Object|string} collection The collection to inspect.
  26574. * @param {*} value The value to search for.
  26575. * @param {number} [fromIndex=0] The index to search from.
  26576. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26577. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26578. * @example
  26579. *
  26580. * _.includes([1, 2, 3], 1);
  26581. * // => true
  26582. *
  26583. * _.includes([1, 2, 3], 1, 2);
  26584. * // => false
  26585. *
  26586. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26587. * // => true
  26588. *
  26589. * _.includes('abcd', 'bc');
  26590. * // => true
  26591. */
  26592. function includes(collection, value, fromIndex, guard) {
  26593. collection = isArrayLike(collection) ? collection : values(collection);
  26594. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26595. var length = collection.length;
  26596. if (fromIndex < 0) {
  26597. fromIndex = nativeMax(length + fromIndex, 0);
  26598. }
  26599. return isString(collection)
  26600. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26601. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26602. }
  26603. /**
  26604. * Invokes the method at `path` of each element in `collection`, returning
  26605. * an array of the results of each invoked method. Any additional arguments
  26606. * are provided to each invoked method. If `path` is a function, it's invoked
  26607. * for, and `this` bound to, each element in `collection`.
  26608. *
  26609. * @static
  26610. * @memberOf _
  26611. * @since 4.0.0
  26612. * @category Collection
  26613. * @param {Array|Object} collection The collection to iterate over.
  26614. * @param {Array|Function|string} path The path of the method to invoke or
  26615. * the function invoked per iteration.
  26616. * @param {...*} [args] The arguments to invoke each method with.
  26617. * @returns {Array} Returns the array of results.
  26618. * @example
  26619. *
  26620. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26621. * // => [[1, 5, 7], [1, 2, 3]]
  26622. *
  26623. * _.invokeMap([123, 456], String.prototype.split, '');
  26624. * // => [['1', '2', '3'], ['4', '5', '6']]
  26625. */
  26626. var invokeMap = baseRest(function(collection, path, args) {
  26627. var index = -1,
  26628. isFunc = typeof path == 'function',
  26629. result = isArrayLike(collection) ? Array(collection.length) : [];
  26630. baseEach(collection, function(value) {
  26631. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26632. });
  26633. return result;
  26634. });
  26635. /**
  26636. * Creates an object composed of keys generated from the results of running
  26637. * each element of `collection` thru `iteratee`. The corresponding value of
  26638. * each key is the last element responsible for generating the key. The
  26639. * iteratee is invoked with one argument: (value).
  26640. *
  26641. * @static
  26642. * @memberOf _
  26643. * @since 4.0.0
  26644. * @category Collection
  26645. * @param {Array|Object} collection The collection to iterate over.
  26646. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26647. * @returns {Object} Returns the composed aggregate object.
  26648. * @example
  26649. *
  26650. * var array = [
  26651. * { 'dir': 'left', 'code': 97 },
  26652. * { 'dir': 'right', 'code': 100 }
  26653. * ];
  26654. *
  26655. * _.keyBy(array, function(o) {
  26656. * return String.fromCharCode(o.code);
  26657. * });
  26658. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26659. *
  26660. * _.keyBy(array, 'dir');
  26661. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26662. */
  26663. var keyBy = createAggregator(function(result, value, key) {
  26664. baseAssignValue(result, key, value);
  26665. });
  26666. /**
  26667. * Creates an array of values by running each element in `collection` thru
  26668. * `iteratee`. The iteratee is invoked with three arguments:
  26669. * (value, index|key, collection).
  26670. *
  26671. * Many lodash methods are guarded to work as iteratees for methods like
  26672. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26673. *
  26674. * The guarded methods are:
  26675. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26676. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26677. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26678. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26679. *
  26680. * @static
  26681. * @memberOf _
  26682. * @since 0.1.0
  26683. * @category Collection
  26684. * @param {Array|Object} collection The collection to iterate over.
  26685. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26686. * @returns {Array} Returns the new mapped array.
  26687. * @example
  26688. *
  26689. * function square(n) {
  26690. * return n * n;
  26691. * }
  26692. *
  26693. * _.map([4, 8], square);
  26694. * // => [16, 64]
  26695. *
  26696. * _.map({ 'a': 4, 'b': 8 }, square);
  26697. * // => [16, 64] (iteration order is not guaranteed)
  26698. *
  26699. * var users = [
  26700. * { 'user': 'barney' },
  26701. * { 'user': 'fred' }
  26702. * ];
  26703. *
  26704. * // The `_.property` iteratee shorthand.
  26705. * _.map(users, 'user');
  26706. * // => ['barney', 'fred']
  26707. */
  26708. function map(collection, iteratee) {
  26709. var func = isArray(collection) ? arrayMap : baseMap;
  26710. return func(collection, getIteratee(iteratee, 3));
  26711. }
  26712. /**
  26713. * This method is like `_.sortBy` except that it allows specifying the sort
  26714. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26715. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26716. * descending or "asc" for ascending sort order of corresponding values.
  26717. *
  26718. * @static
  26719. * @memberOf _
  26720. * @since 4.0.0
  26721. * @category Collection
  26722. * @param {Array|Object} collection The collection to iterate over.
  26723. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26724. * The iteratees to sort by.
  26725. * @param {string[]} [orders] The sort orders of `iteratees`.
  26726. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26727. * @returns {Array} Returns the new sorted array.
  26728. * @example
  26729. *
  26730. * var users = [
  26731. * { 'user': 'fred', 'age': 48 },
  26732. * { 'user': 'barney', 'age': 34 },
  26733. * { 'user': 'fred', 'age': 40 },
  26734. * { 'user': 'barney', 'age': 36 }
  26735. * ];
  26736. *
  26737. * // Sort by `user` in ascending order and by `age` in descending order.
  26738. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26739. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26740. */
  26741. function orderBy(collection, iteratees, orders, guard) {
  26742. if (collection == null) {
  26743. return [];
  26744. }
  26745. if (!isArray(iteratees)) {
  26746. iteratees = iteratees == null ? [] : [iteratees];
  26747. }
  26748. orders = guard ? undefined : orders;
  26749. if (!isArray(orders)) {
  26750. orders = orders == null ? [] : [orders];
  26751. }
  26752. return baseOrderBy(collection, iteratees, orders);
  26753. }
  26754. /**
  26755. * Creates an array of elements split into two groups, the first of which
  26756. * contains elements `predicate` returns truthy for, the second of which
  26757. * contains elements `predicate` returns falsey for. The predicate is
  26758. * invoked with one argument: (value).
  26759. *
  26760. * @static
  26761. * @memberOf _
  26762. * @since 3.0.0
  26763. * @category Collection
  26764. * @param {Array|Object} collection The collection to iterate over.
  26765. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26766. * @returns {Array} Returns the array of grouped elements.
  26767. * @example
  26768. *
  26769. * var users = [
  26770. * { 'user': 'barney', 'age': 36, 'active': false },
  26771. * { 'user': 'fred', 'age': 40, 'active': true },
  26772. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26773. * ];
  26774. *
  26775. * _.partition(users, function(o) { return o.active; });
  26776. * // => objects for [['fred'], ['barney', 'pebbles']]
  26777. *
  26778. * // The `_.matches` iteratee shorthand.
  26779. * _.partition(users, { 'age': 1, 'active': false });
  26780. * // => objects for [['pebbles'], ['barney', 'fred']]
  26781. *
  26782. * // The `_.matchesProperty` iteratee shorthand.
  26783. * _.partition(users, ['active', false]);
  26784. * // => objects for [['barney', 'pebbles'], ['fred']]
  26785. *
  26786. * // The `_.property` iteratee shorthand.
  26787. * _.partition(users, 'active');
  26788. * // => objects for [['fred'], ['barney', 'pebbles']]
  26789. */
  26790. var partition = createAggregator(function(result, value, key) {
  26791. result[key ? 0 : 1].push(value);
  26792. }, function() { return [[], []]; });
  26793. /**
  26794. * Reduces `collection` to a value which is the accumulated result of running
  26795. * each element in `collection` thru `iteratee`, where each successive
  26796. * invocation is supplied the return value of the previous. If `accumulator`
  26797. * is not given, the first element of `collection` is used as the initial
  26798. * value. The iteratee is invoked with four arguments:
  26799. * (accumulator, value, index|key, collection).
  26800. *
  26801. * Many lodash methods are guarded to work as iteratees for methods like
  26802. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26803. *
  26804. * The guarded methods are:
  26805. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26806. * and `sortBy`
  26807. *
  26808. * @static
  26809. * @memberOf _
  26810. * @since 0.1.0
  26811. * @category Collection
  26812. * @param {Array|Object} collection The collection to iterate over.
  26813. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26814. * @param {*} [accumulator] The initial value.
  26815. * @returns {*} Returns the accumulated value.
  26816. * @see _.reduceRight
  26817. * @example
  26818. *
  26819. * _.reduce([1, 2], function(sum, n) {
  26820. * return sum + n;
  26821. * }, 0);
  26822. * // => 3
  26823. *
  26824. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26825. * (result[value] || (result[value] = [])).push(key);
  26826. * return result;
  26827. * }, {});
  26828. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26829. */
  26830. function reduce(collection, iteratee, accumulator) {
  26831. var func = isArray(collection) ? arrayReduce : baseReduce,
  26832. initAccum = arguments.length < 3;
  26833. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26834. }
  26835. /**
  26836. * This method is like `_.reduce` except that it iterates over elements of
  26837. * `collection` from right to left.
  26838. *
  26839. * @static
  26840. * @memberOf _
  26841. * @since 0.1.0
  26842. * @category Collection
  26843. * @param {Array|Object} collection The collection to iterate over.
  26844. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26845. * @param {*} [accumulator] The initial value.
  26846. * @returns {*} Returns the accumulated value.
  26847. * @see _.reduce
  26848. * @example
  26849. *
  26850. * var array = [[0, 1], [2, 3], [4, 5]];
  26851. *
  26852. * _.reduceRight(array, function(flattened, other) {
  26853. * return flattened.concat(other);
  26854. * }, []);
  26855. * // => [4, 5, 2, 3, 0, 1]
  26856. */
  26857. function reduceRight(collection, iteratee, accumulator) {
  26858. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26859. initAccum = arguments.length < 3;
  26860. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26861. }
  26862. /**
  26863. * The opposite of `_.filter`; this method returns the elements of `collection`
  26864. * that `predicate` does **not** return truthy for.
  26865. *
  26866. * @static
  26867. * @memberOf _
  26868. * @since 0.1.0
  26869. * @category Collection
  26870. * @param {Array|Object} collection The collection to iterate over.
  26871. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26872. * @returns {Array} Returns the new filtered array.
  26873. * @see _.filter
  26874. * @example
  26875. *
  26876. * var users = [
  26877. * { 'user': 'barney', 'age': 36, 'active': false },
  26878. * { 'user': 'fred', 'age': 40, 'active': true }
  26879. * ];
  26880. *
  26881. * _.reject(users, function(o) { return !o.active; });
  26882. * // => objects for ['fred']
  26883. *
  26884. * // The `_.matches` iteratee shorthand.
  26885. * _.reject(users, { 'age': 40, 'active': true });
  26886. * // => objects for ['barney']
  26887. *
  26888. * // The `_.matchesProperty` iteratee shorthand.
  26889. * _.reject(users, ['active', false]);
  26890. * // => objects for ['fred']
  26891. *
  26892. * // The `_.property` iteratee shorthand.
  26893. * _.reject(users, 'active');
  26894. * // => objects for ['barney']
  26895. */
  26896. function reject(collection, predicate) {
  26897. var func = isArray(collection) ? arrayFilter : baseFilter;
  26898. return func(collection, negate(getIteratee(predicate, 3)));
  26899. }
  26900. /**
  26901. * Gets a random element from `collection`.
  26902. *
  26903. * @static
  26904. * @memberOf _
  26905. * @since 2.0.0
  26906. * @category Collection
  26907. * @param {Array|Object} collection The collection to sample.
  26908. * @returns {*} Returns the random element.
  26909. * @example
  26910. *
  26911. * _.sample([1, 2, 3, 4]);
  26912. * // => 2
  26913. */
  26914. function sample(collection) {
  26915. var func = isArray(collection) ? arraySample : baseSample;
  26916. return func(collection);
  26917. }
  26918. /**
  26919. * Gets `n` random elements at unique keys from `collection` up to the
  26920. * size of `collection`.
  26921. *
  26922. * @static
  26923. * @memberOf _
  26924. * @since 4.0.0
  26925. * @category Collection
  26926. * @param {Array|Object} collection The collection to sample.
  26927. * @param {number} [n=1] The number of elements to sample.
  26928. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26929. * @returns {Array} Returns the random elements.
  26930. * @example
  26931. *
  26932. * _.sampleSize([1, 2, 3], 2);
  26933. * // => [3, 1]
  26934. *
  26935. * _.sampleSize([1, 2, 3], 4);
  26936. * // => [2, 3, 1]
  26937. */
  26938. function sampleSize(collection, n, guard) {
  26939. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26940. n = 1;
  26941. } else {
  26942. n = toInteger(n);
  26943. }
  26944. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26945. return func(collection, n);
  26946. }
  26947. /**
  26948. * Creates an array of shuffled values, using a version of the
  26949. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26950. *
  26951. * @static
  26952. * @memberOf _
  26953. * @since 0.1.0
  26954. * @category Collection
  26955. * @param {Array|Object} collection The collection to shuffle.
  26956. * @returns {Array} Returns the new shuffled array.
  26957. * @example
  26958. *
  26959. * _.shuffle([1, 2, 3, 4]);
  26960. * // => [4, 1, 3, 2]
  26961. */
  26962. function shuffle(collection) {
  26963. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26964. return func(collection);
  26965. }
  26966. /**
  26967. * Gets the size of `collection` by returning its length for array-like
  26968. * values or the number of own enumerable string keyed properties for objects.
  26969. *
  26970. * @static
  26971. * @memberOf _
  26972. * @since 0.1.0
  26973. * @category Collection
  26974. * @param {Array|Object|string} collection The collection to inspect.
  26975. * @returns {number} Returns the collection size.
  26976. * @example
  26977. *
  26978. * _.size([1, 2, 3]);
  26979. * // => 3
  26980. *
  26981. * _.size({ 'a': 1, 'b': 2 });
  26982. * // => 2
  26983. *
  26984. * _.size('pebbles');
  26985. * // => 7
  26986. */
  26987. function size(collection) {
  26988. if (collection == null) {
  26989. return 0;
  26990. }
  26991. if (isArrayLike(collection)) {
  26992. return isString(collection) ? stringSize(collection) : collection.length;
  26993. }
  26994. var tag = getTag(collection);
  26995. if (tag == mapTag || tag == setTag) {
  26996. return collection.size;
  26997. }
  26998. return baseKeys(collection).length;
  26999. }
  27000. /**
  27001. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27002. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27003. * invoked with three arguments: (value, index|key, collection).
  27004. *
  27005. * @static
  27006. * @memberOf _
  27007. * @since 0.1.0
  27008. * @category Collection
  27009. * @param {Array|Object} collection The collection to iterate over.
  27010. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27011. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27012. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27013. * else `false`.
  27014. * @example
  27015. *
  27016. * _.some([null, 0, 'yes', false], Boolean);
  27017. * // => true
  27018. *
  27019. * var users = [
  27020. * { 'user': 'barney', 'active': true },
  27021. * { 'user': 'fred', 'active': false }
  27022. * ];
  27023. *
  27024. * // The `_.matches` iteratee shorthand.
  27025. * _.some(users, { 'user': 'barney', 'active': false });
  27026. * // => false
  27027. *
  27028. * // The `_.matchesProperty` iteratee shorthand.
  27029. * _.some(users, ['active', false]);
  27030. * // => true
  27031. *
  27032. * // The `_.property` iteratee shorthand.
  27033. * _.some(users, 'active');
  27034. * // => true
  27035. */
  27036. function some(collection, predicate, guard) {
  27037. var func = isArray(collection) ? arraySome : baseSome;
  27038. if (guard && isIterateeCall(collection, predicate, guard)) {
  27039. predicate = undefined;
  27040. }
  27041. return func(collection, getIteratee(predicate, 3));
  27042. }
  27043. /**
  27044. * Creates an array of elements, sorted in ascending order by the results of
  27045. * running each element in a collection thru each iteratee. This method
  27046. * performs a stable sort, that is, it preserves the original sort order of
  27047. * equal elements. The iteratees are invoked with one argument: (value).
  27048. *
  27049. * @static
  27050. * @memberOf _
  27051. * @since 0.1.0
  27052. * @category Collection
  27053. * @param {Array|Object} collection The collection to iterate over.
  27054. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27055. * The iteratees to sort by.
  27056. * @returns {Array} Returns the new sorted array.
  27057. * @example
  27058. *
  27059. * var users = [
  27060. * { 'user': 'fred', 'age': 48 },
  27061. * { 'user': 'barney', 'age': 36 },
  27062. * { 'user': 'fred', 'age': 40 },
  27063. * { 'user': 'barney', 'age': 34 }
  27064. * ];
  27065. *
  27066. * _.sortBy(users, [function(o) { return o.user; }]);
  27067. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27068. *
  27069. * _.sortBy(users, ['user', 'age']);
  27070. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27071. */
  27072. var sortBy = baseRest(function(collection, iteratees) {
  27073. if (collection == null) {
  27074. return [];
  27075. }
  27076. var length = iteratees.length;
  27077. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27078. iteratees = [];
  27079. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27080. iteratees = [iteratees[0]];
  27081. }
  27082. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27083. });
  27084. /*------------------------------------------------------------------------*/
  27085. /**
  27086. * Gets the timestamp of the number of milliseconds that have elapsed since
  27087. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27088. *
  27089. * @static
  27090. * @memberOf _
  27091. * @since 2.4.0
  27092. * @category Date
  27093. * @returns {number} Returns the timestamp.
  27094. * @example
  27095. *
  27096. * _.defer(function(stamp) {
  27097. * console.log(_.now() - stamp);
  27098. * }, _.now());
  27099. * // => Logs the number of milliseconds it took for the deferred invocation.
  27100. */
  27101. var now = ctxNow || function() {
  27102. return root.Date.now();
  27103. };
  27104. /*------------------------------------------------------------------------*/
  27105. /**
  27106. * The opposite of `_.before`; this method creates a function that invokes
  27107. * `func` once it's called `n` or more times.
  27108. *
  27109. * @static
  27110. * @memberOf _
  27111. * @since 0.1.0
  27112. * @category Function
  27113. * @param {number} n The number of calls before `func` is invoked.
  27114. * @param {Function} func The function to restrict.
  27115. * @returns {Function} Returns the new restricted function.
  27116. * @example
  27117. *
  27118. * var saves = ['profile', 'settings'];
  27119. *
  27120. * var done = _.after(saves.length, function() {
  27121. * console.log('done saving!');
  27122. * });
  27123. *
  27124. * _.forEach(saves, function(type) {
  27125. * asyncSave({ 'type': type, 'complete': done });
  27126. * });
  27127. * // => Logs 'done saving!' after the two async saves have completed.
  27128. */
  27129. function after(n, func) {
  27130. if (typeof func != 'function') {
  27131. throw new TypeError(FUNC_ERROR_TEXT);
  27132. }
  27133. n = toInteger(n);
  27134. return function() {
  27135. if (--n < 1) {
  27136. return func.apply(this, arguments);
  27137. }
  27138. };
  27139. }
  27140. /**
  27141. * Creates a function that invokes `func`, with up to `n` arguments,
  27142. * ignoring any additional arguments.
  27143. *
  27144. * @static
  27145. * @memberOf _
  27146. * @since 3.0.0
  27147. * @category Function
  27148. * @param {Function} func The function to cap arguments for.
  27149. * @param {number} [n=func.length] The arity cap.
  27150. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27151. * @returns {Function} Returns the new capped function.
  27152. * @example
  27153. *
  27154. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27155. * // => [6, 8, 10]
  27156. */
  27157. function ary(func, n, guard) {
  27158. n = guard ? undefined : n;
  27159. n = (func && n == null) ? func.length : n;
  27160. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27161. }
  27162. /**
  27163. * Creates a function that invokes `func`, with the `this` binding and arguments
  27164. * of the created function, while it's called less than `n` times. Subsequent
  27165. * calls to the created function return the result of the last `func` invocation.
  27166. *
  27167. * @static
  27168. * @memberOf _
  27169. * @since 3.0.0
  27170. * @category Function
  27171. * @param {number} n The number of calls at which `func` is no longer invoked.
  27172. * @param {Function} func The function to restrict.
  27173. * @returns {Function} Returns the new restricted function.
  27174. * @example
  27175. *
  27176. * jQuery(element).on('click', _.before(5, addContactToList));
  27177. * // => Allows adding up to 4 contacts to the list.
  27178. */
  27179. function before(n, func) {
  27180. var result;
  27181. if (typeof func != 'function') {
  27182. throw new TypeError(FUNC_ERROR_TEXT);
  27183. }
  27184. n = toInteger(n);
  27185. return function() {
  27186. if (--n > 0) {
  27187. result = func.apply(this, arguments);
  27188. }
  27189. if (n <= 1) {
  27190. func = undefined;
  27191. }
  27192. return result;
  27193. };
  27194. }
  27195. /**
  27196. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27197. * and `partials` prepended to the arguments it receives.
  27198. *
  27199. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27200. * may be used as a placeholder for partially applied arguments.
  27201. *
  27202. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27203. * property of bound functions.
  27204. *
  27205. * @static
  27206. * @memberOf _
  27207. * @since 0.1.0
  27208. * @category Function
  27209. * @param {Function} func The function to bind.
  27210. * @param {*} thisArg The `this` binding of `func`.
  27211. * @param {...*} [partials] The arguments to be partially applied.
  27212. * @returns {Function} Returns the new bound function.
  27213. * @example
  27214. *
  27215. * function greet(greeting, punctuation) {
  27216. * return greeting + ' ' + this.user + punctuation;
  27217. * }
  27218. *
  27219. * var object = { 'user': 'fred' };
  27220. *
  27221. * var bound = _.bind(greet, object, 'hi');
  27222. * bound('!');
  27223. * // => 'hi fred!'
  27224. *
  27225. * // Bound with placeholders.
  27226. * var bound = _.bind(greet, object, _, '!');
  27227. * bound('hi');
  27228. * // => 'hi fred!'
  27229. */
  27230. var bind = baseRest(function(func, thisArg, partials) {
  27231. var bitmask = WRAP_BIND_FLAG;
  27232. if (partials.length) {
  27233. var holders = replaceHolders(partials, getHolder(bind));
  27234. bitmask |= WRAP_PARTIAL_FLAG;
  27235. }
  27236. return createWrap(func, bitmask, thisArg, partials, holders);
  27237. });
  27238. /**
  27239. * Creates a function that invokes the method at `object[key]` with `partials`
  27240. * prepended to the arguments it receives.
  27241. *
  27242. * This method differs from `_.bind` by allowing bound functions to reference
  27243. * methods that may be redefined or don't yet exist. See
  27244. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27245. * for more details.
  27246. *
  27247. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27248. * builds, may be used as a placeholder for partially applied arguments.
  27249. *
  27250. * @static
  27251. * @memberOf _
  27252. * @since 0.10.0
  27253. * @category Function
  27254. * @param {Object} object The object to invoke the method on.
  27255. * @param {string} key The key of the method.
  27256. * @param {...*} [partials] The arguments to be partially applied.
  27257. * @returns {Function} Returns the new bound function.
  27258. * @example
  27259. *
  27260. * var object = {
  27261. * 'user': 'fred',
  27262. * 'greet': function(greeting, punctuation) {
  27263. * return greeting + ' ' + this.user + punctuation;
  27264. * }
  27265. * };
  27266. *
  27267. * var bound = _.bindKey(object, 'greet', 'hi');
  27268. * bound('!');
  27269. * // => 'hi fred!'
  27270. *
  27271. * object.greet = function(greeting, punctuation) {
  27272. * return greeting + 'ya ' + this.user + punctuation;
  27273. * };
  27274. *
  27275. * bound('!');
  27276. * // => 'hiya fred!'
  27277. *
  27278. * // Bound with placeholders.
  27279. * var bound = _.bindKey(object, 'greet', _, '!');
  27280. * bound('hi');
  27281. * // => 'hiya fred!'
  27282. */
  27283. var bindKey = baseRest(function(object, key, partials) {
  27284. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27285. if (partials.length) {
  27286. var holders = replaceHolders(partials, getHolder(bindKey));
  27287. bitmask |= WRAP_PARTIAL_FLAG;
  27288. }
  27289. return createWrap(key, bitmask, object, partials, holders);
  27290. });
  27291. /**
  27292. * Creates a function that accepts arguments of `func` and either invokes
  27293. * `func` returning its result, if at least `arity` number of arguments have
  27294. * been provided, or returns a function that accepts the remaining `func`
  27295. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27296. * is not sufficient.
  27297. *
  27298. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27299. * may be used as a placeholder for provided arguments.
  27300. *
  27301. * **Note:** This method doesn't set the "length" property of curried functions.
  27302. *
  27303. * @static
  27304. * @memberOf _
  27305. * @since 2.0.0
  27306. * @category Function
  27307. * @param {Function} func The function to curry.
  27308. * @param {number} [arity=func.length] The arity of `func`.
  27309. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27310. * @returns {Function} Returns the new curried function.
  27311. * @example
  27312. *
  27313. * var abc = function(a, b, c) {
  27314. * return [a, b, c];
  27315. * };
  27316. *
  27317. * var curried = _.curry(abc);
  27318. *
  27319. * curried(1)(2)(3);
  27320. * // => [1, 2, 3]
  27321. *
  27322. * curried(1, 2)(3);
  27323. * // => [1, 2, 3]
  27324. *
  27325. * curried(1, 2, 3);
  27326. * // => [1, 2, 3]
  27327. *
  27328. * // Curried with placeholders.
  27329. * curried(1)(_, 3)(2);
  27330. * // => [1, 2, 3]
  27331. */
  27332. function curry(func, arity, guard) {
  27333. arity = guard ? undefined : arity;
  27334. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27335. result.placeholder = curry.placeholder;
  27336. return result;
  27337. }
  27338. /**
  27339. * This method is like `_.curry` except that arguments are applied to `func`
  27340. * in the manner of `_.partialRight` instead of `_.partial`.
  27341. *
  27342. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27343. * builds, may be used as a placeholder for provided arguments.
  27344. *
  27345. * **Note:** This method doesn't set the "length" property of curried functions.
  27346. *
  27347. * @static
  27348. * @memberOf _
  27349. * @since 3.0.0
  27350. * @category Function
  27351. * @param {Function} func The function to curry.
  27352. * @param {number} [arity=func.length] The arity of `func`.
  27353. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27354. * @returns {Function} Returns the new curried function.
  27355. * @example
  27356. *
  27357. * var abc = function(a, b, c) {
  27358. * return [a, b, c];
  27359. * };
  27360. *
  27361. * var curried = _.curryRight(abc);
  27362. *
  27363. * curried(3)(2)(1);
  27364. * // => [1, 2, 3]
  27365. *
  27366. * curried(2, 3)(1);
  27367. * // => [1, 2, 3]
  27368. *
  27369. * curried(1, 2, 3);
  27370. * // => [1, 2, 3]
  27371. *
  27372. * // Curried with placeholders.
  27373. * curried(3)(1, _)(2);
  27374. * // => [1, 2, 3]
  27375. */
  27376. function curryRight(func, arity, guard) {
  27377. arity = guard ? undefined : arity;
  27378. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27379. result.placeholder = curryRight.placeholder;
  27380. return result;
  27381. }
  27382. /**
  27383. * Creates a debounced function that delays invoking `func` until after `wait`
  27384. * milliseconds have elapsed since the last time the debounced function was
  27385. * invoked. The debounced function comes with a `cancel` method to cancel
  27386. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27387. * Provide `options` to indicate whether `func` should be invoked on the
  27388. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27389. * with the last arguments provided to the debounced function. Subsequent
  27390. * calls to the debounced function return the result of the last `func`
  27391. * invocation.
  27392. *
  27393. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27394. * invoked on the trailing edge of the timeout only if the debounced function
  27395. * is invoked more than once during the `wait` timeout.
  27396. *
  27397. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27398. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27399. *
  27400. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27401. * for details over the differences between `_.debounce` and `_.throttle`.
  27402. *
  27403. * @static
  27404. * @memberOf _
  27405. * @since 0.1.0
  27406. * @category Function
  27407. * @param {Function} func The function to debounce.
  27408. * @param {number} [wait=0] The number of milliseconds to delay.
  27409. * @param {Object} [options={}] The options object.
  27410. * @param {boolean} [options.leading=false]
  27411. * Specify invoking on the leading edge of the timeout.
  27412. * @param {number} [options.maxWait]
  27413. * The maximum time `func` is allowed to be delayed before it's invoked.
  27414. * @param {boolean} [options.trailing=true]
  27415. * Specify invoking on the trailing edge of the timeout.
  27416. * @returns {Function} Returns the new debounced function.
  27417. * @example
  27418. *
  27419. * // Avoid costly calculations while the window size is in flux.
  27420. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27421. *
  27422. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27423. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27424. * 'leading': true,
  27425. * 'trailing': false
  27426. * }));
  27427. *
  27428. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27429. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27430. * var source = new EventSource('/stream');
  27431. * jQuery(source).on('message', debounced);
  27432. *
  27433. * // Cancel the trailing debounced invocation.
  27434. * jQuery(window).on('popstate', debounced.cancel);
  27435. */
  27436. function debounce(func, wait, options) {
  27437. var lastArgs,
  27438. lastThis,
  27439. maxWait,
  27440. result,
  27441. timerId,
  27442. lastCallTime,
  27443. lastInvokeTime = 0,
  27444. leading = false,
  27445. maxing = false,
  27446. trailing = true;
  27447. if (typeof func != 'function') {
  27448. throw new TypeError(FUNC_ERROR_TEXT);
  27449. }
  27450. wait = toNumber(wait) || 0;
  27451. if (isObject(options)) {
  27452. leading = !!options.leading;
  27453. maxing = 'maxWait' in options;
  27454. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27455. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27456. }
  27457. function invokeFunc(time) {
  27458. var args = lastArgs,
  27459. thisArg = lastThis;
  27460. lastArgs = lastThis = undefined;
  27461. lastInvokeTime = time;
  27462. result = func.apply(thisArg, args);
  27463. return result;
  27464. }
  27465. function leadingEdge(time) {
  27466. // Reset any `maxWait` timer.
  27467. lastInvokeTime = time;
  27468. // Start the timer for the trailing edge.
  27469. timerId = setTimeout(timerExpired, wait);
  27470. // Invoke the leading edge.
  27471. return leading ? invokeFunc(time) : result;
  27472. }
  27473. function remainingWait(time) {
  27474. var timeSinceLastCall = time - lastCallTime,
  27475. timeSinceLastInvoke = time - lastInvokeTime,
  27476. timeWaiting = wait - timeSinceLastCall;
  27477. return maxing
  27478. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27479. : timeWaiting;
  27480. }
  27481. function shouldInvoke(time) {
  27482. var timeSinceLastCall = time - lastCallTime,
  27483. timeSinceLastInvoke = time - lastInvokeTime;
  27484. // Either this is the first call, activity has stopped and we're at the
  27485. // trailing edge, the system time has gone backwards and we're treating
  27486. // it as the trailing edge, or we've hit the `maxWait` limit.
  27487. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27488. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27489. }
  27490. function timerExpired() {
  27491. var time = now();
  27492. if (shouldInvoke(time)) {
  27493. return trailingEdge(time);
  27494. }
  27495. // Restart the timer.
  27496. timerId = setTimeout(timerExpired, remainingWait(time));
  27497. }
  27498. function trailingEdge(time) {
  27499. timerId = undefined;
  27500. // Only invoke if we have `lastArgs` which means `func` has been
  27501. // debounced at least once.
  27502. if (trailing && lastArgs) {
  27503. return invokeFunc(time);
  27504. }
  27505. lastArgs = lastThis = undefined;
  27506. return result;
  27507. }
  27508. function cancel() {
  27509. if (timerId !== undefined) {
  27510. clearTimeout(timerId);
  27511. }
  27512. lastInvokeTime = 0;
  27513. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27514. }
  27515. function flush() {
  27516. return timerId === undefined ? result : trailingEdge(now());
  27517. }
  27518. function debounced() {
  27519. var time = now(),
  27520. isInvoking = shouldInvoke(time);
  27521. lastArgs = arguments;
  27522. lastThis = this;
  27523. lastCallTime = time;
  27524. if (isInvoking) {
  27525. if (timerId === undefined) {
  27526. return leadingEdge(lastCallTime);
  27527. }
  27528. if (maxing) {
  27529. // Handle invocations in a tight loop.
  27530. clearTimeout(timerId);
  27531. timerId = setTimeout(timerExpired, wait);
  27532. return invokeFunc(lastCallTime);
  27533. }
  27534. }
  27535. if (timerId === undefined) {
  27536. timerId = setTimeout(timerExpired, wait);
  27537. }
  27538. return result;
  27539. }
  27540. debounced.cancel = cancel;
  27541. debounced.flush = flush;
  27542. return debounced;
  27543. }
  27544. /**
  27545. * Defers invoking the `func` until the current call stack has cleared. Any
  27546. * additional arguments are provided to `func` when it's invoked.
  27547. *
  27548. * @static
  27549. * @memberOf _
  27550. * @since 0.1.0
  27551. * @category Function
  27552. * @param {Function} func The function to defer.
  27553. * @param {...*} [args] The arguments to invoke `func` with.
  27554. * @returns {number} Returns the timer id.
  27555. * @example
  27556. *
  27557. * _.defer(function(text) {
  27558. * console.log(text);
  27559. * }, 'deferred');
  27560. * // => Logs 'deferred' after one millisecond.
  27561. */
  27562. var defer = baseRest(function(func, args) {
  27563. return baseDelay(func, 1, args);
  27564. });
  27565. /**
  27566. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27567. * provided to `func` when it's invoked.
  27568. *
  27569. * @static
  27570. * @memberOf _
  27571. * @since 0.1.0
  27572. * @category Function
  27573. * @param {Function} func The function to delay.
  27574. * @param {number} wait The number of milliseconds to delay invocation.
  27575. * @param {...*} [args] The arguments to invoke `func` with.
  27576. * @returns {number} Returns the timer id.
  27577. * @example
  27578. *
  27579. * _.delay(function(text) {
  27580. * console.log(text);
  27581. * }, 1000, 'later');
  27582. * // => Logs 'later' after one second.
  27583. */
  27584. var delay = baseRest(function(func, wait, args) {
  27585. return baseDelay(func, toNumber(wait) || 0, args);
  27586. });
  27587. /**
  27588. * Creates a function that invokes `func` with arguments reversed.
  27589. *
  27590. * @static
  27591. * @memberOf _
  27592. * @since 4.0.0
  27593. * @category Function
  27594. * @param {Function} func The function to flip arguments for.
  27595. * @returns {Function} Returns the new flipped function.
  27596. * @example
  27597. *
  27598. * var flipped = _.flip(function() {
  27599. * return _.toArray(arguments);
  27600. * });
  27601. *
  27602. * flipped('a', 'b', 'c', 'd');
  27603. * // => ['d', 'c', 'b', 'a']
  27604. */
  27605. function flip(func) {
  27606. return createWrap(func, WRAP_FLIP_FLAG);
  27607. }
  27608. /**
  27609. * Creates a function that memoizes the result of `func`. If `resolver` is
  27610. * provided, it determines the cache key for storing the result based on the
  27611. * arguments provided to the memoized function. By default, the first argument
  27612. * provided to the memoized function is used as the map cache key. The `func`
  27613. * is invoked with the `this` binding of the memoized function.
  27614. *
  27615. * **Note:** The cache is exposed as the `cache` property on the memoized
  27616. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27617. * constructor with one whose instances implement the
  27618. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27619. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27620. *
  27621. * @static
  27622. * @memberOf _
  27623. * @since 0.1.0
  27624. * @category Function
  27625. * @param {Function} func The function to have its output memoized.
  27626. * @param {Function} [resolver] The function to resolve the cache key.
  27627. * @returns {Function} Returns the new memoized function.
  27628. * @example
  27629. *
  27630. * var object = { 'a': 1, 'b': 2 };
  27631. * var other = { 'c': 3, 'd': 4 };
  27632. *
  27633. * var values = _.memoize(_.values);
  27634. * values(object);
  27635. * // => [1, 2]
  27636. *
  27637. * values(other);
  27638. * // => [3, 4]
  27639. *
  27640. * object.a = 2;
  27641. * values(object);
  27642. * // => [1, 2]
  27643. *
  27644. * // Modify the result cache.
  27645. * values.cache.set(object, ['a', 'b']);
  27646. * values(object);
  27647. * // => ['a', 'b']
  27648. *
  27649. * // Replace `_.memoize.Cache`.
  27650. * _.memoize.Cache = WeakMap;
  27651. */
  27652. function memoize(func, resolver) {
  27653. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27654. throw new TypeError(FUNC_ERROR_TEXT);
  27655. }
  27656. var memoized = function() {
  27657. var args = arguments,
  27658. key = resolver ? resolver.apply(this, args) : args[0],
  27659. cache = memoized.cache;
  27660. if (cache.has(key)) {
  27661. return cache.get(key);
  27662. }
  27663. var result = func.apply(this, args);
  27664. memoized.cache = cache.set(key, result) || cache;
  27665. return result;
  27666. };
  27667. memoized.cache = new (memoize.Cache || MapCache);
  27668. return memoized;
  27669. }
  27670. // Expose `MapCache`.
  27671. memoize.Cache = MapCache;
  27672. /**
  27673. * Creates a function that negates the result of the predicate `func`. The
  27674. * `func` predicate is invoked with the `this` binding and arguments of the
  27675. * created function.
  27676. *
  27677. * @static
  27678. * @memberOf _
  27679. * @since 3.0.0
  27680. * @category Function
  27681. * @param {Function} predicate The predicate to negate.
  27682. * @returns {Function} Returns the new negated function.
  27683. * @example
  27684. *
  27685. * function isEven(n) {
  27686. * return n % 2 == 0;
  27687. * }
  27688. *
  27689. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27690. * // => [1, 3, 5]
  27691. */
  27692. function negate(predicate) {
  27693. if (typeof predicate != 'function') {
  27694. throw new TypeError(FUNC_ERROR_TEXT);
  27695. }
  27696. return function() {
  27697. var args = arguments;
  27698. switch (args.length) {
  27699. case 0: return !predicate.call(this);
  27700. case 1: return !predicate.call(this, args[0]);
  27701. case 2: return !predicate.call(this, args[0], args[1]);
  27702. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27703. }
  27704. return !predicate.apply(this, args);
  27705. };
  27706. }
  27707. /**
  27708. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27709. * to the function return the value of the first invocation. The `func` is
  27710. * invoked with the `this` binding and arguments of the created function.
  27711. *
  27712. * @static
  27713. * @memberOf _
  27714. * @since 0.1.0
  27715. * @category Function
  27716. * @param {Function} func The function to restrict.
  27717. * @returns {Function} Returns the new restricted function.
  27718. * @example
  27719. *
  27720. * var initialize = _.once(createApplication);
  27721. * initialize();
  27722. * initialize();
  27723. * // => `createApplication` is invoked once
  27724. */
  27725. function once(func) {
  27726. return before(2, func);
  27727. }
  27728. /**
  27729. * Creates a function that invokes `func` with its arguments transformed.
  27730. *
  27731. * @static
  27732. * @since 4.0.0
  27733. * @memberOf _
  27734. * @category Function
  27735. * @param {Function} func The function to wrap.
  27736. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27737. * The argument transforms.
  27738. * @returns {Function} Returns the new function.
  27739. * @example
  27740. *
  27741. * function doubled(n) {
  27742. * return n * 2;
  27743. * }
  27744. *
  27745. * function square(n) {
  27746. * return n * n;
  27747. * }
  27748. *
  27749. * var func = _.overArgs(function(x, y) {
  27750. * return [x, y];
  27751. * }, [square, doubled]);
  27752. *
  27753. * func(9, 3);
  27754. * // => [81, 6]
  27755. *
  27756. * func(10, 5);
  27757. * // => [100, 10]
  27758. */
  27759. var overArgs = castRest(function(func, transforms) {
  27760. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27761. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27762. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27763. var funcsLength = transforms.length;
  27764. return baseRest(function(args) {
  27765. var index = -1,
  27766. length = nativeMin(args.length, funcsLength);
  27767. while (++index < length) {
  27768. args[index] = transforms[index].call(this, args[index]);
  27769. }
  27770. return apply(func, this, args);
  27771. });
  27772. });
  27773. /**
  27774. * Creates a function that invokes `func` with `partials` prepended to the
  27775. * arguments it receives. This method is like `_.bind` except it does **not**
  27776. * alter the `this` binding.
  27777. *
  27778. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27779. * builds, may be used as a placeholder for partially applied arguments.
  27780. *
  27781. * **Note:** This method doesn't set the "length" property of partially
  27782. * applied functions.
  27783. *
  27784. * @static
  27785. * @memberOf _
  27786. * @since 0.2.0
  27787. * @category Function
  27788. * @param {Function} func The function to partially apply arguments to.
  27789. * @param {...*} [partials] The arguments to be partially applied.
  27790. * @returns {Function} Returns the new partially applied function.
  27791. * @example
  27792. *
  27793. * function greet(greeting, name) {
  27794. * return greeting + ' ' + name;
  27795. * }
  27796. *
  27797. * var sayHelloTo = _.partial(greet, 'hello');
  27798. * sayHelloTo('fred');
  27799. * // => 'hello fred'
  27800. *
  27801. * // Partially applied with placeholders.
  27802. * var greetFred = _.partial(greet, _, 'fred');
  27803. * greetFred('hi');
  27804. * // => 'hi fred'
  27805. */
  27806. var partial = baseRest(function(func, partials) {
  27807. var holders = replaceHolders(partials, getHolder(partial));
  27808. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27809. });
  27810. /**
  27811. * This method is like `_.partial` except that partially applied arguments
  27812. * are appended to the arguments it receives.
  27813. *
  27814. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27815. * builds, may be used as a placeholder for partially applied arguments.
  27816. *
  27817. * **Note:** This method doesn't set the "length" property of partially
  27818. * applied functions.
  27819. *
  27820. * @static
  27821. * @memberOf _
  27822. * @since 1.0.0
  27823. * @category Function
  27824. * @param {Function} func The function to partially apply arguments to.
  27825. * @param {...*} [partials] The arguments to be partially applied.
  27826. * @returns {Function} Returns the new partially applied function.
  27827. * @example
  27828. *
  27829. * function greet(greeting, name) {
  27830. * return greeting + ' ' + name;
  27831. * }
  27832. *
  27833. * var greetFred = _.partialRight(greet, 'fred');
  27834. * greetFred('hi');
  27835. * // => 'hi fred'
  27836. *
  27837. * // Partially applied with placeholders.
  27838. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27839. * sayHelloTo('fred');
  27840. * // => 'hello fred'
  27841. */
  27842. var partialRight = baseRest(function(func, partials) {
  27843. var holders = replaceHolders(partials, getHolder(partialRight));
  27844. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27845. });
  27846. /**
  27847. * Creates a function that invokes `func` with arguments arranged according
  27848. * to the specified `indexes` where the argument value at the first index is
  27849. * provided as the first argument, the argument value at the second index is
  27850. * provided as the second argument, and so on.
  27851. *
  27852. * @static
  27853. * @memberOf _
  27854. * @since 3.0.0
  27855. * @category Function
  27856. * @param {Function} func The function to rearrange arguments for.
  27857. * @param {...(number|number[])} indexes The arranged argument indexes.
  27858. * @returns {Function} Returns the new function.
  27859. * @example
  27860. *
  27861. * var rearged = _.rearg(function(a, b, c) {
  27862. * return [a, b, c];
  27863. * }, [2, 0, 1]);
  27864. *
  27865. * rearged('b', 'c', 'a')
  27866. * // => ['a', 'b', 'c']
  27867. */
  27868. var rearg = flatRest(function(func, indexes) {
  27869. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27870. });
  27871. /**
  27872. * Creates a function that invokes `func` with the `this` binding of the
  27873. * created function and arguments from `start` and beyond provided as
  27874. * an array.
  27875. *
  27876. * **Note:** This method is based on the
  27877. * [rest parameter](https://mdn.io/rest_parameters).
  27878. *
  27879. * @static
  27880. * @memberOf _
  27881. * @since 4.0.0
  27882. * @category Function
  27883. * @param {Function} func The function to apply a rest parameter to.
  27884. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27885. * @returns {Function} Returns the new function.
  27886. * @example
  27887. *
  27888. * var say = _.rest(function(what, names) {
  27889. * return what + ' ' + _.initial(names).join(', ') +
  27890. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27891. * });
  27892. *
  27893. * say('hello', 'fred', 'barney', 'pebbles');
  27894. * // => 'hello fred, barney, & pebbles'
  27895. */
  27896. function rest(func, start) {
  27897. if (typeof func != 'function') {
  27898. throw new TypeError(FUNC_ERROR_TEXT);
  27899. }
  27900. start = start === undefined ? start : toInteger(start);
  27901. return baseRest(func, start);
  27902. }
  27903. /**
  27904. * Creates a function that invokes `func` with the `this` binding of the
  27905. * create function and an array of arguments much like
  27906. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27907. *
  27908. * **Note:** This method is based on the
  27909. * [spread operator](https://mdn.io/spread_operator).
  27910. *
  27911. * @static
  27912. * @memberOf _
  27913. * @since 3.2.0
  27914. * @category Function
  27915. * @param {Function} func The function to spread arguments over.
  27916. * @param {number} [start=0] The start position of the spread.
  27917. * @returns {Function} Returns the new function.
  27918. * @example
  27919. *
  27920. * var say = _.spread(function(who, what) {
  27921. * return who + ' says ' + what;
  27922. * });
  27923. *
  27924. * say(['fred', 'hello']);
  27925. * // => 'fred says hello'
  27926. *
  27927. * var numbers = Promise.all([
  27928. * Promise.resolve(40),
  27929. * Promise.resolve(36)
  27930. * ]);
  27931. *
  27932. * numbers.then(_.spread(function(x, y) {
  27933. * return x + y;
  27934. * }));
  27935. * // => a Promise of 76
  27936. */
  27937. function spread(func, start) {
  27938. if (typeof func != 'function') {
  27939. throw new TypeError(FUNC_ERROR_TEXT);
  27940. }
  27941. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27942. return baseRest(function(args) {
  27943. var array = args[start],
  27944. otherArgs = castSlice(args, 0, start);
  27945. if (array) {
  27946. arrayPush(otherArgs, array);
  27947. }
  27948. return apply(func, this, otherArgs);
  27949. });
  27950. }
  27951. /**
  27952. * Creates a throttled function that only invokes `func` at most once per
  27953. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27954. * method to cancel delayed `func` invocations and a `flush` method to
  27955. * immediately invoke them. Provide `options` to indicate whether `func`
  27956. * should be invoked on the leading and/or trailing edge of the `wait`
  27957. * timeout. The `func` is invoked with the last arguments provided to the
  27958. * throttled function. Subsequent calls to the throttled function return the
  27959. * result of the last `func` invocation.
  27960. *
  27961. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27962. * invoked on the trailing edge of the timeout only if the throttled function
  27963. * is invoked more than once during the `wait` timeout.
  27964. *
  27965. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27966. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27967. *
  27968. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27969. * for details over the differences between `_.throttle` and `_.debounce`.
  27970. *
  27971. * @static
  27972. * @memberOf _
  27973. * @since 0.1.0
  27974. * @category Function
  27975. * @param {Function} func The function to throttle.
  27976. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  27977. * @param {Object} [options={}] The options object.
  27978. * @param {boolean} [options.leading=true]
  27979. * Specify invoking on the leading edge of the timeout.
  27980. * @param {boolean} [options.trailing=true]
  27981. * Specify invoking on the trailing edge of the timeout.
  27982. * @returns {Function} Returns the new throttled function.
  27983. * @example
  27984. *
  27985. * // Avoid excessively updating the position while scrolling.
  27986. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  27987. *
  27988. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  27989. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  27990. * jQuery(element).on('click', throttled);
  27991. *
  27992. * // Cancel the trailing throttled invocation.
  27993. * jQuery(window).on('popstate', throttled.cancel);
  27994. */
  27995. function throttle(func, wait, options) {
  27996. var leading = true,
  27997. trailing = true;
  27998. if (typeof func != 'function') {
  27999. throw new TypeError(FUNC_ERROR_TEXT);
  28000. }
  28001. if (isObject(options)) {
  28002. leading = 'leading' in options ? !!options.leading : leading;
  28003. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28004. }
  28005. return debounce(func, wait, {
  28006. 'leading': leading,
  28007. 'maxWait': wait,
  28008. 'trailing': trailing
  28009. });
  28010. }
  28011. /**
  28012. * Creates a function that accepts up to one argument, ignoring any
  28013. * additional arguments.
  28014. *
  28015. * @static
  28016. * @memberOf _
  28017. * @since 4.0.0
  28018. * @category Function
  28019. * @param {Function} func The function to cap arguments for.
  28020. * @returns {Function} Returns the new capped function.
  28021. * @example
  28022. *
  28023. * _.map(['6', '8', '10'], _.unary(parseInt));
  28024. * // => [6, 8, 10]
  28025. */
  28026. function unary(func) {
  28027. return ary(func, 1);
  28028. }
  28029. /**
  28030. * Creates a function that provides `value` to `wrapper` as its first
  28031. * argument. Any additional arguments provided to the function are appended
  28032. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28033. * binding of the created function.
  28034. *
  28035. * @static
  28036. * @memberOf _
  28037. * @since 0.1.0
  28038. * @category Function
  28039. * @param {*} value The value to wrap.
  28040. * @param {Function} [wrapper=identity] The wrapper function.
  28041. * @returns {Function} Returns the new function.
  28042. * @example
  28043. *
  28044. * var p = _.wrap(_.escape, function(func, text) {
  28045. * return '<p>' + func(text) + '</p>';
  28046. * });
  28047. *
  28048. * p('fred, barney, & pebbles');
  28049. * // => '<p>fred, barney, &amp; pebbles</p>'
  28050. */
  28051. function wrap(value, wrapper) {
  28052. return partial(castFunction(wrapper), value);
  28053. }
  28054. /*------------------------------------------------------------------------*/
  28055. /**
  28056. * Casts `value` as an array if it's not one.
  28057. *
  28058. * @static
  28059. * @memberOf _
  28060. * @since 4.4.0
  28061. * @category Lang
  28062. * @param {*} value The value to inspect.
  28063. * @returns {Array} Returns the cast array.
  28064. * @example
  28065. *
  28066. * _.castArray(1);
  28067. * // => [1]
  28068. *
  28069. * _.castArray({ 'a': 1 });
  28070. * // => [{ 'a': 1 }]
  28071. *
  28072. * _.castArray('abc');
  28073. * // => ['abc']
  28074. *
  28075. * _.castArray(null);
  28076. * // => [null]
  28077. *
  28078. * _.castArray(undefined);
  28079. * // => [undefined]
  28080. *
  28081. * _.castArray();
  28082. * // => []
  28083. *
  28084. * var array = [1, 2, 3];
  28085. * console.log(_.castArray(array) === array);
  28086. * // => true
  28087. */
  28088. function castArray() {
  28089. if (!arguments.length) {
  28090. return [];
  28091. }
  28092. var value = arguments[0];
  28093. return isArray(value) ? value : [value];
  28094. }
  28095. /**
  28096. * Creates a shallow clone of `value`.
  28097. *
  28098. * **Note:** This method is loosely based on the
  28099. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28100. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28101. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28102. * arrays. The own enumerable properties of `arguments` objects are cloned
  28103. * as plain objects. An empty object is returned for uncloneable values such
  28104. * as error objects, functions, DOM nodes, and WeakMaps.
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 0.1.0
  28109. * @category Lang
  28110. * @param {*} value The value to clone.
  28111. * @returns {*} Returns the cloned value.
  28112. * @see _.cloneDeep
  28113. * @example
  28114. *
  28115. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28116. *
  28117. * var shallow = _.clone(objects);
  28118. * console.log(shallow[0] === objects[0]);
  28119. * // => true
  28120. */
  28121. function clone(value) {
  28122. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28123. }
  28124. /**
  28125. * This method is like `_.clone` except that it accepts `customizer` which
  28126. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28127. * cloning is handled by the method instead. The `customizer` is invoked with
  28128. * up to four arguments; (value [, index|key, object, stack]).
  28129. *
  28130. * @static
  28131. * @memberOf _
  28132. * @since 4.0.0
  28133. * @category Lang
  28134. * @param {*} value The value to clone.
  28135. * @param {Function} [customizer] The function to customize cloning.
  28136. * @returns {*} Returns the cloned value.
  28137. * @see _.cloneDeepWith
  28138. * @example
  28139. *
  28140. * function customizer(value) {
  28141. * if (_.isElement(value)) {
  28142. * return value.cloneNode(false);
  28143. * }
  28144. * }
  28145. *
  28146. * var el = _.cloneWith(document.body, customizer);
  28147. *
  28148. * console.log(el === document.body);
  28149. * // => false
  28150. * console.log(el.nodeName);
  28151. * // => 'BODY'
  28152. * console.log(el.childNodes.length);
  28153. * // => 0
  28154. */
  28155. function cloneWith(value, customizer) {
  28156. customizer = typeof customizer == 'function' ? customizer : undefined;
  28157. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28158. }
  28159. /**
  28160. * This method is like `_.clone` except that it recursively clones `value`.
  28161. *
  28162. * @static
  28163. * @memberOf _
  28164. * @since 1.0.0
  28165. * @category Lang
  28166. * @param {*} value The value to recursively clone.
  28167. * @returns {*} Returns the deep cloned value.
  28168. * @see _.clone
  28169. * @example
  28170. *
  28171. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28172. *
  28173. * var deep = _.cloneDeep(objects);
  28174. * console.log(deep[0] === objects[0]);
  28175. * // => false
  28176. */
  28177. function cloneDeep(value) {
  28178. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28179. }
  28180. /**
  28181. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28182. *
  28183. * @static
  28184. * @memberOf _
  28185. * @since 4.0.0
  28186. * @category Lang
  28187. * @param {*} value The value to recursively clone.
  28188. * @param {Function} [customizer] The function to customize cloning.
  28189. * @returns {*} Returns the deep cloned value.
  28190. * @see _.cloneWith
  28191. * @example
  28192. *
  28193. * function customizer(value) {
  28194. * if (_.isElement(value)) {
  28195. * return value.cloneNode(true);
  28196. * }
  28197. * }
  28198. *
  28199. * var el = _.cloneDeepWith(document.body, customizer);
  28200. *
  28201. * console.log(el === document.body);
  28202. * // => false
  28203. * console.log(el.nodeName);
  28204. * // => 'BODY'
  28205. * console.log(el.childNodes.length);
  28206. * // => 20
  28207. */
  28208. function cloneDeepWith(value, customizer) {
  28209. customizer = typeof customizer == 'function' ? customizer : undefined;
  28210. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28211. }
  28212. /**
  28213. * Checks if `object` conforms to `source` by invoking the predicate
  28214. * properties of `source` with the corresponding property values of `object`.
  28215. *
  28216. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28217. * partially applied.
  28218. *
  28219. * @static
  28220. * @memberOf _
  28221. * @since 4.14.0
  28222. * @category Lang
  28223. * @param {Object} object The object to inspect.
  28224. * @param {Object} source The object of property predicates to conform to.
  28225. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28226. * @example
  28227. *
  28228. * var object = { 'a': 1, 'b': 2 };
  28229. *
  28230. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28231. * // => true
  28232. *
  28233. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28234. * // => false
  28235. */
  28236. function conformsTo(object, source) {
  28237. return source == null || baseConformsTo(object, source, keys(source));
  28238. }
  28239. /**
  28240. * Performs a
  28241. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28242. * comparison between two values to determine if they are equivalent.
  28243. *
  28244. * @static
  28245. * @memberOf _
  28246. * @since 4.0.0
  28247. * @category Lang
  28248. * @param {*} value The value to compare.
  28249. * @param {*} other The other value to compare.
  28250. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28251. * @example
  28252. *
  28253. * var object = { 'a': 1 };
  28254. * var other = { 'a': 1 };
  28255. *
  28256. * _.eq(object, object);
  28257. * // => true
  28258. *
  28259. * _.eq(object, other);
  28260. * // => false
  28261. *
  28262. * _.eq('a', 'a');
  28263. * // => true
  28264. *
  28265. * _.eq('a', Object('a'));
  28266. * // => false
  28267. *
  28268. * _.eq(NaN, NaN);
  28269. * // => true
  28270. */
  28271. function eq(value, other) {
  28272. return value === other || (value !== value && other !== other);
  28273. }
  28274. /**
  28275. * Checks if `value` is greater than `other`.
  28276. *
  28277. * @static
  28278. * @memberOf _
  28279. * @since 3.9.0
  28280. * @category Lang
  28281. * @param {*} value The value to compare.
  28282. * @param {*} other The other value to compare.
  28283. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28284. * else `false`.
  28285. * @see _.lt
  28286. * @example
  28287. *
  28288. * _.gt(3, 1);
  28289. * // => true
  28290. *
  28291. * _.gt(3, 3);
  28292. * // => false
  28293. *
  28294. * _.gt(1, 3);
  28295. * // => false
  28296. */
  28297. var gt = createRelationalOperation(baseGt);
  28298. /**
  28299. * Checks if `value` is greater than or equal to `other`.
  28300. *
  28301. * @static
  28302. * @memberOf _
  28303. * @since 3.9.0
  28304. * @category Lang
  28305. * @param {*} value The value to compare.
  28306. * @param {*} other The other value to compare.
  28307. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28308. * `other`, else `false`.
  28309. * @see _.lte
  28310. * @example
  28311. *
  28312. * _.gte(3, 1);
  28313. * // => true
  28314. *
  28315. * _.gte(3, 3);
  28316. * // => true
  28317. *
  28318. * _.gte(1, 3);
  28319. * // => false
  28320. */
  28321. var gte = createRelationalOperation(function(value, other) {
  28322. return value >= other;
  28323. });
  28324. /**
  28325. * Checks if `value` is likely an `arguments` object.
  28326. *
  28327. * @static
  28328. * @memberOf _
  28329. * @since 0.1.0
  28330. * @category Lang
  28331. * @param {*} value The value to check.
  28332. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28333. * else `false`.
  28334. * @example
  28335. *
  28336. * _.isArguments(function() { return arguments; }());
  28337. * // => true
  28338. *
  28339. * _.isArguments([1, 2, 3]);
  28340. * // => false
  28341. */
  28342. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28343. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28344. !propertyIsEnumerable.call(value, 'callee');
  28345. };
  28346. /**
  28347. * Checks if `value` is classified as an `Array` object.
  28348. *
  28349. * @static
  28350. * @memberOf _
  28351. * @since 0.1.0
  28352. * @category Lang
  28353. * @param {*} value The value to check.
  28354. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28355. * @example
  28356. *
  28357. * _.isArray([1, 2, 3]);
  28358. * // => true
  28359. *
  28360. * _.isArray(document.body.children);
  28361. * // => false
  28362. *
  28363. * _.isArray('abc');
  28364. * // => false
  28365. *
  28366. * _.isArray(_.noop);
  28367. * // => false
  28368. */
  28369. var isArray = Array.isArray;
  28370. /**
  28371. * Checks if `value` is classified as an `ArrayBuffer` object.
  28372. *
  28373. * @static
  28374. * @memberOf _
  28375. * @since 4.3.0
  28376. * @category Lang
  28377. * @param {*} value The value to check.
  28378. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28379. * @example
  28380. *
  28381. * _.isArrayBuffer(new ArrayBuffer(2));
  28382. * // => true
  28383. *
  28384. * _.isArrayBuffer(new Array(2));
  28385. * // => false
  28386. */
  28387. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28388. /**
  28389. * Checks if `value` is array-like. A value is considered array-like if it's
  28390. * not a function and has a `value.length` that's an integer greater than or
  28391. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28392. *
  28393. * @static
  28394. * @memberOf _
  28395. * @since 4.0.0
  28396. * @category Lang
  28397. * @param {*} value The value to check.
  28398. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28399. * @example
  28400. *
  28401. * _.isArrayLike([1, 2, 3]);
  28402. * // => true
  28403. *
  28404. * _.isArrayLike(document.body.children);
  28405. * // => true
  28406. *
  28407. * _.isArrayLike('abc');
  28408. * // => true
  28409. *
  28410. * _.isArrayLike(_.noop);
  28411. * // => false
  28412. */
  28413. function isArrayLike(value) {
  28414. return value != null && isLength(value.length) && !isFunction(value);
  28415. }
  28416. /**
  28417. * This method is like `_.isArrayLike` except that it also checks if `value`
  28418. * is an object.
  28419. *
  28420. * @static
  28421. * @memberOf _
  28422. * @since 4.0.0
  28423. * @category Lang
  28424. * @param {*} value The value to check.
  28425. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28426. * else `false`.
  28427. * @example
  28428. *
  28429. * _.isArrayLikeObject([1, 2, 3]);
  28430. * // => true
  28431. *
  28432. * _.isArrayLikeObject(document.body.children);
  28433. * // => true
  28434. *
  28435. * _.isArrayLikeObject('abc');
  28436. * // => false
  28437. *
  28438. * _.isArrayLikeObject(_.noop);
  28439. * // => false
  28440. */
  28441. function isArrayLikeObject(value) {
  28442. return isObjectLike(value) && isArrayLike(value);
  28443. }
  28444. /**
  28445. * Checks if `value` is classified as a boolean primitive or object.
  28446. *
  28447. * @static
  28448. * @memberOf _
  28449. * @since 0.1.0
  28450. * @category Lang
  28451. * @param {*} value The value to check.
  28452. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28453. * @example
  28454. *
  28455. * _.isBoolean(false);
  28456. * // => true
  28457. *
  28458. * _.isBoolean(null);
  28459. * // => false
  28460. */
  28461. function isBoolean(value) {
  28462. return value === true || value === false ||
  28463. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28464. }
  28465. /**
  28466. * Checks if `value` is a buffer.
  28467. *
  28468. * @static
  28469. * @memberOf _
  28470. * @since 4.3.0
  28471. * @category Lang
  28472. * @param {*} value The value to check.
  28473. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28474. * @example
  28475. *
  28476. * _.isBuffer(new Buffer(2));
  28477. * // => true
  28478. *
  28479. * _.isBuffer(new Uint8Array(2));
  28480. * // => false
  28481. */
  28482. var isBuffer = nativeIsBuffer || stubFalse;
  28483. /**
  28484. * Checks if `value` is classified as a `Date` object.
  28485. *
  28486. * @static
  28487. * @memberOf _
  28488. * @since 0.1.0
  28489. * @category Lang
  28490. * @param {*} value The value to check.
  28491. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28492. * @example
  28493. *
  28494. * _.isDate(new Date);
  28495. * // => true
  28496. *
  28497. * _.isDate('Mon April 23 2012');
  28498. * // => false
  28499. */
  28500. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28501. /**
  28502. * Checks if `value` is likely a DOM element.
  28503. *
  28504. * @static
  28505. * @memberOf _
  28506. * @since 0.1.0
  28507. * @category Lang
  28508. * @param {*} value The value to check.
  28509. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28510. * @example
  28511. *
  28512. * _.isElement(document.body);
  28513. * // => true
  28514. *
  28515. * _.isElement('<body>');
  28516. * // => false
  28517. */
  28518. function isElement(value) {
  28519. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28520. }
  28521. /**
  28522. * Checks if `value` is an empty object, collection, map, or set.
  28523. *
  28524. * Objects are considered empty if they have no own enumerable string keyed
  28525. * properties.
  28526. *
  28527. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28528. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28529. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28530. *
  28531. * @static
  28532. * @memberOf _
  28533. * @since 0.1.0
  28534. * @category Lang
  28535. * @param {*} value The value to check.
  28536. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28537. * @example
  28538. *
  28539. * _.isEmpty(null);
  28540. * // => true
  28541. *
  28542. * _.isEmpty(true);
  28543. * // => true
  28544. *
  28545. * _.isEmpty(1);
  28546. * // => true
  28547. *
  28548. * _.isEmpty([1, 2, 3]);
  28549. * // => false
  28550. *
  28551. * _.isEmpty({ 'a': 1 });
  28552. * // => false
  28553. */
  28554. function isEmpty(value) {
  28555. if (value == null) {
  28556. return true;
  28557. }
  28558. if (isArrayLike(value) &&
  28559. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28560. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28561. return !value.length;
  28562. }
  28563. var tag = getTag(value);
  28564. if (tag == mapTag || tag == setTag) {
  28565. return !value.size;
  28566. }
  28567. if (isPrototype(value)) {
  28568. return !baseKeys(value).length;
  28569. }
  28570. for (var key in value) {
  28571. if (hasOwnProperty.call(value, key)) {
  28572. return false;
  28573. }
  28574. }
  28575. return true;
  28576. }
  28577. /**
  28578. * Performs a deep comparison between two values to determine if they are
  28579. * equivalent.
  28580. *
  28581. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28582. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28583. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28584. * by their own, not inherited, enumerable properties. Functions and DOM
  28585. * nodes are compared by strict equality, i.e. `===`.
  28586. *
  28587. * @static
  28588. * @memberOf _
  28589. * @since 0.1.0
  28590. * @category Lang
  28591. * @param {*} value The value to compare.
  28592. * @param {*} other The other value to compare.
  28593. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28594. * @example
  28595. *
  28596. * var object = { 'a': 1 };
  28597. * var other = { 'a': 1 };
  28598. *
  28599. * _.isEqual(object, other);
  28600. * // => true
  28601. *
  28602. * object === other;
  28603. * // => false
  28604. */
  28605. function isEqual(value, other) {
  28606. return baseIsEqual(value, other);
  28607. }
  28608. /**
  28609. * This method is like `_.isEqual` except that it accepts `customizer` which
  28610. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28611. * are handled by the method instead. The `customizer` is invoked with up to
  28612. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28613. *
  28614. * @static
  28615. * @memberOf _
  28616. * @since 4.0.0
  28617. * @category Lang
  28618. * @param {*} value The value to compare.
  28619. * @param {*} other The other value to compare.
  28620. * @param {Function} [customizer] The function to customize comparisons.
  28621. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28622. * @example
  28623. *
  28624. * function isGreeting(value) {
  28625. * return /^h(?:i|ello)$/.test(value);
  28626. * }
  28627. *
  28628. * function customizer(objValue, othValue) {
  28629. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28630. * return true;
  28631. * }
  28632. * }
  28633. *
  28634. * var array = ['hello', 'goodbye'];
  28635. * var other = ['hi', 'goodbye'];
  28636. *
  28637. * _.isEqualWith(array, other, customizer);
  28638. * // => true
  28639. */
  28640. function isEqualWith(value, other, customizer) {
  28641. customizer = typeof customizer == 'function' ? customizer : undefined;
  28642. var result = customizer ? customizer(value, other) : undefined;
  28643. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28644. }
  28645. /**
  28646. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28647. * `SyntaxError`, `TypeError`, or `URIError` object.
  28648. *
  28649. * @static
  28650. * @memberOf _
  28651. * @since 3.0.0
  28652. * @category Lang
  28653. * @param {*} value The value to check.
  28654. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28655. * @example
  28656. *
  28657. * _.isError(new Error);
  28658. * // => true
  28659. *
  28660. * _.isError(Error);
  28661. * // => false
  28662. */
  28663. function isError(value) {
  28664. if (!isObjectLike(value)) {
  28665. return false;
  28666. }
  28667. var tag = baseGetTag(value);
  28668. return tag == errorTag || tag == domExcTag ||
  28669. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28670. }
  28671. /**
  28672. * Checks if `value` is a finite primitive number.
  28673. *
  28674. * **Note:** This method is based on
  28675. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28676. *
  28677. * @static
  28678. * @memberOf _
  28679. * @since 0.1.0
  28680. * @category Lang
  28681. * @param {*} value The value to check.
  28682. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28683. * @example
  28684. *
  28685. * _.isFinite(3);
  28686. * // => true
  28687. *
  28688. * _.isFinite(Number.MIN_VALUE);
  28689. * // => true
  28690. *
  28691. * _.isFinite(Infinity);
  28692. * // => false
  28693. *
  28694. * _.isFinite('3');
  28695. * // => false
  28696. */
  28697. function isFinite(value) {
  28698. return typeof value == 'number' && nativeIsFinite(value);
  28699. }
  28700. /**
  28701. * Checks if `value` is classified as a `Function` object.
  28702. *
  28703. * @static
  28704. * @memberOf _
  28705. * @since 0.1.0
  28706. * @category Lang
  28707. * @param {*} value The value to check.
  28708. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28709. * @example
  28710. *
  28711. * _.isFunction(_);
  28712. * // => true
  28713. *
  28714. * _.isFunction(/abc/);
  28715. * // => false
  28716. */
  28717. function isFunction(value) {
  28718. if (!isObject(value)) {
  28719. return false;
  28720. }
  28721. // The use of `Object#toString` avoids issues with the `typeof` operator
  28722. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28723. var tag = baseGetTag(value);
  28724. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28725. }
  28726. /**
  28727. * Checks if `value` is an integer.
  28728. *
  28729. * **Note:** This method is based on
  28730. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28731. *
  28732. * @static
  28733. * @memberOf _
  28734. * @since 4.0.0
  28735. * @category Lang
  28736. * @param {*} value The value to check.
  28737. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28738. * @example
  28739. *
  28740. * _.isInteger(3);
  28741. * // => true
  28742. *
  28743. * _.isInteger(Number.MIN_VALUE);
  28744. * // => false
  28745. *
  28746. * _.isInteger(Infinity);
  28747. * // => false
  28748. *
  28749. * _.isInteger('3');
  28750. * // => false
  28751. */
  28752. function isInteger(value) {
  28753. return typeof value == 'number' && value == toInteger(value);
  28754. }
  28755. /**
  28756. * Checks if `value` is a valid array-like length.
  28757. *
  28758. * **Note:** This method is loosely based on
  28759. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28760. *
  28761. * @static
  28762. * @memberOf _
  28763. * @since 4.0.0
  28764. * @category Lang
  28765. * @param {*} value The value to check.
  28766. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28767. * @example
  28768. *
  28769. * _.isLength(3);
  28770. * // => true
  28771. *
  28772. * _.isLength(Number.MIN_VALUE);
  28773. * // => false
  28774. *
  28775. * _.isLength(Infinity);
  28776. * // => false
  28777. *
  28778. * _.isLength('3');
  28779. * // => false
  28780. */
  28781. function isLength(value) {
  28782. return typeof value == 'number' &&
  28783. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28784. }
  28785. /**
  28786. * Checks if `value` is the
  28787. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28788. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28789. *
  28790. * @static
  28791. * @memberOf _
  28792. * @since 0.1.0
  28793. * @category Lang
  28794. * @param {*} value The value to check.
  28795. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28796. * @example
  28797. *
  28798. * _.isObject({});
  28799. * // => true
  28800. *
  28801. * _.isObject([1, 2, 3]);
  28802. * // => true
  28803. *
  28804. * _.isObject(_.noop);
  28805. * // => true
  28806. *
  28807. * _.isObject(null);
  28808. * // => false
  28809. */
  28810. function isObject(value) {
  28811. var type = typeof value;
  28812. return value != null && (type == 'object' || type == 'function');
  28813. }
  28814. /**
  28815. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28816. * and has a `typeof` result of "object".
  28817. *
  28818. * @static
  28819. * @memberOf _
  28820. * @since 4.0.0
  28821. * @category Lang
  28822. * @param {*} value The value to check.
  28823. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28824. * @example
  28825. *
  28826. * _.isObjectLike({});
  28827. * // => true
  28828. *
  28829. * _.isObjectLike([1, 2, 3]);
  28830. * // => true
  28831. *
  28832. * _.isObjectLike(_.noop);
  28833. * // => false
  28834. *
  28835. * _.isObjectLike(null);
  28836. * // => false
  28837. */
  28838. function isObjectLike(value) {
  28839. return value != null && typeof value == 'object';
  28840. }
  28841. /**
  28842. * Checks if `value` is classified as a `Map` object.
  28843. *
  28844. * @static
  28845. * @memberOf _
  28846. * @since 4.3.0
  28847. * @category Lang
  28848. * @param {*} value The value to check.
  28849. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28850. * @example
  28851. *
  28852. * _.isMap(new Map);
  28853. * // => true
  28854. *
  28855. * _.isMap(new WeakMap);
  28856. * // => false
  28857. */
  28858. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28859. /**
  28860. * Performs a partial deep comparison between `object` and `source` to
  28861. * determine if `object` contains equivalent property values.
  28862. *
  28863. * **Note:** This method is equivalent to `_.matches` when `source` is
  28864. * partially applied.
  28865. *
  28866. * Partial comparisons will match empty array and empty object `source`
  28867. * values against any array or object value, respectively. See `_.isEqual`
  28868. * for a list of supported value comparisons.
  28869. *
  28870. * @static
  28871. * @memberOf _
  28872. * @since 3.0.0
  28873. * @category Lang
  28874. * @param {Object} object The object to inspect.
  28875. * @param {Object} source The object of property values to match.
  28876. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28877. * @example
  28878. *
  28879. * var object = { 'a': 1, 'b': 2 };
  28880. *
  28881. * _.isMatch(object, { 'b': 2 });
  28882. * // => true
  28883. *
  28884. * _.isMatch(object, { 'b': 1 });
  28885. * // => false
  28886. */
  28887. function isMatch(object, source) {
  28888. return object === source || baseIsMatch(object, source, getMatchData(source));
  28889. }
  28890. /**
  28891. * This method is like `_.isMatch` except that it accepts `customizer` which
  28892. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28893. * are handled by the method instead. The `customizer` is invoked with five
  28894. * arguments: (objValue, srcValue, index|key, object, source).
  28895. *
  28896. * @static
  28897. * @memberOf _
  28898. * @since 4.0.0
  28899. * @category Lang
  28900. * @param {Object} object The object to inspect.
  28901. * @param {Object} source The object of property values to match.
  28902. * @param {Function} [customizer] The function to customize comparisons.
  28903. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28904. * @example
  28905. *
  28906. * function isGreeting(value) {
  28907. * return /^h(?:i|ello)$/.test(value);
  28908. * }
  28909. *
  28910. * function customizer(objValue, srcValue) {
  28911. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28912. * return true;
  28913. * }
  28914. * }
  28915. *
  28916. * var object = { 'greeting': 'hello' };
  28917. * var source = { 'greeting': 'hi' };
  28918. *
  28919. * _.isMatchWith(object, source, customizer);
  28920. * // => true
  28921. */
  28922. function isMatchWith(object, source, customizer) {
  28923. customizer = typeof customizer == 'function' ? customizer : undefined;
  28924. return baseIsMatch(object, source, getMatchData(source), customizer);
  28925. }
  28926. /**
  28927. * Checks if `value` is `NaN`.
  28928. *
  28929. * **Note:** This method is based on
  28930. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28931. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28932. * `undefined` and other non-number values.
  28933. *
  28934. * @static
  28935. * @memberOf _
  28936. * @since 0.1.0
  28937. * @category Lang
  28938. * @param {*} value The value to check.
  28939. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28940. * @example
  28941. *
  28942. * _.isNaN(NaN);
  28943. * // => true
  28944. *
  28945. * _.isNaN(new Number(NaN));
  28946. * // => true
  28947. *
  28948. * isNaN(undefined);
  28949. * // => true
  28950. *
  28951. * _.isNaN(undefined);
  28952. * // => false
  28953. */
  28954. function isNaN(value) {
  28955. // An `NaN` primitive is the only value that is not equal to itself.
  28956. // Perform the `toStringTag` check first to avoid errors with some
  28957. // ActiveX objects in IE.
  28958. return isNumber(value) && value != +value;
  28959. }
  28960. /**
  28961. * Checks if `value` is a pristine native function.
  28962. *
  28963. * **Note:** This method can't reliably detect native functions in the presence
  28964. * of the core-js package because core-js circumvents this kind of detection.
  28965. * Despite multiple requests, the core-js maintainer has made it clear: any
  28966. * attempt to fix the detection will be obstructed. As a result, we're left
  28967. * with little choice but to throw an error. Unfortunately, this also affects
  28968. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  28969. * which rely on core-js.
  28970. *
  28971. * @static
  28972. * @memberOf _
  28973. * @since 3.0.0
  28974. * @category Lang
  28975. * @param {*} value The value to check.
  28976. * @returns {boolean} Returns `true` if `value` is a native function,
  28977. * else `false`.
  28978. * @example
  28979. *
  28980. * _.isNative(Array.prototype.push);
  28981. * // => true
  28982. *
  28983. * _.isNative(_);
  28984. * // => false
  28985. */
  28986. function isNative(value) {
  28987. if (isMaskable(value)) {
  28988. throw new Error(CORE_ERROR_TEXT);
  28989. }
  28990. return baseIsNative(value);
  28991. }
  28992. /**
  28993. * Checks if `value` is `null`.
  28994. *
  28995. * @static
  28996. * @memberOf _
  28997. * @since 0.1.0
  28998. * @category Lang
  28999. * @param {*} value The value to check.
  29000. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29001. * @example
  29002. *
  29003. * _.isNull(null);
  29004. * // => true
  29005. *
  29006. * _.isNull(void 0);
  29007. * // => false
  29008. */
  29009. function isNull(value) {
  29010. return value === null;
  29011. }
  29012. /**
  29013. * Checks if `value` is `null` or `undefined`.
  29014. *
  29015. * @static
  29016. * @memberOf _
  29017. * @since 4.0.0
  29018. * @category Lang
  29019. * @param {*} value The value to check.
  29020. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29021. * @example
  29022. *
  29023. * _.isNil(null);
  29024. * // => true
  29025. *
  29026. * _.isNil(void 0);
  29027. * // => true
  29028. *
  29029. * _.isNil(NaN);
  29030. * // => false
  29031. */
  29032. function isNil(value) {
  29033. return value == null;
  29034. }
  29035. /**
  29036. * Checks if `value` is classified as a `Number` primitive or object.
  29037. *
  29038. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29039. * classified as numbers, use the `_.isFinite` method.
  29040. *
  29041. * @static
  29042. * @memberOf _
  29043. * @since 0.1.0
  29044. * @category Lang
  29045. * @param {*} value The value to check.
  29046. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29047. * @example
  29048. *
  29049. * _.isNumber(3);
  29050. * // => true
  29051. *
  29052. * _.isNumber(Number.MIN_VALUE);
  29053. * // => true
  29054. *
  29055. * _.isNumber(Infinity);
  29056. * // => true
  29057. *
  29058. * _.isNumber('3');
  29059. * // => false
  29060. */
  29061. function isNumber(value) {
  29062. return typeof value == 'number' ||
  29063. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29064. }
  29065. /**
  29066. * Checks if `value` is a plain object, that is, an object created by the
  29067. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29068. *
  29069. * @static
  29070. * @memberOf _
  29071. * @since 0.8.0
  29072. * @category Lang
  29073. * @param {*} value The value to check.
  29074. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29075. * @example
  29076. *
  29077. * function Foo() {
  29078. * this.a = 1;
  29079. * }
  29080. *
  29081. * _.isPlainObject(new Foo);
  29082. * // => false
  29083. *
  29084. * _.isPlainObject([1, 2, 3]);
  29085. * // => false
  29086. *
  29087. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29088. * // => true
  29089. *
  29090. * _.isPlainObject(Object.create(null));
  29091. * // => true
  29092. */
  29093. function isPlainObject(value) {
  29094. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29095. return false;
  29096. }
  29097. var proto = getPrototype(value);
  29098. if (proto === null) {
  29099. return true;
  29100. }
  29101. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29102. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29103. funcToString.call(Ctor) == objectCtorString;
  29104. }
  29105. /**
  29106. * Checks if `value` is classified as a `RegExp` object.
  29107. *
  29108. * @static
  29109. * @memberOf _
  29110. * @since 0.1.0
  29111. * @category Lang
  29112. * @param {*} value The value to check.
  29113. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29114. * @example
  29115. *
  29116. * _.isRegExp(/abc/);
  29117. * // => true
  29118. *
  29119. * _.isRegExp('/abc/');
  29120. * // => false
  29121. */
  29122. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29123. /**
  29124. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29125. * double precision number which isn't the result of a rounded unsafe integer.
  29126. *
  29127. * **Note:** This method is based on
  29128. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29129. *
  29130. * @static
  29131. * @memberOf _
  29132. * @since 4.0.0
  29133. * @category Lang
  29134. * @param {*} value The value to check.
  29135. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29136. * @example
  29137. *
  29138. * _.isSafeInteger(3);
  29139. * // => true
  29140. *
  29141. * _.isSafeInteger(Number.MIN_VALUE);
  29142. * // => false
  29143. *
  29144. * _.isSafeInteger(Infinity);
  29145. * // => false
  29146. *
  29147. * _.isSafeInteger('3');
  29148. * // => false
  29149. */
  29150. function isSafeInteger(value) {
  29151. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29152. }
  29153. /**
  29154. * Checks if `value` is classified as a `Set` object.
  29155. *
  29156. * @static
  29157. * @memberOf _
  29158. * @since 4.3.0
  29159. * @category Lang
  29160. * @param {*} value The value to check.
  29161. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29162. * @example
  29163. *
  29164. * _.isSet(new Set);
  29165. * // => true
  29166. *
  29167. * _.isSet(new WeakSet);
  29168. * // => false
  29169. */
  29170. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29171. /**
  29172. * Checks if `value` is classified as a `String` primitive or object.
  29173. *
  29174. * @static
  29175. * @since 0.1.0
  29176. * @memberOf _
  29177. * @category Lang
  29178. * @param {*} value The value to check.
  29179. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29180. * @example
  29181. *
  29182. * _.isString('abc');
  29183. * // => true
  29184. *
  29185. * _.isString(1);
  29186. * // => false
  29187. */
  29188. function isString(value) {
  29189. return typeof value == 'string' ||
  29190. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29191. }
  29192. /**
  29193. * Checks if `value` is classified as a `Symbol` primitive or object.
  29194. *
  29195. * @static
  29196. * @memberOf _
  29197. * @since 4.0.0
  29198. * @category Lang
  29199. * @param {*} value The value to check.
  29200. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29201. * @example
  29202. *
  29203. * _.isSymbol(Symbol.iterator);
  29204. * // => true
  29205. *
  29206. * _.isSymbol('abc');
  29207. * // => false
  29208. */
  29209. function isSymbol(value) {
  29210. return typeof value == 'symbol' ||
  29211. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29212. }
  29213. /**
  29214. * Checks if `value` is classified as a typed array.
  29215. *
  29216. * @static
  29217. * @memberOf _
  29218. * @since 3.0.0
  29219. * @category Lang
  29220. * @param {*} value The value to check.
  29221. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29222. * @example
  29223. *
  29224. * _.isTypedArray(new Uint8Array);
  29225. * // => true
  29226. *
  29227. * _.isTypedArray([]);
  29228. * // => false
  29229. */
  29230. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29231. /**
  29232. * Checks if `value` is `undefined`.
  29233. *
  29234. * @static
  29235. * @since 0.1.0
  29236. * @memberOf _
  29237. * @category Lang
  29238. * @param {*} value The value to check.
  29239. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29240. * @example
  29241. *
  29242. * _.isUndefined(void 0);
  29243. * // => true
  29244. *
  29245. * _.isUndefined(null);
  29246. * // => false
  29247. */
  29248. function isUndefined(value) {
  29249. return value === undefined;
  29250. }
  29251. /**
  29252. * Checks if `value` is classified as a `WeakMap` object.
  29253. *
  29254. * @static
  29255. * @memberOf _
  29256. * @since 4.3.0
  29257. * @category Lang
  29258. * @param {*} value The value to check.
  29259. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29260. * @example
  29261. *
  29262. * _.isWeakMap(new WeakMap);
  29263. * // => true
  29264. *
  29265. * _.isWeakMap(new Map);
  29266. * // => false
  29267. */
  29268. function isWeakMap(value) {
  29269. return isObjectLike(value) && getTag(value) == weakMapTag;
  29270. }
  29271. /**
  29272. * Checks if `value` is classified as a `WeakSet` object.
  29273. *
  29274. * @static
  29275. * @memberOf _
  29276. * @since 4.3.0
  29277. * @category Lang
  29278. * @param {*} value The value to check.
  29279. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29280. * @example
  29281. *
  29282. * _.isWeakSet(new WeakSet);
  29283. * // => true
  29284. *
  29285. * _.isWeakSet(new Set);
  29286. * // => false
  29287. */
  29288. function isWeakSet(value) {
  29289. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29290. }
  29291. /**
  29292. * Checks if `value` is less than `other`.
  29293. *
  29294. * @static
  29295. * @memberOf _
  29296. * @since 3.9.0
  29297. * @category Lang
  29298. * @param {*} value The value to compare.
  29299. * @param {*} other The other value to compare.
  29300. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29301. * else `false`.
  29302. * @see _.gt
  29303. * @example
  29304. *
  29305. * _.lt(1, 3);
  29306. * // => true
  29307. *
  29308. * _.lt(3, 3);
  29309. * // => false
  29310. *
  29311. * _.lt(3, 1);
  29312. * // => false
  29313. */
  29314. var lt = createRelationalOperation(baseLt);
  29315. /**
  29316. * Checks if `value` is less than or equal to `other`.
  29317. *
  29318. * @static
  29319. * @memberOf _
  29320. * @since 3.9.0
  29321. * @category Lang
  29322. * @param {*} value The value to compare.
  29323. * @param {*} other The other value to compare.
  29324. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29325. * `other`, else `false`.
  29326. * @see _.gte
  29327. * @example
  29328. *
  29329. * _.lte(1, 3);
  29330. * // => true
  29331. *
  29332. * _.lte(3, 3);
  29333. * // => true
  29334. *
  29335. * _.lte(3, 1);
  29336. * // => false
  29337. */
  29338. var lte = createRelationalOperation(function(value, other) {
  29339. return value <= other;
  29340. });
  29341. /**
  29342. * Converts `value` to an array.
  29343. *
  29344. * @static
  29345. * @since 0.1.0
  29346. * @memberOf _
  29347. * @category Lang
  29348. * @param {*} value The value to convert.
  29349. * @returns {Array} Returns the converted array.
  29350. * @example
  29351. *
  29352. * _.toArray({ 'a': 1, 'b': 2 });
  29353. * // => [1, 2]
  29354. *
  29355. * _.toArray('abc');
  29356. * // => ['a', 'b', 'c']
  29357. *
  29358. * _.toArray(1);
  29359. * // => []
  29360. *
  29361. * _.toArray(null);
  29362. * // => []
  29363. */
  29364. function toArray(value) {
  29365. if (!value) {
  29366. return [];
  29367. }
  29368. if (isArrayLike(value)) {
  29369. return isString(value) ? stringToArray(value) : copyArray(value);
  29370. }
  29371. if (symIterator && value[symIterator]) {
  29372. return iteratorToArray(value[symIterator]());
  29373. }
  29374. var tag = getTag(value),
  29375. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29376. return func(value);
  29377. }
  29378. /**
  29379. * Converts `value` to a finite number.
  29380. *
  29381. * @static
  29382. * @memberOf _
  29383. * @since 4.12.0
  29384. * @category Lang
  29385. * @param {*} value The value to convert.
  29386. * @returns {number} Returns the converted number.
  29387. * @example
  29388. *
  29389. * _.toFinite(3.2);
  29390. * // => 3.2
  29391. *
  29392. * _.toFinite(Number.MIN_VALUE);
  29393. * // => 5e-324
  29394. *
  29395. * _.toFinite(Infinity);
  29396. * // => 1.7976931348623157e+308
  29397. *
  29398. * _.toFinite('3.2');
  29399. * // => 3.2
  29400. */
  29401. function toFinite(value) {
  29402. if (!value) {
  29403. return value === 0 ? value : 0;
  29404. }
  29405. value = toNumber(value);
  29406. if (value === INFINITY || value === -INFINITY) {
  29407. var sign = (value < 0 ? -1 : 1);
  29408. return sign * MAX_INTEGER;
  29409. }
  29410. return value === value ? value : 0;
  29411. }
  29412. /**
  29413. * Converts `value` to an integer.
  29414. *
  29415. * **Note:** This method is loosely based on
  29416. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29417. *
  29418. * @static
  29419. * @memberOf _
  29420. * @since 4.0.0
  29421. * @category Lang
  29422. * @param {*} value The value to convert.
  29423. * @returns {number} Returns the converted integer.
  29424. * @example
  29425. *
  29426. * _.toInteger(3.2);
  29427. * // => 3
  29428. *
  29429. * _.toInteger(Number.MIN_VALUE);
  29430. * // => 0
  29431. *
  29432. * _.toInteger(Infinity);
  29433. * // => 1.7976931348623157e+308
  29434. *
  29435. * _.toInteger('3.2');
  29436. * // => 3
  29437. */
  29438. function toInteger(value) {
  29439. var result = toFinite(value),
  29440. remainder = result % 1;
  29441. return result === result ? (remainder ? result - remainder : result) : 0;
  29442. }
  29443. /**
  29444. * Converts `value` to an integer suitable for use as the length of an
  29445. * array-like object.
  29446. *
  29447. * **Note:** This method is based on
  29448. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29449. *
  29450. * @static
  29451. * @memberOf _
  29452. * @since 4.0.0
  29453. * @category Lang
  29454. * @param {*} value The value to convert.
  29455. * @returns {number} Returns the converted integer.
  29456. * @example
  29457. *
  29458. * _.toLength(3.2);
  29459. * // => 3
  29460. *
  29461. * _.toLength(Number.MIN_VALUE);
  29462. * // => 0
  29463. *
  29464. * _.toLength(Infinity);
  29465. * // => 4294967295
  29466. *
  29467. * _.toLength('3.2');
  29468. * // => 3
  29469. */
  29470. function toLength(value) {
  29471. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29472. }
  29473. /**
  29474. * Converts `value` to a number.
  29475. *
  29476. * @static
  29477. * @memberOf _
  29478. * @since 4.0.0
  29479. * @category Lang
  29480. * @param {*} value The value to process.
  29481. * @returns {number} Returns the number.
  29482. * @example
  29483. *
  29484. * _.toNumber(3.2);
  29485. * // => 3.2
  29486. *
  29487. * _.toNumber(Number.MIN_VALUE);
  29488. * // => 5e-324
  29489. *
  29490. * _.toNumber(Infinity);
  29491. * // => Infinity
  29492. *
  29493. * _.toNumber('3.2');
  29494. * // => 3.2
  29495. */
  29496. function toNumber(value) {
  29497. if (typeof value == 'number') {
  29498. return value;
  29499. }
  29500. if (isSymbol(value)) {
  29501. return NAN;
  29502. }
  29503. if (isObject(value)) {
  29504. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29505. value = isObject(other) ? (other + '') : other;
  29506. }
  29507. if (typeof value != 'string') {
  29508. return value === 0 ? value : +value;
  29509. }
  29510. value = value.replace(reTrim, '');
  29511. var isBinary = reIsBinary.test(value);
  29512. return (isBinary || reIsOctal.test(value))
  29513. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29514. : (reIsBadHex.test(value) ? NAN : +value);
  29515. }
  29516. /**
  29517. * Converts `value` to a plain object flattening inherited enumerable string
  29518. * keyed properties of `value` to own properties of the plain object.
  29519. *
  29520. * @static
  29521. * @memberOf _
  29522. * @since 3.0.0
  29523. * @category Lang
  29524. * @param {*} value The value to convert.
  29525. * @returns {Object} Returns the converted plain object.
  29526. * @example
  29527. *
  29528. * function Foo() {
  29529. * this.b = 2;
  29530. * }
  29531. *
  29532. * Foo.prototype.c = 3;
  29533. *
  29534. * _.assign({ 'a': 1 }, new Foo);
  29535. * // => { 'a': 1, 'b': 2 }
  29536. *
  29537. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29538. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29539. */
  29540. function toPlainObject(value) {
  29541. return copyObject(value, keysIn(value));
  29542. }
  29543. /**
  29544. * Converts `value` to a safe integer. A safe integer can be compared and
  29545. * represented correctly.
  29546. *
  29547. * @static
  29548. * @memberOf _
  29549. * @since 4.0.0
  29550. * @category Lang
  29551. * @param {*} value The value to convert.
  29552. * @returns {number} Returns the converted integer.
  29553. * @example
  29554. *
  29555. * _.toSafeInteger(3.2);
  29556. * // => 3
  29557. *
  29558. * _.toSafeInteger(Number.MIN_VALUE);
  29559. * // => 0
  29560. *
  29561. * _.toSafeInteger(Infinity);
  29562. * // => 9007199254740991
  29563. *
  29564. * _.toSafeInteger('3.2');
  29565. * // => 3
  29566. */
  29567. function toSafeInteger(value) {
  29568. return value
  29569. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29570. : (value === 0 ? value : 0);
  29571. }
  29572. /**
  29573. * Converts `value` to a string. An empty string is returned for `null`
  29574. * and `undefined` values. The sign of `-0` is preserved.
  29575. *
  29576. * @static
  29577. * @memberOf _
  29578. * @since 4.0.0
  29579. * @category Lang
  29580. * @param {*} value The value to convert.
  29581. * @returns {string} Returns the converted string.
  29582. * @example
  29583. *
  29584. * _.toString(null);
  29585. * // => ''
  29586. *
  29587. * _.toString(-0);
  29588. * // => '-0'
  29589. *
  29590. * _.toString([1, 2, 3]);
  29591. * // => '1,2,3'
  29592. */
  29593. function toString(value) {
  29594. return value == null ? '' : baseToString(value);
  29595. }
  29596. /*------------------------------------------------------------------------*/
  29597. /**
  29598. * Assigns own enumerable string keyed properties of source objects to the
  29599. * destination object. Source objects are applied from left to right.
  29600. * Subsequent sources overwrite property assignments of previous sources.
  29601. *
  29602. * **Note:** This method mutates `object` and is loosely based on
  29603. * [`Object.assign`](https://mdn.io/Object/assign).
  29604. *
  29605. * @static
  29606. * @memberOf _
  29607. * @since 0.10.0
  29608. * @category Object
  29609. * @param {Object} object The destination object.
  29610. * @param {...Object} [sources] The source objects.
  29611. * @returns {Object} Returns `object`.
  29612. * @see _.assignIn
  29613. * @example
  29614. *
  29615. * function Foo() {
  29616. * this.a = 1;
  29617. * }
  29618. *
  29619. * function Bar() {
  29620. * this.c = 3;
  29621. * }
  29622. *
  29623. * Foo.prototype.b = 2;
  29624. * Bar.prototype.d = 4;
  29625. *
  29626. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29627. * // => { 'a': 1, 'c': 3 }
  29628. */
  29629. var assign = createAssigner(function(object, source) {
  29630. if (isPrototype(source) || isArrayLike(source)) {
  29631. copyObject(source, keys(source), object);
  29632. return;
  29633. }
  29634. for (var key in source) {
  29635. if (hasOwnProperty.call(source, key)) {
  29636. assignValue(object, key, source[key]);
  29637. }
  29638. }
  29639. });
  29640. /**
  29641. * This method is like `_.assign` except that it iterates over own and
  29642. * inherited source properties.
  29643. *
  29644. * **Note:** This method mutates `object`.
  29645. *
  29646. * @static
  29647. * @memberOf _
  29648. * @since 4.0.0
  29649. * @alias extend
  29650. * @category Object
  29651. * @param {Object} object The destination object.
  29652. * @param {...Object} [sources] The source objects.
  29653. * @returns {Object} Returns `object`.
  29654. * @see _.assign
  29655. * @example
  29656. *
  29657. * function Foo() {
  29658. * this.a = 1;
  29659. * }
  29660. *
  29661. * function Bar() {
  29662. * this.c = 3;
  29663. * }
  29664. *
  29665. * Foo.prototype.b = 2;
  29666. * Bar.prototype.d = 4;
  29667. *
  29668. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29669. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29670. */
  29671. var assignIn = createAssigner(function(object, source) {
  29672. copyObject(source, keysIn(source), object);
  29673. });
  29674. /**
  29675. * This method is like `_.assignIn` except that it accepts `customizer`
  29676. * which is invoked to produce the assigned values. If `customizer` returns
  29677. * `undefined`, assignment is handled by the method instead. The `customizer`
  29678. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29679. *
  29680. * **Note:** This method mutates `object`.
  29681. *
  29682. * @static
  29683. * @memberOf _
  29684. * @since 4.0.0
  29685. * @alias extendWith
  29686. * @category Object
  29687. * @param {Object} object The destination object.
  29688. * @param {...Object} sources The source objects.
  29689. * @param {Function} [customizer] The function to customize assigned values.
  29690. * @returns {Object} Returns `object`.
  29691. * @see _.assignWith
  29692. * @example
  29693. *
  29694. * function customizer(objValue, srcValue) {
  29695. * return _.isUndefined(objValue) ? srcValue : objValue;
  29696. * }
  29697. *
  29698. * var defaults = _.partialRight(_.assignInWith, customizer);
  29699. *
  29700. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29701. * // => { 'a': 1, 'b': 2 }
  29702. */
  29703. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29704. copyObject(source, keysIn(source), object, customizer);
  29705. });
  29706. /**
  29707. * This method is like `_.assign` except that it accepts `customizer`
  29708. * which is invoked to produce the assigned values. If `customizer` returns
  29709. * `undefined`, assignment is handled by the method instead. The `customizer`
  29710. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29711. *
  29712. * **Note:** This method mutates `object`.
  29713. *
  29714. * @static
  29715. * @memberOf _
  29716. * @since 4.0.0
  29717. * @category Object
  29718. * @param {Object} object The destination object.
  29719. * @param {...Object} sources The source objects.
  29720. * @param {Function} [customizer] The function to customize assigned values.
  29721. * @returns {Object} Returns `object`.
  29722. * @see _.assignInWith
  29723. * @example
  29724. *
  29725. * function customizer(objValue, srcValue) {
  29726. * return _.isUndefined(objValue) ? srcValue : objValue;
  29727. * }
  29728. *
  29729. * var defaults = _.partialRight(_.assignWith, customizer);
  29730. *
  29731. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29732. * // => { 'a': 1, 'b': 2 }
  29733. */
  29734. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29735. copyObject(source, keys(source), object, customizer);
  29736. });
  29737. /**
  29738. * Creates an array of values corresponding to `paths` of `object`.
  29739. *
  29740. * @static
  29741. * @memberOf _
  29742. * @since 1.0.0
  29743. * @category Object
  29744. * @param {Object} object The object to iterate over.
  29745. * @param {...(string|string[])} [paths] The property paths to pick.
  29746. * @returns {Array} Returns the picked values.
  29747. * @example
  29748. *
  29749. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29750. *
  29751. * _.at(object, ['a[0].b.c', 'a[1]']);
  29752. * // => [3, 4]
  29753. */
  29754. var at = flatRest(baseAt);
  29755. /**
  29756. * Creates an object that inherits from the `prototype` object. If a
  29757. * `properties` object is given, its own enumerable string keyed properties
  29758. * are assigned to the created object.
  29759. *
  29760. * @static
  29761. * @memberOf _
  29762. * @since 2.3.0
  29763. * @category Object
  29764. * @param {Object} prototype The object to inherit from.
  29765. * @param {Object} [properties] The properties to assign to the object.
  29766. * @returns {Object} Returns the new object.
  29767. * @example
  29768. *
  29769. * function Shape() {
  29770. * this.x = 0;
  29771. * this.y = 0;
  29772. * }
  29773. *
  29774. * function Circle() {
  29775. * Shape.call(this);
  29776. * }
  29777. *
  29778. * Circle.prototype = _.create(Shape.prototype, {
  29779. * 'constructor': Circle
  29780. * });
  29781. *
  29782. * var circle = new Circle;
  29783. * circle instanceof Circle;
  29784. * // => true
  29785. *
  29786. * circle instanceof Shape;
  29787. * // => true
  29788. */
  29789. function create(prototype, properties) {
  29790. var result = baseCreate(prototype);
  29791. return properties == null ? result : baseAssign(result, properties);
  29792. }
  29793. /**
  29794. * Assigns own and inherited enumerable string keyed properties of source
  29795. * objects to the destination object for all destination properties that
  29796. * resolve to `undefined`. Source objects are applied from left to right.
  29797. * Once a property is set, additional values of the same property are ignored.
  29798. *
  29799. * **Note:** This method mutates `object`.
  29800. *
  29801. * @static
  29802. * @since 0.1.0
  29803. * @memberOf _
  29804. * @category Object
  29805. * @param {Object} object The destination object.
  29806. * @param {...Object} [sources] The source objects.
  29807. * @returns {Object} Returns `object`.
  29808. * @see _.defaultsDeep
  29809. * @example
  29810. *
  29811. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29812. * // => { 'a': 1, 'b': 2 }
  29813. */
  29814. var defaults = baseRest(function(object, sources) {
  29815. object = Object(object);
  29816. var index = -1;
  29817. var length = sources.length;
  29818. var guard = length > 2 ? sources[2] : undefined;
  29819. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29820. length = 1;
  29821. }
  29822. while (++index < length) {
  29823. var source = sources[index];
  29824. var props = keysIn(source);
  29825. var propsIndex = -1;
  29826. var propsLength = props.length;
  29827. while (++propsIndex < propsLength) {
  29828. var key = props[propsIndex];
  29829. var value = object[key];
  29830. if (value === undefined ||
  29831. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29832. object[key] = source[key];
  29833. }
  29834. }
  29835. }
  29836. return object;
  29837. });
  29838. /**
  29839. * This method is like `_.defaults` except that it recursively assigns
  29840. * default properties.
  29841. *
  29842. * **Note:** This method mutates `object`.
  29843. *
  29844. * @static
  29845. * @memberOf _
  29846. * @since 3.10.0
  29847. * @category Object
  29848. * @param {Object} object The destination object.
  29849. * @param {...Object} [sources] The source objects.
  29850. * @returns {Object} Returns `object`.
  29851. * @see _.defaults
  29852. * @example
  29853. *
  29854. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29855. * // => { 'a': { 'b': 2, 'c': 3 } }
  29856. */
  29857. var defaultsDeep = baseRest(function(args) {
  29858. args.push(undefined, customDefaultsMerge);
  29859. return apply(mergeWith, undefined, args);
  29860. });
  29861. /**
  29862. * This method is like `_.find` except that it returns the key of the first
  29863. * element `predicate` returns truthy for instead of the element itself.
  29864. *
  29865. * @static
  29866. * @memberOf _
  29867. * @since 1.1.0
  29868. * @category Object
  29869. * @param {Object} object The object to inspect.
  29870. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29871. * @returns {string|undefined} Returns the key of the matched element,
  29872. * else `undefined`.
  29873. * @example
  29874. *
  29875. * var users = {
  29876. * 'barney': { 'age': 36, 'active': true },
  29877. * 'fred': { 'age': 40, 'active': false },
  29878. * 'pebbles': { 'age': 1, 'active': true }
  29879. * };
  29880. *
  29881. * _.findKey(users, function(o) { return o.age < 40; });
  29882. * // => 'barney' (iteration order is not guaranteed)
  29883. *
  29884. * // The `_.matches` iteratee shorthand.
  29885. * _.findKey(users, { 'age': 1, 'active': true });
  29886. * // => 'pebbles'
  29887. *
  29888. * // The `_.matchesProperty` iteratee shorthand.
  29889. * _.findKey(users, ['active', false]);
  29890. * // => 'fred'
  29891. *
  29892. * // The `_.property` iteratee shorthand.
  29893. * _.findKey(users, 'active');
  29894. * // => 'barney'
  29895. */
  29896. function findKey(object, predicate) {
  29897. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29898. }
  29899. /**
  29900. * This method is like `_.findKey` except that it iterates over elements of
  29901. * a collection in the opposite order.
  29902. *
  29903. * @static
  29904. * @memberOf _
  29905. * @since 2.0.0
  29906. * @category Object
  29907. * @param {Object} object The object to inspect.
  29908. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29909. * @returns {string|undefined} Returns the key of the matched element,
  29910. * else `undefined`.
  29911. * @example
  29912. *
  29913. * var users = {
  29914. * 'barney': { 'age': 36, 'active': true },
  29915. * 'fred': { 'age': 40, 'active': false },
  29916. * 'pebbles': { 'age': 1, 'active': true }
  29917. * };
  29918. *
  29919. * _.findLastKey(users, function(o) { return o.age < 40; });
  29920. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29921. *
  29922. * // The `_.matches` iteratee shorthand.
  29923. * _.findLastKey(users, { 'age': 36, 'active': true });
  29924. * // => 'barney'
  29925. *
  29926. * // The `_.matchesProperty` iteratee shorthand.
  29927. * _.findLastKey(users, ['active', false]);
  29928. * // => 'fred'
  29929. *
  29930. * // The `_.property` iteratee shorthand.
  29931. * _.findLastKey(users, 'active');
  29932. * // => 'pebbles'
  29933. */
  29934. function findLastKey(object, predicate) {
  29935. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29936. }
  29937. /**
  29938. * Iterates over own and inherited enumerable string keyed properties of an
  29939. * object and invokes `iteratee` for each property. The iteratee is invoked
  29940. * with three arguments: (value, key, object). Iteratee functions may exit
  29941. * iteration early by explicitly returning `false`.
  29942. *
  29943. * @static
  29944. * @memberOf _
  29945. * @since 0.3.0
  29946. * @category Object
  29947. * @param {Object} object The object to iterate over.
  29948. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29949. * @returns {Object} Returns `object`.
  29950. * @see _.forInRight
  29951. * @example
  29952. *
  29953. * function Foo() {
  29954. * this.a = 1;
  29955. * this.b = 2;
  29956. * }
  29957. *
  29958. * Foo.prototype.c = 3;
  29959. *
  29960. * _.forIn(new Foo, function(value, key) {
  29961. * console.log(key);
  29962. * });
  29963. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29964. */
  29965. function forIn(object, iteratee) {
  29966. return object == null
  29967. ? object
  29968. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  29969. }
  29970. /**
  29971. * This method is like `_.forIn` except that it iterates over properties of
  29972. * `object` in the opposite order.
  29973. *
  29974. * @static
  29975. * @memberOf _
  29976. * @since 2.0.0
  29977. * @category Object
  29978. * @param {Object} object The object to iterate over.
  29979. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29980. * @returns {Object} Returns `object`.
  29981. * @see _.forIn
  29982. * @example
  29983. *
  29984. * function Foo() {
  29985. * this.a = 1;
  29986. * this.b = 2;
  29987. * }
  29988. *
  29989. * Foo.prototype.c = 3;
  29990. *
  29991. * _.forInRight(new Foo, function(value, key) {
  29992. * console.log(key);
  29993. * });
  29994. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  29995. */
  29996. function forInRight(object, iteratee) {
  29997. return object == null
  29998. ? object
  29999. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30000. }
  30001. /**
  30002. * Iterates over own enumerable string keyed properties of an object and
  30003. * invokes `iteratee` for each property. The iteratee is invoked with three
  30004. * arguments: (value, key, object). Iteratee functions may exit iteration
  30005. * early by explicitly returning `false`.
  30006. *
  30007. * @static
  30008. * @memberOf _
  30009. * @since 0.3.0
  30010. * @category Object
  30011. * @param {Object} object The object to iterate over.
  30012. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30013. * @returns {Object} Returns `object`.
  30014. * @see _.forOwnRight
  30015. * @example
  30016. *
  30017. * function Foo() {
  30018. * this.a = 1;
  30019. * this.b = 2;
  30020. * }
  30021. *
  30022. * Foo.prototype.c = 3;
  30023. *
  30024. * _.forOwn(new Foo, function(value, key) {
  30025. * console.log(key);
  30026. * });
  30027. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30028. */
  30029. function forOwn(object, iteratee) {
  30030. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30031. }
  30032. /**
  30033. * This method is like `_.forOwn` except that it iterates over properties of
  30034. * `object` in the opposite order.
  30035. *
  30036. * @static
  30037. * @memberOf _
  30038. * @since 2.0.0
  30039. * @category Object
  30040. * @param {Object} object The object to iterate over.
  30041. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30042. * @returns {Object} Returns `object`.
  30043. * @see _.forOwn
  30044. * @example
  30045. *
  30046. * function Foo() {
  30047. * this.a = 1;
  30048. * this.b = 2;
  30049. * }
  30050. *
  30051. * Foo.prototype.c = 3;
  30052. *
  30053. * _.forOwnRight(new Foo, function(value, key) {
  30054. * console.log(key);
  30055. * });
  30056. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30057. */
  30058. function forOwnRight(object, iteratee) {
  30059. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30060. }
  30061. /**
  30062. * Creates an array of function property names from own enumerable properties
  30063. * of `object`.
  30064. *
  30065. * @static
  30066. * @since 0.1.0
  30067. * @memberOf _
  30068. * @category Object
  30069. * @param {Object} object The object to inspect.
  30070. * @returns {Array} Returns the function names.
  30071. * @see _.functionsIn
  30072. * @example
  30073. *
  30074. * function Foo() {
  30075. * this.a = _.constant('a');
  30076. * this.b = _.constant('b');
  30077. * }
  30078. *
  30079. * Foo.prototype.c = _.constant('c');
  30080. *
  30081. * _.functions(new Foo);
  30082. * // => ['a', 'b']
  30083. */
  30084. function functions(object) {
  30085. return object == null ? [] : baseFunctions(object, keys(object));
  30086. }
  30087. /**
  30088. * Creates an array of function property names from own and inherited
  30089. * enumerable properties of `object`.
  30090. *
  30091. * @static
  30092. * @memberOf _
  30093. * @since 4.0.0
  30094. * @category Object
  30095. * @param {Object} object The object to inspect.
  30096. * @returns {Array} Returns the function names.
  30097. * @see _.functions
  30098. * @example
  30099. *
  30100. * function Foo() {
  30101. * this.a = _.constant('a');
  30102. * this.b = _.constant('b');
  30103. * }
  30104. *
  30105. * Foo.prototype.c = _.constant('c');
  30106. *
  30107. * _.functionsIn(new Foo);
  30108. * // => ['a', 'b', 'c']
  30109. */
  30110. function functionsIn(object) {
  30111. return object == null ? [] : baseFunctions(object, keysIn(object));
  30112. }
  30113. /**
  30114. * Gets the value at `path` of `object`. If the resolved value is
  30115. * `undefined`, the `defaultValue` is returned in its place.
  30116. *
  30117. * @static
  30118. * @memberOf _
  30119. * @since 3.7.0
  30120. * @category Object
  30121. * @param {Object} object The object to query.
  30122. * @param {Array|string} path The path of the property to get.
  30123. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30124. * @returns {*} Returns the resolved value.
  30125. * @example
  30126. *
  30127. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30128. *
  30129. * _.get(object, 'a[0].b.c');
  30130. * // => 3
  30131. *
  30132. * _.get(object, ['a', '0', 'b', 'c']);
  30133. * // => 3
  30134. *
  30135. * _.get(object, 'a.b.c', 'default');
  30136. * // => 'default'
  30137. */
  30138. function get(object, path, defaultValue) {
  30139. var result = object == null ? undefined : baseGet(object, path);
  30140. return result === undefined ? defaultValue : result;
  30141. }
  30142. /**
  30143. * Checks if `path` is a direct property of `object`.
  30144. *
  30145. * @static
  30146. * @since 0.1.0
  30147. * @memberOf _
  30148. * @category Object
  30149. * @param {Object} object The object to query.
  30150. * @param {Array|string} path The path to check.
  30151. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30152. * @example
  30153. *
  30154. * var object = { 'a': { 'b': 2 } };
  30155. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30156. *
  30157. * _.has(object, 'a');
  30158. * // => true
  30159. *
  30160. * _.has(object, 'a.b');
  30161. * // => true
  30162. *
  30163. * _.has(object, ['a', 'b']);
  30164. * // => true
  30165. *
  30166. * _.has(other, 'a');
  30167. * // => false
  30168. */
  30169. function has(object, path) {
  30170. return object != null && hasPath(object, path, baseHas);
  30171. }
  30172. /**
  30173. * Checks if `path` is a direct or inherited property of `object`.
  30174. *
  30175. * @static
  30176. * @memberOf _
  30177. * @since 4.0.0
  30178. * @category Object
  30179. * @param {Object} object The object to query.
  30180. * @param {Array|string} path The path to check.
  30181. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30182. * @example
  30183. *
  30184. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30185. *
  30186. * _.hasIn(object, 'a');
  30187. * // => true
  30188. *
  30189. * _.hasIn(object, 'a.b');
  30190. * // => true
  30191. *
  30192. * _.hasIn(object, ['a', 'b']);
  30193. * // => true
  30194. *
  30195. * _.hasIn(object, 'b');
  30196. * // => false
  30197. */
  30198. function hasIn(object, path) {
  30199. return object != null && hasPath(object, path, baseHasIn);
  30200. }
  30201. /**
  30202. * Creates an object composed of the inverted keys and values of `object`.
  30203. * If `object` contains duplicate values, subsequent values overwrite
  30204. * property assignments of previous values.
  30205. *
  30206. * @static
  30207. * @memberOf _
  30208. * @since 0.7.0
  30209. * @category Object
  30210. * @param {Object} object The object to invert.
  30211. * @returns {Object} Returns the new inverted object.
  30212. * @example
  30213. *
  30214. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30215. *
  30216. * _.invert(object);
  30217. * // => { '1': 'c', '2': 'b' }
  30218. */
  30219. var invert = createInverter(function(result, value, key) {
  30220. if (value != null &&
  30221. typeof value.toString != 'function') {
  30222. value = nativeObjectToString.call(value);
  30223. }
  30224. result[value] = key;
  30225. }, constant(identity));
  30226. /**
  30227. * This method is like `_.invert` except that the inverted object is generated
  30228. * from the results of running each element of `object` thru `iteratee`. The
  30229. * corresponding inverted value of each inverted key is an array of keys
  30230. * responsible for generating the inverted value. The iteratee is invoked
  30231. * with one argument: (value).
  30232. *
  30233. * @static
  30234. * @memberOf _
  30235. * @since 4.1.0
  30236. * @category Object
  30237. * @param {Object} object The object to invert.
  30238. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30239. * @returns {Object} Returns the new inverted object.
  30240. * @example
  30241. *
  30242. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30243. *
  30244. * _.invertBy(object);
  30245. * // => { '1': ['a', 'c'], '2': ['b'] }
  30246. *
  30247. * _.invertBy(object, function(value) {
  30248. * return 'group' + value;
  30249. * });
  30250. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30251. */
  30252. var invertBy = createInverter(function(result, value, key) {
  30253. if (value != null &&
  30254. typeof value.toString != 'function') {
  30255. value = nativeObjectToString.call(value);
  30256. }
  30257. if (hasOwnProperty.call(result, value)) {
  30258. result[value].push(key);
  30259. } else {
  30260. result[value] = [key];
  30261. }
  30262. }, getIteratee);
  30263. /**
  30264. * Invokes the method at `path` of `object`.
  30265. *
  30266. * @static
  30267. * @memberOf _
  30268. * @since 4.0.0
  30269. * @category Object
  30270. * @param {Object} object The object to query.
  30271. * @param {Array|string} path The path of the method to invoke.
  30272. * @param {...*} [args] The arguments to invoke the method with.
  30273. * @returns {*} Returns the result of the invoked method.
  30274. * @example
  30275. *
  30276. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30277. *
  30278. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30279. * // => [2, 3]
  30280. */
  30281. var invoke = baseRest(baseInvoke);
  30282. /**
  30283. * Creates an array of the own enumerable property names of `object`.
  30284. *
  30285. * **Note:** Non-object values are coerced to objects. See the
  30286. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30287. * for more details.
  30288. *
  30289. * @static
  30290. * @since 0.1.0
  30291. * @memberOf _
  30292. * @category Object
  30293. * @param {Object} object The object to query.
  30294. * @returns {Array} Returns the array of property names.
  30295. * @example
  30296. *
  30297. * function Foo() {
  30298. * this.a = 1;
  30299. * this.b = 2;
  30300. * }
  30301. *
  30302. * Foo.prototype.c = 3;
  30303. *
  30304. * _.keys(new Foo);
  30305. * // => ['a', 'b'] (iteration order is not guaranteed)
  30306. *
  30307. * _.keys('hi');
  30308. * // => ['0', '1']
  30309. */
  30310. function keys(object) {
  30311. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30312. }
  30313. /**
  30314. * Creates an array of the own and inherited enumerable property names of `object`.
  30315. *
  30316. * **Note:** Non-object values are coerced to objects.
  30317. *
  30318. * @static
  30319. * @memberOf _
  30320. * @since 3.0.0
  30321. * @category Object
  30322. * @param {Object} object The object to query.
  30323. * @returns {Array} Returns the array of property names.
  30324. * @example
  30325. *
  30326. * function Foo() {
  30327. * this.a = 1;
  30328. * this.b = 2;
  30329. * }
  30330. *
  30331. * Foo.prototype.c = 3;
  30332. *
  30333. * _.keysIn(new Foo);
  30334. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30335. */
  30336. function keysIn(object) {
  30337. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30338. }
  30339. /**
  30340. * The opposite of `_.mapValues`; this method creates an object with the
  30341. * same values as `object` and keys generated by running each own enumerable
  30342. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30343. * with three arguments: (value, key, object).
  30344. *
  30345. * @static
  30346. * @memberOf _
  30347. * @since 3.8.0
  30348. * @category Object
  30349. * @param {Object} object The object to iterate over.
  30350. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30351. * @returns {Object} Returns the new mapped object.
  30352. * @see _.mapValues
  30353. * @example
  30354. *
  30355. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30356. * return key + value;
  30357. * });
  30358. * // => { 'a1': 1, 'b2': 2 }
  30359. */
  30360. function mapKeys(object, iteratee) {
  30361. var result = {};
  30362. iteratee = getIteratee(iteratee, 3);
  30363. baseForOwn(object, function(value, key, object) {
  30364. baseAssignValue(result, iteratee(value, key, object), value);
  30365. });
  30366. return result;
  30367. }
  30368. /**
  30369. * Creates an object with the same keys as `object` and values generated
  30370. * by running each own enumerable string keyed property of `object` thru
  30371. * `iteratee`. The iteratee is invoked with three arguments:
  30372. * (value, key, object).
  30373. *
  30374. * @static
  30375. * @memberOf _
  30376. * @since 2.4.0
  30377. * @category Object
  30378. * @param {Object} object The object to iterate over.
  30379. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30380. * @returns {Object} Returns the new mapped object.
  30381. * @see _.mapKeys
  30382. * @example
  30383. *
  30384. * var users = {
  30385. * 'fred': { 'user': 'fred', 'age': 40 },
  30386. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30387. * };
  30388. *
  30389. * _.mapValues(users, function(o) { return o.age; });
  30390. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30391. *
  30392. * // The `_.property` iteratee shorthand.
  30393. * _.mapValues(users, 'age');
  30394. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30395. */
  30396. function mapValues(object, iteratee) {
  30397. var result = {};
  30398. iteratee = getIteratee(iteratee, 3);
  30399. baseForOwn(object, function(value, key, object) {
  30400. baseAssignValue(result, key, iteratee(value, key, object));
  30401. });
  30402. return result;
  30403. }
  30404. /**
  30405. * This method is like `_.assign` except that it recursively merges own and
  30406. * inherited enumerable string keyed properties of source objects into the
  30407. * destination object. Source properties that resolve to `undefined` are
  30408. * skipped if a destination value exists. Array and plain object properties
  30409. * are merged recursively. Other objects and value types are overridden by
  30410. * assignment. Source objects are applied from left to right. Subsequent
  30411. * sources overwrite property assignments of previous sources.
  30412. *
  30413. * **Note:** This method mutates `object`.
  30414. *
  30415. * @static
  30416. * @memberOf _
  30417. * @since 0.5.0
  30418. * @category Object
  30419. * @param {Object} object The destination object.
  30420. * @param {...Object} [sources] The source objects.
  30421. * @returns {Object} Returns `object`.
  30422. * @example
  30423. *
  30424. * var object = {
  30425. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30426. * };
  30427. *
  30428. * var other = {
  30429. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30430. * };
  30431. *
  30432. * _.merge(object, other);
  30433. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30434. */
  30435. var merge = createAssigner(function(object, source, srcIndex) {
  30436. baseMerge(object, source, srcIndex);
  30437. });
  30438. /**
  30439. * This method is like `_.merge` except that it accepts `customizer` which
  30440. * is invoked to produce the merged values of the destination and source
  30441. * properties. If `customizer` returns `undefined`, merging is handled by the
  30442. * method instead. The `customizer` is invoked with six arguments:
  30443. * (objValue, srcValue, key, object, source, stack).
  30444. *
  30445. * **Note:** This method mutates `object`.
  30446. *
  30447. * @static
  30448. * @memberOf _
  30449. * @since 4.0.0
  30450. * @category Object
  30451. * @param {Object} object The destination object.
  30452. * @param {...Object} sources The source objects.
  30453. * @param {Function} customizer The function to customize assigned values.
  30454. * @returns {Object} Returns `object`.
  30455. * @example
  30456. *
  30457. * function customizer(objValue, srcValue) {
  30458. * if (_.isArray(objValue)) {
  30459. * return objValue.concat(srcValue);
  30460. * }
  30461. * }
  30462. *
  30463. * var object = { 'a': [1], 'b': [2] };
  30464. * var other = { 'a': [3], 'b': [4] };
  30465. *
  30466. * _.mergeWith(object, other, customizer);
  30467. * // => { 'a': [1, 3], 'b': [2, 4] }
  30468. */
  30469. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30470. baseMerge(object, source, srcIndex, customizer);
  30471. });
  30472. /**
  30473. * The opposite of `_.pick`; this method creates an object composed of the
  30474. * own and inherited enumerable property paths of `object` that are not omitted.
  30475. *
  30476. * **Note:** This method is considerably slower than `_.pick`.
  30477. *
  30478. * @static
  30479. * @since 0.1.0
  30480. * @memberOf _
  30481. * @category Object
  30482. * @param {Object} object The source object.
  30483. * @param {...(string|string[])} [paths] The property paths to omit.
  30484. * @returns {Object} Returns the new object.
  30485. * @example
  30486. *
  30487. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30488. *
  30489. * _.omit(object, ['a', 'c']);
  30490. * // => { 'b': '2' }
  30491. */
  30492. var omit = flatRest(function(object, paths) {
  30493. var result = {};
  30494. if (object == null) {
  30495. return result;
  30496. }
  30497. var isDeep = false;
  30498. paths = arrayMap(paths, function(path) {
  30499. path = castPath(path, object);
  30500. isDeep || (isDeep = path.length > 1);
  30501. return path;
  30502. });
  30503. copyObject(object, getAllKeysIn(object), result);
  30504. if (isDeep) {
  30505. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30506. }
  30507. var length = paths.length;
  30508. while (length--) {
  30509. baseUnset(result, paths[length]);
  30510. }
  30511. return result;
  30512. });
  30513. /**
  30514. * The opposite of `_.pickBy`; this method creates an object composed of
  30515. * the own and inherited enumerable string keyed properties of `object` that
  30516. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30517. * arguments: (value, key).
  30518. *
  30519. * @static
  30520. * @memberOf _
  30521. * @since 4.0.0
  30522. * @category Object
  30523. * @param {Object} object The source object.
  30524. * @param {Function} [predicate=_.identity] The function invoked per property.
  30525. * @returns {Object} Returns the new object.
  30526. * @example
  30527. *
  30528. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30529. *
  30530. * _.omitBy(object, _.isNumber);
  30531. * // => { 'b': '2' }
  30532. */
  30533. function omitBy(object, predicate) {
  30534. return pickBy(object, negate(getIteratee(predicate)));
  30535. }
  30536. /**
  30537. * Creates an object composed of the picked `object` properties.
  30538. *
  30539. * @static
  30540. * @since 0.1.0
  30541. * @memberOf _
  30542. * @category Object
  30543. * @param {Object} object The source object.
  30544. * @param {...(string|string[])} [paths] The property paths to pick.
  30545. * @returns {Object} Returns the new object.
  30546. * @example
  30547. *
  30548. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30549. *
  30550. * _.pick(object, ['a', 'c']);
  30551. * // => { 'a': 1, 'c': 3 }
  30552. */
  30553. var pick = flatRest(function(object, paths) {
  30554. return object == null ? {} : basePick(object, paths);
  30555. });
  30556. /**
  30557. * Creates an object composed of the `object` properties `predicate` returns
  30558. * truthy for. The predicate is invoked with two arguments: (value, key).
  30559. *
  30560. * @static
  30561. * @memberOf _
  30562. * @since 4.0.0
  30563. * @category Object
  30564. * @param {Object} object The source object.
  30565. * @param {Function} [predicate=_.identity] The function invoked per property.
  30566. * @returns {Object} Returns the new object.
  30567. * @example
  30568. *
  30569. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30570. *
  30571. * _.pickBy(object, _.isNumber);
  30572. * // => { 'a': 1, 'c': 3 }
  30573. */
  30574. function pickBy(object, predicate) {
  30575. if (object == null) {
  30576. return {};
  30577. }
  30578. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30579. return [prop];
  30580. });
  30581. predicate = getIteratee(predicate);
  30582. return basePickBy(object, props, function(value, path) {
  30583. return predicate(value, path[0]);
  30584. });
  30585. }
  30586. /**
  30587. * This method is like `_.get` except that if the resolved value is a
  30588. * function it's invoked with the `this` binding of its parent object and
  30589. * its result is returned.
  30590. *
  30591. * @static
  30592. * @since 0.1.0
  30593. * @memberOf _
  30594. * @category Object
  30595. * @param {Object} object The object to query.
  30596. * @param {Array|string} path The path of the property to resolve.
  30597. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30598. * @returns {*} Returns the resolved value.
  30599. * @example
  30600. *
  30601. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30602. *
  30603. * _.result(object, 'a[0].b.c1');
  30604. * // => 3
  30605. *
  30606. * _.result(object, 'a[0].b.c2');
  30607. * // => 4
  30608. *
  30609. * _.result(object, 'a[0].b.c3', 'default');
  30610. * // => 'default'
  30611. *
  30612. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30613. * // => 'default'
  30614. */
  30615. function result(object, path, defaultValue) {
  30616. path = castPath(path, object);
  30617. var index = -1,
  30618. length = path.length;
  30619. // Ensure the loop is entered when path is empty.
  30620. if (!length) {
  30621. length = 1;
  30622. object = undefined;
  30623. }
  30624. while (++index < length) {
  30625. var value = object == null ? undefined : object[toKey(path[index])];
  30626. if (value === undefined) {
  30627. index = length;
  30628. value = defaultValue;
  30629. }
  30630. object = isFunction(value) ? value.call(object) : value;
  30631. }
  30632. return object;
  30633. }
  30634. /**
  30635. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30636. * it's created. Arrays are created for missing index properties while objects
  30637. * are created for all other missing properties. Use `_.setWith` to customize
  30638. * `path` creation.
  30639. *
  30640. * **Note:** This method mutates `object`.
  30641. *
  30642. * @static
  30643. * @memberOf _
  30644. * @since 3.7.0
  30645. * @category Object
  30646. * @param {Object} object The object to modify.
  30647. * @param {Array|string} path The path of the property to set.
  30648. * @param {*} value The value to set.
  30649. * @returns {Object} Returns `object`.
  30650. * @example
  30651. *
  30652. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30653. *
  30654. * _.set(object, 'a[0].b.c', 4);
  30655. * console.log(object.a[0].b.c);
  30656. * // => 4
  30657. *
  30658. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30659. * console.log(object.x[0].y.z);
  30660. * // => 5
  30661. */
  30662. function set(object, path, value) {
  30663. return object == null ? object : baseSet(object, path, value);
  30664. }
  30665. /**
  30666. * This method is like `_.set` except that it accepts `customizer` which is
  30667. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30668. * path creation is handled by the method instead. The `customizer` is invoked
  30669. * with three arguments: (nsValue, key, nsObject).
  30670. *
  30671. * **Note:** This method mutates `object`.
  30672. *
  30673. * @static
  30674. * @memberOf _
  30675. * @since 4.0.0
  30676. * @category Object
  30677. * @param {Object} object The object to modify.
  30678. * @param {Array|string} path The path of the property to set.
  30679. * @param {*} value The value to set.
  30680. * @param {Function} [customizer] The function to customize assigned values.
  30681. * @returns {Object} Returns `object`.
  30682. * @example
  30683. *
  30684. * var object = {};
  30685. *
  30686. * _.setWith(object, '[0][1]', 'a', Object);
  30687. * // => { '0': { '1': 'a' } }
  30688. */
  30689. function setWith(object, path, value, customizer) {
  30690. customizer = typeof customizer == 'function' ? customizer : undefined;
  30691. return object == null ? object : baseSet(object, path, value, customizer);
  30692. }
  30693. /**
  30694. * Creates an array of own enumerable string keyed-value pairs for `object`
  30695. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30696. * entries are returned.
  30697. *
  30698. * @static
  30699. * @memberOf _
  30700. * @since 4.0.0
  30701. * @alias entries
  30702. * @category Object
  30703. * @param {Object} object The object to query.
  30704. * @returns {Array} Returns the key-value pairs.
  30705. * @example
  30706. *
  30707. * function Foo() {
  30708. * this.a = 1;
  30709. * this.b = 2;
  30710. * }
  30711. *
  30712. * Foo.prototype.c = 3;
  30713. *
  30714. * _.toPairs(new Foo);
  30715. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30716. */
  30717. var toPairs = createToPairs(keys);
  30718. /**
  30719. * Creates an array of own and inherited enumerable string keyed-value pairs
  30720. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30721. * or set, its entries are returned.
  30722. *
  30723. * @static
  30724. * @memberOf _
  30725. * @since 4.0.0
  30726. * @alias entriesIn
  30727. * @category Object
  30728. * @param {Object} object The object to query.
  30729. * @returns {Array} Returns the key-value pairs.
  30730. * @example
  30731. *
  30732. * function Foo() {
  30733. * this.a = 1;
  30734. * this.b = 2;
  30735. * }
  30736. *
  30737. * Foo.prototype.c = 3;
  30738. *
  30739. * _.toPairsIn(new Foo);
  30740. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30741. */
  30742. var toPairsIn = createToPairs(keysIn);
  30743. /**
  30744. * An alternative to `_.reduce`; this method transforms `object` to a new
  30745. * `accumulator` object which is the result of running each of its own
  30746. * enumerable string keyed properties thru `iteratee`, with each invocation
  30747. * potentially mutating the `accumulator` object. If `accumulator` is not
  30748. * provided, a new object with the same `[[Prototype]]` will be used. The
  30749. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30750. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30751. *
  30752. * @static
  30753. * @memberOf _
  30754. * @since 1.3.0
  30755. * @category Object
  30756. * @param {Object} object The object to iterate over.
  30757. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30758. * @param {*} [accumulator] The custom accumulator value.
  30759. * @returns {*} Returns the accumulated value.
  30760. * @example
  30761. *
  30762. * _.transform([2, 3, 4], function(result, n) {
  30763. * result.push(n *= n);
  30764. * return n % 2 == 0;
  30765. * }, []);
  30766. * // => [4, 9]
  30767. *
  30768. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30769. * (result[value] || (result[value] = [])).push(key);
  30770. * }, {});
  30771. * // => { '1': ['a', 'c'], '2': ['b'] }
  30772. */
  30773. function transform(object, iteratee, accumulator) {
  30774. var isArr = isArray(object),
  30775. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30776. iteratee = getIteratee(iteratee, 4);
  30777. if (accumulator == null) {
  30778. var Ctor = object && object.constructor;
  30779. if (isArrLike) {
  30780. accumulator = isArr ? new Ctor : [];
  30781. }
  30782. else if (isObject(object)) {
  30783. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30784. }
  30785. else {
  30786. accumulator = {};
  30787. }
  30788. }
  30789. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30790. return iteratee(accumulator, value, index, object);
  30791. });
  30792. return accumulator;
  30793. }
  30794. /**
  30795. * Removes the property at `path` of `object`.
  30796. *
  30797. * **Note:** This method mutates `object`.
  30798. *
  30799. * @static
  30800. * @memberOf _
  30801. * @since 4.0.0
  30802. * @category Object
  30803. * @param {Object} object The object to modify.
  30804. * @param {Array|string} path The path of the property to unset.
  30805. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30806. * @example
  30807. *
  30808. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30809. * _.unset(object, 'a[0].b.c');
  30810. * // => true
  30811. *
  30812. * console.log(object);
  30813. * // => { 'a': [{ 'b': {} }] };
  30814. *
  30815. * _.unset(object, ['a', '0', 'b', 'c']);
  30816. * // => true
  30817. *
  30818. * console.log(object);
  30819. * // => { 'a': [{ 'b': {} }] };
  30820. */
  30821. function unset(object, path) {
  30822. return object == null ? true : baseUnset(object, path);
  30823. }
  30824. /**
  30825. * This method is like `_.set` except that accepts `updater` to produce the
  30826. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30827. * is invoked with one argument: (value).
  30828. *
  30829. * **Note:** This method mutates `object`.
  30830. *
  30831. * @static
  30832. * @memberOf _
  30833. * @since 4.6.0
  30834. * @category Object
  30835. * @param {Object} object The object to modify.
  30836. * @param {Array|string} path The path of the property to set.
  30837. * @param {Function} updater The function to produce the updated value.
  30838. * @returns {Object} Returns `object`.
  30839. * @example
  30840. *
  30841. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30842. *
  30843. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30844. * console.log(object.a[0].b.c);
  30845. * // => 9
  30846. *
  30847. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30848. * console.log(object.x[0].y.z);
  30849. * // => 0
  30850. */
  30851. function update(object, path, updater) {
  30852. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30853. }
  30854. /**
  30855. * This method is like `_.update` except that it accepts `customizer` which is
  30856. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30857. * path creation is handled by the method instead. The `customizer` is invoked
  30858. * with three arguments: (nsValue, key, nsObject).
  30859. *
  30860. * **Note:** This method mutates `object`.
  30861. *
  30862. * @static
  30863. * @memberOf _
  30864. * @since 4.6.0
  30865. * @category Object
  30866. * @param {Object} object The object to modify.
  30867. * @param {Array|string} path The path of the property to set.
  30868. * @param {Function} updater The function to produce the updated value.
  30869. * @param {Function} [customizer] The function to customize assigned values.
  30870. * @returns {Object} Returns `object`.
  30871. * @example
  30872. *
  30873. * var object = {};
  30874. *
  30875. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30876. * // => { '0': { '1': 'a' } }
  30877. */
  30878. function updateWith(object, path, updater, customizer) {
  30879. customizer = typeof customizer == 'function' ? customizer : undefined;
  30880. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30881. }
  30882. /**
  30883. * Creates an array of the own enumerable string keyed property values of `object`.
  30884. *
  30885. * **Note:** Non-object values are coerced to objects.
  30886. *
  30887. * @static
  30888. * @since 0.1.0
  30889. * @memberOf _
  30890. * @category Object
  30891. * @param {Object} object The object to query.
  30892. * @returns {Array} Returns the array of property values.
  30893. * @example
  30894. *
  30895. * function Foo() {
  30896. * this.a = 1;
  30897. * this.b = 2;
  30898. * }
  30899. *
  30900. * Foo.prototype.c = 3;
  30901. *
  30902. * _.values(new Foo);
  30903. * // => [1, 2] (iteration order is not guaranteed)
  30904. *
  30905. * _.values('hi');
  30906. * // => ['h', 'i']
  30907. */
  30908. function values(object) {
  30909. return object == null ? [] : baseValues(object, keys(object));
  30910. }
  30911. /**
  30912. * Creates an array of the own and inherited enumerable string keyed property
  30913. * values of `object`.
  30914. *
  30915. * **Note:** Non-object values are coerced to objects.
  30916. *
  30917. * @static
  30918. * @memberOf _
  30919. * @since 3.0.0
  30920. * @category Object
  30921. * @param {Object} object The object to query.
  30922. * @returns {Array} Returns the array of property values.
  30923. * @example
  30924. *
  30925. * function Foo() {
  30926. * this.a = 1;
  30927. * this.b = 2;
  30928. * }
  30929. *
  30930. * Foo.prototype.c = 3;
  30931. *
  30932. * _.valuesIn(new Foo);
  30933. * // => [1, 2, 3] (iteration order is not guaranteed)
  30934. */
  30935. function valuesIn(object) {
  30936. return object == null ? [] : baseValues(object, keysIn(object));
  30937. }
  30938. /*------------------------------------------------------------------------*/
  30939. /**
  30940. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30941. *
  30942. * @static
  30943. * @memberOf _
  30944. * @since 4.0.0
  30945. * @category Number
  30946. * @param {number} number The number to clamp.
  30947. * @param {number} [lower] The lower bound.
  30948. * @param {number} upper The upper bound.
  30949. * @returns {number} Returns the clamped number.
  30950. * @example
  30951. *
  30952. * _.clamp(-10, -5, 5);
  30953. * // => -5
  30954. *
  30955. * _.clamp(10, -5, 5);
  30956. * // => 5
  30957. */
  30958. function clamp(number, lower, upper) {
  30959. if (upper === undefined) {
  30960. upper = lower;
  30961. lower = undefined;
  30962. }
  30963. if (upper !== undefined) {
  30964. upper = toNumber(upper);
  30965. upper = upper === upper ? upper : 0;
  30966. }
  30967. if (lower !== undefined) {
  30968. lower = toNumber(lower);
  30969. lower = lower === lower ? lower : 0;
  30970. }
  30971. return baseClamp(toNumber(number), lower, upper);
  30972. }
  30973. /**
  30974. * Checks if `n` is between `start` and up to, but not including, `end`. If
  30975. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  30976. * If `start` is greater than `end` the params are swapped to support
  30977. * negative ranges.
  30978. *
  30979. * @static
  30980. * @memberOf _
  30981. * @since 3.3.0
  30982. * @category Number
  30983. * @param {number} number The number to check.
  30984. * @param {number} [start=0] The start of the range.
  30985. * @param {number} end The end of the range.
  30986. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  30987. * @see _.range, _.rangeRight
  30988. * @example
  30989. *
  30990. * _.inRange(3, 2, 4);
  30991. * // => true
  30992. *
  30993. * _.inRange(4, 8);
  30994. * // => true
  30995. *
  30996. * _.inRange(4, 2);
  30997. * // => false
  30998. *
  30999. * _.inRange(2, 2);
  31000. * // => false
  31001. *
  31002. * _.inRange(1.2, 2);
  31003. * // => true
  31004. *
  31005. * _.inRange(5.2, 4);
  31006. * // => false
  31007. *
  31008. * _.inRange(-3, -2, -6);
  31009. * // => true
  31010. */
  31011. function inRange(number, start, end) {
  31012. start = toFinite(start);
  31013. if (end === undefined) {
  31014. end = start;
  31015. start = 0;
  31016. } else {
  31017. end = toFinite(end);
  31018. }
  31019. number = toNumber(number);
  31020. return baseInRange(number, start, end);
  31021. }
  31022. /**
  31023. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31024. * If only one argument is provided a number between `0` and the given number
  31025. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31026. * floats, a floating-point number is returned instead of an integer.
  31027. *
  31028. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31029. * floating-point values which can produce unexpected results.
  31030. *
  31031. * @static
  31032. * @memberOf _
  31033. * @since 0.7.0
  31034. * @category Number
  31035. * @param {number} [lower=0] The lower bound.
  31036. * @param {number} [upper=1] The upper bound.
  31037. * @param {boolean} [floating] Specify returning a floating-point number.
  31038. * @returns {number} Returns the random number.
  31039. * @example
  31040. *
  31041. * _.random(0, 5);
  31042. * // => an integer between 0 and 5
  31043. *
  31044. * _.random(5);
  31045. * // => also an integer between 0 and 5
  31046. *
  31047. * _.random(5, true);
  31048. * // => a floating-point number between 0 and 5
  31049. *
  31050. * _.random(1.2, 5.2);
  31051. * // => a floating-point number between 1.2 and 5.2
  31052. */
  31053. function random(lower, upper, floating) {
  31054. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31055. upper = floating = undefined;
  31056. }
  31057. if (floating === undefined) {
  31058. if (typeof upper == 'boolean') {
  31059. floating = upper;
  31060. upper = undefined;
  31061. }
  31062. else if (typeof lower == 'boolean') {
  31063. floating = lower;
  31064. lower = undefined;
  31065. }
  31066. }
  31067. if (lower === undefined && upper === undefined) {
  31068. lower = 0;
  31069. upper = 1;
  31070. }
  31071. else {
  31072. lower = toFinite(lower);
  31073. if (upper === undefined) {
  31074. upper = lower;
  31075. lower = 0;
  31076. } else {
  31077. upper = toFinite(upper);
  31078. }
  31079. }
  31080. if (lower > upper) {
  31081. var temp = lower;
  31082. lower = upper;
  31083. upper = temp;
  31084. }
  31085. if (floating || lower % 1 || upper % 1) {
  31086. var rand = nativeRandom();
  31087. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31088. }
  31089. return baseRandom(lower, upper);
  31090. }
  31091. /*------------------------------------------------------------------------*/
  31092. /**
  31093. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31094. *
  31095. * @static
  31096. * @memberOf _
  31097. * @since 3.0.0
  31098. * @category String
  31099. * @param {string} [string=''] The string to convert.
  31100. * @returns {string} Returns the camel cased string.
  31101. * @example
  31102. *
  31103. * _.camelCase('Foo Bar');
  31104. * // => 'fooBar'
  31105. *
  31106. * _.camelCase('--foo-bar--');
  31107. * // => 'fooBar'
  31108. *
  31109. * _.camelCase('__FOO_BAR__');
  31110. * // => 'fooBar'
  31111. */
  31112. var camelCase = createCompounder(function(result, word, index) {
  31113. word = word.toLowerCase();
  31114. return result + (index ? capitalize(word) : word);
  31115. });
  31116. /**
  31117. * Converts the first character of `string` to upper case and the remaining
  31118. * to lower case.
  31119. *
  31120. * @static
  31121. * @memberOf _
  31122. * @since 3.0.0
  31123. * @category String
  31124. * @param {string} [string=''] The string to capitalize.
  31125. * @returns {string} Returns the capitalized string.
  31126. * @example
  31127. *
  31128. * _.capitalize('FRED');
  31129. * // => 'Fred'
  31130. */
  31131. function capitalize(string) {
  31132. return upperFirst(toString(string).toLowerCase());
  31133. }
  31134. /**
  31135. * Deburrs `string` by converting
  31136. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31137. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31138. * letters to basic Latin letters and removing
  31139. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31140. *
  31141. * @static
  31142. * @memberOf _
  31143. * @since 3.0.0
  31144. * @category String
  31145. * @param {string} [string=''] The string to deburr.
  31146. * @returns {string} Returns the deburred string.
  31147. * @example
  31148. *
  31149. * _.deburr('déjà vu');
  31150. * // => 'deja vu'
  31151. */
  31152. function deburr(string) {
  31153. string = toString(string);
  31154. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31155. }
  31156. /**
  31157. * Checks if `string` ends with the given target string.
  31158. *
  31159. * @static
  31160. * @memberOf _
  31161. * @since 3.0.0
  31162. * @category String
  31163. * @param {string} [string=''] The string to inspect.
  31164. * @param {string} [target] The string to search for.
  31165. * @param {number} [position=string.length] The position to search up to.
  31166. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31167. * else `false`.
  31168. * @example
  31169. *
  31170. * _.endsWith('abc', 'c');
  31171. * // => true
  31172. *
  31173. * _.endsWith('abc', 'b');
  31174. * // => false
  31175. *
  31176. * _.endsWith('abc', 'b', 2);
  31177. * // => true
  31178. */
  31179. function endsWith(string, target, position) {
  31180. string = toString(string);
  31181. target = baseToString(target);
  31182. var length = string.length;
  31183. position = position === undefined
  31184. ? length
  31185. : baseClamp(toInteger(position), 0, length);
  31186. var end = position;
  31187. position -= target.length;
  31188. return position >= 0 && string.slice(position, end) == target;
  31189. }
  31190. /**
  31191. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31192. * corresponding HTML entities.
  31193. *
  31194. * **Note:** No other characters are escaped. To escape additional
  31195. * characters use a third-party library like [_he_](https://mths.be/he).
  31196. *
  31197. * Though the ">" character is escaped for symmetry, characters like
  31198. * ">" and "/" don't need escaping in HTML and have no special meaning
  31199. * unless they're part of a tag or unquoted attribute value. See
  31200. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31201. * (under "semi-related fun fact") for more details.
  31202. *
  31203. * When working with HTML you should always
  31204. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31205. * XSS vectors.
  31206. *
  31207. * @static
  31208. * @since 0.1.0
  31209. * @memberOf _
  31210. * @category String
  31211. * @param {string} [string=''] The string to escape.
  31212. * @returns {string} Returns the escaped string.
  31213. * @example
  31214. *
  31215. * _.escape('fred, barney, & pebbles');
  31216. * // => 'fred, barney, &amp; pebbles'
  31217. */
  31218. function escape(string) {
  31219. string = toString(string);
  31220. return (string && reHasUnescapedHtml.test(string))
  31221. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31222. : string;
  31223. }
  31224. /**
  31225. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31226. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31227. *
  31228. * @static
  31229. * @memberOf _
  31230. * @since 3.0.0
  31231. * @category String
  31232. * @param {string} [string=''] The string to escape.
  31233. * @returns {string} Returns the escaped string.
  31234. * @example
  31235. *
  31236. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31237. * // => '\[lodash\]\(https://lodash\.com/\)'
  31238. */
  31239. function escapeRegExp(string) {
  31240. string = toString(string);
  31241. return (string && reHasRegExpChar.test(string))
  31242. ? string.replace(reRegExpChar, '\\$&')
  31243. : string;
  31244. }
  31245. /**
  31246. * Converts `string` to
  31247. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31248. *
  31249. * @static
  31250. * @memberOf _
  31251. * @since 3.0.0
  31252. * @category String
  31253. * @param {string} [string=''] The string to convert.
  31254. * @returns {string} Returns the kebab cased string.
  31255. * @example
  31256. *
  31257. * _.kebabCase('Foo Bar');
  31258. * // => 'foo-bar'
  31259. *
  31260. * _.kebabCase('fooBar');
  31261. * // => 'foo-bar'
  31262. *
  31263. * _.kebabCase('__FOO_BAR__');
  31264. * // => 'foo-bar'
  31265. */
  31266. var kebabCase = createCompounder(function(result, word, index) {
  31267. return result + (index ? '-' : '') + word.toLowerCase();
  31268. });
  31269. /**
  31270. * Converts `string`, as space separated words, to lower case.
  31271. *
  31272. * @static
  31273. * @memberOf _
  31274. * @since 4.0.0
  31275. * @category String
  31276. * @param {string} [string=''] The string to convert.
  31277. * @returns {string} Returns the lower cased string.
  31278. * @example
  31279. *
  31280. * _.lowerCase('--Foo-Bar--');
  31281. * // => 'foo bar'
  31282. *
  31283. * _.lowerCase('fooBar');
  31284. * // => 'foo bar'
  31285. *
  31286. * _.lowerCase('__FOO_BAR__');
  31287. * // => 'foo bar'
  31288. */
  31289. var lowerCase = createCompounder(function(result, word, index) {
  31290. return result + (index ? ' ' : '') + word.toLowerCase();
  31291. });
  31292. /**
  31293. * Converts the first character of `string` to lower case.
  31294. *
  31295. * @static
  31296. * @memberOf _
  31297. * @since 4.0.0
  31298. * @category String
  31299. * @param {string} [string=''] The string to convert.
  31300. * @returns {string} Returns the converted string.
  31301. * @example
  31302. *
  31303. * _.lowerFirst('Fred');
  31304. * // => 'fred'
  31305. *
  31306. * _.lowerFirst('FRED');
  31307. * // => 'fRED'
  31308. */
  31309. var lowerFirst = createCaseFirst('toLowerCase');
  31310. /**
  31311. * Pads `string` on the left and right sides if it's shorter than `length`.
  31312. * Padding characters are truncated if they can't be evenly divided by `length`.
  31313. *
  31314. * @static
  31315. * @memberOf _
  31316. * @since 3.0.0
  31317. * @category String
  31318. * @param {string} [string=''] The string to pad.
  31319. * @param {number} [length=0] The padding length.
  31320. * @param {string} [chars=' '] The string used as padding.
  31321. * @returns {string} Returns the padded string.
  31322. * @example
  31323. *
  31324. * _.pad('abc', 8);
  31325. * // => ' abc '
  31326. *
  31327. * _.pad('abc', 8, '_-');
  31328. * // => '_-abc_-_'
  31329. *
  31330. * _.pad('abc', 3);
  31331. * // => 'abc'
  31332. */
  31333. function pad(string, length, chars) {
  31334. string = toString(string);
  31335. length = toInteger(length);
  31336. var strLength = length ? stringSize(string) : 0;
  31337. if (!length || strLength >= length) {
  31338. return string;
  31339. }
  31340. var mid = (length - strLength) / 2;
  31341. return (
  31342. createPadding(nativeFloor(mid), chars) +
  31343. string +
  31344. createPadding(nativeCeil(mid), chars)
  31345. );
  31346. }
  31347. /**
  31348. * Pads `string` on the right side if it's shorter than `length`. Padding
  31349. * characters are truncated if they exceed `length`.
  31350. *
  31351. * @static
  31352. * @memberOf _
  31353. * @since 4.0.0
  31354. * @category String
  31355. * @param {string} [string=''] The string to pad.
  31356. * @param {number} [length=0] The padding length.
  31357. * @param {string} [chars=' '] The string used as padding.
  31358. * @returns {string} Returns the padded string.
  31359. * @example
  31360. *
  31361. * _.padEnd('abc', 6);
  31362. * // => 'abc '
  31363. *
  31364. * _.padEnd('abc', 6, '_-');
  31365. * // => 'abc_-_'
  31366. *
  31367. * _.padEnd('abc', 3);
  31368. * // => 'abc'
  31369. */
  31370. function padEnd(string, length, chars) {
  31371. string = toString(string);
  31372. length = toInteger(length);
  31373. var strLength = length ? stringSize(string) : 0;
  31374. return (length && strLength < length)
  31375. ? (string + createPadding(length - strLength, chars))
  31376. : string;
  31377. }
  31378. /**
  31379. * Pads `string` on the left side if it's shorter than `length`. Padding
  31380. * characters are truncated if they exceed `length`.
  31381. *
  31382. * @static
  31383. * @memberOf _
  31384. * @since 4.0.0
  31385. * @category String
  31386. * @param {string} [string=''] The string to pad.
  31387. * @param {number} [length=0] The padding length.
  31388. * @param {string} [chars=' '] The string used as padding.
  31389. * @returns {string} Returns the padded string.
  31390. * @example
  31391. *
  31392. * _.padStart('abc', 6);
  31393. * // => ' abc'
  31394. *
  31395. * _.padStart('abc', 6, '_-');
  31396. * // => '_-_abc'
  31397. *
  31398. * _.padStart('abc', 3);
  31399. * // => 'abc'
  31400. */
  31401. function padStart(string, length, chars) {
  31402. string = toString(string);
  31403. length = toInteger(length);
  31404. var strLength = length ? stringSize(string) : 0;
  31405. return (length && strLength < length)
  31406. ? (createPadding(length - strLength, chars) + string)
  31407. : string;
  31408. }
  31409. /**
  31410. * Converts `string` to an integer of the specified radix. If `radix` is
  31411. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31412. * hexadecimal, in which case a `radix` of `16` is used.
  31413. *
  31414. * **Note:** This method aligns with the
  31415. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31416. *
  31417. * @static
  31418. * @memberOf _
  31419. * @since 1.1.0
  31420. * @category String
  31421. * @param {string} string The string to convert.
  31422. * @param {number} [radix=10] The radix to interpret `value` by.
  31423. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31424. * @returns {number} Returns the converted integer.
  31425. * @example
  31426. *
  31427. * _.parseInt('08');
  31428. * // => 8
  31429. *
  31430. * _.map(['6', '08', '10'], _.parseInt);
  31431. * // => [6, 8, 10]
  31432. */
  31433. function parseInt(string, radix, guard) {
  31434. if (guard || radix == null) {
  31435. radix = 0;
  31436. } else if (radix) {
  31437. radix = +radix;
  31438. }
  31439. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31440. }
  31441. /**
  31442. * Repeats the given string `n` times.
  31443. *
  31444. * @static
  31445. * @memberOf _
  31446. * @since 3.0.0
  31447. * @category String
  31448. * @param {string} [string=''] The string to repeat.
  31449. * @param {number} [n=1] The number of times to repeat the string.
  31450. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31451. * @returns {string} Returns the repeated string.
  31452. * @example
  31453. *
  31454. * _.repeat('*', 3);
  31455. * // => '***'
  31456. *
  31457. * _.repeat('abc', 2);
  31458. * // => 'abcabc'
  31459. *
  31460. * _.repeat('abc', 0);
  31461. * // => ''
  31462. */
  31463. function repeat(string, n, guard) {
  31464. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31465. n = 1;
  31466. } else {
  31467. n = toInteger(n);
  31468. }
  31469. return baseRepeat(toString(string), n);
  31470. }
  31471. /**
  31472. * Replaces matches for `pattern` in `string` with `replacement`.
  31473. *
  31474. * **Note:** This method is based on
  31475. * [`String#replace`](https://mdn.io/String/replace).
  31476. *
  31477. * @static
  31478. * @memberOf _
  31479. * @since 4.0.0
  31480. * @category String
  31481. * @param {string} [string=''] The string to modify.
  31482. * @param {RegExp|string} pattern The pattern to replace.
  31483. * @param {Function|string} replacement The match replacement.
  31484. * @returns {string} Returns the modified string.
  31485. * @example
  31486. *
  31487. * _.replace('Hi Fred', 'Fred', 'Barney');
  31488. * // => 'Hi Barney'
  31489. */
  31490. function replace() {
  31491. var args = arguments,
  31492. string = toString(args[0]);
  31493. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31494. }
  31495. /**
  31496. * Converts `string` to
  31497. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31498. *
  31499. * @static
  31500. * @memberOf _
  31501. * @since 3.0.0
  31502. * @category String
  31503. * @param {string} [string=''] The string to convert.
  31504. * @returns {string} Returns the snake cased string.
  31505. * @example
  31506. *
  31507. * _.snakeCase('Foo Bar');
  31508. * // => 'foo_bar'
  31509. *
  31510. * _.snakeCase('fooBar');
  31511. * // => 'foo_bar'
  31512. *
  31513. * _.snakeCase('--FOO-BAR--');
  31514. * // => 'foo_bar'
  31515. */
  31516. var snakeCase = createCompounder(function(result, word, index) {
  31517. return result + (index ? '_' : '') + word.toLowerCase();
  31518. });
  31519. /**
  31520. * Splits `string` by `separator`.
  31521. *
  31522. * **Note:** This method is based on
  31523. * [`String#split`](https://mdn.io/String/split).
  31524. *
  31525. * @static
  31526. * @memberOf _
  31527. * @since 4.0.0
  31528. * @category String
  31529. * @param {string} [string=''] The string to split.
  31530. * @param {RegExp|string} separator The separator pattern to split by.
  31531. * @param {number} [limit] The length to truncate results to.
  31532. * @returns {Array} Returns the string segments.
  31533. * @example
  31534. *
  31535. * _.split('a-b-c', '-', 2);
  31536. * // => ['a', 'b']
  31537. */
  31538. function split(string, separator, limit) {
  31539. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31540. separator = limit = undefined;
  31541. }
  31542. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31543. if (!limit) {
  31544. return [];
  31545. }
  31546. string = toString(string);
  31547. if (string && (
  31548. typeof separator == 'string' ||
  31549. (separator != null && !isRegExp(separator))
  31550. )) {
  31551. separator = baseToString(separator);
  31552. if (!separator && hasUnicode(string)) {
  31553. return castSlice(stringToArray(string), 0, limit);
  31554. }
  31555. }
  31556. return string.split(separator, limit);
  31557. }
  31558. /**
  31559. * Converts `string` to
  31560. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31561. *
  31562. * @static
  31563. * @memberOf _
  31564. * @since 3.1.0
  31565. * @category String
  31566. * @param {string} [string=''] The string to convert.
  31567. * @returns {string} Returns the start cased string.
  31568. * @example
  31569. *
  31570. * _.startCase('--foo-bar--');
  31571. * // => 'Foo Bar'
  31572. *
  31573. * _.startCase('fooBar');
  31574. * // => 'Foo Bar'
  31575. *
  31576. * _.startCase('__FOO_BAR__');
  31577. * // => 'FOO BAR'
  31578. */
  31579. var startCase = createCompounder(function(result, word, index) {
  31580. return result + (index ? ' ' : '') + upperFirst(word);
  31581. });
  31582. /**
  31583. * Checks if `string` starts with the given target string.
  31584. *
  31585. * @static
  31586. * @memberOf _
  31587. * @since 3.0.0
  31588. * @category String
  31589. * @param {string} [string=''] The string to inspect.
  31590. * @param {string} [target] The string to search for.
  31591. * @param {number} [position=0] The position to search from.
  31592. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31593. * else `false`.
  31594. * @example
  31595. *
  31596. * _.startsWith('abc', 'a');
  31597. * // => true
  31598. *
  31599. * _.startsWith('abc', 'b');
  31600. * // => false
  31601. *
  31602. * _.startsWith('abc', 'b', 1);
  31603. * // => true
  31604. */
  31605. function startsWith(string, target, position) {
  31606. string = toString(string);
  31607. position = position == null
  31608. ? 0
  31609. : baseClamp(toInteger(position), 0, string.length);
  31610. target = baseToString(target);
  31611. return string.slice(position, position + target.length) == target;
  31612. }
  31613. /**
  31614. * Creates a compiled template function that can interpolate data properties
  31615. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31616. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31617. * properties may be accessed as free variables in the template. If a setting
  31618. * object is given, it takes precedence over `_.templateSettings` values.
  31619. *
  31620. * **Note:** In the development build `_.template` utilizes
  31621. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31622. * for easier debugging.
  31623. *
  31624. * For more information on precompiling templates see
  31625. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31626. *
  31627. * For more information on Chrome extension sandboxes see
  31628. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31629. *
  31630. * @static
  31631. * @since 0.1.0
  31632. * @memberOf _
  31633. * @category String
  31634. * @param {string} [string=''] The template string.
  31635. * @param {Object} [options={}] The options object.
  31636. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31637. * The HTML "escape" delimiter.
  31638. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31639. * The "evaluate" delimiter.
  31640. * @param {Object} [options.imports=_.templateSettings.imports]
  31641. * An object to import into the template as free variables.
  31642. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31643. * The "interpolate" delimiter.
  31644. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31645. * The sourceURL of the compiled template.
  31646. * @param {string} [options.variable='obj']
  31647. * The data object variable name.
  31648. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31649. * @returns {Function} Returns the compiled template function.
  31650. * @example
  31651. *
  31652. * // Use the "interpolate" delimiter to create a compiled template.
  31653. * var compiled = _.template('hello <%= user %>!');
  31654. * compiled({ 'user': 'fred' });
  31655. * // => 'hello fred!'
  31656. *
  31657. * // Use the HTML "escape" delimiter to escape data property values.
  31658. * var compiled = _.template('<b><%- value %></b>');
  31659. * compiled({ 'value': '<script>' });
  31660. * // => '<b>&lt;script&gt;</b>'
  31661. *
  31662. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31663. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31664. * compiled({ 'users': ['fred', 'barney'] });
  31665. * // => '<li>fred</li><li>barney</li>'
  31666. *
  31667. * // Use the internal `print` function in "evaluate" delimiters.
  31668. * var compiled = _.template('<% print("hello " + user); %>!');
  31669. * compiled({ 'user': 'barney' });
  31670. * // => 'hello barney!'
  31671. *
  31672. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31673. * // Disable support by replacing the "interpolate" delimiter.
  31674. * var compiled = _.template('hello ${ user }!');
  31675. * compiled({ 'user': 'pebbles' });
  31676. * // => 'hello pebbles!'
  31677. *
  31678. * // Use backslashes to treat delimiters as plain text.
  31679. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31680. * compiled({ 'value': 'ignored' });
  31681. * // => '<%- value %>'
  31682. *
  31683. * // Use the `imports` option to import `jQuery` as `jq`.
  31684. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31685. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31686. * compiled({ 'users': ['fred', 'barney'] });
  31687. * // => '<li>fred</li><li>barney</li>'
  31688. *
  31689. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31690. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31691. * compiled(data);
  31692. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31693. *
  31694. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31695. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31696. * compiled.source;
  31697. * // => function(data) {
  31698. * // var __t, __p = '';
  31699. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31700. * // return __p;
  31701. * // }
  31702. *
  31703. * // Use custom template delimiters.
  31704. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31705. * var compiled = _.template('hello {{ user }}!');
  31706. * compiled({ 'user': 'mustache' });
  31707. * // => 'hello mustache!'
  31708. *
  31709. * // Use the `source` property to inline compiled templates for meaningful
  31710. * // line numbers in error messages and stack traces.
  31711. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31712. * var JST = {\
  31713. * "main": ' + _.template(mainText).source + '\
  31714. * };\
  31715. * ');
  31716. */
  31717. function template(string, options, guard) {
  31718. // Based on John Resig's `tmpl` implementation
  31719. // (http://ejohn.org/blog/javascript-micro-templating/)
  31720. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31721. var settings = lodash.templateSettings;
  31722. if (guard && isIterateeCall(string, options, guard)) {
  31723. options = undefined;
  31724. }
  31725. string = toString(string);
  31726. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31727. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31728. importsKeys = keys(imports),
  31729. importsValues = baseValues(imports, importsKeys);
  31730. var isEscaping,
  31731. isEvaluating,
  31732. index = 0,
  31733. interpolate = options.interpolate || reNoMatch,
  31734. source = "__p += '";
  31735. // Compile the regexp to match each delimiter.
  31736. var reDelimiters = RegExp(
  31737. (options.escape || reNoMatch).source + '|' +
  31738. interpolate.source + '|' +
  31739. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31740. (options.evaluate || reNoMatch).source + '|$'
  31741. , 'g');
  31742. // Use a sourceURL for easier debugging.
  31743. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31744. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31745. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31746. var sourceURL = '//# sourceURL=' +
  31747. (hasOwnProperty.call(options, 'sourceURL')
  31748. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31749. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31750. ) + '\n';
  31751. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31752. interpolateValue || (interpolateValue = esTemplateValue);
  31753. // Escape characters that can't be included in string literals.
  31754. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31755. // Replace delimiters with snippets.
  31756. if (escapeValue) {
  31757. isEscaping = true;
  31758. source += "' +\n__e(" + escapeValue + ") +\n'";
  31759. }
  31760. if (evaluateValue) {
  31761. isEvaluating = true;
  31762. source += "';\n" + evaluateValue + ";\n__p += '";
  31763. }
  31764. if (interpolateValue) {
  31765. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31766. }
  31767. index = offset + match.length;
  31768. // The JS engine embedded in Adobe products needs `match` returned in
  31769. // order to produce the correct `offset` value.
  31770. return match;
  31771. });
  31772. source += "';\n";
  31773. // If `variable` is not specified wrap a with-statement around the generated
  31774. // code to add the data object to the top of the scope chain.
  31775. // Like with sourceURL, we take care to not check the option's prototype,
  31776. // as this configuration is a code injection vector.
  31777. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31778. if (!variable) {
  31779. source = 'with (obj) {\n' + source + '\n}\n';
  31780. }
  31781. // Cleanup code by stripping empty strings.
  31782. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31783. .replace(reEmptyStringMiddle, '$1')
  31784. .replace(reEmptyStringTrailing, '$1;');
  31785. // Frame code as the function body.
  31786. source = 'function(' + (variable || 'obj') + ') {\n' +
  31787. (variable
  31788. ? ''
  31789. : 'obj || (obj = {});\n'
  31790. ) +
  31791. "var __t, __p = ''" +
  31792. (isEscaping
  31793. ? ', __e = _.escape'
  31794. : ''
  31795. ) +
  31796. (isEvaluating
  31797. ? ', __j = Array.prototype.join;\n' +
  31798. "function print() { __p += __j.call(arguments, '') }\n"
  31799. : ';\n'
  31800. ) +
  31801. source +
  31802. 'return __p\n}';
  31803. var result = attempt(function() {
  31804. return Function(importsKeys, sourceURL + 'return ' + source)
  31805. .apply(undefined, importsValues);
  31806. });
  31807. // Provide the compiled function's source by its `toString` method or
  31808. // the `source` property as a convenience for inlining compiled templates.
  31809. result.source = source;
  31810. if (isError(result)) {
  31811. throw result;
  31812. }
  31813. return result;
  31814. }
  31815. /**
  31816. * Converts `string`, as a whole, to lower case just like
  31817. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31818. *
  31819. * @static
  31820. * @memberOf _
  31821. * @since 4.0.0
  31822. * @category String
  31823. * @param {string} [string=''] The string to convert.
  31824. * @returns {string} Returns the lower cased string.
  31825. * @example
  31826. *
  31827. * _.toLower('--Foo-Bar--');
  31828. * // => '--foo-bar--'
  31829. *
  31830. * _.toLower('fooBar');
  31831. * // => 'foobar'
  31832. *
  31833. * _.toLower('__FOO_BAR__');
  31834. * // => '__foo_bar__'
  31835. */
  31836. function toLower(value) {
  31837. return toString(value).toLowerCase();
  31838. }
  31839. /**
  31840. * Converts `string`, as a whole, to upper case just like
  31841. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31842. *
  31843. * @static
  31844. * @memberOf _
  31845. * @since 4.0.0
  31846. * @category String
  31847. * @param {string} [string=''] The string to convert.
  31848. * @returns {string} Returns the upper cased string.
  31849. * @example
  31850. *
  31851. * _.toUpper('--foo-bar--');
  31852. * // => '--FOO-BAR--'
  31853. *
  31854. * _.toUpper('fooBar');
  31855. * // => 'FOOBAR'
  31856. *
  31857. * _.toUpper('__foo_bar__');
  31858. * // => '__FOO_BAR__'
  31859. */
  31860. function toUpper(value) {
  31861. return toString(value).toUpperCase();
  31862. }
  31863. /**
  31864. * Removes leading and trailing whitespace or specified characters from `string`.
  31865. *
  31866. * @static
  31867. * @memberOf _
  31868. * @since 3.0.0
  31869. * @category String
  31870. * @param {string} [string=''] The string to trim.
  31871. * @param {string} [chars=whitespace] The characters to trim.
  31872. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31873. * @returns {string} Returns the trimmed string.
  31874. * @example
  31875. *
  31876. * _.trim(' abc ');
  31877. * // => 'abc'
  31878. *
  31879. * _.trim('-_-abc-_-', '_-');
  31880. * // => 'abc'
  31881. *
  31882. * _.map([' foo ', ' bar '], _.trim);
  31883. * // => ['foo', 'bar']
  31884. */
  31885. function trim(string, chars, guard) {
  31886. string = toString(string);
  31887. if (string && (guard || chars === undefined)) {
  31888. return string.replace(reTrim, '');
  31889. }
  31890. if (!string || !(chars = baseToString(chars))) {
  31891. return string;
  31892. }
  31893. var strSymbols = stringToArray(string),
  31894. chrSymbols = stringToArray(chars),
  31895. start = charsStartIndex(strSymbols, chrSymbols),
  31896. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31897. return castSlice(strSymbols, start, end).join('');
  31898. }
  31899. /**
  31900. * Removes trailing whitespace or specified characters from `string`.
  31901. *
  31902. * @static
  31903. * @memberOf _
  31904. * @since 4.0.0
  31905. * @category String
  31906. * @param {string} [string=''] The string to trim.
  31907. * @param {string} [chars=whitespace] The characters to trim.
  31908. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31909. * @returns {string} Returns the trimmed string.
  31910. * @example
  31911. *
  31912. * _.trimEnd(' abc ');
  31913. * // => ' abc'
  31914. *
  31915. * _.trimEnd('-_-abc-_-', '_-');
  31916. * // => '-_-abc'
  31917. */
  31918. function trimEnd(string, chars, guard) {
  31919. string = toString(string);
  31920. if (string && (guard || chars === undefined)) {
  31921. return string.replace(reTrimEnd, '');
  31922. }
  31923. if (!string || !(chars = baseToString(chars))) {
  31924. return string;
  31925. }
  31926. var strSymbols = stringToArray(string),
  31927. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31928. return castSlice(strSymbols, 0, end).join('');
  31929. }
  31930. /**
  31931. * Removes leading whitespace or specified characters from `string`.
  31932. *
  31933. * @static
  31934. * @memberOf _
  31935. * @since 4.0.0
  31936. * @category String
  31937. * @param {string} [string=''] The string to trim.
  31938. * @param {string} [chars=whitespace] The characters to trim.
  31939. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31940. * @returns {string} Returns the trimmed string.
  31941. * @example
  31942. *
  31943. * _.trimStart(' abc ');
  31944. * // => 'abc '
  31945. *
  31946. * _.trimStart('-_-abc-_-', '_-');
  31947. * // => 'abc-_-'
  31948. */
  31949. function trimStart(string, chars, guard) {
  31950. string = toString(string);
  31951. if (string && (guard || chars === undefined)) {
  31952. return string.replace(reTrimStart, '');
  31953. }
  31954. if (!string || !(chars = baseToString(chars))) {
  31955. return string;
  31956. }
  31957. var strSymbols = stringToArray(string),
  31958. start = charsStartIndex(strSymbols, stringToArray(chars));
  31959. return castSlice(strSymbols, start).join('');
  31960. }
  31961. /**
  31962. * Truncates `string` if it's longer than the given maximum string length.
  31963. * The last characters of the truncated string are replaced with the omission
  31964. * string which defaults to "...".
  31965. *
  31966. * @static
  31967. * @memberOf _
  31968. * @since 4.0.0
  31969. * @category String
  31970. * @param {string} [string=''] The string to truncate.
  31971. * @param {Object} [options={}] The options object.
  31972. * @param {number} [options.length=30] The maximum string length.
  31973. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  31974. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  31975. * @returns {string} Returns the truncated string.
  31976. * @example
  31977. *
  31978. * _.truncate('hi-diddly-ho there, neighborino');
  31979. * // => 'hi-diddly-ho there, neighbo...'
  31980. *
  31981. * _.truncate('hi-diddly-ho there, neighborino', {
  31982. * 'length': 24,
  31983. * 'separator': ' '
  31984. * });
  31985. * // => 'hi-diddly-ho there,...'
  31986. *
  31987. * _.truncate('hi-diddly-ho there, neighborino', {
  31988. * 'length': 24,
  31989. * 'separator': /,? +/
  31990. * });
  31991. * // => 'hi-diddly-ho there...'
  31992. *
  31993. * _.truncate('hi-diddly-ho there, neighborino', {
  31994. * 'omission': ' [...]'
  31995. * });
  31996. * // => 'hi-diddly-ho there, neig [...]'
  31997. */
  31998. function truncate(string, options) {
  31999. var length = DEFAULT_TRUNC_LENGTH,
  32000. omission = DEFAULT_TRUNC_OMISSION;
  32001. if (isObject(options)) {
  32002. var separator = 'separator' in options ? options.separator : separator;
  32003. length = 'length' in options ? toInteger(options.length) : length;
  32004. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32005. }
  32006. string = toString(string);
  32007. var strLength = string.length;
  32008. if (hasUnicode(string)) {
  32009. var strSymbols = stringToArray(string);
  32010. strLength = strSymbols.length;
  32011. }
  32012. if (length >= strLength) {
  32013. return string;
  32014. }
  32015. var end = length - stringSize(omission);
  32016. if (end < 1) {
  32017. return omission;
  32018. }
  32019. var result = strSymbols
  32020. ? castSlice(strSymbols, 0, end).join('')
  32021. : string.slice(0, end);
  32022. if (separator === undefined) {
  32023. return result + omission;
  32024. }
  32025. if (strSymbols) {
  32026. end += (result.length - end);
  32027. }
  32028. if (isRegExp(separator)) {
  32029. if (string.slice(end).search(separator)) {
  32030. var match,
  32031. substring = result;
  32032. if (!separator.global) {
  32033. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32034. }
  32035. separator.lastIndex = 0;
  32036. while ((match = separator.exec(substring))) {
  32037. var newEnd = match.index;
  32038. }
  32039. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32040. }
  32041. } else if (string.indexOf(baseToString(separator), end) != end) {
  32042. var index = result.lastIndexOf(separator);
  32043. if (index > -1) {
  32044. result = result.slice(0, index);
  32045. }
  32046. }
  32047. return result + omission;
  32048. }
  32049. /**
  32050. * The inverse of `_.escape`; this method converts the HTML entities
  32051. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32052. * their corresponding characters.
  32053. *
  32054. * **Note:** No other HTML entities are unescaped. To unescape additional
  32055. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32056. *
  32057. * @static
  32058. * @memberOf _
  32059. * @since 0.6.0
  32060. * @category String
  32061. * @param {string} [string=''] The string to unescape.
  32062. * @returns {string} Returns the unescaped string.
  32063. * @example
  32064. *
  32065. * _.unescape('fred, barney, &amp; pebbles');
  32066. * // => 'fred, barney, & pebbles'
  32067. */
  32068. function unescape(string) {
  32069. string = toString(string);
  32070. return (string && reHasEscapedHtml.test(string))
  32071. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32072. : string;
  32073. }
  32074. /**
  32075. * Converts `string`, as space separated words, to upper case.
  32076. *
  32077. * @static
  32078. * @memberOf _
  32079. * @since 4.0.0
  32080. * @category String
  32081. * @param {string} [string=''] The string to convert.
  32082. * @returns {string} Returns the upper cased string.
  32083. * @example
  32084. *
  32085. * _.upperCase('--foo-bar');
  32086. * // => 'FOO BAR'
  32087. *
  32088. * _.upperCase('fooBar');
  32089. * // => 'FOO BAR'
  32090. *
  32091. * _.upperCase('__foo_bar__');
  32092. * // => 'FOO BAR'
  32093. */
  32094. var upperCase = createCompounder(function(result, word, index) {
  32095. return result + (index ? ' ' : '') + word.toUpperCase();
  32096. });
  32097. /**
  32098. * Converts the first character of `string` to upper case.
  32099. *
  32100. * @static
  32101. * @memberOf _
  32102. * @since 4.0.0
  32103. * @category String
  32104. * @param {string} [string=''] The string to convert.
  32105. * @returns {string} Returns the converted string.
  32106. * @example
  32107. *
  32108. * _.upperFirst('fred');
  32109. * // => 'Fred'
  32110. *
  32111. * _.upperFirst('FRED');
  32112. * // => 'FRED'
  32113. */
  32114. var upperFirst = createCaseFirst('toUpperCase');
  32115. /**
  32116. * Splits `string` into an array of its words.
  32117. *
  32118. * @static
  32119. * @memberOf _
  32120. * @since 3.0.0
  32121. * @category String
  32122. * @param {string} [string=''] The string to inspect.
  32123. * @param {RegExp|string} [pattern] The pattern to match words.
  32124. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32125. * @returns {Array} Returns the words of `string`.
  32126. * @example
  32127. *
  32128. * _.words('fred, barney, & pebbles');
  32129. * // => ['fred', 'barney', 'pebbles']
  32130. *
  32131. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32132. * // => ['fred', 'barney', '&', 'pebbles']
  32133. */
  32134. function words(string, pattern, guard) {
  32135. string = toString(string);
  32136. pattern = guard ? undefined : pattern;
  32137. if (pattern === undefined) {
  32138. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32139. }
  32140. return string.match(pattern) || [];
  32141. }
  32142. /*------------------------------------------------------------------------*/
  32143. /**
  32144. * Attempts to invoke `func`, returning either the result or the caught error
  32145. * object. Any additional arguments are provided to `func` when it's invoked.
  32146. *
  32147. * @static
  32148. * @memberOf _
  32149. * @since 3.0.0
  32150. * @category Util
  32151. * @param {Function} func The function to attempt.
  32152. * @param {...*} [args] The arguments to invoke `func` with.
  32153. * @returns {*} Returns the `func` result or error object.
  32154. * @example
  32155. *
  32156. * // Avoid throwing errors for invalid selectors.
  32157. * var elements = _.attempt(function(selector) {
  32158. * return document.querySelectorAll(selector);
  32159. * }, '>_>');
  32160. *
  32161. * if (_.isError(elements)) {
  32162. * elements = [];
  32163. * }
  32164. */
  32165. var attempt = baseRest(function(func, args) {
  32166. try {
  32167. return apply(func, undefined, args);
  32168. } catch (e) {
  32169. return isError(e) ? e : new Error(e);
  32170. }
  32171. });
  32172. /**
  32173. * Binds methods of an object to the object itself, overwriting the existing
  32174. * method.
  32175. *
  32176. * **Note:** This method doesn't set the "length" property of bound functions.
  32177. *
  32178. * @static
  32179. * @since 0.1.0
  32180. * @memberOf _
  32181. * @category Util
  32182. * @param {Object} object The object to bind and assign the bound methods to.
  32183. * @param {...(string|string[])} methodNames The object method names to bind.
  32184. * @returns {Object} Returns `object`.
  32185. * @example
  32186. *
  32187. * var view = {
  32188. * 'label': 'docs',
  32189. * 'click': function() {
  32190. * console.log('clicked ' + this.label);
  32191. * }
  32192. * };
  32193. *
  32194. * _.bindAll(view, ['click']);
  32195. * jQuery(element).on('click', view.click);
  32196. * // => Logs 'clicked docs' when clicked.
  32197. */
  32198. var bindAll = flatRest(function(object, methodNames) {
  32199. arrayEach(methodNames, function(key) {
  32200. key = toKey(key);
  32201. baseAssignValue(object, key, bind(object[key], object));
  32202. });
  32203. return object;
  32204. });
  32205. /**
  32206. * Creates a function that iterates over `pairs` and invokes the corresponding
  32207. * function of the first predicate to return truthy. The predicate-function
  32208. * pairs are invoked with the `this` binding and arguments of the created
  32209. * function.
  32210. *
  32211. * @static
  32212. * @memberOf _
  32213. * @since 4.0.0
  32214. * @category Util
  32215. * @param {Array} pairs The predicate-function pairs.
  32216. * @returns {Function} Returns the new composite function.
  32217. * @example
  32218. *
  32219. * var func = _.cond([
  32220. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32221. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32222. * [_.stubTrue, _.constant('no match')]
  32223. * ]);
  32224. *
  32225. * func({ 'a': 1, 'b': 2 });
  32226. * // => 'matches A'
  32227. *
  32228. * func({ 'a': 0, 'b': 1 });
  32229. * // => 'matches B'
  32230. *
  32231. * func({ 'a': '1', 'b': '2' });
  32232. * // => 'no match'
  32233. */
  32234. function cond(pairs) {
  32235. var length = pairs == null ? 0 : pairs.length,
  32236. toIteratee = getIteratee();
  32237. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32238. if (typeof pair[1] != 'function') {
  32239. throw new TypeError(FUNC_ERROR_TEXT);
  32240. }
  32241. return [toIteratee(pair[0]), pair[1]];
  32242. });
  32243. return baseRest(function(args) {
  32244. var index = -1;
  32245. while (++index < length) {
  32246. var pair = pairs[index];
  32247. if (apply(pair[0], this, args)) {
  32248. return apply(pair[1], this, args);
  32249. }
  32250. }
  32251. });
  32252. }
  32253. /**
  32254. * Creates a function that invokes the predicate properties of `source` with
  32255. * the corresponding property values of a given object, returning `true` if
  32256. * all predicates return truthy, else `false`.
  32257. *
  32258. * **Note:** The created function is equivalent to `_.conformsTo` with
  32259. * `source` partially applied.
  32260. *
  32261. * @static
  32262. * @memberOf _
  32263. * @since 4.0.0
  32264. * @category Util
  32265. * @param {Object} source The object of property predicates to conform to.
  32266. * @returns {Function} Returns the new spec function.
  32267. * @example
  32268. *
  32269. * var objects = [
  32270. * { 'a': 2, 'b': 1 },
  32271. * { 'a': 1, 'b': 2 }
  32272. * ];
  32273. *
  32274. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32275. * // => [{ 'a': 1, 'b': 2 }]
  32276. */
  32277. function conforms(source) {
  32278. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32279. }
  32280. /**
  32281. * Creates a function that returns `value`.
  32282. *
  32283. * @static
  32284. * @memberOf _
  32285. * @since 2.4.0
  32286. * @category Util
  32287. * @param {*} value The value to return from the new function.
  32288. * @returns {Function} Returns the new constant function.
  32289. * @example
  32290. *
  32291. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32292. *
  32293. * console.log(objects);
  32294. * // => [{ 'a': 1 }, { 'a': 1 }]
  32295. *
  32296. * console.log(objects[0] === objects[1]);
  32297. * // => true
  32298. */
  32299. function constant(value) {
  32300. return function() {
  32301. return value;
  32302. };
  32303. }
  32304. /**
  32305. * Checks `value` to determine whether a default value should be returned in
  32306. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32307. * or `undefined`.
  32308. *
  32309. * @static
  32310. * @memberOf _
  32311. * @since 4.14.0
  32312. * @category Util
  32313. * @param {*} value The value to check.
  32314. * @param {*} defaultValue The default value.
  32315. * @returns {*} Returns the resolved value.
  32316. * @example
  32317. *
  32318. * _.defaultTo(1, 10);
  32319. * // => 1
  32320. *
  32321. * _.defaultTo(undefined, 10);
  32322. * // => 10
  32323. */
  32324. function defaultTo(value, defaultValue) {
  32325. return (value == null || value !== value) ? defaultValue : value;
  32326. }
  32327. /**
  32328. * Creates a function that returns the result of invoking the given functions
  32329. * with the `this` binding of the created function, where each successive
  32330. * invocation is supplied the return value of the previous.
  32331. *
  32332. * @static
  32333. * @memberOf _
  32334. * @since 3.0.0
  32335. * @category Util
  32336. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32337. * @returns {Function} Returns the new composite function.
  32338. * @see _.flowRight
  32339. * @example
  32340. *
  32341. * function square(n) {
  32342. * return n * n;
  32343. * }
  32344. *
  32345. * var addSquare = _.flow([_.add, square]);
  32346. * addSquare(1, 2);
  32347. * // => 9
  32348. */
  32349. var flow = createFlow();
  32350. /**
  32351. * This method is like `_.flow` except that it creates a function that
  32352. * invokes the given functions from right to left.
  32353. *
  32354. * @static
  32355. * @since 3.0.0
  32356. * @memberOf _
  32357. * @category Util
  32358. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32359. * @returns {Function} Returns the new composite function.
  32360. * @see _.flow
  32361. * @example
  32362. *
  32363. * function square(n) {
  32364. * return n * n;
  32365. * }
  32366. *
  32367. * var addSquare = _.flowRight([square, _.add]);
  32368. * addSquare(1, 2);
  32369. * // => 9
  32370. */
  32371. var flowRight = createFlow(true);
  32372. /**
  32373. * This method returns the first argument it receives.
  32374. *
  32375. * @static
  32376. * @since 0.1.0
  32377. * @memberOf _
  32378. * @category Util
  32379. * @param {*} value Any value.
  32380. * @returns {*} Returns `value`.
  32381. * @example
  32382. *
  32383. * var object = { 'a': 1 };
  32384. *
  32385. * console.log(_.identity(object) === object);
  32386. * // => true
  32387. */
  32388. function identity(value) {
  32389. return value;
  32390. }
  32391. /**
  32392. * Creates a function that invokes `func` with the arguments of the created
  32393. * function. If `func` is a property name, the created function returns the
  32394. * property value for a given element. If `func` is an array or object, the
  32395. * created function returns `true` for elements that contain the equivalent
  32396. * source properties, otherwise it returns `false`.
  32397. *
  32398. * @static
  32399. * @since 4.0.0
  32400. * @memberOf _
  32401. * @category Util
  32402. * @param {*} [func=_.identity] The value to convert to a callback.
  32403. * @returns {Function} Returns the callback.
  32404. * @example
  32405. *
  32406. * var users = [
  32407. * { 'user': 'barney', 'age': 36, 'active': true },
  32408. * { 'user': 'fred', 'age': 40, 'active': false }
  32409. * ];
  32410. *
  32411. * // The `_.matches` iteratee shorthand.
  32412. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32413. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32414. *
  32415. * // The `_.matchesProperty` iteratee shorthand.
  32416. * _.filter(users, _.iteratee(['user', 'fred']));
  32417. * // => [{ 'user': 'fred', 'age': 40 }]
  32418. *
  32419. * // The `_.property` iteratee shorthand.
  32420. * _.map(users, _.iteratee('user'));
  32421. * // => ['barney', 'fred']
  32422. *
  32423. * // Create custom iteratee shorthands.
  32424. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32425. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32426. * return func.test(string);
  32427. * };
  32428. * });
  32429. *
  32430. * _.filter(['abc', 'def'], /ef/);
  32431. * // => ['def']
  32432. */
  32433. function iteratee(func) {
  32434. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32435. }
  32436. /**
  32437. * Creates a function that performs a partial deep comparison between a given
  32438. * object and `source`, returning `true` if the given object has equivalent
  32439. * property values, else `false`.
  32440. *
  32441. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32442. * partially applied.
  32443. *
  32444. * Partial comparisons will match empty array and empty object `source`
  32445. * values against any array or object value, respectively. See `_.isEqual`
  32446. * for a list of supported value comparisons.
  32447. *
  32448. * @static
  32449. * @memberOf _
  32450. * @since 3.0.0
  32451. * @category Util
  32452. * @param {Object} source The object of property values to match.
  32453. * @returns {Function} Returns the new spec function.
  32454. * @example
  32455. *
  32456. * var objects = [
  32457. * { 'a': 1, 'b': 2, 'c': 3 },
  32458. * { 'a': 4, 'b': 5, 'c': 6 }
  32459. * ];
  32460. *
  32461. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32462. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32463. */
  32464. function matches(source) {
  32465. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32466. }
  32467. /**
  32468. * Creates a function that performs a partial deep comparison between the
  32469. * value at `path` of a given object to `srcValue`, returning `true` if the
  32470. * object value is equivalent, else `false`.
  32471. *
  32472. * **Note:** Partial comparisons will match empty array and empty object
  32473. * `srcValue` values against any array or object value, respectively. See
  32474. * `_.isEqual` for a list of supported value comparisons.
  32475. *
  32476. * @static
  32477. * @memberOf _
  32478. * @since 3.2.0
  32479. * @category Util
  32480. * @param {Array|string} path The path of the property to get.
  32481. * @param {*} srcValue The value to match.
  32482. * @returns {Function} Returns the new spec function.
  32483. * @example
  32484. *
  32485. * var objects = [
  32486. * { 'a': 1, 'b': 2, 'c': 3 },
  32487. * { 'a': 4, 'b': 5, 'c': 6 }
  32488. * ];
  32489. *
  32490. * _.find(objects, _.matchesProperty('a', 4));
  32491. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32492. */
  32493. function matchesProperty(path, srcValue) {
  32494. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32495. }
  32496. /**
  32497. * Creates a function that invokes the method at `path` of a given object.
  32498. * Any additional arguments are provided to the invoked method.
  32499. *
  32500. * @static
  32501. * @memberOf _
  32502. * @since 3.7.0
  32503. * @category Util
  32504. * @param {Array|string} path The path of the method to invoke.
  32505. * @param {...*} [args] The arguments to invoke the method with.
  32506. * @returns {Function} Returns the new invoker function.
  32507. * @example
  32508. *
  32509. * var objects = [
  32510. * { 'a': { 'b': _.constant(2) } },
  32511. * { 'a': { 'b': _.constant(1) } }
  32512. * ];
  32513. *
  32514. * _.map(objects, _.method('a.b'));
  32515. * // => [2, 1]
  32516. *
  32517. * _.map(objects, _.method(['a', 'b']));
  32518. * // => [2, 1]
  32519. */
  32520. var method = baseRest(function(path, args) {
  32521. return function(object) {
  32522. return baseInvoke(object, path, args);
  32523. };
  32524. });
  32525. /**
  32526. * The opposite of `_.method`; this method creates a function that invokes
  32527. * the method at a given path of `object`. Any additional arguments are
  32528. * provided to the invoked method.
  32529. *
  32530. * @static
  32531. * @memberOf _
  32532. * @since 3.7.0
  32533. * @category Util
  32534. * @param {Object} object The object to query.
  32535. * @param {...*} [args] The arguments to invoke the method with.
  32536. * @returns {Function} Returns the new invoker function.
  32537. * @example
  32538. *
  32539. * var array = _.times(3, _.constant),
  32540. * object = { 'a': array, 'b': array, 'c': array };
  32541. *
  32542. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32543. * // => [2, 0]
  32544. *
  32545. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32546. * // => [2, 0]
  32547. */
  32548. var methodOf = baseRest(function(object, args) {
  32549. return function(path) {
  32550. return baseInvoke(object, path, args);
  32551. };
  32552. });
  32553. /**
  32554. * Adds all own enumerable string keyed function properties of a source
  32555. * object to the destination object. If `object` is a function, then methods
  32556. * are added to its prototype as well.
  32557. *
  32558. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32559. * avoid conflicts caused by modifying the original.
  32560. *
  32561. * @static
  32562. * @since 0.1.0
  32563. * @memberOf _
  32564. * @category Util
  32565. * @param {Function|Object} [object=lodash] The destination object.
  32566. * @param {Object} source The object of functions to add.
  32567. * @param {Object} [options={}] The options object.
  32568. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32569. * @returns {Function|Object} Returns `object`.
  32570. * @example
  32571. *
  32572. * function vowels(string) {
  32573. * return _.filter(string, function(v) {
  32574. * return /[aeiou]/i.test(v);
  32575. * });
  32576. * }
  32577. *
  32578. * _.mixin({ 'vowels': vowels });
  32579. * _.vowels('fred');
  32580. * // => ['e']
  32581. *
  32582. * _('fred').vowels().value();
  32583. * // => ['e']
  32584. *
  32585. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32586. * _('fred').vowels();
  32587. * // => ['e']
  32588. */
  32589. function mixin(object, source, options) {
  32590. var props = keys(source),
  32591. methodNames = baseFunctions(source, props);
  32592. if (options == null &&
  32593. !(isObject(source) && (methodNames.length || !props.length))) {
  32594. options = source;
  32595. source = object;
  32596. object = this;
  32597. methodNames = baseFunctions(source, keys(source));
  32598. }
  32599. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32600. isFunc = isFunction(object);
  32601. arrayEach(methodNames, function(methodName) {
  32602. var func = source[methodName];
  32603. object[methodName] = func;
  32604. if (isFunc) {
  32605. object.prototype[methodName] = function() {
  32606. var chainAll = this.__chain__;
  32607. if (chain || chainAll) {
  32608. var result = object(this.__wrapped__),
  32609. actions = result.__actions__ = copyArray(this.__actions__);
  32610. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32611. result.__chain__ = chainAll;
  32612. return result;
  32613. }
  32614. return func.apply(object, arrayPush([this.value()], arguments));
  32615. };
  32616. }
  32617. });
  32618. return object;
  32619. }
  32620. /**
  32621. * Reverts the `_` variable to its previous value and returns a reference to
  32622. * the `lodash` function.
  32623. *
  32624. * @static
  32625. * @since 0.1.0
  32626. * @memberOf _
  32627. * @category Util
  32628. * @returns {Function} Returns the `lodash` function.
  32629. * @example
  32630. *
  32631. * var lodash = _.noConflict();
  32632. */
  32633. function noConflict() {
  32634. if (root._ === this) {
  32635. root._ = oldDash;
  32636. }
  32637. return this;
  32638. }
  32639. /**
  32640. * This method returns `undefined`.
  32641. *
  32642. * @static
  32643. * @memberOf _
  32644. * @since 2.3.0
  32645. * @category Util
  32646. * @example
  32647. *
  32648. * _.times(2, _.noop);
  32649. * // => [undefined, undefined]
  32650. */
  32651. function noop() {
  32652. // No operation performed.
  32653. }
  32654. /**
  32655. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32656. * the nth argument from the end is returned.
  32657. *
  32658. * @static
  32659. * @memberOf _
  32660. * @since 4.0.0
  32661. * @category Util
  32662. * @param {number} [n=0] The index of the argument to return.
  32663. * @returns {Function} Returns the new pass-thru function.
  32664. * @example
  32665. *
  32666. * var func = _.nthArg(1);
  32667. * func('a', 'b', 'c', 'd');
  32668. * // => 'b'
  32669. *
  32670. * var func = _.nthArg(-2);
  32671. * func('a', 'b', 'c', 'd');
  32672. * // => 'c'
  32673. */
  32674. function nthArg(n) {
  32675. n = toInteger(n);
  32676. return baseRest(function(args) {
  32677. return baseNth(args, n);
  32678. });
  32679. }
  32680. /**
  32681. * Creates a function that invokes `iteratees` with the arguments it receives
  32682. * and returns their results.
  32683. *
  32684. * @static
  32685. * @memberOf _
  32686. * @since 4.0.0
  32687. * @category Util
  32688. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32689. * The iteratees to invoke.
  32690. * @returns {Function} Returns the new function.
  32691. * @example
  32692. *
  32693. * var func = _.over([Math.max, Math.min]);
  32694. *
  32695. * func(1, 2, 3, 4);
  32696. * // => [4, 1]
  32697. */
  32698. var over = createOver(arrayMap);
  32699. /**
  32700. * Creates a function that checks if **all** of the `predicates` return
  32701. * truthy when invoked with the arguments it receives.
  32702. *
  32703. * @static
  32704. * @memberOf _
  32705. * @since 4.0.0
  32706. * @category Util
  32707. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32708. * The predicates to check.
  32709. * @returns {Function} Returns the new function.
  32710. * @example
  32711. *
  32712. * var func = _.overEvery([Boolean, isFinite]);
  32713. *
  32714. * func('1');
  32715. * // => true
  32716. *
  32717. * func(null);
  32718. * // => false
  32719. *
  32720. * func(NaN);
  32721. * // => false
  32722. */
  32723. var overEvery = createOver(arrayEvery);
  32724. /**
  32725. * Creates a function that checks if **any** of the `predicates` return
  32726. * truthy when invoked with the arguments it receives.
  32727. *
  32728. * @static
  32729. * @memberOf _
  32730. * @since 4.0.0
  32731. * @category Util
  32732. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32733. * The predicates to check.
  32734. * @returns {Function} Returns the new function.
  32735. * @example
  32736. *
  32737. * var func = _.overSome([Boolean, isFinite]);
  32738. *
  32739. * func('1');
  32740. * // => true
  32741. *
  32742. * func(null);
  32743. * // => true
  32744. *
  32745. * func(NaN);
  32746. * // => false
  32747. */
  32748. var overSome = createOver(arraySome);
  32749. /**
  32750. * Creates a function that returns the value at `path` of a given object.
  32751. *
  32752. * @static
  32753. * @memberOf _
  32754. * @since 2.4.0
  32755. * @category Util
  32756. * @param {Array|string} path The path of the property to get.
  32757. * @returns {Function} Returns the new accessor function.
  32758. * @example
  32759. *
  32760. * var objects = [
  32761. * { 'a': { 'b': 2 } },
  32762. * { 'a': { 'b': 1 } }
  32763. * ];
  32764. *
  32765. * _.map(objects, _.property('a.b'));
  32766. * // => [2, 1]
  32767. *
  32768. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32769. * // => [1, 2]
  32770. */
  32771. function property(path) {
  32772. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32773. }
  32774. /**
  32775. * The opposite of `_.property`; this method creates a function that returns
  32776. * the value at a given path of `object`.
  32777. *
  32778. * @static
  32779. * @memberOf _
  32780. * @since 3.0.0
  32781. * @category Util
  32782. * @param {Object} object The object to query.
  32783. * @returns {Function} Returns the new accessor function.
  32784. * @example
  32785. *
  32786. * var array = [0, 1, 2],
  32787. * object = { 'a': array, 'b': array, 'c': array };
  32788. *
  32789. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32790. * // => [2, 0]
  32791. *
  32792. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32793. * // => [2, 0]
  32794. */
  32795. function propertyOf(object) {
  32796. return function(path) {
  32797. return object == null ? undefined : baseGet(object, path);
  32798. };
  32799. }
  32800. /**
  32801. * Creates an array of numbers (positive and/or negative) progressing from
  32802. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32803. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32804. * it's set to `start` with `start` then set to `0`.
  32805. *
  32806. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32807. * floating-point values which can produce unexpected results.
  32808. *
  32809. * @static
  32810. * @since 0.1.0
  32811. * @memberOf _
  32812. * @category Util
  32813. * @param {number} [start=0] The start of the range.
  32814. * @param {number} end The end of the range.
  32815. * @param {number} [step=1] The value to increment or decrement by.
  32816. * @returns {Array} Returns the range of numbers.
  32817. * @see _.inRange, _.rangeRight
  32818. * @example
  32819. *
  32820. * _.range(4);
  32821. * // => [0, 1, 2, 3]
  32822. *
  32823. * _.range(-4);
  32824. * // => [0, -1, -2, -3]
  32825. *
  32826. * _.range(1, 5);
  32827. * // => [1, 2, 3, 4]
  32828. *
  32829. * _.range(0, 20, 5);
  32830. * // => [0, 5, 10, 15]
  32831. *
  32832. * _.range(0, -4, -1);
  32833. * // => [0, -1, -2, -3]
  32834. *
  32835. * _.range(1, 4, 0);
  32836. * // => [1, 1, 1]
  32837. *
  32838. * _.range(0);
  32839. * // => []
  32840. */
  32841. var range = createRange();
  32842. /**
  32843. * This method is like `_.range` except that it populates values in
  32844. * descending order.
  32845. *
  32846. * @static
  32847. * @memberOf _
  32848. * @since 4.0.0
  32849. * @category Util
  32850. * @param {number} [start=0] The start of the range.
  32851. * @param {number} end The end of the range.
  32852. * @param {number} [step=1] The value to increment or decrement by.
  32853. * @returns {Array} Returns the range of numbers.
  32854. * @see _.inRange, _.range
  32855. * @example
  32856. *
  32857. * _.rangeRight(4);
  32858. * // => [3, 2, 1, 0]
  32859. *
  32860. * _.rangeRight(-4);
  32861. * // => [-3, -2, -1, 0]
  32862. *
  32863. * _.rangeRight(1, 5);
  32864. * // => [4, 3, 2, 1]
  32865. *
  32866. * _.rangeRight(0, 20, 5);
  32867. * // => [15, 10, 5, 0]
  32868. *
  32869. * _.rangeRight(0, -4, -1);
  32870. * // => [-3, -2, -1, 0]
  32871. *
  32872. * _.rangeRight(1, 4, 0);
  32873. * // => [1, 1, 1]
  32874. *
  32875. * _.rangeRight(0);
  32876. * // => []
  32877. */
  32878. var rangeRight = createRange(true);
  32879. /**
  32880. * This method returns a new empty array.
  32881. *
  32882. * @static
  32883. * @memberOf _
  32884. * @since 4.13.0
  32885. * @category Util
  32886. * @returns {Array} Returns the new empty array.
  32887. * @example
  32888. *
  32889. * var arrays = _.times(2, _.stubArray);
  32890. *
  32891. * console.log(arrays);
  32892. * // => [[], []]
  32893. *
  32894. * console.log(arrays[0] === arrays[1]);
  32895. * // => false
  32896. */
  32897. function stubArray() {
  32898. return [];
  32899. }
  32900. /**
  32901. * This method returns `false`.
  32902. *
  32903. * @static
  32904. * @memberOf _
  32905. * @since 4.13.0
  32906. * @category Util
  32907. * @returns {boolean} Returns `false`.
  32908. * @example
  32909. *
  32910. * _.times(2, _.stubFalse);
  32911. * // => [false, false]
  32912. */
  32913. function stubFalse() {
  32914. return false;
  32915. }
  32916. /**
  32917. * This method returns a new empty object.
  32918. *
  32919. * @static
  32920. * @memberOf _
  32921. * @since 4.13.0
  32922. * @category Util
  32923. * @returns {Object} Returns the new empty object.
  32924. * @example
  32925. *
  32926. * var objects = _.times(2, _.stubObject);
  32927. *
  32928. * console.log(objects);
  32929. * // => [{}, {}]
  32930. *
  32931. * console.log(objects[0] === objects[1]);
  32932. * // => false
  32933. */
  32934. function stubObject() {
  32935. return {};
  32936. }
  32937. /**
  32938. * This method returns an empty string.
  32939. *
  32940. * @static
  32941. * @memberOf _
  32942. * @since 4.13.0
  32943. * @category Util
  32944. * @returns {string} Returns the empty string.
  32945. * @example
  32946. *
  32947. * _.times(2, _.stubString);
  32948. * // => ['', '']
  32949. */
  32950. function stubString() {
  32951. return '';
  32952. }
  32953. /**
  32954. * This method returns `true`.
  32955. *
  32956. * @static
  32957. * @memberOf _
  32958. * @since 4.13.0
  32959. * @category Util
  32960. * @returns {boolean} Returns `true`.
  32961. * @example
  32962. *
  32963. * _.times(2, _.stubTrue);
  32964. * // => [true, true]
  32965. */
  32966. function stubTrue() {
  32967. return true;
  32968. }
  32969. /**
  32970. * Invokes the iteratee `n` times, returning an array of the results of
  32971. * each invocation. The iteratee is invoked with one argument; (index).
  32972. *
  32973. * @static
  32974. * @since 0.1.0
  32975. * @memberOf _
  32976. * @category Util
  32977. * @param {number} n The number of times to invoke `iteratee`.
  32978. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32979. * @returns {Array} Returns the array of results.
  32980. * @example
  32981. *
  32982. * _.times(3, String);
  32983. * // => ['0', '1', '2']
  32984. *
  32985. * _.times(4, _.constant(0));
  32986. * // => [0, 0, 0, 0]
  32987. */
  32988. function times(n, iteratee) {
  32989. n = toInteger(n);
  32990. if (n < 1 || n > MAX_SAFE_INTEGER) {
  32991. return [];
  32992. }
  32993. var index = MAX_ARRAY_LENGTH,
  32994. length = nativeMin(n, MAX_ARRAY_LENGTH);
  32995. iteratee = getIteratee(iteratee);
  32996. n -= MAX_ARRAY_LENGTH;
  32997. var result = baseTimes(length, iteratee);
  32998. while (++index < n) {
  32999. iteratee(index);
  33000. }
  33001. return result;
  33002. }
  33003. /**
  33004. * Converts `value` to a property path array.
  33005. *
  33006. * @static
  33007. * @memberOf _
  33008. * @since 4.0.0
  33009. * @category Util
  33010. * @param {*} value The value to convert.
  33011. * @returns {Array} Returns the new property path array.
  33012. * @example
  33013. *
  33014. * _.toPath('a.b.c');
  33015. * // => ['a', 'b', 'c']
  33016. *
  33017. * _.toPath('a[0].b.c');
  33018. * // => ['a', '0', 'b', 'c']
  33019. */
  33020. function toPath(value) {
  33021. if (isArray(value)) {
  33022. return arrayMap(value, toKey);
  33023. }
  33024. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33025. }
  33026. /**
  33027. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33028. *
  33029. * @static
  33030. * @since 0.1.0
  33031. * @memberOf _
  33032. * @category Util
  33033. * @param {string} [prefix=''] The value to prefix the ID with.
  33034. * @returns {string} Returns the unique ID.
  33035. * @example
  33036. *
  33037. * _.uniqueId('contact_');
  33038. * // => 'contact_104'
  33039. *
  33040. * _.uniqueId();
  33041. * // => '105'
  33042. */
  33043. function uniqueId(prefix) {
  33044. var id = ++idCounter;
  33045. return toString(prefix) + id;
  33046. }
  33047. /*------------------------------------------------------------------------*/
  33048. /**
  33049. * Adds two numbers.
  33050. *
  33051. * @static
  33052. * @memberOf _
  33053. * @since 3.4.0
  33054. * @category Math
  33055. * @param {number} augend The first number in an addition.
  33056. * @param {number} addend The second number in an addition.
  33057. * @returns {number} Returns the total.
  33058. * @example
  33059. *
  33060. * _.add(6, 4);
  33061. * // => 10
  33062. */
  33063. var add = createMathOperation(function(augend, addend) {
  33064. return augend + addend;
  33065. }, 0);
  33066. /**
  33067. * Computes `number` rounded up to `precision`.
  33068. *
  33069. * @static
  33070. * @memberOf _
  33071. * @since 3.10.0
  33072. * @category Math
  33073. * @param {number} number The number to round up.
  33074. * @param {number} [precision=0] The precision to round up to.
  33075. * @returns {number} Returns the rounded up number.
  33076. * @example
  33077. *
  33078. * _.ceil(4.006);
  33079. * // => 5
  33080. *
  33081. * _.ceil(6.004, 2);
  33082. * // => 6.01
  33083. *
  33084. * _.ceil(6040, -2);
  33085. * // => 6100
  33086. */
  33087. var ceil = createRound('ceil');
  33088. /**
  33089. * Divide two numbers.
  33090. *
  33091. * @static
  33092. * @memberOf _
  33093. * @since 4.7.0
  33094. * @category Math
  33095. * @param {number} dividend The first number in a division.
  33096. * @param {number} divisor The second number in a division.
  33097. * @returns {number} Returns the quotient.
  33098. * @example
  33099. *
  33100. * _.divide(6, 4);
  33101. * // => 1.5
  33102. */
  33103. var divide = createMathOperation(function(dividend, divisor) {
  33104. return dividend / divisor;
  33105. }, 1);
  33106. /**
  33107. * Computes `number` rounded down to `precision`.
  33108. *
  33109. * @static
  33110. * @memberOf _
  33111. * @since 3.10.0
  33112. * @category Math
  33113. * @param {number} number The number to round down.
  33114. * @param {number} [precision=0] The precision to round down to.
  33115. * @returns {number} Returns the rounded down number.
  33116. * @example
  33117. *
  33118. * _.floor(4.006);
  33119. * // => 4
  33120. *
  33121. * _.floor(0.046, 2);
  33122. * // => 0.04
  33123. *
  33124. * _.floor(4060, -2);
  33125. * // => 4000
  33126. */
  33127. var floor = createRound('floor');
  33128. /**
  33129. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33130. * `undefined` is returned.
  33131. *
  33132. * @static
  33133. * @since 0.1.0
  33134. * @memberOf _
  33135. * @category Math
  33136. * @param {Array} array The array to iterate over.
  33137. * @returns {*} Returns the maximum value.
  33138. * @example
  33139. *
  33140. * _.max([4, 2, 8, 6]);
  33141. * // => 8
  33142. *
  33143. * _.max([]);
  33144. * // => undefined
  33145. */
  33146. function max(array) {
  33147. return (array && array.length)
  33148. ? baseExtremum(array, identity, baseGt)
  33149. : undefined;
  33150. }
  33151. /**
  33152. * This method is like `_.max` except that it accepts `iteratee` which is
  33153. * invoked for each element in `array` to generate the criterion by which
  33154. * the value is ranked. The iteratee is invoked with one argument: (value).
  33155. *
  33156. * @static
  33157. * @memberOf _
  33158. * @since 4.0.0
  33159. * @category Math
  33160. * @param {Array} array The array to iterate over.
  33161. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33162. * @returns {*} Returns the maximum value.
  33163. * @example
  33164. *
  33165. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33166. *
  33167. * _.maxBy(objects, function(o) { return o.n; });
  33168. * // => { 'n': 2 }
  33169. *
  33170. * // The `_.property` iteratee shorthand.
  33171. * _.maxBy(objects, 'n');
  33172. * // => { 'n': 2 }
  33173. */
  33174. function maxBy(array, iteratee) {
  33175. return (array && array.length)
  33176. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33177. : undefined;
  33178. }
  33179. /**
  33180. * Computes the mean of the values in `array`.
  33181. *
  33182. * @static
  33183. * @memberOf _
  33184. * @since 4.0.0
  33185. * @category Math
  33186. * @param {Array} array The array to iterate over.
  33187. * @returns {number} Returns the mean.
  33188. * @example
  33189. *
  33190. * _.mean([4, 2, 8, 6]);
  33191. * // => 5
  33192. */
  33193. function mean(array) {
  33194. return baseMean(array, identity);
  33195. }
  33196. /**
  33197. * This method is like `_.mean` except that it accepts `iteratee` which is
  33198. * invoked for each element in `array` to generate the value to be averaged.
  33199. * The iteratee is invoked with one argument: (value).
  33200. *
  33201. * @static
  33202. * @memberOf _
  33203. * @since 4.7.0
  33204. * @category Math
  33205. * @param {Array} array The array to iterate over.
  33206. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33207. * @returns {number} Returns the mean.
  33208. * @example
  33209. *
  33210. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33211. *
  33212. * _.meanBy(objects, function(o) { return o.n; });
  33213. * // => 5
  33214. *
  33215. * // The `_.property` iteratee shorthand.
  33216. * _.meanBy(objects, 'n');
  33217. * // => 5
  33218. */
  33219. function meanBy(array, iteratee) {
  33220. return baseMean(array, getIteratee(iteratee, 2));
  33221. }
  33222. /**
  33223. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33224. * `undefined` is returned.
  33225. *
  33226. * @static
  33227. * @since 0.1.0
  33228. * @memberOf _
  33229. * @category Math
  33230. * @param {Array} array The array to iterate over.
  33231. * @returns {*} Returns the minimum value.
  33232. * @example
  33233. *
  33234. * _.min([4, 2, 8, 6]);
  33235. * // => 2
  33236. *
  33237. * _.min([]);
  33238. * // => undefined
  33239. */
  33240. function min(array) {
  33241. return (array && array.length)
  33242. ? baseExtremum(array, identity, baseLt)
  33243. : undefined;
  33244. }
  33245. /**
  33246. * This method is like `_.min` except that it accepts `iteratee` which is
  33247. * invoked for each element in `array` to generate the criterion by which
  33248. * the value is ranked. The iteratee is invoked with one argument: (value).
  33249. *
  33250. * @static
  33251. * @memberOf _
  33252. * @since 4.0.0
  33253. * @category Math
  33254. * @param {Array} array The array to iterate over.
  33255. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33256. * @returns {*} Returns the minimum value.
  33257. * @example
  33258. *
  33259. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33260. *
  33261. * _.minBy(objects, function(o) { return o.n; });
  33262. * // => { 'n': 1 }
  33263. *
  33264. * // The `_.property` iteratee shorthand.
  33265. * _.minBy(objects, 'n');
  33266. * // => { 'n': 1 }
  33267. */
  33268. function minBy(array, iteratee) {
  33269. return (array && array.length)
  33270. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33271. : undefined;
  33272. }
  33273. /**
  33274. * Multiply two numbers.
  33275. *
  33276. * @static
  33277. * @memberOf _
  33278. * @since 4.7.0
  33279. * @category Math
  33280. * @param {number} multiplier The first number in a multiplication.
  33281. * @param {number} multiplicand The second number in a multiplication.
  33282. * @returns {number} Returns the product.
  33283. * @example
  33284. *
  33285. * _.multiply(6, 4);
  33286. * // => 24
  33287. */
  33288. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33289. return multiplier * multiplicand;
  33290. }, 1);
  33291. /**
  33292. * Computes `number` rounded to `precision`.
  33293. *
  33294. * @static
  33295. * @memberOf _
  33296. * @since 3.10.0
  33297. * @category Math
  33298. * @param {number} number The number to round.
  33299. * @param {number} [precision=0] The precision to round to.
  33300. * @returns {number} Returns the rounded number.
  33301. * @example
  33302. *
  33303. * _.round(4.006);
  33304. * // => 4
  33305. *
  33306. * _.round(4.006, 2);
  33307. * // => 4.01
  33308. *
  33309. * _.round(4060, -2);
  33310. * // => 4100
  33311. */
  33312. var round = createRound('round');
  33313. /**
  33314. * Subtract two numbers.
  33315. *
  33316. * @static
  33317. * @memberOf _
  33318. * @since 4.0.0
  33319. * @category Math
  33320. * @param {number} minuend The first number in a subtraction.
  33321. * @param {number} subtrahend The second number in a subtraction.
  33322. * @returns {number} Returns the difference.
  33323. * @example
  33324. *
  33325. * _.subtract(6, 4);
  33326. * // => 2
  33327. */
  33328. var subtract = createMathOperation(function(minuend, subtrahend) {
  33329. return minuend - subtrahend;
  33330. }, 0);
  33331. /**
  33332. * Computes the sum of the values in `array`.
  33333. *
  33334. * @static
  33335. * @memberOf _
  33336. * @since 3.4.0
  33337. * @category Math
  33338. * @param {Array} array The array to iterate over.
  33339. * @returns {number} Returns the sum.
  33340. * @example
  33341. *
  33342. * _.sum([4, 2, 8, 6]);
  33343. * // => 20
  33344. */
  33345. function sum(array) {
  33346. return (array && array.length)
  33347. ? baseSum(array, identity)
  33348. : 0;
  33349. }
  33350. /**
  33351. * This method is like `_.sum` except that it accepts `iteratee` which is
  33352. * invoked for each element in `array` to generate the value to be summed.
  33353. * The iteratee is invoked with one argument: (value).
  33354. *
  33355. * @static
  33356. * @memberOf _
  33357. * @since 4.0.0
  33358. * @category Math
  33359. * @param {Array} array The array to iterate over.
  33360. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33361. * @returns {number} Returns the sum.
  33362. * @example
  33363. *
  33364. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33365. *
  33366. * _.sumBy(objects, function(o) { return o.n; });
  33367. * // => 20
  33368. *
  33369. * // The `_.property` iteratee shorthand.
  33370. * _.sumBy(objects, 'n');
  33371. * // => 20
  33372. */
  33373. function sumBy(array, iteratee) {
  33374. return (array && array.length)
  33375. ? baseSum(array, getIteratee(iteratee, 2))
  33376. : 0;
  33377. }
  33378. /*------------------------------------------------------------------------*/
  33379. // Add methods that return wrapped values in chain sequences.
  33380. lodash.after = after;
  33381. lodash.ary = ary;
  33382. lodash.assign = assign;
  33383. lodash.assignIn = assignIn;
  33384. lodash.assignInWith = assignInWith;
  33385. lodash.assignWith = assignWith;
  33386. lodash.at = at;
  33387. lodash.before = before;
  33388. lodash.bind = bind;
  33389. lodash.bindAll = bindAll;
  33390. lodash.bindKey = bindKey;
  33391. lodash.castArray = castArray;
  33392. lodash.chain = chain;
  33393. lodash.chunk = chunk;
  33394. lodash.compact = compact;
  33395. lodash.concat = concat;
  33396. lodash.cond = cond;
  33397. lodash.conforms = conforms;
  33398. lodash.constant = constant;
  33399. lodash.countBy = countBy;
  33400. lodash.create = create;
  33401. lodash.curry = curry;
  33402. lodash.curryRight = curryRight;
  33403. lodash.debounce = debounce;
  33404. lodash.defaults = defaults;
  33405. lodash.defaultsDeep = defaultsDeep;
  33406. lodash.defer = defer;
  33407. lodash.delay = delay;
  33408. lodash.difference = difference;
  33409. lodash.differenceBy = differenceBy;
  33410. lodash.differenceWith = differenceWith;
  33411. lodash.drop = drop;
  33412. lodash.dropRight = dropRight;
  33413. lodash.dropRightWhile = dropRightWhile;
  33414. lodash.dropWhile = dropWhile;
  33415. lodash.fill = fill;
  33416. lodash.filter = filter;
  33417. lodash.flatMap = flatMap;
  33418. lodash.flatMapDeep = flatMapDeep;
  33419. lodash.flatMapDepth = flatMapDepth;
  33420. lodash.flatten = flatten;
  33421. lodash.flattenDeep = flattenDeep;
  33422. lodash.flattenDepth = flattenDepth;
  33423. lodash.flip = flip;
  33424. lodash.flow = flow;
  33425. lodash.flowRight = flowRight;
  33426. lodash.fromPairs = fromPairs;
  33427. lodash.functions = functions;
  33428. lodash.functionsIn = functionsIn;
  33429. lodash.groupBy = groupBy;
  33430. lodash.initial = initial;
  33431. lodash.intersection = intersection;
  33432. lodash.intersectionBy = intersectionBy;
  33433. lodash.intersectionWith = intersectionWith;
  33434. lodash.invert = invert;
  33435. lodash.invertBy = invertBy;
  33436. lodash.invokeMap = invokeMap;
  33437. lodash.iteratee = iteratee;
  33438. lodash.keyBy = keyBy;
  33439. lodash.keys = keys;
  33440. lodash.keysIn = keysIn;
  33441. lodash.map = map;
  33442. lodash.mapKeys = mapKeys;
  33443. lodash.mapValues = mapValues;
  33444. lodash.matches = matches;
  33445. lodash.matchesProperty = matchesProperty;
  33446. lodash.memoize = memoize;
  33447. lodash.merge = merge;
  33448. lodash.mergeWith = mergeWith;
  33449. lodash.method = method;
  33450. lodash.methodOf = methodOf;
  33451. lodash.mixin = mixin;
  33452. lodash.negate = negate;
  33453. lodash.nthArg = nthArg;
  33454. lodash.omit = omit;
  33455. lodash.omitBy = omitBy;
  33456. lodash.once = once;
  33457. lodash.orderBy = orderBy;
  33458. lodash.over = over;
  33459. lodash.overArgs = overArgs;
  33460. lodash.overEvery = overEvery;
  33461. lodash.overSome = overSome;
  33462. lodash.partial = partial;
  33463. lodash.partialRight = partialRight;
  33464. lodash.partition = partition;
  33465. lodash.pick = pick;
  33466. lodash.pickBy = pickBy;
  33467. lodash.property = property;
  33468. lodash.propertyOf = propertyOf;
  33469. lodash.pull = pull;
  33470. lodash.pullAll = pullAll;
  33471. lodash.pullAllBy = pullAllBy;
  33472. lodash.pullAllWith = pullAllWith;
  33473. lodash.pullAt = pullAt;
  33474. lodash.range = range;
  33475. lodash.rangeRight = rangeRight;
  33476. lodash.rearg = rearg;
  33477. lodash.reject = reject;
  33478. lodash.remove = remove;
  33479. lodash.rest = rest;
  33480. lodash.reverse = reverse;
  33481. lodash.sampleSize = sampleSize;
  33482. lodash.set = set;
  33483. lodash.setWith = setWith;
  33484. lodash.shuffle = shuffle;
  33485. lodash.slice = slice;
  33486. lodash.sortBy = sortBy;
  33487. lodash.sortedUniq = sortedUniq;
  33488. lodash.sortedUniqBy = sortedUniqBy;
  33489. lodash.split = split;
  33490. lodash.spread = spread;
  33491. lodash.tail = tail;
  33492. lodash.take = take;
  33493. lodash.takeRight = takeRight;
  33494. lodash.takeRightWhile = takeRightWhile;
  33495. lodash.takeWhile = takeWhile;
  33496. lodash.tap = tap;
  33497. lodash.throttle = throttle;
  33498. lodash.thru = thru;
  33499. lodash.toArray = toArray;
  33500. lodash.toPairs = toPairs;
  33501. lodash.toPairsIn = toPairsIn;
  33502. lodash.toPath = toPath;
  33503. lodash.toPlainObject = toPlainObject;
  33504. lodash.transform = transform;
  33505. lodash.unary = unary;
  33506. lodash.union = union;
  33507. lodash.unionBy = unionBy;
  33508. lodash.unionWith = unionWith;
  33509. lodash.uniq = uniq;
  33510. lodash.uniqBy = uniqBy;
  33511. lodash.uniqWith = uniqWith;
  33512. lodash.unset = unset;
  33513. lodash.unzip = unzip;
  33514. lodash.unzipWith = unzipWith;
  33515. lodash.update = update;
  33516. lodash.updateWith = updateWith;
  33517. lodash.values = values;
  33518. lodash.valuesIn = valuesIn;
  33519. lodash.without = without;
  33520. lodash.words = words;
  33521. lodash.wrap = wrap;
  33522. lodash.xor = xor;
  33523. lodash.xorBy = xorBy;
  33524. lodash.xorWith = xorWith;
  33525. lodash.zip = zip;
  33526. lodash.zipObject = zipObject;
  33527. lodash.zipObjectDeep = zipObjectDeep;
  33528. lodash.zipWith = zipWith;
  33529. // Add aliases.
  33530. lodash.entries = toPairs;
  33531. lodash.entriesIn = toPairsIn;
  33532. lodash.extend = assignIn;
  33533. lodash.extendWith = assignInWith;
  33534. // Add methods to `lodash.prototype`.
  33535. mixin(lodash, lodash);
  33536. /*------------------------------------------------------------------------*/
  33537. // Add methods that return unwrapped values in chain sequences.
  33538. lodash.add = add;
  33539. lodash.attempt = attempt;
  33540. lodash.camelCase = camelCase;
  33541. lodash.capitalize = capitalize;
  33542. lodash.ceil = ceil;
  33543. lodash.clamp = clamp;
  33544. lodash.clone = clone;
  33545. lodash.cloneDeep = cloneDeep;
  33546. lodash.cloneDeepWith = cloneDeepWith;
  33547. lodash.cloneWith = cloneWith;
  33548. lodash.conformsTo = conformsTo;
  33549. lodash.deburr = deburr;
  33550. lodash.defaultTo = defaultTo;
  33551. lodash.divide = divide;
  33552. lodash.endsWith = endsWith;
  33553. lodash.eq = eq;
  33554. lodash.escape = escape;
  33555. lodash.escapeRegExp = escapeRegExp;
  33556. lodash.every = every;
  33557. lodash.find = find;
  33558. lodash.findIndex = findIndex;
  33559. lodash.findKey = findKey;
  33560. lodash.findLast = findLast;
  33561. lodash.findLastIndex = findLastIndex;
  33562. lodash.findLastKey = findLastKey;
  33563. lodash.floor = floor;
  33564. lodash.forEach = forEach;
  33565. lodash.forEachRight = forEachRight;
  33566. lodash.forIn = forIn;
  33567. lodash.forInRight = forInRight;
  33568. lodash.forOwn = forOwn;
  33569. lodash.forOwnRight = forOwnRight;
  33570. lodash.get = get;
  33571. lodash.gt = gt;
  33572. lodash.gte = gte;
  33573. lodash.has = has;
  33574. lodash.hasIn = hasIn;
  33575. lodash.head = head;
  33576. lodash.identity = identity;
  33577. lodash.includes = includes;
  33578. lodash.indexOf = indexOf;
  33579. lodash.inRange = inRange;
  33580. lodash.invoke = invoke;
  33581. lodash.isArguments = isArguments;
  33582. lodash.isArray = isArray;
  33583. lodash.isArrayBuffer = isArrayBuffer;
  33584. lodash.isArrayLike = isArrayLike;
  33585. lodash.isArrayLikeObject = isArrayLikeObject;
  33586. lodash.isBoolean = isBoolean;
  33587. lodash.isBuffer = isBuffer;
  33588. lodash.isDate = isDate;
  33589. lodash.isElement = isElement;
  33590. lodash.isEmpty = isEmpty;
  33591. lodash.isEqual = isEqual;
  33592. lodash.isEqualWith = isEqualWith;
  33593. lodash.isError = isError;
  33594. lodash.isFinite = isFinite;
  33595. lodash.isFunction = isFunction;
  33596. lodash.isInteger = isInteger;
  33597. lodash.isLength = isLength;
  33598. lodash.isMap = isMap;
  33599. lodash.isMatch = isMatch;
  33600. lodash.isMatchWith = isMatchWith;
  33601. lodash.isNaN = isNaN;
  33602. lodash.isNative = isNative;
  33603. lodash.isNil = isNil;
  33604. lodash.isNull = isNull;
  33605. lodash.isNumber = isNumber;
  33606. lodash.isObject = isObject;
  33607. lodash.isObjectLike = isObjectLike;
  33608. lodash.isPlainObject = isPlainObject;
  33609. lodash.isRegExp = isRegExp;
  33610. lodash.isSafeInteger = isSafeInteger;
  33611. lodash.isSet = isSet;
  33612. lodash.isString = isString;
  33613. lodash.isSymbol = isSymbol;
  33614. lodash.isTypedArray = isTypedArray;
  33615. lodash.isUndefined = isUndefined;
  33616. lodash.isWeakMap = isWeakMap;
  33617. lodash.isWeakSet = isWeakSet;
  33618. lodash.join = join;
  33619. lodash.kebabCase = kebabCase;
  33620. lodash.last = last;
  33621. lodash.lastIndexOf = lastIndexOf;
  33622. lodash.lowerCase = lowerCase;
  33623. lodash.lowerFirst = lowerFirst;
  33624. lodash.lt = lt;
  33625. lodash.lte = lte;
  33626. lodash.max = max;
  33627. lodash.maxBy = maxBy;
  33628. lodash.mean = mean;
  33629. lodash.meanBy = meanBy;
  33630. lodash.min = min;
  33631. lodash.minBy = minBy;
  33632. lodash.stubArray = stubArray;
  33633. lodash.stubFalse = stubFalse;
  33634. lodash.stubObject = stubObject;
  33635. lodash.stubString = stubString;
  33636. lodash.stubTrue = stubTrue;
  33637. lodash.multiply = multiply;
  33638. lodash.nth = nth;
  33639. lodash.noConflict = noConflict;
  33640. lodash.noop = noop;
  33641. lodash.now = now;
  33642. lodash.pad = pad;
  33643. lodash.padEnd = padEnd;
  33644. lodash.padStart = padStart;
  33645. lodash.parseInt = parseInt;
  33646. lodash.random = random;
  33647. lodash.reduce = reduce;
  33648. lodash.reduceRight = reduceRight;
  33649. lodash.repeat = repeat;
  33650. lodash.replace = replace;
  33651. lodash.result = result;
  33652. lodash.round = round;
  33653. lodash.runInContext = runInContext;
  33654. lodash.sample = sample;
  33655. lodash.size = size;
  33656. lodash.snakeCase = snakeCase;
  33657. lodash.some = some;
  33658. lodash.sortedIndex = sortedIndex;
  33659. lodash.sortedIndexBy = sortedIndexBy;
  33660. lodash.sortedIndexOf = sortedIndexOf;
  33661. lodash.sortedLastIndex = sortedLastIndex;
  33662. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33663. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33664. lodash.startCase = startCase;
  33665. lodash.startsWith = startsWith;
  33666. lodash.subtract = subtract;
  33667. lodash.sum = sum;
  33668. lodash.sumBy = sumBy;
  33669. lodash.template = template;
  33670. lodash.times = times;
  33671. lodash.toFinite = toFinite;
  33672. lodash.toInteger = toInteger;
  33673. lodash.toLength = toLength;
  33674. lodash.toLower = toLower;
  33675. lodash.toNumber = toNumber;
  33676. lodash.toSafeInteger = toSafeInteger;
  33677. lodash.toString = toString;
  33678. lodash.toUpper = toUpper;
  33679. lodash.trim = trim;
  33680. lodash.trimEnd = trimEnd;
  33681. lodash.trimStart = trimStart;
  33682. lodash.truncate = truncate;
  33683. lodash.unescape = unescape;
  33684. lodash.uniqueId = uniqueId;
  33685. lodash.upperCase = upperCase;
  33686. lodash.upperFirst = upperFirst;
  33687. // Add aliases.
  33688. lodash.each = forEach;
  33689. lodash.eachRight = forEachRight;
  33690. lodash.first = head;
  33691. mixin(lodash, (function() {
  33692. var source = {};
  33693. baseForOwn(lodash, function(func, methodName) {
  33694. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33695. source[methodName] = func;
  33696. }
  33697. });
  33698. return source;
  33699. }()), { 'chain': false });
  33700. /*------------------------------------------------------------------------*/
  33701. /**
  33702. * The semantic version number.
  33703. *
  33704. * @static
  33705. * @memberOf _
  33706. * @type {string}
  33707. */
  33708. lodash.VERSION = VERSION;
  33709. // Assign default placeholders.
  33710. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33711. lodash[methodName].placeholder = lodash;
  33712. });
  33713. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33714. arrayEach(['drop', 'take'], function(methodName, index) {
  33715. LazyWrapper.prototype[methodName] = function(n) {
  33716. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33717. var result = (this.__filtered__ && !index)
  33718. ? new LazyWrapper(this)
  33719. : this.clone();
  33720. if (result.__filtered__) {
  33721. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33722. } else {
  33723. result.__views__.push({
  33724. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33725. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33726. });
  33727. }
  33728. return result;
  33729. };
  33730. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33731. return this.reverse()[methodName](n).reverse();
  33732. };
  33733. });
  33734. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33735. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33736. var type = index + 1,
  33737. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33738. LazyWrapper.prototype[methodName] = function(iteratee) {
  33739. var result = this.clone();
  33740. result.__iteratees__.push({
  33741. 'iteratee': getIteratee(iteratee, 3),
  33742. 'type': type
  33743. });
  33744. result.__filtered__ = result.__filtered__ || isFilter;
  33745. return result;
  33746. };
  33747. });
  33748. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33749. arrayEach(['head', 'last'], function(methodName, index) {
  33750. var takeName = 'take' + (index ? 'Right' : '');
  33751. LazyWrapper.prototype[methodName] = function() {
  33752. return this[takeName](1).value()[0];
  33753. };
  33754. });
  33755. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33756. arrayEach(['initial', 'tail'], function(methodName, index) {
  33757. var dropName = 'drop' + (index ? '' : 'Right');
  33758. LazyWrapper.prototype[methodName] = function() {
  33759. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33760. };
  33761. });
  33762. LazyWrapper.prototype.compact = function() {
  33763. return this.filter(identity);
  33764. };
  33765. LazyWrapper.prototype.find = function(predicate) {
  33766. return this.filter(predicate).head();
  33767. };
  33768. LazyWrapper.prototype.findLast = function(predicate) {
  33769. return this.reverse().find(predicate);
  33770. };
  33771. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33772. if (typeof path == 'function') {
  33773. return new LazyWrapper(this);
  33774. }
  33775. return this.map(function(value) {
  33776. return baseInvoke(value, path, args);
  33777. });
  33778. });
  33779. LazyWrapper.prototype.reject = function(predicate) {
  33780. return this.filter(negate(getIteratee(predicate)));
  33781. };
  33782. LazyWrapper.prototype.slice = function(start, end) {
  33783. start = toInteger(start);
  33784. var result = this;
  33785. if (result.__filtered__ && (start > 0 || end < 0)) {
  33786. return new LazyWrapper(result);
  33787. }
  33788. if (start < 0) {
  33789. result = result.takeRight(-start);
  33790. } else if (start) {
  33791. result = result.drop(start);
  33792. }
  33793. if (end !== undefined) {
  33794. end = toInteger(end);
  33795. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33796. }
  33797. return result;
  33798. };
  33799. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33800. return this.reverse().takeWhile(predicate).reverse();
  33801. };
  33802. LazyWrapper.prototype.toArray = function() {
  33803. return this.take(MAX_ARRAY_LENGTH);
  33804. };
  33805. // Add `LazyWrapper` methods to `lodash.prototype`.
  33806. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33807. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33808. isTaker = /^(?:head|last)$/.test(methodName),
  33809. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33810. retUnwrapped = isTaker || /^find/.test(methodName);
  33811. if (!lodashFunc) {
  33812. return;
  33813. }
  33814. lodash.prototype[methodName] = function() {
  33815. var value = this.__wrapped__,
  33816. args = isTaker ? [1] : arguments,
  33817. isLazy = value instanceof LazyWrapper,
  33818. iteratee = args[0],
  33819. useLazy = isLazy || isArray(value);
  33820. var interceptor = function(value) {
  33821. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33822. return (isTaker && chainAll) ? result[0] : result;
  33823. };
  33824. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33825. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33826. isLazy = useLazy = false;
  33827. }
  33828. var chainAll = this.__chain__,
  33829. isHybrid = !!this.__actions__.length,
  33830. isUnwrapped = retUnwrapped && !chainAll,
  33831. onlyLazy = isLazy && !isHybrid;
  33832. if (!retUnwrapped && useLazy) {
  33833. value = onlyLazy ? value : new LazyWrapper(this);
  33834. var result = func.apply(value, args);
  33835. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33836. return new LodashWrapper(result, chainAll);
  33837. }
  33838. if (isUnwrapped && onlyLazy) {
  33839. return func.apply(this, args);
  33840. }
  33841. result = this.thru(interceptor);
  33842. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33843. };
  33844. });
  33845. // Add `Array` methods to `lodash.prototype`.
  33846. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33847. var func = arrayProto[methodName],
  33848. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33849. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33850. lodash.prototype[methodName] = function() {
  33851. var args = arguments;
  33852. if (retUnwrapped && !this.__chain__) {
  33853. var value = this.value();
  33854. return func.apply(isArray(value) ? value : [], args);
  33855. }
  33856. return this[chainName](function(value) {
  33857. return func.apply(isArray(value) ? value : [], args);
  33858. });
  33859. };
  33860. });
  33861. // Map minified method names to their real names.
  33862. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33863. var lodashFunc = lodash[methodName];
  33864. if (lodashFunc) {
  33865. var key = lodashFunc.name + '';
  33866. if (!hasOwnProperty.call(realNames, key)) {
  33867. realNames[key] = [];
  33868. }
  33869. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33870. }
  33871. });
  33872. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33873. 'name': 'wrapper',
  33874. 'func': undefined
  33875. }];
  33876. // Add methods to `LazyWrapper`.
  33877. LazyWrapper.prototype.clone = lazyClone;
  33878. LazyWrapper.prototype.reverse = lazyReverse;
  33879. LazyWrapper.prototype.value = lazyValue;
  33880. // Add chain sequence methods to the `lodash` wrapper.
  33881. lodash.prototype.at = wrapperAt;
  33882. lodash.prototype.chain = wrapperChain;
  33883. lodash.prototype.commit = wrapperCommit;
  33884. lodash.prototype.next = wrapperNext;
  33885. lodash.prototype.plant = wrapperPlant;
  33886. lodash.prototype.reverse = wrapperReverse;
  33887. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33888. // Add lazy aliases.
  33889. lodash.prototype.first = lodash.prototype.head;
  33890. if (symIterator) {
  33891. lodash.prototype[symIterator] = wrapperToIterator;
  33892. }
  33893. return lodash;
  33894. });
  33895. /*--------------------------------------------------------------------------*/
  33896. // Export lodash.
  33897. var _ = runInContext();
  33898. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33899. if (true) {
  33900. // Expose Lodash on the global object to prevent errors when Lodash is
  33901. // loaded by a script tag in the presence of an AMD loader.
  33902. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33903. // Use `_.noConflict` to remove Lodash from the global object.
  33904. root._ = _;
  33905. // Define as an anonymous module so, through path mapping, it can be
  33906. // referenced as the "underscore" module.
  33907. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33908. return _;
  33909. }).call(exports, __webpack_require__, exports, module),
  33910. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33911. }
  33912. // Check for `exports` after `define` in case a build optimizer adds it.
  33913. else {}
  33914. }.call(this));
  33915. /* 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)))
  33916. /***/ }),
  33917. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33918. /*!***************************************************!*\
  33919. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33920. \***************************************************/
  33921. /*! exports provided: default */
  33922. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33923. "use strict";
  33924. __webpack_require__.r(__webpack_exports__);
  33925. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33926. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33927. * @version 1.16.1
  33928. * @license
  33929. * Copyright (c) 2016 Federico Zivolo and contributors
  33930. *
  33931. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33932. * of this software and associated documentation files (the "Software"), to deal
  33933. * in the Software without restriction, including without limitation the rights
  33934. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33935. * copies of the Software, and to permit persons to whom the Software is
  33936. * furnished to do so, subject to the following conditions:
  33937. *
  33938. * The above copyright notice and this permission notice shall be included in all
  33939. * copies or substantial portions of the Software.
  33940. *
  33941. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33942. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33943. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33944. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33945. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33946. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33947. * SOFTWARE.
  33948. */
  33949. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33950. var timeoutDuration = function () {
  33951. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33952. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33953. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33954. return 1;
  33955. }
  33956. }
  33957. return 0;
  33958. }();
  33959. function microtaskDebounce(fn) {
  33960. var called = false;
  33961. return function () {
  33962. if (called) {
  33963. return;
  33964. }
  33965. called = true;
  33966. window.Promise.resolve().then(function () {
  33967. called = false;
  33968. fn();
  33969. });
  33970. };
  33971. }
  33972. function taskDebounce(fn) {
  33973. var scheduled = false;
  33974. return function () {
  33975. if (!scheduled) {
  33976. scheduled = true;
  33977. setTimeout(function () {
  33978. scheduled = false;
  33979. fn();
  33980. }, timeoutDuration);
  33981. }
  33982. };
  33983. }
  33984. var supportsMicroTasks = isBrowser && window.Promise;
  33985. /**
  33986. * Create a debounced version of a method, that's asynchronously deferred
  33987. * but called in the minimum time possible.
  33988. *
  33989. * @method
  33990. * @memberof Popper.Utils
  33991. * @argument {Function} fn
  33992. * @returns {Function}
  33993. */
  33994. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  33995. /**
  33996. * Check if the given variable is a function
  33997. * @method
  33998. * @memberof Popper.Utils
  33999. * @argument {Any} functionToCheck - variable to check
  34000. * @returns {Boolean} answer to: is a function?
  34001. */
  34002. function isFunction(functionToCheck) {
  34003. var getType = {};
  34004. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34005. }
  34006. /**
  34007. * Get CSS computed property of the given element
  34008. * @method
  34009. * @memberof Popper.Utils
  34010. * @argument {Eement} element
  34011. * @argument {String} property
  34012. */
  34013. function getStyleComputedProperty(element, property) {
  34014. if (element.nodeType !== 1) {
  34015. return [];
  34016. }
  34017. // NOTE: 1 DOM access here
  34018. var window = element.ownerDocument.defaultView;
  34019. var css = window.getComputedStyle(element, null);
  34020. return property ? css[property] : css;
  34021. }
  34022. /**
  34023. * Returns the parentNode or the host of the element
  34024. * @method
  34025. * @memberof Popper.Utils
  34026. * @argument {Element} element
  34027. * @returns {Element} parent
  34028. */
  34029. function getParentNode(element) {
  34030. if (element.nodeName === 'HTML') {
  34031. return element;
  34032. }
  34033. return element.parentNode || element.host;
  34034. }
  34035. /**
  34036. * Returns the scrolling parent of the given element
  34037. * @method
  34038. * @memberof Popper.Utils
  34039. * @argument {Element} element
  34040. * @returns {Element} scroll parent
  34041. */
  34042. function getScrollParent(element) {
  34043. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34044. if (!element) {
  34045. return document.body;
  34046. }
  34047. switch (element.nodeName) {
  34048. case 'HTML':
  34049. case 'BODY':
  34050. return element.ownerDocument.body;
  34051. case '#document':
  34052. return element.body;
  34053. }
  34054. // Firefox want us to check `-x` and `-y` variations as well
  34055. var _getStyleComputedProp = getStyleComputedProperty(element),
  34056. overflow = _getStyleComputedProp.overflow,
  34057. overflowX = _getStyleComputedProp.overflowX,
  34058. overflowY = _getStyleComputedProp.overflowY;
  34059. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34060. return element;
  34061. }
  34062. return getScrollParent(getParentNode(element));
  34063. }
  34064. /**
  34065. * Returns the reference node of the reference object, or the reference object itself.
  34066. * @method
  34067. * @memberof Popper.Utils
  34068. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34069. * @returns {Element} parent
  34070. */
  34071. function getReferenceNode(reference) {
  34072. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34073. }
  34074. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34075. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34076. /**
  34077. * Determines if the browser is Internet Explorer
  34078. * @method
  34079. * @memberof Popper.Utils
  34080. * @param {Number} version to check
  34081. * @returns {Boolean} isIE
  34082. */
  34083. function isIE(version) {
  34084. if (version === 11) {
  34085. return isIE11;
  34086. }
  34087. if (version === 10) {
  34088. return isIE10;
  34089. }
  34090. return isIE11 || isIE10;
  34091. }
  34092. /**
  34093. * Returns the offset parent of the given element
  34094. * @method
  34095. * @memberof Popper.Utils
  34096. * @argument {Element} element
  34097. * @returns {Element} offset parent
  34098. */
  34099. function getOffsetParent(element) {
  34100. if (!element) {
  34101. return document.documentElement;
  34102. }
  34103. var noOffsetParent = isIE(10) ? document.body : null;
  34104. // NOTE: 1 DOM access here
  34105. var offsetParent = element.offsetParent || null;
  34106. // Skip hidden elements which don't have an offsetParent
  34107. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34108. offsetParent = (element = element.nextElementSibling).offsetParent;
  34109. }
  34110. var nodeName = offsetParent && offsetParent.nodeName;
  34111. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34112. return element ? element.ownerDocument.documentElement : document.documentElement;
  34113. }
  34114. // .offsetParent will return the closest TH, TD or TABLE in case
  34115. // no offsetParent is present, I hate this job...
  34116. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34117. return getOffsetParent(offsetParent);
  34118. }
  34119. return offsetParent;
  34120. }
  34121. function isOffsetContainer(element) {
  34122. var nodeName = element.nodeName;
  34123. if (nodeName === 'BODY') {
  34124. return false;
  34125. }
  34126. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34127. }
  34128. /**
  34129. * Finds the root node (document, shadowDOM root) of the given element
  34130. * @method
  34131. * @memberof Popper.Utils
  34132. * @argument {Element} node
  34133. * @returns {Element} root node
  34134. */
  34135. function getRoot(node) {
  34136. if (node.parentNode !== null) {
  34137. return getRoot(node.parentNode);
  34138. }
  34139. return node;
  34140. }
  34141. /**
  34142. * Finds the offset parent common to the two provided nodes
  34143. * @method
  34144. * @memberof Popper.Utils
  34145. * @argument {Element} element1
  34146. * @argument {Element} element2
  34147. * @returns {Element} common offset parent
  34148. */
  34149. function findCommonOffsetParent(element1, element2) {
  34150. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34151. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34152. return document.documentElement;
  34153. }
  34154. // Here we make sure to give as "start" the element that comes first in the DOM
  34155. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34156. var start = order ? element1 : element2;
  34157. var end = order ? element2 : element1;
  34158. // Get common ancestor container
  34159. var range = document.createRange();
  34160. range.setStart(start, 0);
  34161. range.setEnd(end, 0);
  34162. var commonAncestorContainer = range.commonAncestorContainer;
  34163. // Both nodes are inside #document
  34164. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34165. if (isOffsetContainer(commonAncestorContainer)) {
  34166. return commonAncestorContainer;
  34167. }
  34168. return getOffsetParent(commonAncestorContainer);
  34169. }
  34170. // one of the nodes is inside shadowDOM, find which one
  34171. var element1root = getRoot(element1);
  34172. if (element1root.host) {
  34173. return findCommonOffsetParent(element1root.host, element2);
  34174. } else {
  34175. return findCommonOffsetParent(element1, getRoot(element2).host);
  34176. }
  34177. }
  34178. /**
  34179. * Gets the scroll value of the given element in the given side (top and left)
  34180. * @method
  34181. * @memberof Popper.Utils
  34182. * @argument {Element} element
  34183. * @argument {String} side `top` or `left`
  34184. * @returns {number} amount of scrolled pixels
  34185. */
  34186. function getScroll(element) {
  34187. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34188. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34189. var nodeName = element.nodeName;
  34190. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34191. var html = element.ownerDocument.documentElement;
  34192. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34193. return scrollingElement[upperSide];
  34194. }
  34195. return element[upperSide];
  34196. }
  34197. /*
  34198. * Sum or subtract the element scroll values (left and top) from a given rect object
  34199. * @method
  34200. * @memberof Popper.Utils
  34201. * @param {Object} rect - Rect object you want to change
  34202. * @param {HTMLElement} element - The element from the function reads the scroll values
  34203. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34204. * @return {Object} rect - The modifier rect object
  34205. */
  34206. function includeScroll(rect, element) {
  34207. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34208. var scrollTop = getScroll(element, 'top');
  34209. var scrollLeft = getScroll(element, 'left');
  34210. var modifier = subtract ? -1 : 1;
  34211. rect.top += scrollTop * modifier;
  34212. rect.bottom += scrollTop * modifier;
  34213. rect.left += scrollLeft * modifier;
  34214. rect.right += scrollLeft * modifier;
  34215. return rect;
  34216. }
  34217. /*
  34218. * Helper to detect borders of a given element
  34219. * @method
  34220. * @memberof Popper.Utils
  34221. * @param {CSSStyleDeclaration} styles
  34222. * Result of `getStyleComputedProperty` on the given element
  34223. * @param {String} axis - `x` or `y`
  34224. * @return {number} borders - The borders size of the given axis
  34225. */
  34226. function getBordersSize(styles, axis) {
  34227. var sideA = axis === 'x' ? 'Left' : 'Top';
  34228. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34229. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34230. }
  34231. function getSize(axis, body, html, computedStyle) {
  34232. 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);
  34233. }
  34234. function getWindowSizes(document) {
  34235. var body = document.body;
  34236. var html = document.documentElement;
  34237. var computedStyle = isIE(10) && getComputedStyle(html);
  34238. return {
  34239. height: getSize('Height', body, html, computedStyle),
  34240. width: getSize('Width', body, html, computedStyle)
  34241. };
  34242. }
  34243. var classCallCheck = function (instance, Constructor) {
  34244. if (!(instance instanceof Constructor)) {
  34245. throw new TypeError("Cannot call a class as a function");
  34246. }
  34247. };
  34248. var createClass = function () {
  34249. function defineProperties(target, props) {
  34250. for (var i = 0; i < props.length; i++) {
  34251. var descriptor = props[i];
  34252. descriptor.enumerable = descriptor.enumerable || false;
  34253. descriptor.configurable = true;
  34254. if ("value" in descriptor) descriptor.writable = true;
  34255. Object.defineProperty(target, descriptor.key, descriptor);
  34256. }
  34257. }
  34258. return function (Constructor, protoProps, staticProps) {
  34259. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34260. if (staticProps) defineProperties(Constructor, staticProps);
  34261. return Constructor;
  34262. };
  34263. }();
  34264. var defineProperty = function (obj, key, value) {
  34265. if (key in obj) {
  34266. Object.defineProperty(obj, key, {
  34267. value: value,
  34268. enumerable: true,
  34269. configurable: true,
  34270. writable: true
  34271. });
  34272. } else {
  34273. obj[key] = value;
  34274. }
  34275. return obj;
  34276. };
  34277. var _extends = Object.assign || function (target) {
  34278. for (var i = 1; i < arguments.length; i++) {
  34279. var source = arguments[i];
  34280. for (var key in source) {
  34281. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34282. target[key] = source[key];
  34283. }
  34284. }
  34285. }
  34286. return target;
  34287. };
  34288. /**
  34289. * Given element offsets, generate an output similar to getBoundingClientRect
  34290. * @method
  34291. * @memberof Popper.Utils
  34292. * @argument {Object} offsets
  34293. * @returns {Object} ClientRect like output
  34294. */
  34295. function getClientRect(offsets) {
  34296. return _extends({}, offsets, {
  34297. right: offsets.left + offsets.width,
  34298. bottom: offsets.top + offsets.height
  34299. });
  34300. }
  34301. /**
  34302. * Get bounding client rect of given element
  34303. * @method
  34304. * @memberof Popper.Utils
  34305. * @param {HTMLElement} element
  34306. * @return {Object} client rect
  34307. */
  34308. function getBoundingClientRect(element) {
  34309. var rect = {};
  34310. // IE10 10 FIX: Please, don't ask, the element isn't
  34311. // considered in DOM in some circumstances...
  34312. // This isn't reproducible in IE10 compatibility mode of IE11
  34313. try {
  34314. if (isIE(10)) {
  34315. rect = element.getBoundingClientRect();
  34316. var scrollTop = getScroll(element, 'top');
  34317. var scrollLeft = getScroll(element, 'left');
  34318. rect.top += scrollTop;
  34319. rect.left += scrollLeft;
  34320. rect.bottom += scrollTop;
  34321. rect.right += scrollLeft;
  34322. } else {
  34323. rect = element.getBoundingClientRect();
  34324. }
  34325. } catch (e) {}
  34326. var result = {
  34327. left: rect.left,
  34328. top: rect.top,
  34329. width: rect.right - rect.left,
  34330. height: rect.bottom - rect.top
  34331. };
  34332. // subtract scrollbar size from sizes
  34333. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34334. var width = sizes.width || element.clientWidth || result.width;
  34335. var height = sizes.height || element.clientHeight || result.height;
  34336. var horizScrollbar = element.offsetWidth - width;
  34337. var vertScrollbar = element.offsetHeight - height;
  34338. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34339. // we make this check conditional for performance reasons
  34340. if (horizScrollbar || vertScrollbar) {
  34341. var styles = getStyleComputedProperty(element);
  34342. horizScrollbar -= getBordersSize(styles, 'x');
  34343. vertScrollbar -= getBordersSize(styles, 'y');
  34344. result.width -= horizScrollbar;
  34345. result.height -= vertScrollbar;
  34346. }
  34347. return getClientRect(result);
  34348. }
  34349. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34350. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34351. var isIE10 = isIE(10);
  34352. var isHTML = parent.nodeName === 'HTML';
  34353. var childrenRect = getBoundingClientRect(children);
  34354. var parentRect = getBoundingClientRect(parent);
  34355. var scrollParent = getScrollParent(children);
  34356. var styles = getStyleComputedProperty(parent);
  34357. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34358. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34359. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34360. if (fixedPosition && isHTML) {
  34361. parentRect.top = Math.max(parentRect.top, 0);
  34362. parentRect.left = Math.max(parentRect.left, 0);
  34363. }
  34364. var offsets = getClientRect({
  34365. top: childrenRect.top - parentRect.top - borderTopWidth,
  34366. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34367. width: childrenRect.width,
  34368. height: childrenRect.height
  34369. });
  34370. offsets.marginTop = 0;
  34371. offsets.marginLeft = 0;
  34372. // Subtract margins of documentElement in case it's being used as parent
  34373. // we do this only on HTML because it's the only element that behaves
  34374. // differently when margins are applied to it. The margins are included in
  34375. // the box of the documentElement, in the other cases not.
  34376. if (!isIE10 && isHTML) {
  34377. var marginTop = parseFloat(styles.marginTop);
  34378. var marginLeft = parseFloat(styles.marginLeft);
  34379. offsets.top -= borderTopWidth - marginTop;
  34380. offsets.bottom -= borderTopWidth - marginTop;
  34381. offsets.left -= borderLeftWidth - marginLeft;
  34382. offsets.right -= borderLeftWidth - marginLeft;
  34383. // Attach marginTop and marginLeft because in some circumstances we may need them
  34384. offsets.marginTop = marginTop;
  34385. offsets.marginLeft = marginLeft;
  34386. }
  34387. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34388. offsets = includeScroll(offsets, parent);
  34389. }
  34390. return offsets;
  34391. }
  34392. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34393. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34394. var html = element.ownerDocument.documentElement;
  34395. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34396. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34397. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34398. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34399. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34400. var offset = {
  34401. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34402. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34403. width: width,
  34404. height: height
  34405. };
  34406. return getClientRect(offset);
  34407. }
  34408. /**
  34409. * Check if the given element is fixed or is inside a fixed parent
  34410. * @method
  34411. * @memberof Popper.Utils
  34412. * @argument {Element} element
  34413. * @argument {Element} customContainer
  34414. * @returns {Boolean} answer to "isFixed?"
  34415. */
  34416. function isFixed(element) {
  34417. var nodeName = element.nodeName;
  34418. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34419. return false;
  34420. }
  34421. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34422. return true;
  34423. }
  34424. var parentNode = getParentNode(element);
  34425. if (!parentNode) {
  34426. return false;
  34427. }
  34428. return isFixed(parentNode);
  34429. }
  34430. /**
  34431. * Finds the first parent of an element that has a transformed property defined
  34432. * @method
  34433. * @memberof Popper.Utils
  34434. * @argument {Element} element
  34435. * @returns {Element} first transformed parent or documentElement
  34436. */
  34437. function getFixedPositionOffsetParent(element) {
  34438. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34439. if (!element || !element.parentElement || isIE()) {
  34440. return document.documentElement;
  34441. }
  34442. var el = element.parentElement;
  34443. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34444. el = el.parentElement;
  34445. }
  34446. return el || document.documentElement;
  34447. }
  34448. /**
  34449. * Computed the boundaries limits and return them
  34450. * @method
  34451. * @memberof Popper.Utils
  34452. * @param {HTMLElement} popper
  34453. * @param {HTMLElement} reference
  34454. * @param {number} padding
  34455. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34456. * @param {Boolean} fixedPosition - Is in fixed position mode
  34457. * @returns {Object} Coordinates of the boundaries
  34458. */
  34459. function getBoundaries(popper, reference, padding, boundariesElement) {
  34460. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34461. // NOTE: 1 DOM access here
  34462. var boundaries = { top: 0, left: 0 };
  34463. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34464. // Handle viewport case
  34465. if (boundariesElement === 'viewport') {
  34466. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34467. } else {
  34468. // Handle other cases based on DOM element used as boundaries
  34469. var boundariesNode = void 0;
  34470. if (boundariesElement === 'scrollParent') {
  34471. boundariesNode = getScrollParent(getParentNode(reference));
  34472. if (boundariesNode.nodeName === 'BODY') {
  34473. boundariesNode = popper.ownerDocument.documentElement;
  34474. }
  34475. } else if (boundariesElement === 'window') {
  34476. boundariesNode = popper.ownerDocument.documentElement;
  34477. } else {
  34478. boundariesNode = boundariesElement;
  34479. }
  34480. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34481. // In case of HTML, we need a different computation
  34482. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34483. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34484. height = _getWindowSizes.height,
  34485. width = _getWindowSizes.width;
  34486. boundaries.top += offsets.top - offsets.marginTop;
  34487. boundaries.bottom = height + offsets.top;
  34488. boundaries.left += offsets.left - offsets.marginLeft;
  34489. boundaries.right = width + offsets.left;
  34490. } else {
  34491. // for all the other DOM elements, this one is good
  34492. boundaries = offsets;
  34493. }
  34494. }
  34495. // Add paddings
  34496. padding = padding || 0;
  34497. var isPaddingNumber = typeof padding === 'number';
  34498. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34499. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34500. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34501. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34502. return boundaries;
  34503. }
  34504. function getArea(_ref) {
  34505. var width = _ref.width,
  34506. height = _ref.height;
  34507. return width * height;
  34508. }
  34509. /**
  34510. * Utility used to transform the `auto` placement to the placement with more
  34511. * available space.
  34512. * @method
  34513. * @memberof Popper.Utils
  34514. * @argument {Object} data - The data object generated by update method
  34515. * @argument {Object} options - Modifiers configuration and options
  34516. * @returns {Object} The data object, properly modified
  34517. */
  34518. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34519. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34520. if (placement.indexOf('auto') === -1) {
  34521. return placement;
  34522. }
  34523. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34524. var rects = {
  34525. top: {
  34526. width: boundaries.width,
  34527. height: refRect.top - boundaries.top
  34528. },
  34529. right: {
  34530. width: boundaries.right - refRect.right,
  34531. height: boundaries.height
  34532. },
  34533. bottom: {
  34534. width: boundaries.width,
  34535. height: boundaries.bottom - refRect.bottom
  34536. },
  34537. left: {
  34538. width: refRect.left - boundaries.left,
  34539. height: boundaries.height
  34540. }
  34541. };
  34542. var sortedAreas = Object.keys(rects).map(function (key) {
  34543. return _extends({
  34544. key: key
  34545. }, rects[key], {
  34546. area: getArea(rects[key])
  34547. });
  34548. }).sort(function (a, b) {
  34549. return b.area - a.area;
  34550. });
  34551. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34552. var width = _ref2.width,
  34553. height = _ref2.height;
  34554. return width >= popper.clientWidth && height >= popper.clientHeight;
  34555. });
  34556. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34557. var variation = placement.split('-')[1];
  34558. return computedPlacement + (variation ? '-' + variation : '');
  34559. }
  34560. /**
  34561. * Get offsets to the reference element
  34562. * @method
  34563. * @memberof Popper.Utils
  34564. * @param {Object} state
  34565. * @param {Element} popper - the popper element
  34566. * @param {Element} reference - the reference element (the popper will be relative to this)
  34567. * @param {Element} fixedPosition - is in fixed position mode
  34568. * @returns {Object} An object containing the offsets which will be applied to the popper
  34569. */
  34570. function getReferenceOffsets(state, popper, reference) {
  34571. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34572. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34573. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34574. }
  34575. /**
  34576. * Get the outer sizes of the given element (offset size + margins)
  34577. * @method
  34578. * @memberof Popper.Utils
  34579. * @argument {Element} element
  34580. * @returns {Object} object containing width and height properties
  34581. */
  34582. function getOuterSizes(element) {
  34583. var window = element.ownerDocument.defaultView;
  34584. var styles = window.getComputedStyle(element);
  34585. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34586. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34587. var result = {
  34588. width: element.offsetWidth + y,
  34589. height: element.offsetHeight + x
  34590. };
  34591. return result;
  34592. }
  34593. /**
  34594. * Get the opposite placement of the given one
  34595. * @method
  34596. * @memberof Popper.Utils
  34597. * @argument {String} placement
  34598. * @returns {String} flipped placement
  34599. */
  34600. function getOppositePlacement(placement) {
  34601. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34602. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34603. return hash[matched];
  34604. });
  34605. }
  34606. /**
  34607. * Get offsets to the popper
  34608. * @method
  34609. * @memberof Popper.Utils
  34610. * @param {Object} position - CSS position the Popper will get applied
  34611. * @param {HTMLElement} popper - the popper element
  34612. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34613. * @param {String} placement - one of the valid placement options
  34614. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34615. */
  34616. function getPopperOffsets(popper, referenceOffsets, placement) {
  34617. placement = placement.split('-')[0];
  34618. // Get popper node sizes
  34619. var popperRect = getOuterSizes(popper);
  34620. // Add position, width and height to our offsets object
  34621. var popperOffsets = {
  34622. width: popperRect.width,
  34623. height: popperRect.height
  34624. };
  34625. // depending by the popper placement we have to compute its offsets slightly differently
  34626. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34627. var mainSide = isHoriz ? 'top' : 'left';
  34628. var secondarySide = isHoriz ? 'left' : 'top';
  34629. var measurement = isHoriz ? 'height' : 'width';
  34630. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34631. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34632. if (placement === secondarySide) {
  34633. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34634. } else {
  34635. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34636. }
  34637. return popperOffsets;
  34638. }
  34639. /**
  34640. * Mimics the `find` method of Array
  34641. * @method
  34642. * @memberof Popper.Utils
  34643. * @argument {Array} arr
  34644. * @argument prop
  34645. * @argument value
  34646. * @returns index or -1
  34647. */
  34648. function find(arr, check) {
  34649. // use native find if supported
  34650. if (Array.prototype.find) {
  34651. return arr.find(check);
  34652. }
  34653. // use `filter` to obtain the same behavior of `find`
  34654. return arr.filter(check)[0];
  34655. }
  34656. /**
  34657. * Return the index of the matching object
  34658. * @method
  34659. * @memberof Popper.Utils
  34660. * @argument {Array} arr
  34661. * @argument prop
  34662. * @argument value
  34663. * @returns index or -1
  34664. */
  34665. function findIndex(arr, prop, value) {
  34666. // use native findIndex if supported
  34667. if (Array.prototype.findIndex) {
  34668. return arr.findIndex(function (cur) {
  34669. return cur[prop] === value;
  34670. });
  34671. }
  34672. // use `find` + `indexOf` if `findIndex` isn't supported
  34673. var match = find(arr, function (obj) {
  34674. return obj[prop] === value;
  34675. });
  34676. return arr.indexOf(match);
  34677. }
  34678. /**
  34679. * Loop trough the list of modifiers and run them in order,
  34680. * each of them will then edit the data object.
  34681. * @method
  34682. * @memberof Popper.Utils
  34683. * @param {dataObject} data
  34684. * @param {Array} modifiers
  34685. * @param {String} ends - Optional modifier name used as stopper
  34686. * @returns {dataObject}
  34687. */
  34688. function runModifiers(modifiers, data, ends) {
  34689. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34690. modifiersToRun.forEach(function (modifier) {
  34691. if (modifier['function']) {
  34692. // eslint-disable-line dot-notation
  34693. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34694. }
  34695. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34696. if (modifier.enabled && isFunction(fn)) {
  34697. // Add properties to offsets to make them a complete clientRect object
  34698. // we do this before each modifier to make sure the previous one doesn't
  34699. // mess with these values
  34700. data.offsets.popper = getClientRect(data.offsets.popper);
  34701. data.offsets.reference = getClientRect(data.offsets.reference);
  34702. data = fn(data, modifier);
  34703. }
  34704. });
  34705. return data;
  34706. }
  34707. /**
  34708. * Updates the position of the popper, computing the new offsets and applying
  34709. * the new style.<br />
  34710. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34711. * @method
  34712. * @memberof Popper
  34713. */
  34714. function update() {
  34715. // if popper is destroyed, don't perform any further update
  34716. if (this.state.isDestroyed) {
  34717. return;
  34718. }
  34719. var data = {
  34720. instance: this,
  34721. styles: {},
  34722. arrowStyles: {},
  34723. attributes: {},
  34724. flipped: false,
  34725. offsets: {}
  34726. };
  34727. // compute reference element offsets
  34728. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34729. // compute auto placement, store placement inside the data object,
  34730. // modifiers will be able to edit `placement` if needed
  34731. // and refer to originalPlacement to know the original value
  34732. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34733. // store the computed placement inside `originalPlacement`
  34734. data.originalPlacement = data.placement;
  34735. data.positionFixed = this.options.positionFixed;
  34736. // compute the popper offsets
  34737. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34738. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34739. // run the modifiers
  34740. data = runModifiers(this.modifiers, data);
  34741. // the first `update` will call `onCreate` callback
  34742. // the other ones will call `onUpdate` callback
  34743. if (!this.state.isCreated) {
  34744. this.state.isCreated = true;
  34745. this.options.onCreate(data);
  34746. } else {
  34747. this.options.onUpdate(data);
  34748. }
  34749. }
  34750. /**
  34751. * Helper used to know if the given modifier is enabled.
  34752. * @method
  34753. * @memberof Popper.Utils
  34754. * @returns {Boolean}
  34755. */
  34756. function isModifierEnabled(modifiers, modifierName) {
  34757. return modifiers.some(function (_ref) {
  34758. var name = _ref.name,
  34759. enabled = _ref.enabled;
  34760. return enabled && name === modifierName;
  34761. });
  34762. }
  34763. /**
  34764. * Get the prefixed supported property name
  34765. * @method
  34766. * @memberof Popper.Utils
  34767. * @argument {String} property (camelCase)
  34768. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34769. */
  34770. function getSupportedPropertyName(property) {
  34771. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34772. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34773. for (var i = 0; i < prefixes.length; i++) {
  34774. var prefix = prefixes[i];
  34775. var toCheck = prefix ? '' + prefix + upperProp : property;
  34776. if (typeof document.body.style[toCheck] !== 'undefined') {
  34777. return toCheck;
  34778. }
  34779. }
  34780. return null;
  34781. }
  34782. /**
  34783. * Destroys the popper.
  34784. * @method
  34785. * @memberof Popper
  34786. */
  34787. function destroy() {
  34788. this.state.isDestroyed = true;
  34789. // touch DOM only if `applyStyle` modifier is enabled
  34790. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34791. this.popper.removeAttribute('x-placement');
  34792. this.popper.style.position = '';
  34793. this.popper.style.top = '';
  34794. this.popper.style.left = '';
  34795. this.popper.style.right = '';
  34796. this.popper.style.bottom = '';
  34797. this.popper.style.willChange = '';
  34798. this.popper.style[getSupportedPropertyName('transform')] = '';
  34799. }
  34800. this.disableEventListeners();
  34801. // remove the popper if user explicitly asked for the deletion on destroy
  34802. // do not use `remove` because IE11 doesn't support it
  34803. if (this.options.removeOnDestroy) {
  34804. this.popper.parentNode.removeChild(this.popper);
  34805. }
  34806. return this;
  34807. }
  34808. /**
  34809. * Get the window associated with the element
  34810. * @argument {Element} element
  34811. * @returns {Window}
  34812. */
  34813. function getWindow(element) {
  34814. var ownerDocument = element.ownerDocument;
  34815. return ownerDocument ? ownerDocument.defaultView : window;
  34816. }
  34817. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34818. var isBody = scrollParent.nodeName === 'BODY';
  34819. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34820. target.addEventListener(event, callback, { passive: true });
  34821. if (!isBody) {
  34822. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34823. }
  34824. scrollParents.push(target);
  34825. }
  34826. /**
  34827. * Setup needed event listeners used to update the popper position
  34828. * @method
  34829. * @memberof Popper.Utils
  34830. * @private
  34831. */
  34832. function setupEventListeners(reference, options, state, updateBound) {
  34833. // Resize event listener on window
  34834. state.updateBound = updateBound;
  34835. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34836. // Scroll event listener on scroll parents
  34837. var scrollElement = getScrollParent(reference);
  34838. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34839. state.scrollElement = scrollElement;
  34840. state.eventsEnabled = true;
  34841. return state;
  34842. }
  34843. /**
  34844. * It will add resize/scroll events and start recalculating
  34845. * position of the popper element when they are triggered.
  34846. * @method
  34847. * @memberof Popper
  34848. */
  34849. function enableEventListeners() {
  34850. if (!this.state.eventsEnabled) {
  34851. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34852. }
  34853. }
  34854. /**
  34855. * Remove event listeners used to update the popper position
  34856. * @method
  34857. * @memberof Popper.Utils
  34858. * @private
  34859. */
  34860. function removeEventListeners(reference, state) {
  34861. // Remove resize event listener on window
  34862. getWindow(reference).removeEventListener('resize', state.updateBound);
  34863. // Remove scroll event listener on scroll parents
  34864. state.scrollParents.forEach(function (target) {
  34865. target.removeEventListener('scroll', state.updateBound);
  34866. });
  34867. // Reset state
  34868. state.updateBound = null;
  34869. state.scrollParents = [];
  34870. state.scrollElement = null;
  34871. state.eventsEnabled = false;
  34872. return state;
  34873. }
  34874. /**
  34875. * It will remove resize/scroll events and won't recalculate popper position
  34876. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34877. * unless you call `update` method manually.
  34878. * @method
  34879. * @memberof Popper
  34880. */
  34881. function disableEventListeners() {
  34882. if (this.state.eventsEnabled) {
  34883. cancelAnimationFrame(this.scheduleUpdate);
  34884. this.state = removeEventListeners(this.reference, this.state);
  34885. }
  34886. }
  34887. /**
  34888. * Tells if a given input is a number
  34889. * @method
  34890. * @memberof Popper.Utils
  34891. * @param {*} input to check
  34892. * @return {Boolean}
  34893. */
  34894. function isNumeric(n) {
  34895. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34896. }
  34897. /**
  34898. * Set the style to the given popper
  34899. * @method
  34900. * @memberof Popper.Utils
  34901. * @argument {Element} element - Element to apply the style to
  34902. * @argument {Object} styles
  34903. * Object with a list of properties and values which will be applied to the element
  34904. */
  34905. function setStyles(element, styles) {
  34906. Object.keys(styles).forEach(function (prop) {
  34907. var unit = '';
  34908. // add unit if the value is numeric and is one of the following
  34909. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34910. unit = 'px';
  34911. }
  34912. element.style[prop] = styles[prop] + unit;
  34913. });
  34914. }
  34915. /**
  34916. * Set the attributes to the given popper
  34917. * @method
  34918. * @memberof Popper.Utils
  34919. * @argument {Element} element - Element to apply the attributes to
  34920. * @argument {Object} styles
  34921. * Object with a list of properties and values which will be applied to the element
  34922. */
  34923. function setAttributes(element, attributes) {
  34924. Object.keys(attributes).forEach(function (prop) {
  34925. var value = attributes[prop];
  34926. if (value !== false) {
  34927. element.setAttribute(prop, attributes[prop]);
  34928. } else {
  34929. element.removeAttribute(prop);
  34930. }
  34931. });
  34932. }
  34933. /**
  34934. * @function
  34935. * @memberof Modifiers
  34936. * @argument {Object} data - The data object generated by `update` method
  34937. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34938. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34939. * @argument {Object} options - Modifiers configuration and options
  34940. * @returns {Object} The same data object
  34941. */
  34942. function applyStyle(data) {
  34943. // any property present in `data.styles` will be applied to the popper,
  34944. // in this way we can make the 3rd party modifiers add custom styles to it
  34945. // Be aware, modifiers could override the properties defined in the previous
  34946. // lines of this modifier!
  34947. setStyles(data.instance.popper, data.styles);
  34948. // any property present in `data.attributes` will be applied to the popper,
  34949. // they will be set as HTML attributes of the element
  34950. setAttributes(data.instance.popper, data.attributes);
  34951. // if arrowElement is defined and arrowStyles has some properties
  34952. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34953. setStyles(data.arrowElement, data.arrowStyles);
  34954. }
  34955. return data;
  34956. }
  34957. /**
  34958. * Set the x-placement attribute before everything else because it could be used
  34959. * to add margins to the popper margins needs to be calculated to get the
  34960. * correct popper offsets.
  34961. * @method
  34962. * @memberof Popper.modifiers
  34963. * @param {HTMLElement} reference - The reference element used to position the popper
  34964. * @param {HTMLElement} popper - The HTML element used as popper
  34965. * @param {Object} options - Popper.js options
  34966. */
  34967. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  34968. // compute reference element offsets
  34969. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  34970. // compute auto placement, store placement inside the data object,
  34971. // modifiers will be able to edit `placement` if needed
  34972. // and refer to originalPlacement to know the original value
  34973. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  34974. popper.setAttribute('x-placement', placement);
  34975. // Apply `position` to popper before anything else because
  34976. // without the position applied we can't guarantee correct computations
  34977. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  34978. return options;
  34979. }
  34980. /**
  34981. * @function
  34982. * @memberof Popper.Utils
  34983. * @argument {Object} data - The data object generated by `update` method
  34984. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  34985. * @returns {Object} The popper's position offsets rounded
  34986. *
  34987. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  34988. * good as it can be within reason.
  34989. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  34990. *
  34991. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  34992. * as well on High DPI screens).
  34993. *
  34994. * Firefox prefers no rounding for positioning and does not have blurriness on
  34995. * high DPI screens.
  34996. *
  34997. * Only horizontal placement and left/right values need to be considered.
  34998. */
  34999. function getRoundedOffsets(data, shouldRound) {
  35000. var _data$offsets = data.offsets,
  35001. popper = _data$offsets.popper,
  35002. reference = _data$offsets.reference;
  35003. var round = Math.round,
  35004. floor = Math.floor;
  35005. var noRound = function noRound(v) {
  35006. return v;
  35007. };
  35008. var referenceWidth = round(reference.width);
  35009. var popperWidth = round(popper.width);
  35010. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35011. var isVariation = data.placement.indexOf('-') !== -1;
  35012. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35013. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35014. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35015. var verticalToInteger = !shouldRound ? noRound : round;
  35016. return {
  35017. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35018. top: verticalToInteger(popper.top),
  35019. bottom: verticalToInteger(popper.bottom),
  35020. right: horizontalToInteger(popper.right)
  35021. };
  35022. }
  35023. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35024. /**
  35025. * @function
  35026. * @memberof Modifiers
  35027. * @argument {Object} data - The data object generated by `update` method
  35028. * @argument {Object} options - Modifiers configuration and options
  35029. * @returns {Object} The data object, properly modified
  35030. */
  35031. function computeStyle(data, options) {
  35032. var x = options.x,
  35033. y = options.y;
  35034. var popper = data.offsets.popper;
  35035. // Remove this legacy support in Popper.js v2
  35036. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35037. return modifier.name === 'applyStyle';
  35038. }).gpuAcceleration;
  35039. if (legacyGpuAccelerationOption !== undefined) {
  35040. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35041. }
  35042. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35043. var offsetParent = getOffsetParent(data.instance.popper);
  35044. var offsetParentRect = getBoundingClientRect(offsetParent);
  35045. // Styles
  35046. var styles = {
  35047. position: popper.position
  35048. };
  35049. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35050. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35051. var sideB = y === 'right' ? 'left' : 'right';
  35052. // if gpuAcceleration is set to `true` and transform is supported,
  35053. // we use `translate3d` to apply the position to the popper we
  35054. // automatically use the supported prefixed version if needed
  35055. var prefixedProperty = getSupportedPropertyName('transform');
  35056. // now, let's make a step back and look at this code closely (wtf?)
  35057. // If the content of the popper grows once it's been positioned, it
  35058. // may happen that the popper gets misplaced because of the new content
  35059. // overflowing its reference element
  35060. // To avoid this problem, we provide two options (x and y), which allow
  35061. // the consumer to define the offset origin.
  35062. // If we position a popper on top of a reference element, we can set
  35063. // `x` to `top` to make the popper grow towards its top instead of
  35064. // its bottom.
  35065. var left = void 0,
  35066. top = void 0;
  35067. if (sideA === 'bottom') {
  35068. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35069. // and not the bottom of the html element
  35070. if (offsetParent.nodeName === 'HTML') {
  35071. top = -offsetParent.clientHeight + offsets.bottom;
  35072. } else {
  35073. top = -offsetParentRect.height + offsets.bottom;
  35074. }
  35075. } else {
  35076. top = offsets.top;
  35077. }
  35078. if (sideB === 'right') {
  35079. if (offsetParent.nodeName === 'HTML') {
  35080. left = -offsetParent.clientWidth + offsets.right;
  35081. } else {
  35082. left = -offsetParentRect.width + offsets.right;
  35083. }
  35084. } else {
  35085. left = offsets.left;
  35086. }
  35087. if (gpuAcceleration && prefixedProperty) {
  35088. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35089. styles[sideA] = 0;
  35090. styles[sideB] = 0;
  35091. styles.willChange = 'transform';
  35092. } else {
  35093. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35094. var invertTop = sideA === 'bottom' ? -1 : 1;
  35095. var invertLeft = sideB === 'right' ? -1 : 1;
  35096. styles[sideA] = top * invertTop;
  35097. styles[sideB] = left * invertLeft;
  35098. styles.willChange = sideA + ', ' + sideB;
  35099. }
  35100. // Attributes
  35101. var attributes = {
  35102. 'x-placement': data.placement
  35103. };
  35104. // Update `data` attributes, styles and arrowStyles
  35105. data.attributes = _extends({}, attributes, data.attributes);
  35106. data.styles = _extends({}, styles, data.styles);
  35107. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35108. return data;
  35109. }
  35110. /**
  35111. * Helper used to know if the given modifier depends from another one.<br />
  35112. * It checks if the needed modifier is listed and enabled.
  35113. * @method
  35114. * @memberof Popper.Utils
  35115. * @param {Array} modifiers - list of modifiers
  35116. * @param {String} requestingName - name of requesting modifier
  35117. * @param {String} requestedName - name of requested modifier
  35118. * @returns {Boolean}
  35119. */
  35120. function isModifierRequired(modifiers, requestingName, requestedName) {
  35121. var requesting = find(modifiers, function (_ref) {
  35122. var name = _ref.name;
  35123. return name === requestingName;
  35124. });
  35125. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35126. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35127. });
  35128. if (!isRequired) {
  35129. var _requesting = '`' + requestingName + '`';
  35130. var requested = '`' + requestedName + '`';
  35131. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35132. }
  35133. return isRequired;
  35134. }
  35135. /**
  35136. * @function
  35137. * @memberof Modifiers
  35138. * @argument {Object} data - The data object generated by update method
  35139. * @argument {Object} options - Modifiers configuration and options
  35140. * @returns {Object} The data object, properly modified
  35141. */
  35142. function arrow(data, options) {
  35143. var _data$offsets$arrow;
  35144. // arrow depends on keepTogether in order to work
  35145. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35146. return data;
  35147. }
  35148. var arrowElement = options.element;
  35149. // if arrowElement is a string, suppose it's a CSS selector
  35150. if (typeof arrowElement === 'string') {
  35151. arrowElement = data.instance.popper.querySelector(arrowElement);
  35152. // if arrowElement is not found, don't run the modifier
  35153. if (!arrowElement) {
  35154. return data;
  35155. }
  35156. } else {
  35157. // if the arrowElement isn't a query selector we must check that the
  35158. // provided DOM node is child of its popper node
  35159. if (!data.instance.popper.contains(arrowElement)) {
  35160. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35161. return data;
  35162. }
  35163. }
  35164. var placement = data.placement.split('-')[0];
  35165. var _data$offsets = data.offsets,
  35166. popper = _data$offsets.popper,
  35167. reference = _data$offsets.reference;
  35168. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35169. var len = isVertical ? 'height' : 'width';
  35170. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35171. var side = sideCapitalized.toLowerCase();
  35172. var altSide = isVertical ? 'left' : 'top';
  35173. var opSide = isVertical ? 'bottom' : 'right';
  35174. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35175. //
  35176. // extends keepTogether behavior making sure the popper and its
  35177. // reference have enough pixels in conjunction
  35178. //
  35179. // top/left side
  35180. if (reference[opSide] - arrowElementSize < popper[side]) {
  35181. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35182. }
  35183. // bottom/right side
  35184. if (reference[side] + arrowElementSize > popper[opSide]) {
  35185. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35186. }
  35187. data.offsets.popper = getClientRect(data.offsets.popper);
  35188. // compute center of the popper
  35189. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35190. // Compute the sideValue using the updated popper offsets
  35191. // take popper margin in account because we don't have this info available
  35192. var css = getStyleComputedProperty(data.instance.popper);
  35193. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35194. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35195. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35196. // prevent arrowElement from being placed not contiguously to its popper
  35197. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35198. data.arrowElement = arrowElement;
  35199. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35200. return data;
  35201. }
  35202. /**
  35203. * Get the opposite placement variation of the given one
  35204. * @method
  35205. * @memberof Popper.Utils
  35206. * @argument {String} placement variation
  35207. * @returns {String} flipped placement variation
  35208. */
  35209. function getOppositeVariation(variation) {
  35210. if (variation === 'end') {
  35211. return 'start';
  35212. } else if (variation === 'start') {
  35213. return 'end';
  35214. }
  35215. return variation;
  35216. }
  35217. /**
  35218. * List of accepted placements to use as values of the `placement` option.<br />
  35219. * Valid placements are:
  35220. * - `auto`
  35221. * - `top`
  35222. * - `right`
  35223. * - `bottom`
  35224. * - `left`
  35225. *
  35226. * Each placement can have a variation from this list:
  35227. * - `-start`
  35228. * - `-end`
  35229. *
  35230. * Variations are interpreted easily if you think of them as the left to right
  35231. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35232. * is right.<br />
  35233. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35234. *
  35235. * Some valid examples are:
  35236. * - `top-end` (on top of reference, right aligned)
  35237. * - `right-start` (on right of reference, top aligned)
  35238. * - `bottom` (on bottom, centered)
  35239. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35240. *
  35241. * @static
  35242. * @type {Array}
  35243. * @enum {String}
  35244. * @readonly
  35245. * @method placements
  35246. * @memberof Popper
  35247. */
  35248. 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'];
  35249. // Get rid of `auto` `auto-start` and `auto-end`
  35250. var validPlacements = placements.slice(3);
  35251. /**
  35252. * Given an initial placement, returns all the subsequent placements
  35253. * clockwise (or counter-clockwise).
  35254. *
  35255. * @method
  35256. * @memberof Popper.Utils
  35257. * @argument {String} placement - A valid placement (it accepts variations)
  35258. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35259. * @returns {Array} placements including their variations
  35260. */
  35261. function clockwise(placement) {
  35262. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35263. var index = validPlacements.indexOf(placement);
  35264. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35265. return counter ? arr.reverse() : arr;
  35266. }
  35267. var BEHAVIORS = {
  35268. FLIP: 'flip',
  35269. CLOCKWISE: 'clockwise',
  35270. COUNTERCLOCKWISE: 'counterclockwise'
  35271. };
  35272. /**
  35273. * @function
  35274. * @memberof Modifiers
  35275. * @argument {Object} data - The data object generated by update method
  35276. * @argument {Object} options - Modifiers configuration and options
  35277. * @returns {Object} The data object, properly modified
  35278. */
  35279. function flip(data, options) {
  35280. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35281. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35282. return data;
  35283. }
  35284. if (data.flipped && data.placement === data.originalPlacement) {
  35285. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35286. return data;
  35287. }
  35288. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35289. var placement = data.placement.split('-')[0];
  35290. var placementOpposite = getOppositePlacement(placement);
  35291. var variation = data.placement.split('-')[1] || '';
  35292. var flipOrder = [];
  35293. switch (options.behavior) {
  35294. case BEHAVIORS.FLIP:
  35295. flipOrder = [placement, placementOpposite];
  35296. break;
  35297. case BEHAVIORS.CLOCKWISE:
  35298. flipOrder = clockwise(placement);
  35299. break;
  35300. case BEHAVIORS.COUNTERCLOCKWISE:
  35301. flipOrder = clockwise(placement, true);
  35302. break;
  35303. default:
  35304. flipOrder = options.behavior;
  35305. }
  35306. flipOrder.forEach(function (step, index) {
  35307. if (placement !== step || flipOrder.length === index + 1) {
  35308. return data;
  35309. }
  35310. placement = data.placement.split('-')[0];
  35311. placementOpposite = getOppositePlacement(placement);
  35312. var popperOffsets = data.offsets.popper;
  35313. var refOffsets = data.offsets.reference;
  35314. // using floor because the reference offsets may contain decimals we are not going to consider here
  35315. var floor = Math.floor;
  35316. 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);
  35317. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35318. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35319. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35320. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35321. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35322. // flip the variation if required
  35323. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35324. // flips variation if reference element overflows boundaries
  35325. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35326. // flips variation if popper content overflows boundaries
  35327. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35328. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35329. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35330. // this boolean to detect any flip loop
  35331. data.flipped = true;
  35332. if (overlapsRef || overflowsBoundaries) {
  35333. placement = flipOrder[index + 1];
  35334. }
  35335. if (flippedVariation) {
  35336. variation = getOppositeVariation(variation);
  35337. }
  35338. data.placement = placement + (variation ? '-' + variation : '');
  35339. // this object contains `position`, we want to preserve it along with
  35340. // any additional property we may add in the future
  35341. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35342. data = runModifiers(data.instance.modifiers, data, 'flip');
  35343. }
  35344. });
  35345. return data;
  35346. }
  35347. /**
  35348. * @function
  35349. * @memberof Modifiers
  35350. * @argument {Object} data - The data object generated by update method
  35351. * @argument {Object} options - Modifiers configuration and options
  35352. * @returns {Object} The data object, properly modified
  35353. */
  35354. function keepTogether(data) {
  35355. var _data$offsets = data.offsets,
  35356. popper = _data$offsets.popper,
  35357. reference = _data$offsets.reference;
  35358. var placement = data.placement.split('-')[0];
  35359. var floor = Math.floor;
  35360. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35361. var side = isVertical ? 'right' : 'bottom';
  35362. var opSide = isVertical ? 'left' : 'top';
  35363. var measurement = isVertical ? 'width' : 'height';
  35364. if (popper[side] < floor(reference[opSide])) {
  35365. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35366. }
  35367. if (popper[opSide] > floor(reference[side])) {
  35368. data.offsets.popper[opSide] = floor(reference[side]);
  35369. }
  35370. return data;
  35371. }
  35372. /**
  35373. * Converts a string containing value + unit into a px value number
  35374. * @function
  35375. * @memberof {modifiers~offset}
  35376. * @private
  35377. * @argument {String} str - Value + unit string
  35378. * @argument {String} measurement - `height` or `width`
  35379. * @argument {Object} popperOffsets
  35380. * @argument {Object} referenceOffsets
  35381. * @returns {Number|String}
  35382. * Value in pixels, or original string if no values were extracted
  35383. */
  35384. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35385. // separate value from unit
  35386. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35387. var value = +split[1];
  35388. var unit = split[2];
  35389. // If it's not a number it's an operator, I guess
  35390. if (!value) {
  35391. return str;
  35392. }
  35393. if (unit.indexOf('%') === 0) {
  35394. var element = void 0;
  35395. switch (unit) {
  35396. case '%p':
  35397. element = popperOffsets;
  35398. break;
  35399. case '%':
  35400. case '%r':
  35401. default:
  35402. element = referenceOffsets;
  35403. }
  35404. var rect = getClientRect(element);
  35405. return rect[measurement] / 100 * value;
  35406. } else if (unit === 'vh' || unit === 'vw') {
  35407. // if is a vh or vw, we calculate the size based on the viewport
  35408. var size = void 0;
  35409. if (unit === 'vh') {
  35410. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35411. } else {
  35412. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35413. }
  35414. return size / 100 * value;
  35415. } else {
  35416. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35417. // if is an implicit unit, it's px, and we return just the value
  35418. return value;
  35419. }
  35420. }
  35421. /**
  35422. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35423. * @function
  35424. * @memberof {modifiers~offset}
  35425. * @private
  35426. * @argument {String} offset
  35427. * @argument {Object} popperOffsets
  35428. * @argument {Object} referenceOffsets
  35429. * @argument {String} basePlacement
  35430. * @returns {Array} a two cells array with x and y offsets in numbers
  35431. */
  35432. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35433. var offsets = [0, 0];
  35434. // Use height if placement is left or right and index is 0 otherwise use width
  35435. // in this way the first offset will use an axis and the second one
  35436. // will use the other one
  35437. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35438. // Split the offset string to obtain a list of values and operands
  35439. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35440. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35441. return frag.trim();
  35442. });
  35443. // Detect if the offset string contains a pair of values or a single one
  35444. // they could be separated by comma or space
  35445. var divider = fragments.indexOf(find(fragments, function (frag) {
  35446. return frag.search(/,|\s/) !== -1;
  35447. }));
  35448. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35449. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35450. }
  35451. // If divider is found, we divide the list of values and operands to divide
  35452. // them by ofset X and Y.
  35453. var splitRegex = /\s*,\s*|\s+/;
  35454. 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];
  35455. // Convert the values with units to absolute pixels to allow our computations
  35456. ops = ops.map(function (op, index) {
  35457. // Most of the units rely on the orientation of the popper
  35458. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35459. var mergeWithPrevious = false;
  35460. return op
  35461. // This aggregates any `+` or `-` sign that aren't considered operators
  35462. // e.g.: 10 + +5 => [10, +, +5]
  35463. .reduce(function (a, b) {
  35464. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35465. a[a.length - 1] = b;
  35466. mergeWithPrevious = true;
  35467. return a;
  35468. } else if (mergeWithPrevious) {
  35469. a[a.length - 1] += b;
  35470. mergeWithPrevious = false;
  35471. return a;
  35472. } else {
  35473. return a.concat(b);
  35474. }
  35475. }, [])
  35476. // Here we convert the string values into number values (in px)
  35477. .map(function (str) {
  35478. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35479. });
  35480. });
  35481. // Loop trough the offsets arrays and execute the operations
  35482. ops.forEach(function (op, index) {
  35483. op.forEach(function (frag, index2) {
  35484. if (isNumeric(frag)) {
  35485. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35486. }
  35487. });
  35488. });
  35489. return offsets;
  35490. }
  35491. /**
  35492. * @function
  35493. * @memberof Modifiers
  35494. * @argument {Object} data - The data object generated by update method
  35495. * @argument {Object} options - Modifiers configuration and options
  35496. * @argument {Number|String} options.offset=0
  35497. * The offset value as described in the modifier description
  35498. * @returns {Object} The data object, properly modified
  35499. */
  35500. function offset(data, _ref) {
  35501. var offset = _ref.offset;
  35502. var placement = data.placement,
  35503. _data$offsets = data.offsets,
  35504. popper = _data$offsets.popper,
  35505. reference = _data$offsets.reference;
  35506. var basePlacement = placement.split('-')[0];
  35507. var offsets = void 0;
  35508. if (isNumeric(+offset)) {
  35509. offsets = [+offset, 0];
  35510. } else {
  35511. offsets = parseOffset(offset, popper, reference, basePlacement);
  35512. }
  35513. if (basePlacement === 'left') {
  35514. popper.top += offsets[0];
  35515. popper.left -= offsets[1];
  35516. } else if (basePlacement === 'right') {
  35517. popper.top += offsets[0];
  35518. popper.left += offsets[1];
  35519. } else if (basePlacement === 'top') {
  35520. popper.left += offsets[0];
  35521. popper.top -= offsets[1];
  35522. } else if (basePlacement === 'bottom') {
  35523. popper.left += offsets[0];
  35524. popper.top += offsets[1];
  35525. }
  35526. data.popper = popper;
  35527. return data;
  35528. }
  35529. /**
  35530. * @function
  35531. * @memberof Modifiers
  35532. * @argument {Object} data - The data object generated by `update` method
  35533. * @argument {Object} options - Modifiers configuration and options
  35534. * @returns {Object} The data object, properly modified
  35535. */
  35536. function preventOverflow(data, options) {
  35537. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35538. // If offsetParent is the reference element, we really want to
  35539. // go one step up and use the next offsetParent as reference to
  35540. // avoid to make this modifier completely useless and look like broken
  35541. if (data.instance.reference === boundariesElement) {
  35542. boundariesElement = getOffsetParent(boundariesElement);
  35543. }
  35544. // NOTE: DOM access here
  35545. // resets the popper's position so that the document size can be calculated excluding
  35546. // the size of the popper element itself
  35547. var transformProp = getSupportedPropertyName('transform');
  35548. var popperStyles = data.instance.popper.style; // assignment to help minification
  35549. var top = popperStyles.top,
  35550. left = popperStyles.left,
  35551. transform = popperStyles[transformProp];
  35552. popperStyles.top = '';
  35553. popperStyles.left = '';
  35554. popperStyles[transformProp] = '';
  35555. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35556. // NOTE: DOM access here
  35557. // restores the original style properties after the offsets have been computed
  35558. popperStyles.top = top;
  35559. popperStyles.left = left;
  35560. popperStyles[transformProp] = transform;
  35561. options.boundaries = boundaries;
  35562. var order = options.priority;
  35563. var popper = data.offsets.popper;
  35564. var check = {
  35565. primary: function primary(placement) {
  35566. var value = popper[placement];
  35567. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35568. value = Math.max(popper[placement], boundaries[placement]);
  35569. }
  35570. return defineProperty({}, placement, value);
  35571. },
  35572. secondary: function secondary(placement) {
  35573. var mainSide = placement === 'right' ? 'left' : 'top';
  35574. var value = popper[mainSide];
  35575. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35576. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35577. }
  35578. return defineProperty({}, mainSide, value);
  35579. }
  35580. };
  35581. order.forEach(function (placement) {
  35582. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35583. popper = _extends({}, popper, check[side](placement));
  35584. });
  35585. data.offsets.popper = popper;
  35586. return data;
  35587. }
  35588. /**
  35589. * @function
  35590. * @memberof Modifiers
  35591. * @argument {Object} data - The data object generated by `update` method
  35592. * @argument {Object} options - Modifiers configuration and options
  35593. * @returns {Object} The data object, properly modified
  35594. */
  35595. function shift(data) {
  35596. var placement = data.placement;
  35597. var basePlacement = placement.split('-')[0];
  35598. var shiftvariation = placement.split('-')[1];
  35599. // if shift shiftvariation is specified, run the modifier
  35600. if (shiftvariation) {
  35601. var _data$offsets = data.offsets,
  35602. reference = _data$offsets.reference,
  35603. popper = _data$offsets.popper;
  35604. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35605. var side = isVertical ? 'left' : 'top';
  35606. var measurement = isVertical ? 'width' : 'height';
  35607. var shiftOffsets = {
  35608. start: defineProperty({}, side, reference[side]),
  35609. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35610. };
  35611. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35612. }
  35613. return data;
  35614. }
  35615. /**
  35616. * @function
  35617. * @memberof Modifiers
  35618. * @argument {Object} data - The data object generated by update method
  35619. * @argument {Object} options - Modifiers configuration and options
  35620. * @returns {Object} The data object, properly modified
  35621. */
  35622. function hide(data) {
  35623. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35624. return data;
  35625. }
  35626. var refRect = data.offsets.reference;
  35627. var bound = find(data.instance.modifiers, function (modifier) {
  35628. return modifier.name === 'preventOverflow';
  35629. }).boundaries;
  35630. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35631. // Avoid unnecessary DOM access if visibility hasn't changed
  35632. if (data.hide === true) {
  35633. return data;
  35634. }
  35635. data.hide = true;
  35636. data.attributes['x-out-of-boundaries'] = '';
  35637. } else {
  35638. // Avoid unnecessary DOM access if visibility hasn't changed
  35639. if (data.hide === false) {
  35640. return data;
  35641. }
  35642. data.hide = false;
  35643. data.attributes['x-out-of-boundaries'] = false;
  35644. }
  35645. return data;
  35646. }
  35647. /**
  35648. * @function
  35649. * @memberof Modifiers
  35650. * @argument {Object} data - The data object generated by `update` method
  35651. * @argument {Object} options - Modifiers configuration and options
  35652. * @returns {Object} The data object, properly modified
  35653. */
  35654. function inner(data) {
  35655. var placement = data.placement;
  35656. var basePlacement = placement.split('-')[0];
  35657. var _data$offsets = data.offsets,
  35658. popper = _data$offsets.popper,
  35659. reference = _data$offsets.reference;
  35660. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35661. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35662. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35663. data.placement = getOppositePlacement(placement);
  35664. data.offsets.popper = getClientRect(popper);
  35665. return data;
  35666. }
  35667. /**
  35668. * Modifier function, each modifier can have a function of this type assigned
  35669. * to its `fn` property.<br />
  35670. * These functions will be called on each update, this means that you must
  35671. * make sure they are performant enough to avoid performance bottlenecks.
  35672. *
  35673. * @function ModifierFn
  35674. * @argument {dataObject} data - The data object generated by `update` method
  35675. * @argument {Object} options - Modifiers configuration and options
  35676. * @returns {dataObject} The data object, properly modified
  35677. */
  35678. /**
  35679. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35680. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35681. * needed by the library.
  35682. *
  35683. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35684. * All the other properties are configurations that could be tweaked.
  35685. * @namespace modifiers
  35686. */
  35687. var modifiers = {
  35688. /**
  35689. * Modifier used to shift the popper on the start or end of its reference
  35690. * element.<br />
  35691. * It will read the variation of the `placement` property.<br />
  35692. * It can be one either `-end` or `-start`.
  35693. * @memberof modifiers
  35694. * @inner
  35695. */
  35696. shift: {
  35697. /** @prop {number} order=100 - Index used to define the order of execution */
  35698. order: 100,
  35699. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35700. enabled: true,
  35701. /** @prop {ModifierFn} */
  35702. fn: shift
  35703. },
  35704. /**
  35705. * The `offset` modifier can shift your popper on both its axis.
  35706. *
  35707. * It accepts the following units:
  35708. * - `px` or unit-less, interpreted as pixels
  35709. * - `%` or `%r`, percentage relative to the length of the reference element
  35710. * - `%p`, percentage relative to the length of the popper element
  35711. * - `vw`, CSS viewport width unit
  35712. * - `vh`, CSS viewport height unit
  35713. *
  35714. * For length is intended the main axis relative to the placement of the popper.<br />
  35715. * This means that if the placement is `top` or `bottom`, the length will be the
  35716. * `width`. In case of `left` or `right`, it will be the `height`.
  35717. *
  35718. * You can provide a single value (as `Number` or `String`), or a pair of values
  35719. * as `String` divided by a comma or one (or more) white spaces.<br />
  35720. * The latter is a deprecated method because it leads to confusion and will be
  35721. * removed in v2.<br />
  35722. * Additionally, it accepts additions and subtractions between different units.
  35723. * Note that multiplications and divisions aren't supported.
  35724. *
  35725. * Valid examples are:
  35726. * ```
  35727. * 10
  35728. * '10%'
  35729. * '10, 10'
  35730. * '10%, 10'
  35731. * '10 + 10%'
  35732. * '10 - 5vh + 3%'
  35733. * '-10px + 5vh, 5px - 6%'
  35734. * ```
  35735. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35736. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35737. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35738. *
  35739. * @memberof modifiers
  35740. * @inner
  35741. */
  35742. offset: {
  35743. /** @prop {number} order=200 - Index used to define the order of execution */
  35744. order: 200,
  35745. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35746. enabled: true,
  35747. /** @prop {ModifierFn} */
  35748. fn: offset,
  35749. /** @prop {Number|String} offset=0
  35750. * The offset value as described in the modifier description
  35751. */
  35752. offset: 0
  35753. },
  35754. /**
  35755. * Modifier used to prevent the popper from being positioned outside the boundary.
  35756. *
  35757. * A scenario exists where the reference itself is not within the boundaries.<br />
  35758. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35759. * In this case we need to decide whether the popper should either:
  35760. *
  35761. * - detach from the reference and remain "trapped" in the boundaries, or
  35762. * - if it should ignore the boundary and "escape with its reference"
  35763. *
  35764. * When `escapeWithReference` is set to`true` and reference is completely
  35765. * outside its boundaries, the popper will overflow (or completely leave)
  35766. * the boundaries in order to remain attached to the edge of the reference.
  35767. *
  35768. * @memberof modifiers
  35769. * @inner
  35770. */
  35771. preventOverflow: {
  35772. /** @prop {number} order=300 - Index used to define the order of execution */
  35773. order: 300,
  35774. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35775. enabled: true,
  35776. /** @prop {ModifierFn} */
  35777. fn: preventOverflow,
  35778. /**
  35779. * @prop {Array} [priority=['left','right','top','bottom']]
  35780. * Popper will try to prevent overflow following these priorities by default,
  35781. * then, it could overflow on the left and on top of the `boundariesElement`
  35782. */
  35783. priority: ['left', 'right', 'top', 'bottom'],
  35784. /**
  35785. * @prop {number} padding=5
  35786. * Amount of pixel used to define a minimum distance between the boundaries
  35787. * and the popper. This makes sure the popper always has a little padding
  35788. * between the edges of its container
  35789. */
  35790. padding: 5,
  35791. /**
  35792. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35793. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35794. * `viewport` or any DOM element.
  35795. */
  35796. boundariesElement: 'scrollParent'
  35797. },
  35798. /**
  35799. * Modifier used to make sure the reference and its popper stay near each other
  35800. * without leaving any gap between the two. Especially useful when the arrow is
  35801. * enabled and you want to ensure that it points to its reference element.
  35802. * It cares only about the first axis. You can still have poppers with margin
  35803. * between the popper and its reference element.
  35804. * @memberof modifiers
  35805. * @inner
  35806. */
  35807. keepTogether: {
  35808. /** @prop {number} order=400 - Index used to define the order of execution */
  35809. order: 400,
  35810. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35811. enabled: true,
  35812. /** @prop {ModifierFn} */
  35813. fn: keepTogether
  35814. },
  35815. /**
  35816. * This modifier is used to move the `arrowElement` of the popper to make
  35817. * sure it is positioned between the reference element and its popper element.
  35818. * It will read the outer size of the `arrowElement` node to detect how many
  35819. * pixels of conjunction are needed.
  35820. *
  35821. * It has no effect if no `arrowElement` is provided.
  35822. * @memberof modifiers
  35823. * @inner
  35824. */
  35825. arrow: {
  35826. /** @prop {number} order=500 - Index used to define the order of execution */
  35827. order: 500,
  35828. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35829. enabled: true,
  35830. /** @prop {ModifierFn} */
  35831. fn: arrow,
  35832. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35833. element: '[x-arrow]'
  35834. },
  35835. /**
  35836. * Modifier used to flip the popper's placement when it starts to overlap its
  35837. * reference element.
  35838. *
  35839. * Requires the `preventOverflow` modifier before it in order to work.
  35840. *
  35841. * **NOTE:** this modifier will interrupt the current update cycle and will
  35842. * restart it if it detects the need to flip the placement.
  35843. * @memberof modifiers
  35844. * @inner
  35845. */
  35846. flip: {
  35847. /** @prop {number} order=600 - Index used to define the order of execution */
  35848. order: 600,
  35849. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35850. enabled: true,
  35851. /** @prop {ModifierFn} */
  35852. fn: flip,
  35853. /**
  35854. * @prop {String|Array} behavior='flip'
  35855. * The behavior used to change the popper's placement. It can be one of
  35856. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35857. * placements (with optional variations)
  35858. */
  35859. behavior: 'flip',
  35860. /**
  35861. * @prop {number} padding=5
  35862. * The popper will flip if it hits the edges of the `boundariesElement`
  35863. */
  35864. padding: 5,
  35865. /**
  35866. * @prop {String|HTMLElement} boundariesElement='viewport'
  35867. * The element which will define the boundaries of the popper position.
  35868. * The popper will never be placed outside of the defined boundaries
  35869. * (except if `keepTogether` is enabled)
  35870. */
  35871. boundariesElement: 'viewport',
  35872. /**
  35873. * @prop {Boolean} flipVariations=false
  35874. * The popper will switch placement variation between `-start` and `-end` when
  35875. * the reference element overlaps its boundaries.
  35876. *
  35877. * The original placement should have a set variation.
  35878. */
  35879. flipVariations: false,
  35880. /**
  35881. * @prop {Boolean} flipVariationsByContent=false
  35882. * The popper will switch placement variation between `-start` and `-end` when
  35883. * the popper element overlaps its reference boundaries.
  35884. *
  35885. * The original placement should have a set variation.
  35886. */
  35887. flipVariationsByContent: false
  35888. },
  35889. /**
  35890. * Modifier used to make the popper flow toward the inner of the reference element.
  35891. * By default, when this modifier is disabled, the popper will be placed outside
  35892. * the reference element.
  35893. * @memberof modifiers
  35894. * @inner
  35895. */
  35896. inner: {
  35897. /** @prop {number} order=700 - Index used to define the order of execution */
  35898. order: 700,
  35899. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35900. enabled: false,
  35901. /** @prop {ModifierFn} */
  35902. fn: inner
  35903. },
  35904. /**
  35905. * Modifier used to hide the popper when its reference element is outside of the
  35906. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35907. * be used to hide with a CSS selector the popper when its reference is
  35908. * out of boundaries.
  35909. *
  35910. * Requires the `preventOverflow` modifier before it in order to work.
  35911. * @memberof modifiers
  35912. * @inner
  35913. */
  35914. hide: {
  35915. /** @prop {number} order=800 - Index used to define the order of execution */
  35916. order: 800,
  35917. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35918. enabled: true,
  35919. /** @prop {ModifierFn} */
  35920. fn: hide
  35921. },
  35922. /**
  35923. * Computes the style that will be applied to the popper element to gets
  35924. * properly positioned.
  35925. *
  35926. * Note that this modifier will not touch the DOM, it just prepares the styles
  35927. * so that `applyStyle` modifier can apply it. This separation is useful
  35928. * in case you need to replace `applyStyle` with a custom implementation.
  35929. *
  35930. * This modifier has `850` as `order` value to maintain backward compatibility
  35931. * with previous versions of Popper.js. Expect the modifiers ordering method
  35932. * to change in future major versions of the library.
  35933. *
  35934. * @memberof modifiers
  35935. * @inner
  35936. */
  35937. computeStyle: {
  35938. /** @prop {number} order=850 - Index used to define the order of execution */
  35939. order: 850,
  35940. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35941. enabled: true,
  35942. /** @prop {ModifierFn} */
  35943. fn: computeStyle,
  35944. /**
  35945. * @prop {Boolean} gpuAcceleration=true
  35946. * If true, it uses the CSS 3D transformation to position the popper.
  35947. * Otherwise, it will use the `top` and `left` properties
  35948. */
  35949. gpuAcceleration: true,
  35950. /**
  35951. * @prop {string} [x='bottom']
  35952. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35953. * Change this if your popper should grow in a direction different from `bottom`
  35954. */
  35955. x: 'bottom',
  35956. /**
  35957. * @prop {string} [x='left']
  35958. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35959. * Change this if your popper should grow in a direction different from `right`
  35960. */
  35961. y: 'right'
  35962. },
  35963. /**
  35964. * Applies the computed styles to the popper element.
  35965. *
  35966. * All the DOM manipulations are limited to this modifier. This is useful in case
  35967. * you want to integrate Popper.js inside a framework or view library and you
  35968. * want to delegate all the DOM manipulations to it.
  35969. *
  35970. * Note that if you disable this modifier, you must make sure the popper element
  35971. * has its position set to `absolute` before Popper.js can do its work!
  35972. *
  35973. * Just disable this modifier and define your own to achieve the desired effect.
  35974. *
  35975. * @memberof modifiers
  35976. * @inner
  35977. */
  35978. applyStyle: {
  35979. /** @prop {number} order=900 - Index used to define the order of execution */
  35980. order: 900,
  35981. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35982. enabled: true,
  35983. /** @prop {ModifierFn} */
  35984. fn: applyStyle,
  35985. /** @prop {Function} */
  35986. onLoad: applyStyleOnLoad,
  35987. /**
  35988. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  35989. * @prop {Boolean} gpuAcceleration=true
  35990. * If true, it uses the CSS 3D transformation to position the popper.
  35991. * Otherwise, it will use the `top` and `left` properties
  35992. */
  35993. gpuAcceleration: undefined
  35994. }
  35995. };
  35996. /**
  35997. * The `dataObject` is an object containing all the information used by Popper.js.
  35998. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  35999. * @name dataObject
  36000. * @property {Object} data.instance The Popper.js instance
  36001. * @property {String} data.placement Placement applied to popper
  36002. * @property {String} data.originalPlacement Placement originally defined on init
  36003. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36004. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36005. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36006. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36007. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36008. * @property {Object} data.boundaries Offsets of the popper boundaries
  36009. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36010. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36011. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36012. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36013. */
  36014. /**
  36015. * Default options provided to Popper.js constructor.<br />
  36016. * These can be overridden using the `options` argument of Popper.js.<br />
  36017. * To override an option, simply pass an object with the same
  36018. * structure of the `options` object, as the 3rd argument. For example:
  36019. * ```
  36020. * new Popper(ref, pop, {
  36021. * modifiers: {
  36022. * preventOverflow: { enabled: false }
  36023. * }
  36024. * })
  36025. * ```
  36026. * @type {Object}
  36027. * @static
  36028. * @memberof Popper
  36029. */
  36030. var Defaults = {
  36031. /**
  36032. * Popper's placement.
  36033. * @prop {Popper.placements} placement='bottom'
  36034. */
  36035. placement: 'bottom',
  36036. /**
  36037. * Set this to true if you want popper to position it self in 'fixed' mode
  36038. * @prop {Boolean} positionFixed=false
  36039. */
  36040. positionFixed: false,
  36041. /**
  36042. * Whether events (resize, scroll) are initially enabled.
  36043. * @prop {Boolean} eventsEnabled=true
  36044. */
  36045. eventsEnabled: true,
  36046. /**
  36047. * Set to true if you want to automatically remove the popper when
  36048. * you call the `destroy` method.
  36049. * @prop {Boolean} removeOnDestroy=false
  36050. */
  36051. removeOnDestroy: false,
  36052. /**
  36053. * Callback called when the popper is created.<br />
  36054. * By default, it is set to no-op.<br />
  36055. * Access Popper.js instance with `data.instance`.
  36056. * @prop {onCreate}
  36057. */
  36058. onCreate: function onCreate() {},
  36059. /**
  36060. * Callback called when the popper is updated. This callback is not called
  36061. * on the initialization/creation of the popper, but only on subsequent
  36062. * updates.<br />
  36063. * By default, it is set to no-op.<br />
  36064. * Access Popper.js instance with `data.instance`.
  36065. * @prop {onUpdate}
  36066. */
  36067. onUpdate: function onUpdate() {},
  36068. /**
  36069. * List of modifiers used to modify the offsets before they are applied to the popper.
  36070. * They provide most of the functionalities of Popper.js.
  36071. * @prop {modifiers}
  36072. */
  36073. modifiers: modifiers
  36074. };
  36075. /**
  36076. * @callback onCreate
  36077. * @param {dataObject} data
  36078. */
  36079. /**
  36080. * @callback onUpdate
  36081. * @param {dataObject} data
  36082. */
  36083. // Utils
  36084. // Methods
  36085. var Popper = function () {
  36086. /**
  36087. * Creates a new Popper.js instance.
  36088. * @class Popper
  36089. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36090. * @param {Element} popper - The HTML / XML element used as the popper
  36091. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36092. * @return {Object} instance - The generated Popper.js instance
  36093. */
  36094. function Popper(reference, popper) {
  36095. var _this = this;
  36096. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36097. classCallCheck(this, Popper);
  36098. this.scheduleUpdate = function () {
  36099. return requestAnimationFrame(_this.update);
  36100. };
  36101. // make update() debounced, so that it only runs at most once-per-tick
  36102. this.update = debounce(this.update.bind(this));
  36103. // with {} we create a new object with the options inside it
  36104. this.options = _extends({}, Popper.Defaults, options);
  36105. // init state
  36106. this.state = {
  36107. isDestroyed: false,
  36108. isCreated: false,
  36109. scrollParents: []
  36110. };
  36111. // get reference and popper elements (allow jQuery wrappers)
  36112. this.reference = reference && reference.jquery ? reference[0] : reference;
  36113. this.popper = popper && popper.jquery ? popper[0] : popper;
  36114. // Deep merge modifiers options
  36115. this.options.modifiers = {};
  36116. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36117. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36118. });
  36119. // Refactoring modifiers' list (Object => Array)
  36120. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36121. return _extends({
  36122. name: name
  36123. }, _this.options.modifiers[name]);
  36124. })
  36125. // sort the modifiers by order
  36126. .sort(function (a, b) {
  36127. return a.order - b.order;
  36128. });
  36129. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36130. // such code is executed in the same order of its modifier
  36131. // they could add new properties to their options configuration
  36132. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36133. this.modifiers.forEach(function (modifierOptions) {
  36134. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36135. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36136. }
  36137. });
  36138. // fire the first update to position the popper in the right place
  36139. this.update();
  36140. var eventsEnabled = this.options.eventsEnabled;
  36141. if (eventsEnabled) {
  36142. // setup event listeners, they will take care of update the position in specific situations
  36143. this.enableEventListeners();
  36144. }
  36145. this.state.eventsEnabled = eventsEnabled;
  36146. }
  36147. // We can't use class properties because they don't get listed in the
  36148. // class prototype and break stuff like Sinon stubs
  36149. createClass(Popper, [{
  36150. key: 'update',
  36151. value: function update$$1() {
  36152. return update.call(this);
  36153. }
  36154. }, {
  36155. key: 'destroy',
  36156. value: function destroy$$1() {
  36157. return destroy.call(this);
  36158. }
  36159. }, {
  36160. key: 'enableEventListeners',
  36161. value: function enableEventListeners$$1() {
  36162. return enableEventListeners.call(this);
  36163. }
  36164. }, {
  36165. key: 'disableEventListeners',
  36166. value: function disableEventListeners$$1() {
  36167. return disableEventListeners.call(this);
  36168. }
  36169. /**
  36170. * Schedules an update. It will run on the next UI update available.
  36171. * @method scheduleUpdate
  36172. * @memberof Popper
  36173. */
  36174. /**
  36175. * Collection of utilities useful when writing custom modifiers.
  36176. * Starting from version 1.7, this method is available only if you
  36177. * include `popper-utils.js` before `popper.js`.
  36178. *
  36179. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36180. * and will be removed in v2! Use the PopperUtils module directly instead.
  36181. * Due to the high instability of the methods contained in Utils, we can't
  36182. * guarantee them to follow semver. Use them at your own risk!
  36183. * @static
  36184. * @private
  36185. * @type {Object}
  36186. * @deprecated since version 1.8
  36187. * @member Utils
  36188. * @memberof Popper
  36189. */
  36190. }]);
  36191. return Popper;
  36192. }();
  36193. /**
  36194. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36195. * and lets you use it as replacement of a real DOM node.<br />
  36196. * You can use this method to position a popper relatively to a set of coordinates
  36197. * in case you don't have a DOM node to use as reference.
  36198. *
  36199. * ```
  36200. * new Popper(referenceObject, popperNode);
  36201. * ```
  36202. *
  36203. * NB: This feature isn't supported in Internet Explorer 10.
  36204. * @name referenceObject
  36205. * @property {Function} data.getBoundingClientRect
  36206. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36207. * @property {number} data.clientWidth
  36208. * An ES6 getter that will return the width of the virtual reference element.
  36209. * @property {number} data.clientHeight
  36210. * An ES6 getter that will return the height of the virtual reference element.
  36211. */
  36212. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36213. Popper.placements = placements;
  36214. Popper.Defaults = Defaults;
  36215. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36216. //# sourceMappingURL=popper.js.map
  36217. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36218. /***/ }),
  36219. /***/ "./node_modules/process/browser.js":
  36220. /*!*****************************************!*\
  36221. !*** ./node_modules/process/browser.js ***!
  36222. \*****************************************/
  36223. /*! no static exports found */
  36224. /***/ (function(module, exports) {
  36225. // shim for using process in browser
  36226. var process = module.exports = {};
  36227. // cached from whatever global is present so that test runners that stub it
  36228. // don't break things. But we need to wrap it in a try catch in case it is
  36229. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36230. // function because try/catches deoptimize in certain engines.
  36231. var cachedSetTimeout;
  36232. var cachedClearTimeout;
  36233. function defaultSetTimout() {
  36234. throw new Error('setTimeout has not been defined');
  36235. }
  36236. function defaultClearTimeout () {
  36237. throw new Error('clearTimeout has not been defined');
  36238. }
  36239. (function () {
  36240. try {
  36241. if (typeof setTimeout === 'function') {
  36242. cachedSetTimeout = setTimeout;
  36243. } else {
  36244. cachedSetTimeout = defaultSetTimout;
  36245. }
  36246. } catch (e) {
  36247. cachedSetTimeout = defaultSetTimout;
  36248. }
  36249. try {
  36250. if (typeof clearTimeout === 'function') {
  36251. cachedClearTimeout = clearTimeout;
  36252. } else {
  36253. cachedClearTimeout = defaultClearTimeout;
  36254. }
  36255. } catch (e) {
  36256. cachedClearTimeout = defaultClearTimeout;
  36257. }
  36258. } ())
  36259. function runTimeout(fun) {
  36260. if (cachedSetTimeout === setTimeout) {
  36261. //normal enviroments in sane situations
  36262. return setTimeout(fun, 0);
  36263. }
  36264. // if setTimeout wasn't available but was latter defined
  36265. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36266. cachedSetTimeout = setTimeout;
  36267. return setTimeout(fun, 0);
  36268. }
  36269. try {
  36270. // when when somebody has screwed with setTimeout but no I.E. maddness
  36271. return cachedSetTimeout(fun, 0);
  36272. } catch(e){
  36273. try {
  36274. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36275. return cachedSetTimeout.call(null, fun, 0);
  36276. } catch(e){
  36277. // 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
  36278. return cachedSetTimeout.call(this, fun, 0);
  36279. }
  36280. }
  36281. }
  36282. function runClearTimeout(marker) {
  36283. if (cachedClearTimeout === clearTimeout) {
  36284. //normal enviroments in sane situations
  36285. return clearTimeout(marker);
  36286. }
  36287. // if clearTimeout wasn't available but was latter defined
  36288. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36289. cachedClearTimeout = clearTimeout;
  36290. return clearTimeout(marker);
  36291. }
  36292. try {
  36293. // when when somebody has screwed with setTimeout but no I.E. maddness
  36294. return cachedClearTimeout(marker);
  36295. } catch (e){
  36296. try {
  36297. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36298. return cachedClearTimeout.call(null, marker);
  36299. } catch (e){
  36300. // 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.
  36301. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36302. return cachedClearTimeout.call(this, marker);
  36303. }
  36304. }
  36305. }
  36306. var queue = [];
  36307. var draining = false;
  36308. var currentQueue;
  36309. var queueIndex = -1;
  36310. function cleanUpNextTick() {
  36311. if (!draining || !currentQueue) {
  36312. return;
  36313. }
  36314. draining = false;
  36315. if (currentQueue.length) {
  36316. queue = currentQueue.concat(queue);
  36317. } else {
  36318. queueIndex = -1;
  36319. }
  36320. if (queue.length) {
  36321. drainQueue();
  36322. }
  36323. }
  36324. function drainQueue() {
  36325. if (draining) {
  36326. return;
  36327. }
  36328. var timeout = runTimeout(cleanUpNextTick);
  36329. draining = true;
  36330. var len = queue.length;
  36331. while(len) {
  36332. currentQueue = queue;
  36333. queue = [];
  36334. while (++queueIndex < len) {
  36335. if (currentQueue) {
  36336. currentQueue[queueIndex].run();
  36337. }
  36338. }
  36339. queueIndex = -1;
  36340. len = queue.length;
  36341. }
  36342. currentQueue = null;
  36343. draining = false;
  36344. runClearTimeout(timeout);
  36345. }
  36346. process.nextTick = function (fun) {
  36347. var args = new Array(arguments.length - 1);
  36348. if (arguments.length > 1) {
  36349. for (var i = 1; i < arguments.length; i++) {
  36350. args[i - 1] = arguments[i];
  36351. }
  36352. }
  36353. queue.push(new Item(fun, args));
  36354. if (queue.length === 1 && !draining) {
  36355. runTimeout(drainQueue);
  36356. }
  36357. };
  36358. // v8 likes predictible objects
  36359. function Item(fun, array) {
  36360. this.fun = fun;
  36361. this.array = array;
  36362. }
  36363. Item.prototype.run = function () {
  36364. this.fun.apply(null, this.array);
  36365. };
  36366. process.title = 'browser';
  36367. process.browser = true;
  36368. process.env = {};
  36369. process.argv = [];
  36370. process.version = ''; // empty string to avoid regexp issues
  36371. process.versions = {};
  36372. function noop() {}
  36373. process.on = noop;
  36374. process.addListener = noop;
  36375. process.once = noop;
  36376. process.off = noop;
  36377. process.removeListener = noop;
  36378. process.removeAllListeners = noop;
  36379. process.emit = noop;
  36380. process.prependListener = noop;
  36381. process.prependOnceListener = noop;
  36382. process.listeners = function (name) { return [] }
  36383. process.binding = function (name) {
  36384. throw new Error('process.binding is not supported');
  36385. };
  36386. process.cwd = function () { return '/' };
  36387. process.chdir = function (dir) {
  36388. throw new Error('process.chdir is not supported');
  36389. };
  36390. process.umask = function() { return 0; };
  36391. /***/ }),
  36392. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36393. /*!***************************************************!*\
  36394. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36395. \***************************************************/
  36396. /*! no static exports found */
  36397. /***/ (function(module, exports, __webpack_require__) {
  36398. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36399. * Pusher JavaScript Library v5.0.3
  36400. * https://pusher.com/
  36401. *
  36402. * Copyright 2017, Pusher
  36403. * Released under the MIT licence.
  36404. */
  36405. (function webpackUniversalModuleDefinition(root, factory) {
  36406. if(true)
  36407. module.exports = factory();
  36408. else {}
  36409. })(window, function() {
  36410. return /******/ (function(modules) { // webpackBootstrap
  36411. /******/ // The module cache
  36412. /******/ var installedModules = {};
  36413. /******/
  36414. /******/ // The require function
  36415. /******/ function __webpack_require__(moduleId) {
  36416. /******/
  36417. /******/ // Check if module is in cache
  36418. /******/ if(installedModules[moduleId]) {
  36419. /******/ return installedModules[moduleId].exports;
  36420. /******/ }
  36421. /******/ // Create a new module (and put it into the cache)
  36422. /******/ var module = installedModules[moduleId] = {
  36423. /******/ i: moduleId,
  36424. /******/ l: false,
  36425. /******/ exports: {}
  36426. /******/ };
  36427. /******/
  36428. /******/ // Execute the module function
  36429. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36430. /******/
  36431. /******/ // Flag the module as loaded
  36432. /******/ module.l = true;
  36433. /******/
  36434. /******/ // Return the exports of the module
  36435. /******/ return module.exports;
  36436. /******/ }
  36437. /******/
  36438. /******/
  36439. /******/ // expose the modules object (__webpack_modules__)
  36440. /******/ __webpack_require__.m = modules;
  36441. /******/
  36442. /******/ // expose the module cache
  36443. /******/ __webpack_require__.c = installedModules;
  36444. /******/
  36445. /******/ // define getter function for harmony exports
  36446. /******/ __webpack_require__.d = function(exports, name, getter) {
  36447. /******/ if(!__webpack_require__.o(exports, name)) {
  36448. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36449. /******/ }
  36450. /******/ };
  36451. /******/
  36452. /******/ // define __esModule on exports
  36453. /******/ __webpack_require__.r = function(exports) {
  36454. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36455. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36456. /******/ }
  36457. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36458. /******/ };
  36459. /******/
  36460. /******/ // create a fake namespace object
  36461. /******/ // mode & 1: value is a module id, require it
  36462. /******/ // mode & 2: merge all properties of value into the ns
  36463. /******/ // mode & 4: return value when already ns object
  36464. /******/ // mode & 8|1: behave like require
  36465. /******/ __webpack_require__.t = function(value, mode) {
  36466. /******/ if(mode & 1) value = __webpack_require__(value);
  36467. /******/ if(mode & 8) return value;
  36468. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36469. /******/ var ns = Object.create(null);
  36470. /******/ __webpack_require__.r(ns);
  36471. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36472. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36473. /******/ return ns;
  36474. /******/ };
  36475. /******/
  36476. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36477. /******/ __webpack_require__.n = function(module) {
  36478. /******/ var getter = module && module.__esModule ?
  36479. /******/ function getDefault() { return module['default']; } :
  36480. /******/ function getModuleExports() { return module; };
  36481. /******/ __webpack_require__.d(getter, 'a', getter);
  36482. /******/ return getter;
  36483. /******/ };
  36484. /******/
  36485. /******/ // Object.prototype.hasOwnProperty.call
  36486. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36487. /******/
  36488. /******/ // __webpack_public_path__
  36489. /******/ __webpack_require__.p = "";
  36490. /******/
  36491. /******/
  36492. /******/ // Load entry module and return exports
  36493. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36494. /******/ })
  36495. /************************************************************************/
  36496. /******/ ([
  36497. /* 0 */
  36498. /***/ (function(module, exports, __webpack_require__) {
  36499. (function(nacl) {
  36500. 'use strict';
  36501. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36502. // Public domain.
  36503. //
  36504. // Implementation derived from TweetNaCl version 20140427.
  36505. // See for details: http://tweetnacl.cr.yp.to/
  36506. var gf = function(init) {
  36507. var i, r = new Float64Array(16);
  36508. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36509. return r;
  36510. };
  36511. // Pluggable, initialized in high-level API below.
  36512. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36513. var _0 = new Uint8Array(16);
  36514. var _9 = new Uint8Array(32); _9[0] = 9;
  36515. var gf0 = gf(),
  36516. gf1 = gf([1]),
  36517. _121665 = gf([0xdb41, 1]),
  36518. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36519. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36520. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36521. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36522. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36523. function ts64(x, i, h, l) {
  36524. x[i] = (h >> 24) & 0xff;
  36525. x[i+1] = (h >> 16) & 0xff;
  36526. x[i+2] = (h >> 8) & 0xff;
  36527. x[i+3] = h & 0xff;
  36528. x[i+4] = (l >> 24) & 0xff;
  36529. x[i+5] = (l >> 16) & 0xff;
  36530. x[i+6] = (l >> 8) & 0xff;
  36531. x[i+7] = l & 0xff;
  36532. }
  36533. function vn(x, xi, y, yi, n) {
  36534. var i,d = 0;
  36535. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36536. return (1 & ((d - 1) >>> 8)) - 1;
  36537. }
  36538. function crypto_verify_16(x, xi, y, yi) {
  36539. return vn(x,xi,y,yi,16);
  36540. }
  36541. function crypto_verify_32(x, xi, y, yi) {
  36542. return vn(x,xi,y,yi,32);
  36543. }
  36544. function core_salsa20(o, p, k, c) {
  36545. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36546. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36547. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36548. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36549. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36550. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36551. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36552. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36553. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36554. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36555. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36556. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36557. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36558. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36559. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36560. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36561. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36562. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36563. x15 = j15, u;
  36564. for (var i = 0; i < 20; i += 2) {
  36565. u = x0 + x12 | 0;
  36566. x4 ^= u<<7 | u>>>(32-7);
  36567. u = x4 + x0 | 0;
  36568. x8 ^= u<<9 | u>>>(32-9);
  36569. u = x8 + x4 | 0;
  36570. x12 ^= u<<13 | u>>>(32-13);
  36571. u = x12 + x8 | 0;
  36572. x0 ^= u<<18 | u>>>(32-18);
  36573. u = x5 + x1 | 0;
  36574. x9 ^= u<<7 | u>>>(32-7);
  36575. u = x9 + x5 | 0;
  36576. x13 ^= u<<9 | u>>>(32-9);
  36577. u = x13 + x9 | 0;
  36578. x1 ^= u<<13 | u>>>(32-13);
  36579. u = x1 + x13 | 0;
  36580. x5 ^= u<<18 | u>>>(32-18);
  36581. u = x10 + x6 | 0;
  36582. x14 ^= u<<7 | u>>>(32-7);
  36583. u = x14 + x10 | 0;
  36584. x2 ^= u<<9 | u>>>(32-9);
  36585. u = x2 + x14 | 0;
  36586. x6 ^= u<<13 | u>>>(32-13);
  36587. u = x6 + x2 | 0;
  36588. x10 ^= u<<18 | u>>>(32-18);
  36589. u = x15 + x11 | 0;
  36590. x3 ^= u<<7 | u>>>(32-7);
  36591. u = x3 + x15 | 0;
  36592. x7 ^= u<<9 | u>>>(32-9);
  36593. u = x7 + x3 | 0;
  36594. x11 ^= u<<13 | u>>>(32-13);
  36595. u = x11 + x7 | 0;
  36596. x15 ^= u<<18 | u>>>(32-18);
  36597. u = x0 + x3 | 0;
  36598. x1 ^= u<<7 | u>>>(32-7);
  36599. u = x1 + x0 | 0;
  36600. x2 ^= u<<9 | u>>>(32-9);
  36601. u = x2 + x1 | 0;
  36602. x3 ^= u<<13 | u>>>(32-13);
  36603. u = x3 + x2 | 0;
  36604. x0 ^= u<<18 | u>>>(32-18);
  36605. u = x5 + x4 | 0;
  36606. x6 ^= u<<7 | u>>>(32-7);
  36607. u = x6 + x5 | 0;
  36608. x7 ^= u<<9 | u>>>(32-9);
  36609. u = x7 + x6 | 0;
  36610. x4 ^= u<<13 | u>>>(32-13);
  36611. u = x4 + x7 | 0;
  36612. x5 ^= u<<18 | u>>>(32-18);
  36613. u = x10 + x9 | 0;
  36614. x11 ^= u<<7 | u>>>(32-7);
  36615. u = x11 + x10 | 0;
  36616. x8 ^= u<<9 | u>>>(32-9);
  36617. u = x8 + x11 | 0;
  36618. x9 ^= u<<13 | u>>>(32-13);
  36619. u = x9 + x8 | 0;
  36620. x10 ^= u<<18 | u>>>(32-18);
  36621. u = x15 + x14 | 0;
  36622. x12 ^= u<<7 | u>>>(32-7);
  36623. u = x12 + x15 | 0;
  36624. x13 ^= u<<9 | u>>>(32-9);
  36625. u = x13 + x12 | 0;
  36626. x14 ^= u<<13 | u>>>(32-13);
  36627. u = x14 + x13 | 0;
  36628. x15 ^= u<<18 | u>>>(32-18);
  36629. }
  36630. x0 = x0 + j0 | 0;
  36631. x1 = x1 + j1 | 0;
  36632. x2 = x2 + j2 | 0;
  36633. x3 = x3 + j3 | 0;
  36634. x4 = x4 + j4 | 0;
  36635. x5 = x5 + j5 | 0;
  36636. x6 = x6 + j6 | 0;
  36637. x7 = x7 + j7 | 0;
  36638. x8 = x8 + j8 | 0;
  36639. x9 = x9 + j9 | 0;
  36640. x10 = x10 + j10 | 0;
  36641. x11 = x11 + j11 | 0;
  36642. x12 = x12 + j12 | 0;
  36643. x13 = x13 + j13 | 0;
  36644. x14 = x14 + j14 | 0;
  36645. x15 = x15 + j15 | 0;
  36646. o[ 0] = x0 >>> 0 & 0xff;
  36647. o[ 1] = x0 >>> 8 & 0xff;
  36648. o[ 2] = x0 >>> 16 & 0xff;
  36649. o[ 3] = x0 >>> 24 & 0xff;
  36650. o[ 4] = x1 >>> 0 & 0xff;
  36651. o[ 5] = x1 >>> 8 & 0xff;
  36652. o[ 6] = x1 >>> 16 & 0xff;
  36653. o[ 7] = x1 >>> 24 & 0xff;
  36654. o[ 8] = x2 >>> 0 & 0xff;
  36655. o[ 9] = x2 >>> 8 & 0xff;
  36656. o[10] = x2 >>> 16 & 0xff;
  36657. o[11] = x2 >>> 24 & 0xff;
  36658. o[12] = x3 >>> 0 & 0xff;
  36659. o[13] = x3 >>> 8 & 0xff;
  36660. o[14] = x3 >>> 16 & 0xff;
  36661. o[15] = x3 >>> 24 & 0xff;
  36662. o[16] = x4 >>> 0 & 0xff;
  36663. o[17] = x4 >>> 8 & 0xff;
  36664. o[18] = x4 >>> 16 & 0xff;
  36665. o[19] = x4 >>> 24 & 0xff;
  36666. o[20] = x5 >>> 0 & 0xff;
  36667. o[21] = x5 >>> 8 & 0xff;
  36668. o[22] = x5 >>> 16 & 0xff;
  36669. o[23] = x5 >>> 24 & 0xff;
  36670. o[24] = x6 >>> 0 & 0xff;
  36671. o[25] = x6 >>> 8 & 0xff;
  36672. o[26] = x6 >>> 16 & 0xff;
  36673. o[27] = x6 >>> 24 & 0xff;
  36674. o[28] = x7 >>> 0 & 0xff;
  36675. o[29] = x7 >>> 8 & 0xff;
  36676. o[30] = x7 >>> 16 & 0xff;
  36677. o[31] = x7 >>> 24 & 0xff;
  36678. o[32] = x8 >>> 0 & 0xff;
  36679. o[33] = x8 >>> 8 & 0xff;
  36680. o[34] = x8 >>> 16 & 0xff;
  36681. o[35] = x8 >>> 24 & 0xff;
  36682. o[36] = x9 >>> 0 & 0xff;
  36683. o[37] = x9 >>> 8 & 0xff;
  36684. o[38] = x9 >>> 16 & 0xff;
  36685. o[39] = x9 >>> 24 & 0xff;
  36686. o[40] = x10 >>> 0 & 0xff;
  36687. o[41] = x10 >>> 8 & 0xff;
  36688. o[42] = x10 >>> 16 & 0xff;
  36689. o[43] = x10 >>> 24 & 0xff;
  36690. o[44] = x11 >>> 0 & 0xff;
  36691. o[45] = x11 >>> 8 & 0xff;
  36692. o[46] = x11 >>> 16 & 0xff;
  36693. o[47] = x11 >>> 24 & 0xff;
  36694. o[48] = x12 >>> 0 & 0xff;
  36695. o[49] = x12 >>> 8 & 0xff;
  36696. o[50] = x12 >>> 16 & 0xff;
  36697. o[51] = x12 >>> 24 & 0xff;
  36698. o[52] = x13 >>> 0 & 0xff;
  36699. o[53] = x13 >>> 8 & 0xff;
  36700. o[54] = x13 >>> 16 & 0xff;
  36701. o[55] = x13 >>> 24 & 0xff;
  36702. o[56] = x14 >>> 0 & 0xff;
  36703. o[57] = x14 >>> 8 & 0xff;
  36704. o[58] = x14 >>> 16 & 0xff;
  36705. o[59] = x14 >>> 24 & 0xff;
  36706. o[60] = x15 >>> 0 & 0xff;
  36707. o[61] = x15 >>> 8 & 0xff;
  36708. o[62] = x15 >>> 16 & 0xff;
  36709. o[63] = x15 >>> 24 & 0xff;
  36710. }
  36711. function core_hsalsa20(o,p,k,c) {
  36712. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36713. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36714. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36715. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36716. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36717. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36718. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36719. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36720. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36721. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36722. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36723. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36724. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36725. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36726. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36727. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36728. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36729. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36730. x15 = j15, u;
  36731. for (var i = 0; i < 20; i += 2) {
  36732. u = x0 + x12 | 0;
  36733. x4 ^= u<<7 | u>>>(32-7);
  36734. u = x4 + x0 | 0;
  36735. x8 ^= u<<9 | u>>>(32-9);
  36736. u = x8 + x4 | 0;
  36737. x12 ^= u<<13 | u>>>(32-13);
  36738. u = x12 + x8 | 0;
  36739. x0 ^= u<<18 | u>>>(32-18);
  36740. u = x5 + x1 | 0;
  36741. x9 ^= u<<7 | u>>>(32-7);
  36742. u = x9 + x5 | 0;
  36743. x13 ^= u<<9 | u>>>(32-9);
  36744. u = x13 + x9 | 0;
  36745. x1 ^= u<<13 | u>>>(32-13);
  36746. u = x1 + x13 | 0;
  36747. x5 ^= u<<18 | u>>>(32-18);
  36748. u = x10 + x6 | 0;
  36749. x14 ^= u<<7 | u>>>(32-7);
  36750. u = x14 + x10 | 0;
  36751. x2 ^= u<<9 | u>>>(32-9);
  36752. u = x2 + x14 | 0;
  36753. x6 ^= u<<13 | u>>>(32-13);
  36754. u = x6 + x2 | 0;
  36755. x10 ^= u<<18 | u>>>(32-18);
  36756. u = x15 + x11 | 0;
  36757. x3 ^= u<<7 | u>>>(32-7);
  36758. u = x3 + x15 | 0;
  36759. x7 ^= u<<9 | u>>>(32-9);
  36760. u = x7 + x3 | 0;
  36761. x11 ^= u<<13 | u>>>(32-13);
  36762. u = x11 + x7 | 0;
  36763. x15 ^= u<<18 | u>>>(32-18);
  36764. u = x0 + x3 | 0;
  36765. x1 ^= u<<7 | u>>>(32-7);
  36766. u = x1 + x0 | 0;
  36767. x2 ^= u<<9 | u>>>(32-9);
  36768. u = x2 + x1 | 0;
  36769. x3 ^= u<<13 | u>>>(32-13);
  36770. u = x3 + x2 | 0;
  36771. x0 ^= u<<18 | u>>>(32-18);
  36772. u = x5 + x4 | 0;
  36773. x6 ^= u<<7 | u>>>(32-7);
  36774. u = x6 + x5 | 0;
  36775. x7 ^= u<<9 | u>>>(32-9);
  36776. u = x7 + x6 | 0;
  36777. x4 ^= u<<13 | u>>>(32-13);
  36778. u = x4 + x7 | 0;
  36779. x5 ^= u<<18 | u>>>(32-18);
  36780. u = x10 + x9 | 0;
  36781. x11 ^= u<<7 | u>>>(32-7);
  36782. u = x11 + x10 | 0;
  36783. x8 ^= u<<9 | u>>>(32-9);
  36784. u = x8 + x11 | 0;
  36785. x9 ^= u<<13 | u>>>(32-13);
  36786. u = x9 + x8 | 0;
  36787. x10 ^= u<<18 | u>>>(32-18);
  36788. u = x15 + x14 | 0;
  36789. x12 ^= u<<7 | u>>>(32-7);
  36790. u = x12 + x15 | 0;
  36791. x13 ^= u<<9 | u>>>(32-9);
  36792. u = x13 + x12 | 0;
  36793. x14 ^= u<<13 | u>>>(32-13);
  36794. u = x14 + x13 | 0;
  36795. x15 ^= u<<18 | u>>>(32-18);
  36796. }
  36797. o[ 0] = x0 >>> 0 & 0xff;
  36798. o[ 1] = x0 >>> 8 & 0xff;
  36799. o[ 2] = x0 >>> 16 & 0xff;
  36800. o[ 3] = x0 >>> 24 & 0xff;
  36801. o[ 4] = x5 >>> 0 & 0xff;
  36802. o[ 5] = x5 >>> 8 & 0xff;
  36803. o[ 6] = x5 >>> 16 & 0xff;
  36804. o[ 7] = x5 >>> 24 & 0xff;
  36805. o[ 8] = x10 >>> 0 & 0xff;
  36806. o[ 9] = x10 >>> 8 & 0xff;
  36807. o[10] = x10 >>> 16 & 0xff;
  36808. o[11] = x10 >>> 24 & 0xff;
  36809. o[12] = x15 >>> 0 & 0xff;
  36810. o[13] = x15 >>> 8 & 0xff;
  36811. o[14] = x15 >>> 16 & 0xff;
  36812. o[15] = x15 >>> 24 & 0xff;
  36813. o[16] = x6 >>> 0 & 0xff;
  36814. o[17] = x6 >>> 8 & 0xff;
  36815. o[18] = x6 >>> 16 & 0xff;
  36816. o[19] = x6 >>> 24 & 0xff;
  36817. o[20] = x7 >>> 0 & 0xff;
  36818. o[21] = x7 >>> 8 & 0xff;
  36819. o[22] = x7 >>> 16 & 0xff;
  36820. o[23] = x7 >>> 24 & 0xff;
  36821. o[24] = x8 >>> 0 & 0xff;
  36822. o[25] = x8 >>> 8 & 0xff;
  36823. o[26] = x8 >>> 16 & 0xff;
  36824. o[27] = x8 >>> 24 & 0xff;
  36825. o[28] = x9 >>> 0 & 0xff;
  36826. o[29] = x9 >>> 8 & 0xff;
  36827. o[30] = x9 >>> 16 & 0xff;
  36828. o[31] = x9 >>> 24 & 0xff;
  36829. }
  36830. function crypto_core_salsa20(out,inp,k,c) {
  36831. core_salsa20(out,inp,k,c);
  36832. }
  36833. function crypto_core_hsalsa20(out,inp,k,c) {
  36834. core_hsalsa20(out,inp,k,c);
  36835. }
  36836. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36837. // "expand 32-byte k"
  36838. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36839. var z = new Uint8Array(16), x = new Uint8Array(64);
  36840. var u, i;
  36841. for (i = 0; i < 16; i++) z[i] = 0;
  36842. for (i = 0; i < 8; i++) z[i] = n[i];
  36843. while (b >= 64) {
  36844. crypto_core_salsa20(x,z,k,sigma);
  36845. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36846. u = 1;
  36847. for (i = 8; i < 16; i++) {
  36848. u = u + (z[i] & 0xff) | 0;
  36849. z[i] = u & 0xff;
  36850. u >>>= 8;
  36851. }
  36852. b -= 64;
  36853. cpos += 64;
  36854. mpos += 64;
  36855. }
  36856. if (b > 0) {
  36857. crypto_core_salsa20(x,z,k,sigma);
  36858. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36859. }
  36860. return 0;
  36861. }
  36862. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36863. var z = new Uint8Array(16), x = new Uint8Array(64);
  36864. var u, i;
  36865. for (i = 0; i < 16; i++) z[i] = 0;
  36866. for (i = 0; i < 8; i++) z[i] = n[i];
  36867. while (b >= 64) {
  36868. crypto_core_salsa20(x,z,k,sigma);
  36869. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36870. u = 1;
  36871. for (i = 8; i < 16; i++) {
  36872. u = u + (z[i] & 0xff) | 0;
  36873. z[i] = u & 0xff;
  36874. u >>>= 8;
  36875. }
  36876. b -= 64;
  36877. cpos += 64;
  36878. }
  36879. if (b > 0) {
  36880. crypto_core_salsa20(x,z,k,sigma);
  36881. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36882. }
  36883. return 0;
  36884. }
  36885. function crypto_stream(c,cpos,d,n,k) {
  36886. var s = new Uint8Array(32);
  36887. crypto_core_hsalsa20(s,n,k,sigma);
  36888. var sn = new Uint8Array(8);
  36889. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36890. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36891. }
  36892. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36893. var s = new Uint8Array(32);
  36894. crypto_core_hsalsa20(s,n,k,sigma);
  36895. var sn = new Uint8Array(8);
  36896. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36897. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36898. }
  36899. /*
  36900. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36901. * https://github.com/floodyberry/poly1305-donna
  36902. */
  36903. var poly1305 = function(key) {
  36904. this.buffer = new Uint8Array(16);
  36905. this.r = new Uint16Array(10);
  36906. this.h = new Uint16Array(10);
  36907. this.pad = new Uint16Array(8);
  36908. this.leftover = 0;
  36909. this.fin = 0;
  36910. var t0, t1, t2, t3, t4, t5, t6, t7;
  36911. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36912. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36913. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36914. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36915. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36916. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36917. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36918. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36919. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36920. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36921. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36922. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36923. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36924. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36925. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36926. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36927. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36928. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36929. };
  36930. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36931. var hibit = this.fin ? 0 : (1 << 11);
  36932. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36933. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36934. var h0 = this.h[0],
  36935. h1 = this.h[1],
  36936. h2 = this.h[2],
  36937. h3 = this.h[3],
  36938. h4 = this.h[4],
  36939. h5 = this.h[5],
  36940. h6 = this.h[6],
  36941. h7 = this.h[7],
  36942. h8 = this.h[8],
  36943. h9 = this.h[9];
  36944. var r0 = this.r[0],
  36945. r1 = this.r[1],
  36946. r2 = this.r[2],
  36947. r3 = this.r[3],
  36948. r4 = this.r[4],
  36949. r5 = this.r[5],
  36950. r6 = this.r[6],
  36951. r7 = this.r[7],
  36952. r8 = this.r[8],
  36953. r9 = this.r[9];
  36954. while (bytes >= 16) {
  36955. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36956. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36957. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36958. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36959. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36960. h5 += ((t4 >>> 1)) & 0x1fff;
  36961. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36962. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36963. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36964. h9 += ((t7 >>> 5)) | hibit;
  36965. c = 0;
  36966. d0 = c;
  36967. d0 += h0 * r0;
  36968. d0 += h1 * (5 * r9);
  36969. d0 += h2 * (5 * r8);
  36970. d0 += h3 * (5 * r7);
  36971. d0 += h4 * (5 * r6);
  36972. c = (d0 >>> 13); d0 &= 0x1fff;
  36973. d0 += h5 * (5 * r5);
  36974. d0 += h6 * (5 * r4);
  36975. d0 += h7 * (5 * r3);
  36976. d0 += h8 * (5 * r2);
  36977. d0 += h9 * (5 * r1);
  36978. c += (d0 >>> 13); d0 &= 0x1fff;
  36979. d1 = c;
  36980. d1 += h0 * r1;
  36981. d1 += h1 * r0;
  36982. d1 += h2 * (5 * r9);
  36983. d1 += h3 * (5 * r8);
  36984. d1 += h4 * (5 * r7);
  36985. c = (d1 >>> 13); d1 &= 0x1fff;
  36986. d1 += h5 * (5 * r6);
  36987. d1 += h6 * (5 * r5);
  36988. d1 += h7 * (5 * r4);
  36989. d1 += h8 * (5 * r3);
  36990. d1 += h9 * (5 * r2);
  36991. c += (d1 >>> 13); d1 &= 0x1fff;
  36992. d2 = c;
  36993. d2 += h0 * r2;
  36994. d2 += h1 * r1;
  36995. d2 += h2 * r0;
  36996. d2 += h3 * (5 * r9);
  36997. d2 += h4 * (5 * r8);
  36998. c = (d2 >>> 13); d2 &= 0x1fff;
  36999. d2 += h5 * (5 * r7);
  37000. d2 += h6 * (5 * r6);
  37001. d2 += h7 * (5 * r5);
  37002. d2 += h8 * (5 * r4);
  37003. d2 += h9 * (5 * r3);
  37004. c += (d2 >>> 13); d2 &= 0x1fff;
  37005. d3 = c;
  37006. d3 += h0 * r3;
  37007. d3 += h1 * r2;
  37008. d3 += h2 * r1;
  37009. d3 += h3 * r0;
  37010. d3 += h4 * (5 * r9);
  37011. c = (d3 >>> 13); d3 &= 0x1fff;
  37012. d3 += h5 * (5 * r8);
  37013. d3 += h6 * (5 * r7);
  37014. d3 += h7 * (5 * r6);
  37015. d3 += h8 * (5 * r5);
  37016. d3 += h9 * (5 * r4);
  37017. c += (d3 >>> 13); d3 &= 0x1fff;
  37018. d4 = c;
  37019. d4 += h0 * r4;
  37020. d4 += h1 * r3;
  37021. d4 += h2 * r2;
  37022. d4 += h3 * r1;
  37023. d4 += h4 * r0;
  37024. c = (d4 >>> 13); d4 &= 0x1fff;
  37025. d4 += h5 * (5 * r9);
  37026. d4 += h6 * (5 * r8);
  37027. d4 += h7 * (5 * r7);
  37028. d4 += h8 * (5 * r6);
  37029. d4 += h9 * (5 * r5);
  37030. c += (d4 >>> 13); d4 &= 0x1fff;
  37031. d5 = c;
  37032. d5 += h0 * r5;
  37033. d5 += h1 * r4;
  37034. d5 += h2 * r3;
  37035. d5 += h3 * r2;
  37036. d5 += h4 * r1;
  37037. c = (d5 >>> 13); d5 &= 0x1fff;
  37038. d5 += h5 * r0;
  37039. d5 += h6 * (5 * r9);
  37040. d5 += h7 * (5 * r8);
  37041. d5 += h8 * (5 * r7);
  37042. d5 += h9 * (5 * r6);
  37043. c += (d5 >>> 13); d5 &= 0x1fff;
  37044. d6 = c;
  37045. d6 += h0 * r6;
  37046. d6 += h1 * r5;
  37047. d6 += h2 * r4;
  37048. d6 += h3 * r3;
  37049. d6 += h4 * r2;
  37050. c = (d6 >>> 13); d6 &= 0x1fff;
  37051. d6 += h5 * r1;
  37052. d6 += h6 * r0;
  37053. d6 += h7 * (5 * r9);
  37054. d6 += h8 * (5 * r8);
  37055. d6 += h9 * (5 * r7);
  37056. c += (d6 >>> 13); d6 &= 0x1fff;
  37057. d7 = c;
  37058. d7 += h0 * r7;
  37059. d7 += h1 * r6;
  37060. d7 += h2 * r5;
  37061. d7 += h3 * r4;
  37062. d7 += h4 * r3;
  37063. c = (d7 >>> 13); d7 &= 0x1fff;
  37064. d7 += h5 * r2;
  37065. d7 += h6 * r1;
  37066. d7 += h7 * r0;
  37067. d7 += h8 * (5 * r9);
  37068. d7 += h9 * (5 * r8);
  37069. c += (d7 >>> 13); d7 &= 0x1fff;
  37070. d8 = c;
  37071. d8 += h0 * r8;
  37072. d8 += h1 * r7;
  37073. d8 += h2 * r6;
  37074. d8 += h3 * r5;
  37075. d8 += h4 * r4;
  37076. c = (d8 >>> 13); d8 &= 0x1fff;
  37077. d8 += h5 * r3;
  37078. d8 += h6 * r2;
  37079. d8 += h7 * r1;
  37080. d8 += h8 * r0;
  37081. d8 += h9 * (5 * r9);
  37082. c += (d8 >>> 13); d8 &= 0x1fff;
  37083. d9 = c;
  37084. d9 += h0 * r9;
  37085. d9 += h1 * r8;
  37086. d9 += h2 * r7;
  37087. d9 += h3 * r6;
  37088. d9 += h4 * r5;
  37089. c = (d9 >>> 13); d9 &= 0x1fff;
  37090. d9 += h5 * r4;
  37091. d9 += h6 * r3;
  37092. d9 += h7 * r2;
  37093. d9 += h8 * r1;
  37094. d9 += h9 * r0;
  37095. c += (d9 >>> 13); d9 &= 0x1fff;
  37096. c = (((c << 2) + c)) | 0;
  37097. c = (c + d0) | 0;
  37098. d0 = c & 0x1fff;
  37099. c = (c >>> 13);
  37100. d1 += c;
  37101. h0 = d0;
  37102. h1 = d1;
  37103. h2 = d2;
  37104. h3 = d3;
  37105. h4 = d4;
  37106. h5 = d5;
  37107. h6 = d6;
  37108. h7 = d7;
  37109. h8 = d8;
  37110. h9 = d9;
  37111. mpos += 16;
  37112. bytes -= 16;
  37113. }
  37114. this.h[0] = h0;
  37115. this.h[1] = h1;
  37116. this.h[2] = h2;
  37117. this.h[3] = h3;
  37118. this.h[4] = h4;
  37119. this.h[5] = h5;
  37120. this.h[6] = h6;
  37121. this.h[7] = h7;
  37122. this.h[8] = h8;
  37123. this.h[9] = h9;
  37124. };
  37125. poly1305.prototype.finish = function(mac, macpos) {
  37126. var g = new Uint16Array(10);
  37127. var c, mask, f, i;
  37128. if (this.leftover) {
  37129. i = this.leftover;
  37130. this.buffer[i++] = 1;
  37131. for (; i < 16; i++) this.buffer[i] = 0;
  37132. this.fin = 1;
  37133. this.blocks(this.buffer, 0, 16);
  37134. }
  37135. c = this.h[1] >>> 13;
  37136. this.h[1] &= 0x1fff;
  37137. for (i = 2; i < 10; i++) {
  37138. this.h[i] += c;
  37139. c = this.h[i] >>> 13;
  37140. this.h[i] &= 0x1fff;
  37141. }
  37142. this.h[0] += (c * 5);
  37143. c = this.h[0] >>> 13;
  37144. this.h[0] &= 0x1fff;
  37145. this.h[1] += c;
  37146. c = this.h[1] >>> 13;
  37147. this.h[1] &= 0x1fff;
  37148. this.h[2] += c;
  37149. g[0] = this.h[0] + 5;
  37150. c = g[0] >>> 13;
  37151. g[0] &= 0x1fff;
  37152. for (i = 1; i < 10; i++) {
  37153. g[i] = this.h[i] + c;
  37154. c = g[i] >>> 13;
  37155. g[i] &= 0x1fff;
  37156. }
  37157. g[9] -= (1 << 13);
  37158. mask = (c ^ 1) - 1;
  37159. for (i = 0; i < 10; i++) g[i] &= mask;
  37160. mask = ~mask;
  37161. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37162. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37163. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37164. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37165. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37166. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37167. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37168. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37169. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37170. f = this.h[0] + this.pad[0];
  37171. this.h[0] = f & 0xffff;
  37172. for (i = 1; i < 8; i++) {
  37173. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37174. this.h[i] = f & 0xffff;
  37175. }
  37176. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37177. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37178. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37179. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37180. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37181. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37182. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37183. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37184. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37185. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37186. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37187. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37188. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37189. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37190. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37191. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37192. };
  37193. poly1305.prototype.update = function(m, mpos, bytes) {
  37194. var i, want;
  37195. if (this.leftover) {
  37196. want = (16 - this.leftover);
  37197. if (want > bytes)
  37198. want = bytes;
  37199. for (i = 0; i < want; i++)
  37200. this.buffer[this.leftover + i] = m[mpos+i];
  37201. bytes -= want;
  37202. mpos += want;
  37203. this.leftover += want;
  37204. if (this.leftover < 16)
  37205. return;
  37206. this.blocks(this.buffer, 0, 16);
  37207. this.leftover = 0;
  37208. }
  37209. if (bytes >= 16) {
  37210. want = bytes - (bytes % 16);
  37211. this.blocks(m, mpos, want);
  37212. mpos += want;
  37213. bytes -= want;
  37214. }
  37215. if (bytes) {
  37216. for (i = 0; i < bytes; i++)
  37217. this.buffer[this.leftover + i] = m[mpos+i];
  37218. this.leftover += bytes;
  37219. }
  37220. };
  37221. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37222. var s = new poly1305(k);
  37223. s.update(m, mpos, n);
  37224. s.finish(out, outpos);
  37225. return 0;
  37226. }
  37227. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37228. var x = new Uint8Array(16);
  37229. crypto_onetimeauth(x,0,m,mpos,n,k);
  37230. return crypto_verify_16(h,hpos,x,0);
  37231. }
  37232. function crypto_secretbox(c,m,d,n,k) {
  37233. var i;
  37234. if (d < 32) return -1;
  37235. crypto_stream_xor(c,0,m,0,d,n,k);
  37236. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37237. for (i = 0; i < 16; i++) c[i] = 0;
  37238. return 0;
  37239. }
  37240. function crypto_secretbox_open(m,c,d,n,k) {
  37241. var i;
  37242. var x = new Uint8Array(32);
  37243. if (d < 32) return -1;
  37244. crypto_stream(x,0,32,n,k);
  37245. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37246. crypto_stream_xor(m,0,c,0,d,n,k);
  37247. for (i = 0; i < 32; i++) m[i] = 0;
  37248. return 0;
  37249. }
  37250. function set25519(r, a) {
  37251. var i;
  37252. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37253. }
  37254. function car25519(o) {
  37255. var i, v, c = 1;
  37256. for (i = 0; i < 16; i++) {
  37257. v = o[i] + c + 65535;
  37258. c = Math.floor(v / 65536);
  37259. o[i] = v - c * 65536;
  37260. }
  37261. o[0] += c-1 + 37 * (c-1);
  37262. }
  37263. function sel25519(p, q, b) {
  37264. var t, c = ~(b-1);
  37265. for (var i = 0; i < 16; i++) {
  37266. t = c & (p[i] ^ q[i]);
  37267. p[i] ^= t;
  37268. q[i] ^= t;
  37269. }
  37270. }
  37271. function pack25519(o, n) {
  37272. var i, j, b;
  37273. var m = gf(), t = gf();
  37274. for (i = 0; i < 16; i++) t[i] = n[i];
  37275. car25519(t);
  37276. car25519(t);
  37277. car25519(t);
  37278. for (j = 0; j < 2; j++) {
  37279. m[0] = t[0] - 0xffed;
  37280. for (i = 1; i < 15; i++) {
  37281. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37282. m[i-1] &= 0xffff;
  37283. }
  37284. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37285. b = (m[15]>>16) & 1;
  37286. m[14] &= 0xffff;
  37287. sel25519(t, m, 1-b);
  37288. }
  37289. for (i = 0; i < 16; i++) {
  37290. o[2*i] = t[i] & 0xff;
  37291. o[2*i+1] = t[i]>>8;
  37292. }
  37293. }
  37294. function neq25519(a, b) {
  37295. var c = new Uint8Array(32), d = new Uint8Array(32);
  37296. pack25519(c, a);
  37297. pack25519(d, b);
  37298. return crypto_verify_32(c, 0, d, 0);
  37299. }
  37300. function par25519(a) {
  37301. var d = new Uint8Array(32);
  37302. pack25519(d, a);
  37303. return d[0] & 1;
  37304. }
  37305. function unpack25519(o, n) {
  37306. var i;
  37307. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37308. o[15] &= 0x7fff;
  37309. }
  37310. function A(o, a, b) {
  37311. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37312. }
  37313. function Z(o, a, b) {
  37314. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37315. }
  37316. function M(o, a, b) {
  37317. var v, c,
  37318. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37319. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37320. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37321. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37322. b0 = b[0],
  37323. b1 = b[1],
  37324. b2 = b[2],
  37325. b3 = b[3],
  37326. b4 = b[4],
  37327. b5 = b[5],
  37328. b6 = b[6],
  37329. b7 = b[7],
  37330. b8 = b[8],
  37331. b9 = b[9],
  37332. b10 = b[10],
  37333. b11 = b[11],
  37334. b12 = b[12],
  37335. b13 = b[13],
  37336. b14 = b[14],
  37337. b15 = b[15];
  37338. v = a[0];
  37339. t0 += v * b0;
  37340. t1 += v * b1;
  37341. t2 += v * b2;
  37342. t3 += v * b3;
  37343. t4 += v * b4;
  37344. t5 += v * b5;
  37345. t6 += v * b6;
  37346. t7 += v * b7;
  37347. t8 += v * b8;
  37348. t9 += v * b9;
  37349. t10 += v * b10;
  37350. t11 += v * b11;
  37351. t12 += v * b12;
  37352. t13 += v * b13;
  37353. t14 += v * b14;
  37354. t15 += v * b15;
  37355. v = a[1];
  37356. t1 += v * b0;
  37357. t2 += v * b1;
  37358. t3 += v * b2;
  37359. t4 += v * b3;
  37360. t5 += v * b4;
  37361. t6 += v * b5;
  37362. t7 += v * b6;
  37363. t8 += v * b7;
  37364. t9 += v * b8;
  37365. t10 += v * b9;
  37366. t11 += v * b10;
  37367. t12 += v * b11;
  37368. t13 += v * b12;
  37369. t14 += v * b13;
  37370. t15 += v * b14;
  37371. t16 += v * b15;
  37372. v = a[2];
  37373. t2 += v * b0;
  37374. t3 += v * b1;
  37375. t4 += v * b2;
  37376. t5 += v * b3;
  37377. t6 += v * b4;
  37378. t7 += v * b5;
  37379. t8 += v * b6;
  37380. t9 += v * b7;
  37381. t10 += v * b8;
  37382. t11 += v * b9;
  37383. t12 += v * b10;
  37384. t13 += v * b11;
  37385. t14 += v * b12;
  37386. t15 += v * b13;
  37387. t16 += v * b14;
  37388. t17 += v * b15;
  37389. v = a[3];
  37390. t3 += v * b0;
  37391. t4 += v * b1;
  37392. t5 += v * b2;
  37393. t6 += v * b3;
  37394. t7 += v * b4;
  37395. t8 += v * b5;
  37396. t9 += v * b6;
  37397. t10 += v * b7;
  37398. t11 += v * b8;
  37399. t12 += v * b9;
  37400. t13 += v * b10;
  37401. t14 += v * b11;
  37402. t15 += v * b12;
  37403. t16 += v * b13;
  37404. t17 += v * b14;
  37405. t18 += v * b15;
  37406. v = a[4];
  37407. t4 += v * b0;
  37408. t5 += v * b1;
  37409. t6 += v * b2;
  37410. t7 += v * b3;
  37411. t8 += v * b4;
  37412. t9 += v * b5;
  37413. t10 += v * b6;
  37414. t11 += v * b7;
  37415. t12 += v * b8;
  37416. t13 += v * b9;
  37417. t14 += v * b10;
  37418. t15 += v * b11;
  37419. t16 += v * b12;
  37420. t17 += v * b13;
  37421. t18 += v * b14;
  37422. t19 += v * b15;
  37423. v = a[5];
  37424. t5 += v * b0;
  37425. t6 += v * b1;
  37426. t7 += v * b2;
  37427. t8 += v * b3;
  37428. t9 += v * b4;
  37429. t10 += v * b5;
  37430. t11 += v * b6;
  37431. t12 += v * b7;
  37432. t13 += v * b8;
  37433. t14 += v * b9;
  37434. t15 += v * b10;
  37435. t16 += v * b11;
  37436. t17 += v * b12;
  37437. t18 += v * b13;
  37438. t19 += v * b14;
  37439. t20 += v * b15;
  37440. v = a[6];
  37441. t6 += v * b0;
  37442. t7 += v * b1;
  37443. t8 += v * b2;
  37444. t9 += v * b3;
  37445. t10 += v * b4;
  37446. t11 += v * b5;
  37447. t12 += v * b6;
  37448. t13 += v * b7;
  37449. t14 += v * b8;
  37450. t15 += v * b9;
  37451. t16 += v * b10;
  37452. t17 += v * b11;
  37453. t18 += v * b12;
  37454. t19 += v * b13;
  37455. t20 += v * b14;
  37456. t21 += v * b15;
  37457. v = a[7];
  37458. t7 += v * b0;
  37459. t8 += v * b1;
  37460. t9 += v * b2;
  37461. t10 += v * b3;
  37462. t11 += v * b4;
  37463. t12 += v * b5;
  37464. t13 += v * b6;
  37465. t14 += v * b7;
  37466. t15 += v * b8;
  37467. t16 += v * b9;
  37468. t17 += v * b10;
  37469. t18 += v * b11;
  37470. t19 += v * b12;
  37471. t20 += v * b13;
  37472. t21 += v * b14;
  37473. t22 += v * b15;
  37474. v = a[8];
  37475. t8 += v * b0;
  37476. t9 += v * b1;
  37477. t10 += v * b2;
  37478. t11 += v * b3;
  37479. t12 += v * b4;
  37480. t13 += v * b5;
  37481. t14 += v * b6;
  37482. t15 += v * b7;
  37483. t16 += v * b8;
  37484. t17 += v * b9;
  37485. t18 += v * b10;
  37486. t19 += v * b11;
  37487. t20 += v * b12;
  37488. t21 += v * b13;
  37489. t22 += v * b14;
  37490. t23 += v * b15;
  37491. v = a[9];
  37492. t9 += v * b0;
  37493. t10 += v * b1;
  37494. t11 += v * b2;
  37495. t12 += v * b3;
  37496. t13 += v * b4;
  37497. t14 += v * b5;
  37498. t15 += v * b6;
  37499. t16 += v * b7;
  37500. t17 += v * b8;
  37501. t18 += v * b9;
  37502. t19 += v * b10;
  37503. t20 += v * b11;
  37504. t21 += v * b12;
  37505. t22 += v * b13;
  37506. t23 += v * b14;
  37507. t24 += v * b15;
  37508. v = a[10];
  37509. t10 += v * b0;
  37510. t11 += v * b1;
  37511. t12 += v * b2;
  37512. t13 += v * b3;
  37513. t14 += v * b4;
  37514. t15 += v * b5;
  37515. t16 += v * b6;
  37516. t17 += v * b7;
  37517. t18 += v * b8;
  37518. t19 += v * b9;
  37519. t20 += v * b10;
  37520. t21 += v * b11;
  37521. t22 += v * b12;
  37522. t23 += v * b13;
  37523. t24 += v * b14;
  37524. t25 += v * b15;
  37525. v = a[11];
  37526. t11 += v * b0;
  37527. t12 += v * b1;
  37528. t13 += v * b2;
  37529. t14 += v * b3;
  37530. t15 += v * b4;
  37531. t16 += v * b5;
  37532. t17 += v * b6;
  37533. t18 += v * b7;
  37534. t19 += v * b8;
  37535. t20 += v * b9;
  37536. t21 += v * b10;
  37537. t22 += v * b11;
  37538. t23 += v * b12;
  37539. t24 += v * b13;
  37540. t25 += v * b14;
  37541. t26 += v * b15;
  37542. v = a[12];
  37543. t12 += v * b0;
  37544. t13 += v * b1;
  37545. t14 += v * b2;
  37546. t15 += v * b3;
  37547. t16 += v * b4;
  37548. t17 += v * b5;
  37549. t18 += v * b6;
  37550. t19 += v * b7;
  37551. t20 += v * b8;
  37552. t21 += v * b9;
  37553. t22 += v * b10;
  37554. t23 += v * b11;
  37555. t24 += v * b12;
  37556. t25 += v * b13;
  37557. t26 += v * b14;
  37558. t27 += v * b15;
  37559. v = a[13];
  37560. t13 += v * b0;
  37561. t14 += v * b1;
  37562. t15 += v * b2;
  37563. t16 += v * b3;
  37564. t17 += v * b4;
  37565. t18 += v * b5;
  37566. t19 += v * b6;
  37567. t20 += v * b7;
  37568. t21 += v * b8;
  37569. t22 += v * b9;
  37570. t23 += v * b10;
  37571. t24 += v * b11;
  37572. t25 += v * b12;
  37573. t26 += v * b13;
  37574. t27 += v * b14;
  37575. t28 += v * b15;
  37576. v = a[14];
  37577. t14 += v * b0;
  37578. t15 += v * b1;
  37579. t16 += v * b2;
  37580. t17 += v * b3;
  37581. t18 += v * b4;
  37582. t19 += v * b5;
  37583. t20 += v * b6;
  37584. t21 += v * b7;
  37585. t22 += v * b8;
  37586. t23 += v * b9;
  37587. t24 += v * b10;
  37588. t25 += v * b11;
  37589. t26 += v * b12;
  37590. t27 += v * b13;
  37591. t28 += v * b14;
  37592. t29 += v * b15;
  37593. v = a[15];
  37594. t15 += v * b0;
  37595. t16 += v * b1;
  37596. t17 += v * b2;
  37597. t18 += v * b3;
  37598. t19 += v * b4;
  37599. t20 += v * b5;
  37600. t21 += v * b6;
  37601. t22 += v * b7;
  37602. t23 += v * b8;
  37603. t24 += v * b9;
  37604. t25 += v * b10;
  37605. t26 += v * b11;
  37606. t27 += v * b12;
  37607. t28 += v * b13;
  37608. t29 += v * b14;
  37609. t30 += v * b15;
  37610. t0 += 38 * t16;
  37611. t1 += 38 * t17;
  37612. t2 += 38 * t18;
  37613. t3 += 38 * t19;
  37614. t4 += 38 * t20;
  37615. t5 += 38 * t21;
  37616. t6 += 38 * t22;
  37617. t7 += 38 * t23;
  37618. t8 += 38 * t24;
  37619. t9 += 38 * t25;
  37620. t10 += 38 * t26;
  37621. t11 += 38 * t27;
  37622. t12 += 38 * t28;
  37623. t13 += 38 * t29;
  37624. t14 += 38 * t30;
  37625. // t15 left as is
  37626. // first car
  37627. c = 1;
  37628. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37629. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37630. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37631. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37632. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37633. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37634. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37635. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37636. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37637. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37638. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37639. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37640. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37641. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37642. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37643. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37644. t0 += c-1 + 37 * (c-1);
  37645. // second car
  37646. c = 1;
  37647. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37648. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37649. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37650. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37651. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37652. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37653. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37654. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37655. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37656. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37657. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37658. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37659. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37660. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37661. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37662. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37663. t0 += c-1 + 37 * (c-1);
  37664. o[ 0] = t0;
  37665. o[ 1] = t1;
  37666. o[ 2] = t2;
  37667. o[ 3] = t3;
  37668. o[ 4] = t4;
  37669. o[ 5] = t5;
  37670. o[ 6] = t6;
  37671. o[ 7] = t7;
  37672. o[ 8] = t8;
  37673. o[ 9] = t9;
  37674. o[10] = t10;
  37675. o[11] = t11;
  37676. o[12] = t12;
  37677. o[13] = t13;
  37678. o[14] = t14;
  37679. o[15] = t15;
  37680. }
  37681. function S(o, a) {
  37682. M(o, a, a);
  37683. }
  37684. function inv25519(o, i) {
  37685. var c = gf();
  37686. var a;
  37687. for (a = 0; a < 16; a++) c[a] = i[a];
  37688. for (a = 253; a >= 0; a--) {
  37689. S(c, c);
  37690. if(a !== 2 && a !== 4) M(c, c, i);
  37691. }
  37692. for (a = 0; a < 16; a++) o[a] = c[a];
  37693. }
  37694. function pow2523(o, i) {
  37695. var c = gf();
  37696. var a;
  37697. for (a = 0; a < 16; a++) c[a] = i[a];
  37698. for (a = 250; a >= 0; a--) {
  37699. S(c, c);
  37700. if(a !== 1) M(c, c, i);
  37701. }
  37702. for (a = 0; a < 16; a++) o[a] = c[a];
  37703. }
  37704. function crypto_scalarmult(q, n, p) {
  37705. var z = new Uint8Array(32);
  37706. var x = new Float64Array(80), r, i;
  37707. var a = gf(), b = gf(), c = gf(),
  37708. d = gf(), e = gf(), f = gf();
  37709. for (i = 0; i < 31; i++) z[i] = n[i];
  37710. z[31]=(n[31]&127)|64;
  37711. z[0]&=248;
  37712. unpack25519(x,p);
  37713. for (i = 0; i < 16; i++) {
  37714. b[i]=x[i];
  37715. d[i]=a[i]=c[i]=0;
  37716. }
  37717. a[0]=d[0]=1;
  37718. for (i=254; i>=0; --i) {
  37719. r=(z[i>>>3]>>>(i&7))&1;
  37720. sel25519(a,b,r);
  37721. sel25519(c,d,r);
  37722. A(e,a,c);
  37723. Z(a,a,c);
  37724. A(c,b,d);
  37725. Z(b,b,d);
  37726. S(d,e);
  37727. S(f,a);
  37728. M(a,c,a);
  37729. M(c,b,e);
  37730. A(e,a,c);
  37731. Z(a,a,c);
  37732. S(b,a);
  37733. Z(c,d,f);
  37734. M(a,c,_121665);
  37735. A(a,a,d);
  37736. M(c,c,a);
  37737. M(a,d,f);
  37738. M(d,b,x);
  37739. S(b,e);
  37740. sel25519(a,b,r);
  37741. sel25519(c,d,r);
  37742. }
  37743. for (i = 0; i < 16; i++) {
  37744. x[i+16]=a[i];
  37745. x[i+32]=c[i];
  37746. x[i+48]=b[i];
  37747. x[i+64]=d[i];
  37748. }
  37749. var x32 = x.subarray(32);
  37750. var x16 = x.subarray(16);
  37751. inv25519(x32,x32);
  37752. M(x16,x16,x32);
  37753. pack25519(q,x16);
  37754. return 0;
  37755. }
  37756. function crypto_scalarmult_base(q, n) {
  37757. return crypto_scalarmult(q, n, _9);
  37758. }
  37759. function crypto_box_keypair(y, x) {
  37760. randombytes(x, 32);
  37761. return crypto_scalarmult_base(y, x);
  37762. }
  37763. function crypto_box_beforenm(k, y, x) {
  37764. var s = new Uint8Array(32);
  37765. crypto_scalarmult(s, x, y);
  37766. return crypto_core_hsalsa20(k, _0, s, sigma);
  37767. }
  37768. var crypto_box_afternm = crypto_secretbox;
  37769. var crypto_box_open_afternm = crypto_secretbox_open;
  37770. function crypto_box(c, m, d, n, y, x) {
  37771. var k = new Uint8Array(32);
  37772. crypto_box_beforenm(k, y, x);
  37773. return crypto_box_afternm(c, m, d, n, k);
  37774. }
  37775. function crypto_box_open(m, c, d, n, y, x) {
  37776. var k = new Uint8Array(32);
  37777. crypto_box_beforenm(k, y, x);
  37778. return crypto_box_open_afternm(m, c, d, n, k);
  37779. }
  37780. var K = [
  37781. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37782. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37783. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37784. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37785. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37786. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37787. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37788. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37789. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37790. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37791. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37792. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37793. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37794. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37795. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37796. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37797. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37798. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37799. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37800. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37801. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37802. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37803. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37804. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37805. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37806. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37807. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37808. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37809. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37810. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37811. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37812. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37813. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37814. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37815. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37816. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37817. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37818. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37819. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37820. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37821. ];
  37822. function crypto_hashblocks_hl(hh, hl, m, n) {
  37823. var wh = new Int32Array(16), wl = new Int32Array(16),
  37824. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37825. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37826. th, tl, i, j, h, l, a, b, c, d;
  37827. var ah0 = hh[0],
  37828. ah1 = hh[1],
  37829. ah2 = hh[2],
  37830. ah3 = hh[3],
  37831. ah4 = hh[4],
  37832. ah5 = hh[5],
  37833. ah6 = hh[6],
  37834. ah7 = hh[7],
  37835. al0 = hl[0],
  37836. al1 = hl[1],
  37837. al2 = hl[2],
  37838. al3 = hl[3],
  37839. al4 = hl[4],
  37840. al5 = hl[5],
  37841. al6 = hl[6],
  37842. al7 = hl[7];
  37843. var pos = 0;
  37844. while (n >= 128) {
  37845. for (i = 0; i < 16; i++) {
  37846. j = 8 * i + pos;
  37847. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37848. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37849. }
  37850. for (i = 0; i < 80; i++) {
  37851. bh0 = ah0;
  37852. bh1 = ah1;
  37853. bh2 = ah2;
  37854. bh3 = ah3;
  37855. bh4 = ah4;
  37856. bh5 = ah5;
  37857. bh6 = ah6;
  37858. bh7 = ah7;
  37859. bl0 = al0;
  37860. bl1 = al1;
  37861. bl2 = al2;
  37862. bl3 = al3;
  37863. bl4 = al4;
  37864. bl5 = al5;
  37865. bl6 = al6;
  37866. bl7 = al7;
  37867. // add
  37868. h = ah7;
  37869. l = al7;
  37870. a = l & 0xffff; b = l >>> 16;
  37871. c = h & 0xffff; d = h >>> 16;
  37872. // Sigma1
  37873. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37874. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37875. a += l & 0xffff; b += l >>> 16;
  37876. c += h & 0xffff; d += h >>> 16;
  37877. // Ch
  37878. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37879. l = (al4 & al5) ^ (~al4 & al6);
  37880. a += l & 0xffff; b += l >>> 16;
  37881. c += h & 0xffff; d += h >>> 16;
  37882. // K
  37883. h = K[i*2];
  37884. l = K[i*2+1];
  37885. a += l & 0xffff; b += l >>> 16;
  37886. c += h & 0xffff; d += h >>> 16;
  37887. // w
  37888. h = wh[i%16];
  37889. l = wl[i%16];
  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. th = c & 0xffff | d << 16;
  37896. tl = a & 0xffff | b << 16;
  37897. // add
  37898. h = th;
  37899. l = tl;
  37900. a = l & 0xffff; b = l >>> 16;
  37901. c = h & 0xffff; d = h >>> 16;
  37902. // Sigma0
  37903. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37904. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37905. a += l & 0xffff; b += l >>> 16;
  37906. c += h & 0xffff; d += h >>> 16;
  37907. // Maj
  37908. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37909. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37910. a += l & 0xffff; b += l >>> 16;
  37911. c += h & 0xffff; d += h >>> 16;
  37912. b += a >>> 16;
  37913. c += b >>> 16;
  37914. d += c >>> 16;
  37915. bh7 = (c & 0xffff) | (d << 16);
  37916. bl7 = (a & 0xffff) | (b << 16);
  37917. // add
  37918. h = bh3;
  37919. l = bl3;
  37920. a = l & 0xffff; b = l >>> 16;
  37921. c = h & 0xffff; d = h >>> 16;
  37922. h = th;
  37923. l = tl;
  37924. a += l & 0xffff; b += l >>> 16;
  37925. c += h & 0xffff; d += h >>> 16;
  37926. b += a >>> 16;
  37927. c += b >>> 16;
  37928. d += c >>> 16;
  37929. bh3 = (c & 0xffff) | (d << 16);
  37930. bl3 = (a & 0xffff) | (b << 16);
  37931. ah1 = bh0;
  37932. ah2 = bh1;
  37933. ah3 = bh2;
  37934. ah4 = bh3;
  37935. ah5 = bh4;
  37936. ah6 = bh5;
  37937. ah7 = bh6;
  37938. ah0 = bh7;
  37939. al1 = bl0;
  37940. al2 = bl1;
  37941. al3 = bl2;
  37942. al4 = bl3;
  37943. al5 = bl4;
  37944. al6 = bl5;
  37945. al7 = bl6;
  37946. al0 = bl7;
  37947. if (i%16 === 15) {
  37948. for (j = 0; j < 16; j++) {
  37949. // add
  37950. h = wh[j];
  37951. l = wl[j];
  37952. a = l & 0xffff; b = l >>> 16;
  37953. c = h & 0xffff; d = h >>> 16;
  37954. h = wh[(j+9)%16];
  37955. l = wl[(j+9)%16];
  37956. a += l & 0xffff; b += l >>> 16;
  37957. c += h & 0xffff; d += h >>> 16;
  37958. // sigma0
  37959. th = wh[(j+1)%16];
  37960. tl = wl[(j+1)%16];
  37961. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37962. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37963. a += l & 0xffff; b += l >>> 16;
  37964. c += h & 0xffff; d += h >>> 16;
  37965. // sigma1
  37966. th = wh[(j+14)%16];
  37967. tl = wl[(j+14)%16];
  37968. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  37969. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  37970. a += l & 0xffff; b += l >>> 16;
  37971. c += h & 0xffff; d += h >>> 16;
  37972. b += a >>> 16;
  37973. c += b >>> 16;
  37974. d += c >>> 16;
  37975. wh[j] = (c & 0xffff) | (d << 16);
  37976. wl[j] = (a & 0xffff) | (b << 16);
  37977. }
  37978. }
  37979. }
  37980. // add
  37981. h = ah0;
  37982. l = al0;
  37983. a = l & 0xffff; b = l >>> 16;
  37984. c = h & 0xffff; d = h >>> 16;
  37985. h = hh[0];
  37986. l = hl[0];
  37987. a += l & 0xffff; b += l >>> 16;
  37988. c += h & 0xffff; d += h >>> 16;
  37989. b += a >>> 16;
  37990. c += b >>> 16;
  37991. d += c >>> 16;
  37992. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  37993. hl[0] = al0 = (a & 0xffff) | (b << 16);
  37994. h = ah1;
  37995. l = al1;
  37996. a = l & 0xffff; b = l >>> 16;
  37997. c = h & 0xffff; d = h >>> 16;
  37998. h = hh[1];
  37999. l = hl[1];
  38000. a += l & 0xffff; b += l >>> 16;
  38001. c += h & 0xffff; d += h >>> 16;
  38002. b += a >>> 16;
  38003. c += b >>> 16;
  38004. d += c >>> 16;
  38005. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38006. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38007. h = ah2;
  38008. l = al2;
  38009. a = l & 0xffff; b = l >>> 16;
  38010. c = h & 0xffff; d = h >>> 16;
  38011. h = hh[2];
  38012. l = hl[2];
  38013. a += l & 0xffff; b += l >>> 16;
  38014. c += h & 0xffff; d += h >>> 16;
  38015. b += a >>> 16;
  38016. c += b >>> 16;
  38017. d += c >>> 16;
  38018. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38019. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38020. h = ah3;
  38021. l = al3;
  38022. a = l & 0xffff; b = l >>> 16;
  38023. c = h & 0xffff; d = h >>> 16;
  38024. h = hh[3];
  38025. l = hl[3];
  38026. a += l & 0xffff; b += l >>> 16;
  38027. c += h & 0xffff; d += h >>> 16;
  38028. b += a >>> 16;
  38029. c += b >>> 16;
  38030. d += c >>> 16;
  38031. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38032. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38033. h = ah4;
  38034. l = al4;
  38035. a = l & 0xffff; b = l >>> 16;
  38036. c = h & 0xffff; d = h >>> 16;
  38037. h = hh[4];
  38038. l = hl[4];
  38039. a += l & 0xffff; b += l >>> 16;
  38040. c += h & 0xffff; d += h >>> 16;
  38041. b += a >>> 16;
  38042. c += b >>> 16;
  38043. d += c >>> 16;
  38044. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38045. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38046. h = ah5;
  38047. l = al5;
  38048. a = l & 0xffff; b = l >>> 16;
  38049. c = h & 0xffff; d = h >>> 16;
  38050. h = hh[5];
  38051. l = hl[5];
  38052. a += l & 0xffff; b += l >>> 16;
  38053. c += h & 0xffff; d += h >>> 16;
  38054. b += a >>> 16;
  38055. c += b >>> 16;
  38056. d += c >>> 16;
  38057. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38058. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38059. h = ah6;
  38060. l = al6;
  38061. a = l & 0xffff; b = l >>> 16;
  38062. c = h & 0xffff; d = h >>> 16;
  38063. h = hh[6];
  38064. l = hl[6];
  38065. a += l & 0xffff; b += l >>> 16;
  38066. c += h & 0xffff; d += h >>> 16;
  38067. b += a >>> 16;
  38068. c += b >>> 16;
  38069. d += c >>> 16;
  38070. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38071. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38072. h = ah7;
  38073. l = al7;
  38074. a = l & 0xffff; b = l >>> 16;
  38075. c = h & 0xffff; d = h >>> 16;
  38076. h = hh[7];
  38077. l = hl[7];
  38078. a += l & 0xffff; b += l >>> 16;
  38079. c += h & 0xffff; d += h >>> 16;
  38080. b += a >>> 16;
  38081. c += b >>> 16;
  38082. d += c >>> 16;
  38083. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38084. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38085. pos += 128;
  38086. n -= 128;
  38087. }
  38088. return n;
  38089. }
  38090. function crypto_hash(out, m, n) {
  38091. var hh = new Int32Array(8),
  38092. hl = new Int32Array(8),
  38093. x = new Uint8Array(256),
  38094. i, b = n;
  38095. hh[0] = 0x6a09e667;
  38096. hh[1] = 0xbb67ae85;
  38097. hh[2] = 0x3c6ef372;
  38098. hh[3] = 0xa54ff53a;
  38099. hh[4] = 0x510e527f;
  38100. hh[5] = 0x9b05688c;
  38101. hh[6] = 0x1f83d9ab;
  38102. hh[7] = 0x5be0cd19;
  38103. hl[0] = 0xf3bcc908;
  38104. hl[1] = 0x84caa73b;
  38105. hl[2] = 0xfe94f82b;
  38106. hl[3] = 0x5f1d36f1;
  38107. hl[4] = 0xade682d1;
  38108. hl[5] = 0x2b3e6c1f;
  38109. hl[6] = 0xfb41bd6b;
  38110. hl[7] = 0x137e2179;
  38111. crypto_hashblocks_hl(hh, hl, m, n);
  38112. n %= 128;
  38113. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38114. x[n] = 128;
  38115. n = 256-128*(n<112?1:0);
  38116. x[n-9] = 0;
  38117. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38118. crypto_hashblocks_hl(hh, hl, x, n);
  38119. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38120. return 0;
  38121. }
  38122. function add(p, q) {
  38123. var a = gf(), b = gf(), c = gf(),
  38124. d = gf(), e = gf(), f = gf(),
  38125. g = gf(), h = gf(), t = gf();
  38126. Z(a, p[1], p[0]);
  38127. Z(t, q[1], q[0]);
  38128. M(a, a, t);
  38129. A(b, p[0], p[1]);
  38130. A(t, q[0], q[1]);
  38131. M(b, b, t);
  38132. M(c, p[3], q[3]);
  38133. M(c, c, D2);
  38134. M(d, p[2], q[2]);
  38135. A(d, d, d);
  38136. Z(e, b, a);
  38137. Z(f, d, c);
  38138. A(g, d, c);
  38139. A(h, b, a);
  38140. M(p[0], e, f);
  38141. M(p[1], h, g);
  38142. M(p[2], g, f);
  38143. M(p[3], e, h);
  38144. }
  38145. function cswap(p, q, b) {
  38146. var i;
  38147. for (i = 0; i < 4; i++) {
  38148. sel25519(p[i], q[i], b);
  38149. }
  38150. }
  38151. function pack(r, p) {
  38152. var tx = gf(), ty = gf(), zi = gf();
  38153. inv25519(zi, p[2]);
  38154. M(tx, p[0], zi);
  38155. M(ty, p[1], zi);
  38156. pack25519(r, ty);
  38157. r[31] ^= par25519(tx) << 7;
  38158. }
  38159. function scalarmult(p, q, s) {
  38160. var b, i;
  38161. set25519(p[0], gf0);
  38162. set25519(p[1], gf1);
  38163. set25519(p[2], gf1);
  38164. set25519(p[3], gf0);
  38165. for (i = 255; i >= 0; --i) {
  38166. b = (s[(i/8)|0] >> (i&7)) & 1;
  38167. cswap(p, q, b);
  38168. add(q, p);
  38169. add(p, p);
  38170. cswap(p, q, b);
  38171. }
  38172. }
  38173. function scalarbase(p, s) {
  38174. var q = [gf(), gf(), gf(), gf()];
  38175. set25519(q[0], X);
  38176. set25519(q[1], Y);
  38177. set25519(q[2], gf1);
  38178. M(q[3], X, Y);
  38179. scalarmult(p, q, s);
  38180. }
  38181. function crypto_sign_keypair(pk, sk, seeded) {
  38182. var d = new Uint8Array(64);
  38183. var p = [gf(), gf(), gf(), gf()];
  38184. var i;
  38185. if (!seeded) randombytes(sk, 32);
  38186. crypto_hash(d, sk, 32);
  38187. d[0] &= 248;
  38188. d[31] &= 127;
  38189. d[31] |= 64;
  38190. scalarbase(p, d);
  38191. pack(pk, p);
  38192. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38193. return 0;
  38194. }
  38195. 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]);
  38196. function modL(r, x) {
  38197. var carry, i, j, k;
  38198. for (i = 63; i >= 32; --i) {
  38199. carry = 0;
  38200. for (j = i - 32, k = i - 12; j < k; ++j) {
  38201. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38202. carry = (x[j] + 128) >> 8;
  38203. x[j] -= carry * 256;
  38204. }
  38205. x[j] += carry;
  38206. x[i] = 0;
  38207. }
  38208. carry = 0;
  38209. for (j = 0; j < 32; j++) {
  38210. x[j] += carry - (x[31] >> 4) * L[j];
  38211. carry = x[j] >> 8;
  38212. x[j] &= 255;
  38213. }
  38214. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38215. for (i = 0; i < 32; i++) {
  38216. x[i+1] += x[i] >> 8;
  38217. r[i] = x[i] & 255;
  38218. }
  38219. }
  38220. function reduce(r) {
  38221. var x = new Float64Array(64), i;
  38222. for (i = 0; i < 64; i++) x[i] = r[i];
  38223. for (i = 0; i < 64; i++) r[i] = 0;
  38224. modL(r, x);
  38225. }
  38226. // Note: difference from C - smlen returned, not passed as argument.
  38227. function crypto_sign(sm, m, n, sk) {
  38228. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38229. var i, j, x = new Float64Array(64);
  38230. var p = [gf(), gf(), gf(), gf()];
  38231. crypto_hash(d, sk, 32);
  38232. d[0] &= 248;
  38233. d[31] &= 127;
  38234. d[31] |= 64;
  38235. var smlen = n + 64;
  38236. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38237. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38238. crypto_hash(r, sm.subarray(32), n+32);
  38239. reduce(r);
  38240. scalarbase(p, r);
  38241. pack(sm, p);
  38242. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38243. crypto_hash(h, sm, n + 64);
  38244. reduce(h);
  38245. for (i = 0; i < 64; i++) x[i] = 0;
  38246. for (i = 0; i < 32; i++) x[i] = r[i];
  38247. for (i = 0; i < 32; i++) {
  38248. for (j = 0; j < 32; j++) {
  38249. x[i+j] += h[i] * d[j];
  38250. }
  38251. }
  38252. modL(sm.subarray(32), x);
  38253. return smlen;
  38254. }
  38255. function unpackneg(r, p) {
  38256. var t = gf(), chk = gf(), num = gf(),
  38257. den = gf(), den2 = gf(), den4 = gf(),
  38258. den6 = gf();
  38259. set25519(r[2], gf1);
  38260. unpack25519(r[1], p);
  38261. S(num, r[1]);
  38262. M(den, num, D);
  38263. Z(num, num, r[2]);
  38264. A(den, r[2], den);
  38265. S(den2, den);
  38266. S(den4, den2);
  38267. M(den6, den4, den2);
  38268. M(t, den6, num);
  38269. M(t, t, den);
  38270. pow2523(t, t);
  38271. M(t, t, num);
  38272. M(t, t, den);
  38273. M(t, t, den);
  38274. M(r[0], t, den);
  38275. S(chk, r[0]);
  38276. M(chk, chk, den);
  38277. if (neq25519(chk, num)) M(r[0], r[0], I);
  38278. S(chk, r[0]);
  38279. M(chk, chk, den);
  38280. if (neq25519(chk, num)) return -1;
  38281. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38282. M(r[3], r[0], r[1]);
  38283. return 0;
  38284. }
  38285. function crypto_sign_open(m, sm, n, pk) {
  38286. var i, mlen;
  38287. var t = new Uint8Array(32), h = new Uint8Array(64);
  38288. var p = [gf(), gf(), gf(), gf()],
  38289. q = [gf(), gf(), gf(), gf()];
  38290. mlen = -1;
  38291. if (n < 64) return -1;
  38292. if (unpackneg(q, pk)) return -1;
  38293. for (i = 0; i < n; i++) m[i] = sm[i];
  38294. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38295. crypto_hash(h, m, n);
  38296. reduce(h);
  38297. scalarmult(p, q, h);
  38298. scalarbase(q, sm.subarray(32));
  38299. add(p, q);
  38300. pack(t, p);
  38301. n -= 64;
  38302. if (crypto_verify_32(sm, 0, t, 0)) {
  38303. for (i = 0; i < n; i++) m[i] = 0;
  38304. return -1;
  38305. }
  38306. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38307. mlen = n;
  38308. return mlen;
  38309. }
  38310. var crypto_secretbox_KEYBYTES = 32,
  38311. crypto_secretbox_NONCEBYTES = 24,
  38312. crypto_secretbox_ZEROBYTES = 32,
  38313. crypto_secretbox_BOXZEROBYTES = 16,
  38314. crypto_scalarmult_BYTES = 32,
  38315. crypto_scalarmult_SCALARBYTES = 32,
  38316. crypto_box_PUBLICKEYBYTES = 32,
  38317. crypto_box_SECRETKEYBYTES = 32,
  38318. crypto_box_BEFORENMBYTES = 32,
  38319. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38320. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38321. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38322. crypto_sign_BYTES = 64,
  38323. crypto_sign_PUBLICKEYBYTES = 32,
  38324. crypto_sign_SECRETKEYBYTES = 64,
  38325. crypto_sign_SEEDBYTES = 32,
  38326. crypto_hash_BYTES = 64;
  38327. nacl.lowlevel = {
  38328. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38329. crypto_stream_xor: crypto_stream_xor,
  38330. crypto_stream: crypto_stream,
  38331. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38332. crypto_stream_salsa20: crypto_stream_salsa20,
  38333. crypto_onetimeauth: crypto_onetimeauth,
  38334. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38335. crypto_verify_16: crypto_verify_16,
  38336. crypto_verify_32: crypto_verify_32,
  38337. crypto_secretbox: crypto_secretbox,
  38338. crypto_secretbox_open: crypto_secretbox_open,
  38339. crypto_scalarmult: crypto_scalarmult,
  38340. crypto_scalarmult_base: crypto_scalarmult_base,
  38341. crypto_box_beforenm: crypto_box_beforenm,
  38342. crypto_box_afternm: crypto_box_afternm,
  38343. crypto_box: crypto_box,
  38344. crypto_box_open: crypto_box_open,
  38345. crypto_box_keypair: crypto_box_keypair,
  38346. crypto_hash: crypto_hash,
  38347. crypto_sign: crypto_sign,
  38348. crypto_sign_keypair: crypto_sign_keypair,
  38349. crypto_sign_open: crypto_sign_open,
  38350. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38351. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38352. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38353. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38354. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38355. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38356. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38357. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38358. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38359. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38360. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38361. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38362. crypto_sign_BYTES: crypto_sign_BYTES,
  38363. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38364. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38365. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38366. crypto_hash_BYTES: crypto_hash_BYTES
  38367. };
  38368. /* High-level API */
  38369. function checkLengths(k, n) {
  38370. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38371. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38372. }
  38373. function checkBoxLengths(pk, sk) {
  38374. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38375. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38376. }
  38377. function checkArrayTypes() {
  38378. for (var i = 0; i < arguments.length; i++) {
  38379. if (!(arguments[i] instanceof Uint8Array))
  38380. throw new TypeError('unexpected type, use Uint8Array');
  38381. }
  38382. }
  38383. function cleanup(arr) {
  38384. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38385. }
  38386. nacl.randomBytes = function(n) {
  38387. var b = new Uint8Array(n);
  38388. randombytes(b, n);
  38389. return b;
  38390. };
  38391. nacl.secretbox = function(msg, nonce, key) {
  38392. checkArrayTypes(msg, nonce, key);
  38393. checkLengths(key, nonce);
  38394. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38395. var c = new Uint8Array(m.length);
  38396. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38397. crypto_secretbox(c, m, m.length, nonce, key);
  38398. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38399. };
  38400. nacl.secretbox.open = function(box, nonce, key) {
  38401. checkArrayTypes(box, nonce, key);
  38402. checkLengths(key, nonce);
  38403. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38404. var m = new Uint8Array(c.length);
  38405. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38406. if (c.length < 32) return null;
  38407. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38408. return m.subarray(crypto_secretbox_ZEROBYTES);
  38409. };
  38410. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38411. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38412. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38413. nacl.scalarMult = function(n, p) {
  38414. checkArrayTypes(n, p);
  38415. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38416. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38417. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38418. crypto_scalarmult(q, n, p);
  38419. return q;
  38420. };
  38421. nacl.scalarMult.base = function(n) {
  38422. checkArrayTypes(n);
  38423. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38424. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38425. crypto_scalarmult_base(q, n);
  38426. return q;
  38427. };
  38428. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38429. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38430. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38431. var k = nacl.box.before(publicKey, secretKey);
  38432. return nacl.secretbox(msg, nonce, k);
  38433. };
  38434. nacl.box.before = function(publicKey, secretKey) {
  38435. checkArrayTypes(publicKey, secretKey);
  38436. checkBoxLengths(publicKey, secretKey);
  38437. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38438. crypto_box_beforenm(k, publicKey, secretKey);
  38439. return k;
  38440. };
  38441. nacl.box.after = nacl.secretbox;
  38442. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38443. var k = nacl.box.before(publicKey, secretKey);
  38444. return nacl.secretbox.open(msg, nonce, k);
  38445. };
  38446. nacl.box.open.after = nacl.secretbox.open;
  38447. nacl.box.keyPair = function() {
  38448. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38449. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38450. crypto_box_keypair(pk, sk);
  38451. return {publicKey: pk, secretKey: sk};
  38452. };
  38453. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38454. checkArrayTypes(secretKey);
  38455. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38456. throw new Error('bad secret key size');
  38457. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38458. crypto_scalarmult_base(pk, secretKey);
  38459. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38460. };
  38461. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38462. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38463. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38464. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38465. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38466. nacl.sign = function(msg, secretKey) {
  38467. checkArrayTypes(msg, secretKey);
  38468. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38469. throw new Error('bad secret key size');
  38470. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38471. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38472. return signedMsg;
  38473. };
  38474. nacl.sign.open = function(signedMsg, publicKey) {
  38475. checkArrayTypes(signedMsg, publicKey);
  38476. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38477. throw new Error('bad public key size');
  38478. var tmp = new Uint8Array(signedMsg.length);
  38479. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38480. if (mlen < 0) return null;
  38481. var m = new Uint8Array(mlen);
  38482. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38483. return m;
  38484. };
  38485. nacl.sign.detached = function(msg, secretKey) {
  38486. var signedMsg = nacl.sign(msg, secretKey);
  38487. var sig = new Uint8Array(crypto_sign_BYTES);
  38488. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38489. return sig;
  38490. };
  38491. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38492. checkArrayTypes(msg, sig, publicKey);
  38493. if (sig.length !== crypto_sign_BYTES)
  38494. throw new Error('bad signature size');
  38495. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38496. throw new Error('bad public key size');
  38497. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38498. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38499. var i;
  38500. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38501. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38502. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38503. };
  38504. nacl.sign.keyPair = function() {
  38505. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38506. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38507. crypto_sign_keypair(pk, sk);
  38508. return {publicKey: pk, secretKey: sk};
  38509. };
  38510. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38511. checkArrayTypes(secretKey);
  38512. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38513. throw new Error('bad secret key size');
  38514. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38515. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38516. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38517. };
  38518. nacl.sign.keyPair.fromSeed = function(seed) {
  38519. checkArrayTypes(seed);
  38520. if (seed.length !== crypto_sign_SEEDBYTES)
  38521. throw new Error('bad seed size');
  38522. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38523. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38524. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38525. crypto_sign_keypair(pk, sk, true);
  38526. return {publicKey: pk, secretKey: sk};
  38527. };
  38528. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38529. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38530. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38531. nacl.sign.signatureLength = crypto_sign_BYTES;
  38532. nacl.hash = function(msg) {
  38533. checkArrayTypes(msg);
  38534. var h = new Uint8Array(crypto_hash_BYTES);
  38535. crypto_hash(h, msg, msg.length);
  38536. return h;
  38537. };
  38538. nacl.hash.hashLength = crypto_hash_BYTES;
  38539. nacl.verify = function(x, y) {
  38540. checkArrayTypes(x, y);
  38541. // Zero length arguments are considered not equal.
  38542. if (x.length === 0 || y.length === 0) return false;
  38543. if (x.length !== y.length) return false;
  38544. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38545. };
  38546. nacl.setPRNG = function(fn) {
  38547. randombytes = fn;
  38548. };
  38549. (function() {
  38550. // Initialize PRNG if environment provides CSPRNG.
  38551. // If not, methods calling randombytes will throw.
  38552. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38553. if (crypto && crypto.getRandomValues) {
  38554. // Browsers.
  38555. var QUOTA = 65536;
  38556. nacl.setPRNG(function(x, n) {
  38557. var i, v = new Uint8Array(n);
  38558. for (i = 0; i < n; i += QUOTA) {
  38559. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38560. }
  38561. for (i = 0; i < n; i++) x[i] = v[i];
  38562. cleanup(v);
  38563. });
  38564. } else if (true) {
  38565. // Node.js.
  38566. crypto = __webpack_require__(3);
  38567. if (crypto && crypto.randomBytes) {
  38568. nacl.setPRNG(function(x, n) {
  38569. var i, v = crypto.randomBytes(n);
  38570. for (i = 0; i < n; i++) x[i] = v[i];
  38571. cleanup(v);
  38572. });
  38573. }
  38574. }
  38575. })();
  38576. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38577. /***/ }),
  38578. /* 1 */
  38579. /***/ (function(module, exports, __webpack_require__) {
  38580. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38581. // Public domain.
  38582. (function(root, f) {
  38583. 'use strict';
  38584. if ( true && module.exports) module.exports = f();
  38585. else if (root.nacl) root.nacl.util = f();
  38586. else {
  38587. root.nacl = {};
  38588. root.nacl.util = f();
  38589. }
  38590. }(this, function() {
  38591. 'use strict';
  38592. var util = {};
  38593. function validateBase64(s) {
  38594. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38595. throw new TypeError('invalid encoding');
  38596. }
  38597. }
  38598. util.decodeUTF8 = function(s) {
  38599. if (typeof s !== 'string') throw new TypeError('expected string');
  38600. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38601. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38602. return b;
  38603. };
  38604. util.encodeUTF8 = function(arr) {
  38605. var i, s = [];
  38606. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38607. return decodeURIComponent(escape(s.join('')));
  38608. };
  38609. if (typeof atob === 'undefined') {
  38610. // Node.js
  38611. if (typeof Buffer.from !== 'undefined') {
  38612. // Node v6 and later
  38613. util.encodeBase64 = function (arr) { // v6 and later
  38614. return Buffer.from(arr).toString('base64');
  38615. };
  38616. util.decodeBase64 = function (s) {
  38617. validateBase64(s);
  38618. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38619. };
  38620. } else {
  38621. // Node earlier than v6
  38622. util.encodeBase64 = function (arr) { // v6 and later
  38623. return (new Buffer(arr)).toString('base64');
  38624. };
  38625. util.decodeBase64 = function(s) {
  38626. validateBase64(s);
  38627. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38628. };
  38629. }
  38630. } else {
  38631. // Browsers
  38632. util.encodeBase64 = function(arr) {
  38633. var i, s = [], len = arr.length;
  38634. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38635. return btoa(s.join(''));
  38636. };
  38637. util.decodeBase64 = function(s) {
  38638. validateBase64(s);
  38639. var i, d = atob(s), b = new Uint8Array(d.length);
  38640. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38641. return b;
  38642. };
  38643. }
  38644. return util;
  38645. }));
  38646. /***/ }),
  38647. /* 2 */
  38648. /***/ (function(module, exports, __webpack_require__) {
  38649. // required so we don't have to do require('pusher').default etc.
  38650. module.exports = __webpack_require__(4).default;
  38651. /***/ }),
  38652. /* 3 */
  38653. /***/ (function(module, exports) {
  38654. /* (ignored) */
  38655. /***/ }),
  38656. /* 4 */
  38657. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38658. "use strict";
  38659. __webpack_require__.r(__webpack_exports__);
  38660. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38661. var ScriptReceiverFactory = (function () {
  38662. function ScriptReceiverFactory(prefix, name) {
  38663. this.lastId = 0;
  38664. this.prefix = prefix;
  38665. this.name = name;
  38666. }
  38667. ScriptReceiverFactory.prototype.create = function (callback) {
  38668. this.lastId++;
  38669. var number = this.lastId;
  38670. var id = this.prefix + number;
  38671. var name = this.name + "[" + number + "]";
  38672. var called = false;
  38673. var callbackWrapper = function () {
  38674. if (!called) {
  38675. callback.apply(null, arguments);
  38676. called = true;
  38677. }
  38678. };
  38679. this[number] = callbackWrapper;
  38680. return { number: number, id: id, name: name, callback: callbackWrapper };
  38681. };
  38682. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38683. delete this[receiver.number];
  38684. };
  38685. return ScriptReceiverFactory;
  38686. }());
  38687. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38688. // CONCATENATED MODULE: ./src/core/defaults.ts
  38689. var Defaults = {
  38690. VERSION: "5.0.3",
  38691. PROTOCOL: 7,
  38692. host: 'ws.pusherapp.com',
  38693. ws_port: 80,
  38694. wss_port: 443,
  38695. ws_path: '',
  38696. sockjs_host: 'sockjs.pusher.com',
  38697. sockjs_http_port: 80,
  38698. sockjs_https_port: 443,
  38699. sockjs_path: '/pusher',
  38700. stats_host: 'stats.pusher.com',
  38701. channel_auth_endpoint: '/pusher/auth',
  38702. channel_auth_transport: 'ajax',
  38703. activity_timeout: 120000,
  38704. pong_timeout: 30000,
  38705. unavailable_timeout: 10000,
  38706. cdn_http: "http://js.pusher.com",
  38707. cdn_https: "https://js.pusher.com",
  38708. dependency_suffix: ""
  38709. };
  38710. /* harmony default export */ var defaults = (Defaults);
  38711. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38712. var dependency_loader_DependencyLoader = (function () {
  38713. function DependencyLoader(options) {
  38714. this.options = options;
  38715. this.receivers = options.receivers || ScriptReceivers;
  38716. this.loading = {};
  38717. }
  38718. DependencyLoader.prototype.load = function (name, options, callback) {
  38719. var self = this;
  38720. if (self.loading[name] && self.loading[name].length > 0) {
  38721. self.loading[name].push(callback);
  38722. }
  38723. else {
  38724. self.loading[name] = [callback];
  38725. var request = runtime.createScriptRequest(self.getPath(name, options));
  38726. var receiver = self.receivers.create(function (error) {
  38727. self.receivers.remove(receiver);
  38728. if (self.loading[name]) {
  38729. var callbacks = self.loading[name];
  38730. delete self.loading[name];
  38731. var successCallback = function (wasSuccessful) {
  38732. if (!wasSuccessful) {
  38733. request.cleanup();
  38734. }
  38735. };
  38736. for (var i = 0; i < callbacks.length; i++) {
  38737. callbacks[i](error, successCallback);
  38738. }
  38739. }
  38740. });
  38741. request.send(receiver);
  38742. }
  38743. };
  38744. DependencyLoader.prototype.getRoot = function (options) {
  38745. var cdn;
  38746. var protocol = runtime.getDocument().location.protocol;
  38747. if ((options && options.useTLS) || protocol === "https:") {
  38748. cdn = this.options.cdn_https;
  38749. }
  38750. else {
  38751. cdn = this.options.cdn_http;
  38752. }
  38753. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38754. };
  38755. DependencyLoader.prototype.getPath = function (name, options) {
  38756. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38757. };
  38758. ;
  38759. return DependencyLoader;
  38760. }());
  38761. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38762. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38763. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38764. var Dependencies = new dependency_loader({
  38765. cdn_http: defaults.cdn_http,
  38766. cdn_https: defaults.cdn_https,
  38767. version: defaults.VERSION,
  38768. suffix: defaults.dependency_suffix,
  38769. receivers: DependenciesReceivers
  38770. });
  38771. // CONCATENATED MODULE: ./src/core/base64.ts
  38772. function encode(s) {
  38773. return btoa(utob(s));
  38774. }
  38775. var fromCharCode = String.fromCharCode;
  38776. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38777. var b64tab = {};
  38778. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38779. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38780. }
  38781. var cb_utob = function (c) {
  38782. var cc = c.charCodeAt(0);
  38783. return cc < 0x80
  38784. ? c
  38785. : cc < 0x800
  38786. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38787. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38788. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38789. fromCharCode(0x80 | (cc & 0x3f));
  38790. };
  38791. var utob = function (u) {
  38792. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38793. };
  38794. var cb_encode = function (ccc) {
  38795. var padlen = [0, 2, 1][ccc.length % 3];
  38796. var ord = (ccc.charCodeAt(0) << 16) |
  38797. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38798. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38799. var chars = [
  38800. b64chars.charAt(ord >>> 18),
  38801. b64chars.charAt((ord >>> 12) & 63),
  38802. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38803. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38804. ];
  38805. return chars.join('');
  38806. };
  38807. var btoa = window.btoa ||
  38808. function (b) {
  38809. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38810. };
  38811. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38812. var Timer = (function () {
  38813. function Timer(set, clear, delay, callback) {
  38814. var _this = this;
  38815. this.clear = clear;
  38816. this.timer = set(function () {
  38817. if (_this.timer) {
  38818. _this.timer = callback(_this.timer);
  38819. }
  38820. }, delay);
  38821. }
  38822. Timer.prototype.isRunning = function () {
  38823. return this.timer !== null;
  38824. };
  38825. Timer.prototype.ensureAborted = function () {
  38826. if (this.timer) {
  38827. this.clear(this.timer);
  38828. this.timer = null;
  38829. }
  38830. };
  38831. return Timer;
  38832. }());
  38833. /* harmony default export */ var abstract_timer = (Timer);
  38834. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38835. var __extends = (undefined && undefined.__extends) || (function () {
  38836. var extendStatics = function (d, b) {
  38837. extendStatics = Object.setPrototypeOf ||
  38838. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38839. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38840. return extendStatics(d, b);
  38841. };
  38842. return function (d, b) {
  38843. extendStatics(d, b);
  38844. function __() { this.constructor = d; }
  38845. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38846. };
  38847. })();
  38848. function timers_clearTimeout(timer) {
  38849. window.clearTimeout(timer);
  38850. }
  38851. function timers_clearInterval(timer) {
  38852. window.clearInterval(timer);
  38853. }
  38854. var OneOffTimer = (function (_super) {
  38855. __extends(OneOffTimer, _super);
  38856. function OneOffTimer(delay, callback) {
  38857. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38858. callback();
  38859. return null;
  38860. }) || this;
  38861. }
  38862. return OneOffTimer;
  38863. }(abstract_timer));
  38864. var PeriodicTimer = (function (_super) {
  38865. __extends(PeriodicTimer, _super);
  38866. function PeriodicTimer(delay, callback) {
  38867. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38868. callback();
  38869. return timer;
  38870. }) || this;
  38871. }
  38872. return PeriodicTimer;
  38873. }(abstract_timer));
  38874. // CONCATENATED MODULE: ./src/core/util.ts
  38875. var Util = {
  38876. now: function () {
  38877. if (Date.now) {
  38878. return Date.now();
  38879. }
  38880. else {
  38881. return new Date().valueOf();
  38882. }
  38883. },
  38884. defer: function (callback) {
  38885. return new OneOffTimer(0, callback);
  38886. },
  38887. method: function (name) {
  38888. var args = [];
  38889. for (var _i = 1; _i < arguments.length; _i++) {
  38890. args[_i - 1] = arguments[_i];
  38891. }
  38892. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38893. return function (object) {
  38894. return object[name].apply(object, boundArguments.concat(arguments));
  38895. };
  38896. }
  38897. };
  38898. /* harmony default export */ var util = (Util);
  38899. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38900. function extend(target) {
  38901. var sources = [];
  38902. for (var _i = 1; _i < arguments.length; _i++) {
  38903. sources[_i - 1] = arguments[_i];
  38904. }
  38905. for (var i = 0; i < sources.length; i++) {
  38906. var extensions = sources[i];
  38907. for (var property in extensions) {
  38908. if (extensions[property] && extensions[property].constructor &&
  38909. extensions[property].constructor === Object) {
  38910. target[property] = extend(target[property] || {}, extensions[property]);
  38911. }
  38912. else {
  38913. target[property] = extensions[property];
  38914. }
  38915. }
  38916. }
  38917. return target;
  38918. }
  38919. function stringify() {
  38920. var m = ["Pusher"];
  38921. for (var i = 0; i < arguments.length; i++) {
  38922. if (typeof arguments[i] === "string") {
  38923. m.push(arguments[i]);
  38924. }
  38925. else {
  38926. m.push(safeJSONStringify(arguments[i]));
  38927. }
  38928. }
  38929. return m.join(" : ");
  38930. }
  38931. function arrayIndexOf(array, item) {
  38932. var nativeIndexOf = Array.prototype.indexOf;
  38933. if (array === null) {
  38934. return -1;
  38935. }
  38936. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38937. return array.indexOf(item);
  38938. }
  38939. for (var i = 0, l = array.length; i < l; i++) {
  38940. if (array[i] === item) {
  38941. return i;
  38942. }
  38943. }
  38944. return -1;
  38945. }
  38946. function objectApply(object, f) {
  38947. for (var key in object) {
  38948. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38949. f(object[key], key, object);
  38950. }
  38951. }
  38952. }
  38953. function keys(object) {
  38954. var keys = [];
  38955. objectApply(object, function (_, key) {
  38956. keys.push(key);
  38957. });
  38958. return keys;
  38959. }
  38960. function values(object) {
  38961. var values = [];
  38962. objectApply(object, function (value) {
  38963. values.push(value);
  38964. });
  38965. return values;
  38966. }
  38967. function apply(array, f, context) {
  38968. for (var i = 0; i < array.length; i++) {
  38969. f.call(context || window, array[i], i, array);
  38970. }
  38971. }
  38972. function map(array, f) {
  38973. var result = [];
  38974. for (var i = 0; i < array.length; i++) {
  38975. result.push(f(array[i], i, array, result));
  38976. }
  38977. return result;
  38978. }
  38979. function mapObject(object, f) {
  38980. var result = {};
  38981. objectApply(object, function (value, key) {
  38982. result[key] = f(value);
  38983. });
  38984. return result;
  38985. }
  38986. function filter(array, test) {
  38987. test = test || function (value) { return !!value; };
  38988. var result = [];
  38989. for (var i = 0; i < array.length; i++) {
  38990. if (test(array[i], i, array, result)) {
  38991. result.push(array[i]);
  38992. }
  38993. }
  38994. return result;
  38995. }
  38996. function filterObject(object, test) {
  38997. var result = {};
  38998. objectApply(object, function (value, key) {
  38999. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39000. result[key] = value;
  39001. }
  39002. });
  39003. return result;
  39004. }
  39005. function flatten(object) {
  39006. var result = [];
  39007. objectApply(object, function (value, key) {
  39008. result.push([key, value]);
  39009. });
  39010. return result;
  39011. }
  39012. function any(array, test) {
  39013. for (var i = 0; i < array.length; i++) {
  39014. if (test(array[i], i, array)) {
  39015. return true;
  39016. }
  39017. }
  39018. return false;
  39019. }
  39020. function collections_all(array, test) {
  39021. for (var i = 0; i < array.length; i++) {
  39022. if (!test(array[i], i, array)) {
  39023. return false;
  39024. }
  39025. }
  39026. return true;
  39027. }
  39028. function encodeParamsObject(data) {
  39029. return mapObject(data, function (value) {
  39030. if (typeof value === "object") {
  39031. value = safeJSONStringify(value);
  39032. }
  39033. return encodeURIComponent(encode(value.toString()));
  39034. });
  39035. }
  39036. function buildQueryString(data) {
  39037. var params = filterObject(data, function (value) {
  39038. return value !== undefined;
  39039. });
  39040. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39041. return query;
  39042. }
  39043. function decycleObject(object) {
  39044. var objects = [], paths = [];
  39045. return (function derez(value, path) {
  39046. var i, name, nu;
  39047. switch (typeof value) {
  39048. case 'object':
  39049. if (!value) {
  39050. return null;
  39051. }
  39052. for (i = 0; i < objects.length; i += 1) {
  39053. if (objects[i] === value) {
  39054. return { $ref: paths[i] };
  39055. }
  39056. }
  39057. objects.push(value);
  39058. paths.push(path);
  39059. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39060. nu = [];
  39061. for (i = 0; i < value.length; i += 1) {
  39062. nu[i] = derez(value[i], path + '[' + i + ']');
  39063. }
  39064. }
  39065. else {
  39066. nu = {};
  39067. for (name in value) {
  39068. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39069. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39070. }
  39071. }
  39072. }
  39073. return nu;
  39074. case 'number':
  39075. case 'string':
  39076. case 'boolean':
  39077. return value;
  39078. }
  39079. }(object, '$'));
  39080. }
  39081. function safeJSONStringify(source) {
  39082. try {
  39083. return JSON.stringify(source);
  39084. }
  39085. catch (e) {
  39086. return JSON.stringify(decycleObject(source));
  39087. }
  39088. }
  39089. // CONCATENATED MODULE: ./src/core/logger.ts
  39090. var logger_Logger = (function () {
  39091. function Logger() {
  39092. this.globalLog = function (message) {
  39093. if (window.console && window.console.log) {
  39094. window.console.log(message);
  39095. }
  39096. };
  39097. }
  39098. Logger.prototype.debug = function () {
  39099. var args = [];
  39100. for (var _i = 0; _i < arguments.length; _i++) {
  39101. args[_i] = arguments[_i];
  39102. }
  39103. this.log(this.globalLog, args);
  39104. };
  39105. Logger.prototype.warn = function () {
  39106. var args = [];
  39107. for (var _i = 0; _i < arguments.length; _i++) {
  39108. args[_i] = arguments[_i];
  39109. }
  39110. this.log(this.globalLogWarn, args);
  39111. };
  39112. Logger.prototype.error = function () {
  39113. var args = [];
  39114. for (var _i = 0; _i < arguments.length; _i++) {
  39115. args[_i] = arguments[_i];
  39116. }
  39117. this.log(this.globalLogError, args);
  39118. };
  39119. Logger.prototype.globalLogWarn = function (message) {
  39120. if (window.console && window.console.warn) {
  39121. window.console.warn(message);
  39122. }
  39123. else {
  39124. this.globalLog(message);
  39125. }
  39126. };
  39127. Logger.prototype.globalLogError = function (message) {
  39128. if (window.console && window.console.error) {
  39129. window.console.error(message);
  39130. }
  39131. else {
  39132. this.globalLogWarn(message);
  39133. }
  39134. };
  39135. Logger.prototype.log = function (defaultLoggingFunction) {
  39136. var args = [];
  39137. for (var _i = 1; _i < arguments.length; _i++) {
  39138. args[_i - 1] = arguments[_i];
  39139. }
  39140. var message = stringify.apply(this, arguments);
  39141. if (core_pusher.log) {
  39142. core_pusher.log(message);
  39143. }
  39144. else if (core_pusher.logToConsole) {
  39145. var log = defaultLoggingFunction.bind(this);
  39146. log(message);
  39147. }
  39148. };
  39149. return Logger;
  39150. }());
  39151. /* harmony default export */ var logger = (new logger_Logger());
  39152. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39153. var urlStore = {
  39154. baseUrl: "https://pusher.com",
  39155. urls: {
  39156. authenticationEndpoint: {
  39157. path: "/docs/authenticating_users",
  39158. },
  39159. javascriptQuickStart: {
  39160. path: "/docs/javascript_quick_start"
  39161. },
  39162. triggeringClientEvents: {
  39163. path: "/docs/client_api_guide/client_events#trigger-events"
  39164. }
  39165. }
  39166. };
  39167. var buildLogSuffix = function (key) {
  39168. var urlPrefix = "See:";
  39169. var urlObj = urlStore.urls[key];
  39170. if (!urlObj)
  39171. return "";
  39172. var url;
  39173. if (urlObj.fullUrl) {
  39174. url = urlObj.fullUrl;
  39175. }
  39176. else if (urlObj.path) {
  39177. url = urlStore.baseUrl + urlObj.path;
  39178. }
  39179. if (!url)
  39180. return "";
  39181. return urlPrefix + " " + url;
  39182. };
  39183. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39184. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39185. var ajax = function (context, socketId, callback) {
  39186. var self = this, xhr;
  39187. xhr = runtime.createXHR();
  39188. xhr.open("POST", self.options.authEndpoint, true);
  39189. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39190. for (var headerName in this.authOptions.headers) {
  39191. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39192. }
  39193. xhr.onreadystatechange = function () {
  39194. if (xhr.readyState === 4) {
  39195. if (xhr.status === 200) {
  39196. var data, parsed = false;
  39197. try {
  39198. data = JSON.parse(xhr.responseText);
  39199. parsed = true;
  39200. }
  39201. catch (e) {
  39202. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39203. }
  39204. if (parsed) {
  39205. callback(false, data);
  39206. }
  39207. }
  39208. else {
  39209. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39210. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39211. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39212. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39213. callback(true, xhr.status);
  39214. }
  39215. }
  39216. };
  39217. xhr.send(this.composeQuery(socketId));
  39218. return xhr;
  39219. };
  39220. /* harmony default export */ var xhr_auth = (ajax);
  39221. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39222. var jsonp = function (context, socketId, callback) {
  39223. if (this.authOptions.headers !== undefined) {
  39224. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39225. }
  39226. var callbackName = context.nextAuthCallbackID.toString();
  39227. context.nextAuthCallbackID++;
  39228. var document = context.getDocument();
  39229. var script = document.createElement("script");
  39230. context.auth_callbacks[callbackName] = function (data) {
  39231. callback(false, data);
  39232. };
  39233. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39234. script.src = this.options.authEndpoint +
  39235. '?callback=' +
  39236. encodeURIComponent(callback_name) +
  39237. '&' +
  39238. this.composeQuery(socketId);
  39239. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39240. head.insertBefore(script, head.firstChild);
  39241. };
  39242. /* harmony default export */ var jsonp_auth = (jsonp);
  39243. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39244. var ScriptRequest = (function () {
  39245. function ScriptRequest(src) {
  39246. this.src = src;
  39247. }
  39248. ScriptRequest.prototype.send = function (receiver) {
  39249. var self = this;
  39250. var errorString = "Error loading " + self.src;
  39251. self.script = document.createElement("script");
  39252. self.script.id = receiver.id;
  39253. self.script.src = self.src;
  39254. self.script.type = "text/javascript";
  39255. self.script.charset = "UTF-8";
  39256. if (self.script.addEventListener) {
  39257. self.script.onerror = function () {
  39258. receiver.callback(errorString);
  39259. };
  39260. self.script.onload = function () {
  39261. receiver.callback(null);
  39262. };
  39263. }
  39264. else {
  39265. self.script.onreadystatechange = function () {
  39266. if (self.script.readyState === 'loaded' ||
  39267. self.script.readyState === 'complete') {
  39268. receiver.callback(null);
  39269. }
  39270. };
  39271. }
  39272. if (self.script.async === undefined && document.attachEvent &&
  39273. /opera/i.test(navigator.userAgent)) {
  39274. self.errorScript = document.createElement("script");
  39275. self.errorScript.id = receiver.id + "_error";
  39276. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39277. self.script.async = self.errorScript.async = false;
  39278. }
  39279. else {
  39280. self.script.async = true;
  39281. }
  39282. var head = document.getElementsByTagName('head')[0];
  39283. head.insertBefore(self.script, head.firstChild);
  39284. if (self.errorScript) {
  39285. head.insertBefore(self.errorScript, self.script.nextSibling);
  39286. }
  39287. };
  39288. ScriptRequest.prototype.cleanup = function () {
  39289. if (this.script) {
  39290. this.script.onload = this.script.onerror = null;
  39291. this.script.onreadystatechange = null;
  39292. }
  39293. if (this.script && this.script.parentNode) {
  39294. this.script.parentNode.removeChild(this.script);
  39295. }
  39296. if (this.errorScript && this.errorScript.parentNode) {
  39297. this.errorScript.parentNode.removeChild(this.errorScript);
  39298. }
  39299. this.script = null;
  39300. this.errorScript = null;
  39301. };
  39302. return ScriptRequest;
  39303. }());
  39304. /* harmony default export */ var script_request = (ScriptRequest);
  39305. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39306. var jsonp_request_JSONPRequest = (function () {
  39307. function JSONPRequest(url, data) {
  39308. this.url = url;
  39309. this.data = data;
  39310. }
  39311. JSONPRequest.prototype.send = function (receiver) {
  39312. if (this.request) {
  39313. return;
  39314. }
  39315. var query = buildQueryString(this.data);
  39316. var url = this.url + "/" + receiver.number + "?" + query;
  39317. this.request = runtime.createScriptRequest(url);
  39318. this.request.send(receiver);
  39319. };
  39320. JSONPRequest.prototype.cleanup = function () {
  39321. if (this.request) {
  39322. this.request.cleanup();
  39323. }
  39324. };
  39325. return JSONPRequest;
  39326. }());
  39327. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39328. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39329. var getAgent = function (sender, useTLS) {
  39330. return function (data, callback) {
  39331. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39332. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39333. var request = runtime.createJSONPRequest(url, data);
  39334. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39335. ScriptReceivers.remove(receiver);
  39336. request.cleanup();
  39337. if (result && result.host) {
  39338. sender.host = result.host;
  39339. }
  39340. if (callback) {
  39341. callback(error, result);
  39342. }
  39343. });
  39344. request.send(receiver);
  39345. };
  39346. };
  39347. var jsonp_timeline_jsonp = {
  39348. name: 'jsonp',
  39349. getAgent: getAgent
  39350. };
  39351. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39352. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39353. function getGenericURL(baseScheme, params, path) {
  39354. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39355. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39356. return scheme + "://" + host + path;
  39357. }
  39358. function getGenericPath(key, queryString) {
  39359. var path = "/app/" + key;
  39360. var query = "?protocol=" + defaults.PROTOCOL +
  39361. "&client=js" +
  39362. "&version=" + defaults.VERSION +
  39363. (queryString ? ("&" + queryString) : "");
  39364. return path + query;
  39365. }
  39366. var ws = {
  39367. getInitial: function (key, params) {
  39368. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39369. return getGenericURL("ws", params, path);
  39370. }
  39371. };
  39372. var http = {
  39373. getInitial: function (key, params) {
  39374. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39375. return getGenericURL("http", params, path);
  39376. }
  39377. };
  39378. var sockjs = {
  39379. getInitial: function (key, params) {
  39380. return getGenericURL("http", params, params.httpPath || "/pusher");
  39381. },
  39382. getPath: function (key, params) {
  39383. return getGenericPath(key);
  39384. }
  39385. };
  39386. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39387. var callback_registry_CallbackRegistry = (function () {
  39388. function CallbackRegistry() {
  39389. this._callbacks = {};
  39390. }
  39391. CallbackRegistry.prototype.get = function (name) {
  39392. return this._callbacks[prefix(name)];
  39393. };
  39394. CallbackRegistry.prototype.add = function (name, callback, context) {
  39395. var prefixedEventName = prefix(name);
  39396. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39397. this._callbacks[prefixedEventName].push({
  39398. fn: callback,
  39399. context: context
  39400. });
  39401. };
  39402. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39403. if (!name && !callback && !context) {
  39404. this._callbacks = {};
  39405. return;
  39406. }
  39407. var names = name ? [prefix(name)] : keys(this._callbacks);
  39408. if (callback || context) {
  39409. this.removeCallback(names, callback, context);
  39410. }
  39411. else {
  39412. this.removeAllCallbacks(names);
  39413. }
  39414. };
  39415. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39416. apply(names, function (name) {
  39417. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39418. return (callback && callback !== binding.fn) ||
  39419. (context && context !== binding.context);
  39420. });
  39421. if (this._callbacks[name].length === 0) {
  39422. delete this._callbacks[name];
  39423. }
  39424. }, this);
  39425. };
  39426. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39427. apply(names, function (name) {
  39428. delete this._callbacks[name];
  39429. }, this);
  39430. };
  39431. return CallbackRegistry;
  39432. }());
  39433. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39434. function prefix(name) {
  39435. return "_" + name;
  39436. }
  39437. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39438. var dispatcher_Dispatcher = (function () {
  39439. function Dispatcher(failThrough) {
  39440. this.callbacks = new callback_registry();
  39441. this.global_callbacks = [];
  39442. this.failThrough = failThrough;
  39443. }
  39444. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39445. this.callbacks.add(eventName, callback, context);
  39446. return this;
  39447. };
  39448. Dispatcher.prototype.bind_global = function (callback) {
  39449. this.global_callbacks.push(callback);
  39450. return this;
  39451. };
  39452. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39453. this.callbacks.remove(eventName, callback, context);
  39454. return this;
  39455. };
  39456. Dispatcher.prototype.unbind_global = function (callback) {
  39457. if (!callback) {
  39458. this.global_callbacks = [];
  39459. return this;
  39460. }
  39461. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39462. return this;
  39463. };
  39464. Dispatcher.prototype.unbind_all = function () {
  39465. this.unbind();
  39466. this.unbind_global();
  39467. return this;
  39468. };
  39469. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39470. for (var i = 0; i < this.global_callbacks.length; i++) {
  39471. this.global_callbacks[i](eventName, data);
  39472. }
  39473. var callbacks = this.callbacks.get(eventName);
  39474. var args = [];
  39475. if (metadata) {
  39476. args.push(data, metadata);
  39477. }
  39478. else if (data) {
  39479. args.push(data);
  39480. }
  39481. if (callbacks && callbacks.length > 0) {
  39482. for (var i = 0; i < callbacks.length; i++) {
  39483. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39484. }
  39485. }
  39486. else if (this.failThrough) {
  39487. this.failThrough(eventName, data);
  39488. }
  39489. return this;
  39490. };
  39491. return Dispatcher;
  39492. }());
  39493. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39494. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39495. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39496. var extendStatics = function (d, b) {
  39497. extendStatics = Object.setPrototypeOf ||
  39498. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39499. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39500. return extendStatics(d, b);
  39501. };
  39502. return function (d, b) {
  39503. extendStatics(d, b);
  39504. function __() { this.constructor = d; }
  39505. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39506. };
  39507. })();
  39508. var transport_connection_TransportConnection = (function (_super) {
  39509. transport_connection_extends(TransportConnection, _super);
  39510. function TransportConnection(hooks, name, priority, key, options) {
  39511. var _this = _super.call(this) || this;
  39512. _this.initialize = runtime.transportConnectionInitializer;
  39513. _this.hooks = hooks;
  39514. _this.name = name;
  39515. _this.priority = priority;
  39516. _this.key = key;
  39517. _this.options = options;
  39518. _this.state = "new";
  39519. _this.timeline = options.timeline;
  39520. _this.activityTimeout = options.activityTimeout;
  39521. _this.id = _this.timeline.generateUniqueID();
  39522. return _this;
  39523. }
  39524. TransportConnection.prototype.handlesActivityChecks = function () {
  39525. return Boolean(this.hooks.handlesActivityChecks);
  39526. };
  39527. TransportConnection.prototype.supportsPing = function () {
  39528. return Boolean(this.hooks.supportsPing);
  39529. };
  39530. TransportConnection.prototype.connect = function () {
  39531. var _this = this;
  39532. if (this.socket || this.state !== "initialized") {
  39533. return false;
  39534. }
  39535. var url = this.hooks.urls.getInitial(this.key, this.options);
  39536. try {
  39537. this.socket = this.hooks.getSocket(url, this.options);
  39538. }
  39539. catch (e) {
  39540. util.defer(function () {
  39541. _this.onError(e);
  39542. _this.changeState("closed");
  39543. });
  39544. return false;
  39545. }
  39546. this.bindListeners();
  39547. logger.debug("Connecting", { transport: this.name, url: url });
  39548. this.changeState("connecting");
  39549. return true;
  39550. };
  39551. TransportConnection.prototype.close = function () {
  39552. if (this.socket) {
  39553. this.socket.close();
  39554. return true;
  39555. }
  39556. else {
  39557. return false;
  39558. }
  39559. };
  39560. TransportConnection.prototype.send = function (data) {
  39561. var _this = this;
  39562. if (this.state === "open") {
  39563. util.defer(function () {
  39564. if (_this.socket) {
  39565. _this.socket.send(data);
  39566. }
  39567. });
  39568. return true;
  39569. }
  39570. else {
  39571. return false;
  39572. }
  39573. };
  39574. TransportConnection.prototype.ping = function () {
  39575. if (this.state === "open" && this.supportsPing()) {
  39576. this.socket.ping();
  39577. }
  39578. };
  39579. TransportConnection.prototype.onOpen = function () {
  39580. if (this.hooks.beforeOpen) {
  39581. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39582. }
  39583. this.changeState("open");
  39584. this.socket.onopen = undefined;
  39585. };
  39586. TransportConnection.prototype.onError = function (error) {
  39587. this.emit("error", { type: 'WebSocketError', error: error });
  39588. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39589. };
  39590. TransportConnection.prototype.onClose = function (closeEvent) {
  39591. if (closeEvent) {
  39592. this.changeState("closed", {
  39593. code: closeEvent.code,
  39594. reason: closeEvent.reason,
  39595. wasClean: closeEvent.wasClean
  39596. });
  39597. }
  39598. else {
  39599. this.changeState("closed");
  39600. }
  39601. this.unbindListeners();
  39602. this.socket = undefined;
  39603. };
  39604. TransportConnection.prototype.onMessage = function (message) {
  39605. this.emit("message", message);
  39606. };
  39607. TransportConnection.prototype.onActivity = function () {
  39608. this.emit("activity");
  39609. };
  39610. TransportConnection.prototype.bindListeners = function () {
  39611. var _this = this;
  39612. this.socket.onopen = function () {
  39613. _this.onOpen();
  39614. };
  39615. this.socket.onerror = function (error) {
  39616. _this.onError(error);
  39617. };
  39618. this.socket.onclose = function (closeEvent) {
  39619. _this.onClose(closeEvent);
  39620. };
  39621. this.socket.onmessage = function (message) {
  39622. _this.onMessage(message);
  39623. };
  39624. if (this.supportsPing()) {
  39625. this.socket.onactivity = function () { _this.onActivity(); };
  39626. }
  39627. };
  39628. TransportConnection.prototype.unbindListeners = function () {
  39629. if (this.socket) {
  39630. this.socket.onopen = undefined;
  39631. this.socket.onerror = undefined;
  39632. this.socket.onclose = undefined;
  39633. this.socket.onmessage = undefined;
  39634. if (this.supportsPing()) {
  39635. this.socket.onactivity = undefined;
  39636. }
  39637. }
  39638. };
  39639. TransportConnection.prototype.changeState = function (state, params) {
  39640. this.state = state;
  39641. this.timeline.info(this.buildTimelineMessage({
  39642. state: state,
  39643. params: params
  39644. }));
  39645. this.emit(state, params);
  39646. };
  39647. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39648. return extend({ cid: this.id }, message);
  39649. };
  39650. return TransportConnection;
  39651. }(dispatcher));
  39652. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39653. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39654. var transport_Transport = (function () {
  39655. function Transport(hooks) {
  39656. this.hooks = hooks;
  39657. }
  39658. Transport.prototype.isSupported = function (environment) {
  39659. return this.hooks.isSupported(environment);
  39660. };
  39661. Transport.prototype.createConnection = function (name, priority, key, options) {
  39662. return new transport_connection(this.hooks, name, priority, key, options);
  39663. };
  39664. return Transport;
  39665. }());
  39666. /* harmony default export */ var transports_transport = (transport_Transport);
  39667. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39668. var WSTransport = new transports_transport({
  39669. urls: ws,
  39670. handlesActivityChecks: false,
  39671. supportsPing: false,
  39672. isInitialized: function () {
  39673. return Boolean(runtime.getWebSocketAPI());
  39674. },
  39675. isSupported: function () {
  39676. return Boolean(runtime.getWebSocketAPI());
  39677. },
  39678. getSocket: function (url) {
  39679. return runtime.createWebSocket(url);
  39680. }
  39681. });
  39682. var httpConfiguration = {
  39683. urls: http,
  39684. handlesActivityChecks: false,
  39685. supportsPing: true,
  39686. isInitialized: function () {
  39687. return true;
  39688. }
  39689. };
  39690. var streamingConfiguration = extend({ getSocket: function (url) {
  39691. return runtime.HTTPFactory.createStreamingSocket(url);
  39692. }
  39693. }, httpConfiguration);
  39694. var pollingConfiguration = extend({ getSocket: function (url) {
  39695. return runtime.HTTPFactory.createPollingSocket(url);
  39696. }
  39697. }, httpConfiguration);
  39698. var xhrConfiguration = {
  39699. isSupported: function () {
  39700. return runtime.isXHRSupported();
  39701. }
  39702. };
  39703. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39704. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39705. var Transports = {
  39706. ws: WSTransport,
  39707. xhr_streaming: XHRStreamingTransport,
  39708. xhr_polling: XHRPollingTransport
  39709. };
  39710. /* harmony default export */ var transports = (Transports);
  39711. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39712. var SockJSTransport = new transports_transport({
  39713. file: "sockjs",
  39714. urls: sockjs,
  39715. handlesActivityChecks: true,
  39716. supportsPing: false,
  39717. isSupported: function () {
  39718. return true;
  39719. },
  39720. isInitialized: function () {
  39721. return window.SockJS !== undefined;
  39722. },
  39723. getSocket: function (url, options) {
  39724. return new window.SockJS(url, null, {
  39725. js_path: Dependencies.getPath("sockjs", {
  39726. useTLS: options.useTLS
  39727. }),
  39728. ignore_null_origin: options.ignoreNullOrigin
  39729. });
  39730. },
  39731. beforeOpen: function (socket, path) {
  39732. socket.send(JSON.stringify({
  39733. path: path
  39734. }));
  39735. }
  39736. });
  39737. var xdrConfiguration = {
  39738. isSupported: function (environment) {
  39739. var yes = runtime.isXDRSupported(environment.useTLS);
  39740. return yes;
  39741. }
  39742. };
  39743. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39744. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39745. transports.xdr_streaming = XDRStreamingTransport;
  39746. transports.xdr_polling = XDRPollingTransport;
  39747. transports.sockjs = SockJSTransport;
  39748. /* harmony default export */ var transports_transports = (transports);
  39749. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39750. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39751. var extendStatics = function (d, b) {
  39752. extendStatics = Object.setPrototypeOf ||
  39753. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39754. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39755. return extendStatics(d, b);
  39756. };
  39757. return function (d, b) {
  39758. extendStatics(d, b);
  39759. function __() { this.constructor = d; }
  39760. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39761. };
  39762. })();
  39763. var NetInfo = (function (_super) {
  39764. net_info_extends(NetInfo, _super);
  39765. function NetInfo() {
  39766. var _this = _super.call(this) || this;
  39767. var self = _this;
  39768. if (window.addEventListener !== undefined) {
  39769. window.addEventListener("online", function () {
  39770. self.emit('online');
  39771. }, false);
  39772. window.addEventListener("offline", function () {
  39773. self.emit('offline');
  39774. }, false);
  39775. }
  39776. return _this;
  39777. }
  39778. NetInfo.prototype.isOnline = function () {
  39779. if (window.navigator.onLine === undefined) {
  39780. return true;
  39781. }
  39782. else {
  39783. return window.navigator.onLine;
  39784. }
  39785. };
  39786. return NetInfo;
  39787. }(dispatcher));
  39788. var net_info_Network = new NetInfo();
  39789. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39790. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39791. function AssistantToTheTransportManager(manager, transport, options) {
  39792. this.manager = manager;
  39793. this.transport = transport;
  39794. this.minPingDelay = options.minPingDelay;
  39795. this.maxPingDelay = options.maxPingDelay;
  39796. this.pingDelay = undefined;
  39797. }
  39798. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39799. var _this = this;
  39800. options = extend({}, options, {
  39801. activityTimeout: this.pingDelay
  39802. });
  39803. var connection = this.transport.createConnection(name, priority, key, options);
  39804. var openTimestamp = null;
  39805. var onOpen = function () {
  39806. connection.unbind("open", onOpen);
  39807. connection.bind("closed", onClosed);
  39808. openTimestamp = util.now();
  39809. };
  39810. var onClosed = function (closeEvent) {
  39811. connection.unbind("closed", onClosed);
  39812. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39813. _this.manager.reportDeath();
  39814. }
  39815. else if (!closeEvent.wasClean && openTimestamp) {
  39816. var lifespan = util.now() - openTimestamp;
  39817. if (lifespan < 2 * _this.maxPingDelay) {
  39818. _this.manager.reportDeath();
  39819. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39820. }
  39821. }
  39822. };
  39823. connection.bind("open", onOpen);
  39824. return connection;
  39825. };
  39826. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39827. return this.manager.isAlive() && this.transport.isSupported(environment);
  39828. };
  39829. return AssistantToTheTransportManager;
  39830. }());
  39831. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39832. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39833. var Protocol = {
  39834. decodeMessage: function (messageEvent) {
  39835. try {
  39836. var messageData = JSON.parse(messageEvent.data);
  39837. var pusherEventData = messageData.data;
  39838. if (typeof pusherEventData === 'string') {
  39839. try {
  39840. pusherEventData = JSON.parse(messageData.data);
  39841. }
  39842. catch (e) { }
  39843. }
  39844. var pusherEvent = {
  39845. event: messageData.event,
  39846. channel: messageData.channel,
  39847. data: pusherEventData,
  39848. };
  39849. if (messageData.user_id) {
  39850. pusherEvent.user_id = messageData.user_id;
  39851. }
  39852. return pusherEvent;
  39853. }
  39854. catch (e) {
  39855. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39856. }
  39857. },
  39858. encodeMessage: function (event) {
  39859. return JSON.stringify(event);
  39860. },
  39861. processHandshake: function (messageEvent) {
  39862. var message = Protocol.decodeMessage(messageEvent);
  39863. if (message.event === "pusher:connection_established") {
  39864. if (!message.data.activity_timeout) {
  39865. throw "No activity timeout specified in handshake";
  39866. }
  39867. return {
  39868. action: "connected",
  39869. id: message.data.socket_id,
  39870. activityTimeout: message.data.activity_timeout * 1000
  39871. };
  39872. }
  39873. else if (message.event === "pusher:error") {
  39874. return {
  39875. action: this.getCloseAction(message.data),
  39876. error: this.getCloseError(message.data)
  39877. };
  39878. }
  39879. else {
  39880. throw "Invalid handshake";
  39881. }
  39882. },
  39883. getCloseAction: function (closeEvent) {
  39884. if (closeEvent.code < 4000) {
  39885. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39886. return "backoff";
  39887. }
  39888. else {
  39889. return null;
  39890. }
  39891. }
  39892. else if (closeEvent.code === 4000) {
  39893. return "tls_only";
  39894. }
  39895. else if (closeEvent.code < 4100) {
  39896. return "refused";
  39897. }
  39898. else if (closeEvent.code < 4200) {
  39899. return "backoff";
  39900. }
  39901. else if (closeEvent.code < 4300) {
  39902. return "retry";
  39903. }
  39904. else {
  39905. return "refused";
  39906. }
  39907. },
  39908. getCloseError: function (closeEvent) {
  39909. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39910. return {
  39911. type: 'PusherError',
  39912. data: {
  39913. code: closeEvent.code,
  39914. message: closeEvent.reason || closeEvent.message
  39915. }
  39916. };
  39917. }
  39918. else {
  39919. return null;
  39920. }
  39921. }
  39922. };
  39923. /* harmony default export */ var protocol_protocol = (Protocol);
  39924. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39925. var connection_extends = (undefined && undefined.__extends) || (function () {
  39926. var extendStatics = function (d, b) {
  39927. extendStatics = Object.setPrototypeOf ||
  39928. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39929. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39930. return extendStatics(d, b);
  39931. };
  39932. return function (d, b) {
  39933. extendStatics(d, b);
  39934. function __() { this.constructor = d; }
  39935. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39936. };
  39937. })();
  39938. var connection_Connection = (function (_super) {
  39939. connection_extends(Connection, _super);
  39940. function Connection(id, transport) {
  39941. var _this = _super.call(this) || this;
  39942. _this.id = id;
  39943. _this.transport = transport;
  39944. _this.activityTimeout = transport.activityTimeout;
  39945. _this.bindListeners();
  39946. return _this;
  39947. }
  39948. Connection.prototype.handlesActivityChecks = function () {
  39949. return this.transport.handlesActivityChecks();
  39950. };
  39951. Connection.prototype.send = function (data) {
  39952. return this.transport.send(data);
  39953. };
  39954. Connection.prototype.send_event = function (name, data, channel) {
  39955. var event = { event: name, data: data };
  39956. if (channel) {
  39957. event.channel = channel;
  39958. }
  39959. logger.debug('Event sent', event);
  39960. return this.send(protocol_protocol.encodeMessage(event));
  39961. };
  39962. Connection.prototype.ping = function () {
  39963. if (this.transport.supportsPing()) {
  39964. this.transport.ping();
  39965. }
  39966. else {
  39967. this.send_event('pusher:ping', {});
  39968. }
  39969. };
  39970. Connection.prototype.close = function () {
  39971. this.transport.close();
  39972. };
  39973. Connection.prototype.bindListeners = function () {
  39974. var _this = this;
  39975. var listeners = {
  39976. message: function (messageEvent) {
  39977. var pusherEvent;
  39978. try {
  39979. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  39980. }
  39981. catch (e) {
  39982. _this.emit('error', {
  39983. type: 'MessageParseError',
  39984. error: e,
  39985. data: messageEvent.data
  39986. });
  39987. }
  39988. if (pusherEvent !== undefined) {
  39989. logger.debug('Event recd', pusherEvent);
  39990. switch (pusherEvent.event) {
  39991. case 'pusher:error':
  39992. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  39993. break;
  39994. case 'pusher:ping':
  39995. _this.emit("ping");
  39996. break;
  39997. case 'pusher:pong':
  39998. _this.emit("pong");
  39999. break;
  40000. }
  40001. _this.emit('message', pusherEvent);
  40002. }
  40003. },
  40004. activity: function () {
  40005. _this.emit("activity");
  40006. },
  40007. error: function (error) {
  40008. _this.emit("error", { type: "WebSocketError", error: error });
  40009. },
  40010. closed: function (closeEvent) {
  40011. unbindListeners();
  40012. if (closeEvent && closeEvent.code) {
  40013. _this.handleCloseEvent(closeEvent);
  40014. }
  40015. _this.transport = null;
  40016. _this.emit("closed");
  40017. }
  40018. };
  40019. var unbindListeners = function () {
  40020. objectApply(listeners, function (listener, event) {
  40021. _this.transport.unbind(event, listener);
  40022. });
  40023. };
  40024. objectApply(listeners, function (listener, event) {
  40025. _this.transport.bind(event, listener);
  40026. });
  40027. };
  40028. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40029. var action = protocol_protocol.getCloseAction(closeEvent);
  40030. var error = protocol_protocol.getCloseError(closeEvent);
  40031. if (error) {
  40032. this.emit('error', error);
  40033. }
  40034. if (action) {
  40035. this.emit(action, { action: action, error: error });
  40036. }
  40037. };
  40038. return Connection;
  40039. }(dispatcher));
  40040. /* harmony default export */ var connection_connection = (connection_Connection);
  40041. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40042. var handshake_Handshake = (function () {
  40043. function Handshake(transport, callback) {
  40044. this.transport = transport;
  40045. this.callback = callback;
  40046. this.bindListeners();
  40047. }
  40048. Handshake.prototype.close = function () {
  40049. this.unbindListeners();
  40050. this.transport.close();
  40051. };
  40052. Handshake.prototype.bindListeners = function () {
  40053. var _this = this;
  40054. this.onMessage = function (m) {
  40055. _this.unbindListeners();
  40056. var result;
  40057. try {
  40058. result = protocol_protocol.processHandshake(m);
  40059. }
  40060. catch (e) {
  40061. _this.finish("error", { error: e });
  40062. _this.transport.close();
  40063. return;
  40064. }
  40065. if (result.action === "connected") {
  40066. _this.finish("connected", {
  40067. connection: new connection_connection(result.id, _this.transport),
  40068. activityTimeout: result.activityTimeout
  40069. });
  40070. }
  40071. else {
  40072. _this.finish(result.action, { error: result.error });
  40073. _this.transport.close();
  40074. }
  40075. };
  40076. this.onClosed = function (closeEvent) {
  40077. _this.unbindListeners();
  40078. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40079. var error = protocol_protocol.getCloseError(closeEvent);
  40080. _this.finish(action, { error: error });
  40081. };
  40082. this.transport.bind("message", this.onMessage);
  40083. this.transport.bind("closed", this.onClosed);
  40084. };
  40085. Handshake.prototype.unbindListeners = function () {
  40086. this.transport.unbind("message", this.onMessage);
  40087. this.transport.unbind("closed", this.onClosed);
  40088. };
  40089. Handshake.prototype.finish = function (action, params) {
  40090. this.callback(extend({ transport: this.transport, action: action }, params));
  40091. };
  40092. return Handshake;
  40093. }());
  40094. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40095. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40096. var pusher_authorizer_PusherAuthorizer = (function () {
  40097. function PusherAuthorizer(channel, options) {
  40098. this.channel = channel;
  40099. var authTransport = options.authTransport;
  40100. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40101. throw "'" + authTransport + "' is not a recognized auth transport";
  40102. }
  40103. this.type = authTransport;
  40104. this.options = options;
  40105. this.authOptions = (options || {}).auth || {};
  40106. }
  40107. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40108. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40109. '&channel_name=' + encodeURIComponent(this.channel.name);
  40110. for (var i in this.authOptions.params) {
  40111. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40112. }
  40113. return query;
  40114. };
  40115. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40116. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40117. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40118. };
  40119. return PusherAuthorizer;
  40120. }());
  40121. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40122. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40123. var timeline_sender_TimelineSender = (function () {
  40124. function TimelineSender(timeline, options) {
  40125. this.timeline = timeline;
  40126. this.options = options || {};
  40127. }
  40128. TimelineSender.prototype.send = function (useTLS, callback) {
  40129. if (this.timeline.isEmpty()) {
  40130. return;
  40131. }
  40132. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40133. };
  40134. return TimelineSender;
  40135. }());
  40136. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40137. // CONCATENATED MODULE: ./src/core/errors.ts
  40138. var errors_extends = (undefined && undefined.__extends) || (function () {
  40139. var extendStatics = function (d, b) {
  40140. extendStatics = Object.setPrototypeOf ||
  40141. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40142. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40143. return extendStatics(d, b);
  40144. };
  40145. return function (d, b) {
  40146. extendStatics(d, b);
  40147. function __() { this.constructor = d; }
  40148. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40149. };
  40150. })();
  40151. var BadEventName = (function (_super) {
  40152. errors_extends(BadEventName, _super);
  40153. function BadEventName(msg) {
  40154. var _newTarget = this.constructor;
  40155. var _this = _super.call(this, msg) || this;
  40156. Object.setPrototypeOf(_this, _newTarget.prototype);
  40157. return _this;
  40158. }
  40159. return BadEventName;
  40160. }(Error));
  40161. var RequestTimedOut = (function (_super) {
  40162. errors_extends(RequestTimedOut, _super);
  40163. function RequestTimedOut(msg) {
  40164. var _newTarget = this.constructor;
  40165. var _this = _super.call(this, msg) || this;
  40166. Object.setPrototypeOf(_this, _newTarget.prototype);
  40167. return _this;
  40168. }
  40169. return RequestTimedOut;
  40170. }(Error));
  40171. var TransportPriorityTooLow = (function (_super) {
  40172. errors_extends(TransportPriorityTooLow, _super);
  40173. function TransportPriorityTooLow(msg) {
  40174. var _newTarget = this.constructor;
  40175. var _this = _super.call(this, msg) || this;
  40176. Object.setPrototypeOf(_this, _newTarget.prototype);
  40177. return _this;
  40178. }
  40179. return TransportPriorityTooLow;
  40180. }(Error));
  40181. var TransportClosed = (function (_super) {
  40182. errors_extends(TransportClosed, _super);
  40183. function TransportClosed(msg) {
  40184. var _newTarget = this.constructor;
  40185. var _this = _super.call(this, msg) || this;
  40186. Object.setPrototypeOf(_this, _newTarget.prototype);
  40187. return _this;
  40188. }
  40189. return TransportClosed;
  40190. }(Error));
  40191. var UnsupportedFeature = (function (_super) {
  40192. errors_extends(UnsupportedFeature, _super);
  40193. function UnsupportedFeature(msg) {
  40194. var _newTarget = this.constructor;
  40195. var _this = _super.call(this, msg) || this;
  40196. Object.setPrototypeOf(_this, _newTarget.prototype);
  40197. return _this;
  40198. }
  40199. return UnsupportedFeature;
  40200. }(Error));
  40201. var UnsupportedTransport = (function (_super) {
  40202. errors_extends(UnsupportedTransport, _super);
  40203. function UnsupportedTransport(msg) {
  40204. var _newTarget = this.constructor;
  40205. var _this = _super.call(this, msg) || this;
  40206. Object.setPrototypeOf(_this, _newTarget.prototype);
  40207. return _this;
  40208. }
  40209. return UnsupportedTransport;
  40210. }(Error));
  40211. var UnsupportedStrategy = (function (_super) {
  40212. errors_extends(UnsupportedStrategy, _super);
  40213. function UnsupportedStrategy(msg) {
  40214. var _newTarget = this.constructor;
  40215. var _this = _super.call(this, msg) || this;
  40216. Object.setPrototypeOf(_this, _newTarget.prototype);
  40217. return _this;
  40218. }
  40219. return UnsupportedStrategy;
  40220. }(Error));
  40221. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40222. var channel_extends = (undefined && undefined.__extends) || (function () {
  40223. var extendStatics = function (d, b) {
  40224. extendStatics = Object.setPrototypeOf ||
  40225. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40226. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40227. return extendStatics(d, b);
  40228. };
  40229. return function (d, b) {
  40230. extendStatics(d, b);
  40231. function __() { this.constructor = d; }
  40232. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40233. };
  40234. })();
  40235. var channel_Channel = (function (_super) {
  40236. channel_extends(Channel, _super);
  40237. function Channel(name, pusher) {
  40238. var _this = _super.call(this, function (event, data) {
  40239. logger.debug('No callbacks on ' + name + ' for ' + event);
  40240. }) || this;
  40241. _this.name = name;
  40242. _this.pusher = pusher;
  40243. _this.subscribed = false;
  40244. _this.subscriptionPending = false;
  40245. _this.subscriptionCancelled = false;
  40246. return _this;
  40247. }
  40248. Channel.prototype.authorize = function (socketId, callback) {
  40249. return callback(false, {});
  40250. };
  40251. Channel.prototype.trigger = function (event, data) {
  40252. if (event.indexOf("client-") !== 0) {
  40253. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40254. }
  40255. if (!this.subscribed) {
  40256. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40257. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40258. }
  40259. return this.pusher.send_event(event, data, this.name);
  40260. };
  40261. Channel.prototype.disconnect = function () {
  40262. this.subscribed = false;
  40263. this.subscriptionPending = false;
  40264. };
  40265. Channel.prototype.handleEvent = function (event) {
  40266. var eventName = event.event;
  40267. var data = event.data;
  40268. if (eventName === "pusher_internal:subscription_succeeded") {
  40269. this.handleSubscriptionSucceededEvent(event);
  40270. }
  40271. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40272. var metadata = {};
  40273. this.emit(eventName, data, metadata);
  40274. }
  40275. };
  40276. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40277. this.subscriptionPending = false;
  40278. this.subscribed = true;
  40279. if (this.subscriptionCancelled) {
  40280. this.pusher.unsubscribe(this.name);
  40281. }
  40282. else {
  40283. this.emit("pusher:subscription_succeeded", event.data);
  40284. }
  40285. };
  40286. Channel.prototype.subscribe = function () {
  40287. var _this = this;
  40288. if (this.subscribed) {
  40289. return;
  40290. }
  40291. this.subscriptionPending = true;
  40292. this.subscriptionCancelled = false;
  40293. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40294. if (error) {
  40295. logger.error(data);
  40296. _this.emit('pusher:subscription_error', data);
  40297. }
  40298. else {
  40299. _this.pusher.send_event('pusher:subscribe', {
  40300. auth: data.auth,
  40301. channel_data: data.channel_data,
  40302. channel: _this.name
  40303. });
  40304. }
  40305. });
  40306. };
  40307. Channel.prototype.unsubscribe = function () {
  40308. this.subscribed = false;
  40309. this.pusher.send_event('pusher:unsubscribe', {
  40310. channel: this.name
  40311. });
  40312. };
  40313. Channel.prototype.cancelSubscription = function () {
  40314. this.subscriptionCancelled = true;
  40315. };
  40316. Channel.prototype.reinstateSubscription = function () {
  40317. this.subscriptionCancelled = false;
  40318. };
  40319. return Channel;
  40320. }(dispatcher));
  40321. /* harmony default export */ var channels_channel = (channel_Channel);
  40322. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40323. var private_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 private_channel_PrivateChannel = (function (_super) {
  40337. private_channel_extends(PrivateChannel, _super);
  40338. function PrivateChannel() {
  40339. return _super !== null && _super.apply(this, arguments) || this;
  40340. }
  40341. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40342. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40343. return authorizer.authorize(socketId, callback);
  40344. };
  40345. return PrivateChannel;
  40346. }(channels_channel));
  40347. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40348. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40349. var members_Members = (function () {
  40350. function Members() {
  40351. this.reset();
  40352. }
  40353. Members.prototype.get = function (id) {
  40354. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40355. return {
  40356. id: id,
  40357. info: this.members[id]
  40358. };
  40359. }
  40360. else {
  40361. return null;
  40362. }
  40363. };
  40364. Members.prototype.each = function (callback) {
  40365. var _this = this;
  40366. objectApply(this.members, function (member, id) {
  40367. callback(_this.get(id));
  40368. });
  40369. };
  40370. Members.prototype.setMyID = function (id) {
  40371. this.myID = id;
  40372. };
  40373. Members.prototype.onSubscription = function (subscriptionData) {
  40374. this.members = subscriptionData.presence.hash;
  40375. this.count = subscriptionData.presence.count;
  40376. this.me = this.get(this.myID);
  40377. };
  40378. Members.prototype.addMember = function (memberData) {
  40379. if (this.get(memberData.user_id) === null) {
  40380. this.count++;
  40381. }
  40382. this.members[memberData.user_id] = memberData.user_info;
  40383. return this.get(memberData.user_id);
  40384. };
  40385. Members.prototype.removeMember = function (memberData) {
  40386. var member = this.get(memberData.user_id);
  40387. if (member) {
  40388. delete this.members[memberData.user_id];
  40389. this.count--;
  40390. }
  40391. return member;
  40392. };
  40393. Members.prototype.reset = function () {
  40394. this.members = {};
  40395. this.count = 0;
  40396. this.myID = null;
  40397. this.me = null;
  40398. };
  40399. return Members;
  40400. }());
  40401. /* harmony default export */ var members = (members_Members);
  40402. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40403. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40404. var extendStatics = function (d, b) {
  40405. extendStatics = Object.setPrototypeOf ||
  40406. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40407. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40408. return extendStatics(d, b);
  40409. };
  40410. return function (d, b) {
  40411. extendStatics(d, b);
  40412. function __() { this.constructor = d; }
  40413. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40414. };
  40415. })();
  40416. var presence_channel_PresenceChannel = (function (_super) {
  40417. presence_channel_extends(PresenceChannel, _super);
  40418. function PresenceChannel(name, pusher) {
  40419. var _this = _super.call(this, name, pusher) || this;
  40420. _this.members = new members();
  40421. return _this;
  40422. }
  40423. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40424. var _this = this;
  40425. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40426. if (!error) {
  40427. if (authData.channel_data === undefined) {
  40428. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40429. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40430. ("expected 'channel_data' field. " + suffix));
  40431. callback("Invalid auth response");
  40432. return;
  40433. }
  40434. var channelData = JSON.parse(authData.channel_data);
  40435. _this.members.setMyID(channelData.user_id);
  40436. }
  40437. callback(error, authData);
  40438. });
  40439. };
  40440. PresenceChannel.prototype.handleEvent = function (event) {
  40441. var eventName = event.event;
  40442. if (eventName.indexOf("pusher_internal:") === 0) {
  40443. this.handleInternalEvent(event);
  40444. }
  40445. else {
  40446. var data = event.data;
  40447. var metadata = {};
  40448. if (event.user_id) {
  40449. metadata.user_id = event.user_id;
  40450. }
  40451. this.emit(eventName, data, metadata);
  40452. }
  40453. };
  40454. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40455. var eventName = event.event;
  40456. var data = event.data;
  40457. switch (eventName) {
  40458. case "pusher_internal:subscription_succeeded":
  40459. this.handleSubscriptionSucceededEvent(event);
  40460. break;
  40461. case "pusher_internal:member_added":
  40462. var addedMember = this.members.addMember(data);
  40463. this.emit('pusher:member_added', addedMember);
  40464. break;
  40465. case "pusher_internal:member_removed":
  40466. var removedMember = this.members.removeMember(data);
  40467. if (removedMember) {
  40468. this.emit('pusher:member_removed', removedMember);
  40469. }
  40470. break;
  40471. }
  40472. };
  40473. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40474. this.subscriptionPending = false;
  40475. this.subscribed = true;
  40476. if (this.subscriptionCancelled) {
  40477. this.pusher.unsubscribe(this.name);
  40478. }
  40479. else {
  40480. this.members.onSubscription(event.data);
  40481. this.emit("pusher:subscription_succeeded", this.members);
  40482. }
  40483. };
  40484. PresenceChannel.prototype.disconnect = function () {
  40485. this.members.reset();
  40486. _super.prototype.disconnect.call(this);
  40487. };
  40488. return PresenceChannel;
  40489. }(private_channel));
  40490. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40491. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40492. var nacl_fast = __webpack_require__(0);
  40493. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40494. var nacl_util = __webpack_require__(1);
  40495. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40496. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40497. var extendStatics = function (d, b) {
  40498. extendStatics = Object.setPrototypeOf ||
  40499. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40500. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40501. return extendStatics(d, b);
  40502. };
  40503. return function (d, b) {
  40504. extendStatics(d, b);
  40505. function __() { this.constructor = d; }
  40506. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40507. };
  40508. })();
  40509. var encrypted_channel_EncryptedChannel = (function (_super) {
  40510. encrypted_channel_extends(EncryptedChannel, _super);
  40511. function EncryptedChannel() {
  40512. var _this = _super !== null && _super.apply(this, arguments) || this;
  40513. _this.key = null;
  40514. return _this;
  40515. }
  40516. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40517. var _this = this;
  40518. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40519. if (error) {
  40520. callback(true, authData);
  40521. return;
  40522. }
  40523. var sharedSecret = authData["shared_secret"];
  40524. if (!sharedSecret) {
  40525. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40526. callback(true, errorMsg);
  40527. return;
  40528. }
  40529. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40530. delete authData["shared_secret"];
  40531. callback(false, authData);
  40532. });
  40533. };
  40534. EncryptedChannel.prototype.trigger = function (event, data) {
  40535. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40536. };
  40537. EncryptedChannel.prototype.handleEvent = function (event) {
  40538. var eventName = event.event;
  40539. var data = event.data;
  40540. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40541. _super.prototype.handleEvent.call(this, event);
  40542. return;
  40543. }
  40544. this.handleEncryptedEvent(eventName, data);
  40545. };
  40546. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40547. var _this = this;
  40548. if (!this.key) {
  40549. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40550. return;
  40551. }
  40552. if (!data.ciphertext || !data.nonce) {
  40553. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40554. return;
  40555. }
  40556. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40557. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40558. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40559. return;
  40560. }
  40561. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40562. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40563. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40564. return;
  40565. }
  40566. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40567. if (bytes === null) {
  40568. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40569. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40570. if (error) {
  40571. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40572. return;
  40573. }
  40574. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40575. if (bytes === null) {
  40576. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40577. return;
  40578. }
  40579. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40580. return;
  40581. });
  40582. return;
  40583. }
  40584. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40585. };
  40586. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40587. try {
  40588. this.emit(eventName, JSON.parse(data));
  40589. }
  40590. catch (e) {
  40591. this.emit(eventName, data);
  40592. }
  40593. return this;
  40594. };
  40595. return EncryptedChannel;
  40596. }(private_channel));
  40597. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40598. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40599. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40600. var extendStatics = function (d, b) {
  40601. extendStatics = Object.setPrototypeOf ||
  40602. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40603. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40604. return extendStatics(d, b);
  40605. };
  40606. return function (d, b) {
  40607. extendStatics(d, b);
  40608. function __() { this.constructor = d; }
  40609. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40610. };
  40611. })();
  40612. var connection_manager_ConnectionManager = (function (_super) {
  40613. connection_manager_extends(ConnectionManager, _super);
  40614. function ConnectionManager(key, options) {
  40615. var _this = _super.call(this) || this;
  40616. _this.key = key;
  40617. _this.options = options || {};
  40618. _this.state = "initialized";
  40619. _this.connection = null;
  40620. _this.usingTLS = !!options.useTLS;
  40621. _this.timeline = _this.options.timeline;
  40622. _this.errorCallbacks = _this.buildErrorCallbacks();
  40623. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40624. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40625. var Network = runtime.getNetwork();
  40626. Network.bind("online", function () {
  40627. _this.timeline.info({ netinfo: "online" });
  40628. if (_this.state === "connecting" || _this.state === "unavailable") {
  40629. _this.retryIn(0);
  40630. }
  40631. });
  40632. Network.bind("offline", function () {
  40633. _this.timeline.info({ netinfo: "offline" });
  40634. if (_this.connection) {
  40635. _this.sendActivityCheck();
  40636. }
  40637. });
  40638. _this.updateStrategy();
  40639. return _this;
  40640. }
  40641. ConnectionManager.prototype.connect = function () {
  40642. if (this.connection || this.runner) {
  40643. return;
  40644. }
  40645. if (!this.strategy.isSupported()) {
  40646. this.updateState("failed");
  40647. return;
  40648. }
  40649. this.updateState("connecting");
  40650. this.startConnecting();
  40651. this.setUnavailableTimer();
  40652. };
  40653. ;
  40654. ConnectionManager.prototype.send = function (data) {
  40655. if (this.connection) {
  40656. return this.connection.send(data);
  40657. }
  40658. else {
  40659. return false;
  40660. }
  40661. };
  40662. ;
  40663. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40664. if (this.connection) {
  40665. return this.connection.send_event(name, data, channel);
  40666. }
  40667. else {
  40668. return false;
  40669. }
  40670. };
  40671. ;
  40672. ConnectionManager.prototype.disconnect = function () {
  40673. this.disconnectInternally();
  40674. this.updateState("disconnected");
  40675. };
  40676. ;
  40677. ConnectionManager.prototype.isUsingTLS = function () {
  40678. return this.usingTLS;
  40679. };
  40680. ;
  40681. ConnectionManager.prototype.startConnecting = function () {
  40682. var _this = this;
  40683. var callback = function (error, handshake) {
  40684. if (error) {
  40685. _this.runner = _this.strategy.connect(0, callback);
  40686. }
  40687. else {
  40688. if (handshake.action === "error") {
  40689. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40690. _this.timeline.error({ handshakeError: handshake.error });
  40691. }
  40692. else {
  40693. _this.abortConnecting();
  40694. _this.handshakeCallbacks[handshake.action](handshake);
  40695. }
  40696. }
  40697. };
  40698. this.runner = this.strategy.connect(0, callback);
  40699. };
  40700. ;
  40701. ConnectionManager.prototype.abortConnecting = function () {
  40702. if (this.runner) {
  40703. this.runner.abort();
  40704. this.runner = null;
  40705. }
  40706. };
  40707. ;
  40708. ConnectionManager.prototype.disconnectInternally = function () {
  40709. this.abortConnecting();
  40710. this.clearRetryTimer();
  40711. this.clearUnavailableTimer();
  40712. if (this.connection) {
  40713. var connection = this.abandonConnection();
  40714. connection.close();
  40715. }
  40716. };
  40717. ;
  40718. ConnectionManager.prototype.updateStrategy = function () {
  40719. this.strategy = this.options.getStrategy({
  40720. key: this.key,
  40721. timeline: this.timeline,
  40722. useTLS: this.usingTLS
  40723. });
  40724. };
  40725. ;
  40726. ConnectionManager.prototype.retryIn = function (delay) {
  40727. var _this = this;
  40728. this.timeline.info({ action: "retry", delay: delay });
  40729. if (delay > 0) {
  40730. this.emit("connecting_in", Math.round(delay / 1000));
  40731. }
  40732. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40733. _this.disconnectInternally();
  40734. _this.connect();
  40735. });
  40736. };
  40737. ;
  40738. ConnectionManager.prototype.clearRetryTimer = function () {
  40739. if (this.retryTimer) {
  40740. this.retryTimer.ensureAborted();
  40741. this.retryTimer = null;
  40742. }
  40743. };
  40744. ;
  40745. ConnectionManager.prototype.setUnavailableTimer = function () {
  40746. var _this = this;
  40747. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40748. _this.updateState("unavailable");
  40749. });
  40750. };
  40751. ;
  40752. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40753. if (this.unavailableTimer) {
  40754. this.unavailableTimer.ensureAborted();
  40755. }
  40756. };
  40757. ;
  40758. ConnectionManager.prototype.sendActivityCheck = function () {
  40759. var _this = this;
  40760. this.stopActivityCheck();
  40761. this.connection.ping();
  40762. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40763. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40764. _this.retryIn(0);
  40765. });
  40766. };
  40767. ;
  40768. ConnectionManager.prototype.resetActivityCheck = function () {
  40769. var _this = this;
  40770. this.stopActivityCheck();
  40771. if (this.connection && !this.connection.handlesActivityChecks()) {
  40772. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40773. _this.sendActivityCheck();
  40774. });
  40775. }
  40776. };
  40777. ;
  40778. ConnectionManager.prototype.stopActivityCheck = function () {
  40779. if (this.activityTimer) {
  40780. this.activityTimer.ensureAborted();
  40781. }
  40782. };
  40783. ;
  40784. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40785. var _this = this;
  40786. return extend({}, errorCallbacks, {
  40787. message: function (message) {
  40788. _this.resetActivityCheck();
  40789. _this.emit('message', message);
  40790. },
  40791. ping: function () {
  40792. _this.send_event('pusher:pong', {});
  40793. },
  40794. activity: function () {
  40795. _this.resetActivityCheck();
  40796. },
  40797. error: function (error) {
  40798. _this.emit("error", { type: "WebSocketError", error: error });
  40799. },
  40800. closed: function () {
  40801. _this.abandonConnection();
  40802. if (_this.shouldRetry()) {
  40803. _this.retryIn(1000);
  40804. }
  40805. }
  40806. });
  40807. };
  40808. ;
  40809. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40810. var _this = this;
  40811. return extend({}, errorCallbacks, {
  40812. connected: function (handshake) {
  40813. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40814. _this.clearUnavailableTimer();
  40815. _this.setConnection(handshake.connection);
  40816. _this.socket_id = _this.connection.id;
  40817. _this.updateState("connected", { socket_id: _this.socket_id });
  40818. }
  40819. });
  40820. };
  40821. ;
  40822. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40823. var _this = this;
  40824. var withErrorEmitted = function (callback) {
  40825. return function (result) {
  40826. if (result.error) {
  40827. _this.emit("error", { type: "WebSocketError", error: result.error });
  40828. }
  40829. callback(result);
  40830. };
  40831. };
  40832. return {
  40833. tls_only: withErrorEmitted(function () {
  40834. _this.usingTLS = true;
  40835. _this.updateStrategy();
  40836. _this.retryIn(0);
  40837. }),
  40838. refused: withErrorEmitted(function () {
  40839. _this.disconnect();
  40840. }),
  40841. backoff: withErrorEmitted(function () {
  40842. _this.retryIn(1000);
  40843. }),
  40844. retry: withErrorEmitted(function () {
  40845. _this.retryIn(0);
  40846. })
  40847. };
  40848. };
  40849. ;
  40850. ConnectionManager.prototype.setConnection = function (connection) {
  40851. this.connection = connection;
  40852. for (var event in this.connectionCallbacks) {
  40853. this.connection.bind(event, this.connectionCallbacks[event]);
  40854. }
  40855. this.resetActivityCheck();
  40856. };
  40857. ;
  40858. ConnectionManager.prototype.abandonConnection = function () {
  40859. if (!this.connection) {
  40860. return;
  40861. }
  40862. this.stopActivityCheck();
  40863. for (var event in this.connectionCallbacks) {
  40864. this.connection.unbind(event, this.connectionCallbacks[event]);
  40865. }
  40866. var connection = this.connection;
  40867. this.connection = null;
  40868. return connection;
  40869. };
  40870. ConnectionManager.prototype.updateState = function (newState, data) {
  40871. var previousState = this.state;
  40872. this.state = newState;
  40873. if (previousState !== newState) {
  40874. var newStateDescription = newState;
  40875. if (newStateDescription === "connected") {
  40876. newStateDescription += " with new socket ID " + data.socket_id;
  40877. }
  40878. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40879. this.timeline.info({ state: newState, params: data });
  40880. this.emit('state_change', { previous: previousState, current: newState });
  40881. this.emit(newState, data);
  40882. }
  40883. };
  40884. ConnectionManager.prototype.shouldRetry = function () {
  40885. return this.state === "connecting" || this.state === "connected";
  40886. };
  40887. return ConnectionManager;
  40888. }(dispatcher));
  40889. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40890. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40891. var channels_Channels = (function () {
  40892. function Channels() {
  40893. this.channels = {};
  40894. }
  40895. Channels.prototype.add = function (name, pusher) {
  40896. if (!this.channels[name]) {
  40897. this.channels[name] = createChannel(name, pusher);
  40898. }
  40899. return this.channels[name];
  40900. };
  40901. Channels.prototype.all = function () {
  40902. return values(this.channels);
  40903. };
  40904. Channels.prototype.find = function (name) {
  40905. return this.channels[name];
  40906. };
  40907. Channels.prototype.remove = function (name) {
  40908. var channel = this.channels[name];
  40909. delete this.channels[name];
  40910. return channel;
  40911. };
  40912. Channels.prototype.disconnect = function () {
  40913. objectApply(this.channels, function (channel) {
  40914. channel.disconnect();
  40915. });
  40916. };
  40917. return Channels;
  40918. }());
  40919. /* harmony default export */ var channels = (channels_Channels);
  40920. function createChannel(name, pusher) {
  40921. if (name.indexOf('private-encrypted-') === 0) {
  40922. if (false) { var errorMsg; }
  40923. return factory.createEncryptedChannel(name, pusher);
  40924. }
  40925. else if (name.indexOf('private-') === 0) {
  40926. return factory.createPrivateChannel(name, pusher);
  40927. }
  40928. else if (name.indexOf('presence-') === 0) {
  40929. return factory.createPresenceChannel(name, pusher);
  40930. }
  40931. else {
  40932. return factory.createChannel(name, pusher);
  40933. }
  40934. }
  40935. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40936. var Factory = {
  40937. createChannels: function () {
  40938. return new channels();
  40939. },
  40940. createConnectionManager: function (key, options) {
  40941. return new connection_manager(key, options);
  40942. },
  40943. createChannel: function (name, pusher) {
  40944. return new channels_channel(name, pusher);
  40945. },
  40946. createPrivateChannel: function (name, pusher) {
  40947. return new private_channel(name, pusher);
  40948. },
  40949. createPresenceChannel: function (name, pusher) {
  40950. return new presence_channel(name, pusher);
  40951. },
  40952. createEncryptedChannel: function (name, pusher) {
  40953. return new encrypted_channel(name, pusher);
  40954. },
  40955. createTimelineSender: function (timeline, options) {
  40956. return new timeline_sender(timeline, options);
  40957. },
  40958. createAuthorizer: function (channel, options) {
  40959. if (options.authorizer) {
  40960. return options.authorizer(channel, options);
  40961. }
  40962. return new pusher_authorizer(channel, options);
  40963. },
  40964. createHandshake: function (transport, callback) {
  40965. return new connection_handshake(transport, callback);
  40966. },
  40967. createAssistantToTheTransportManager: function (manager, transport, options) {
  40968. return new assistant_to_the_transport_manager(manager, transport, options);
  40969. }
  40970. };
  40971. /* harmony default export */ var factory = (Factory);
  40972. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  40973. var transport_manager_TransportManager = (function () {
  40974. function TransportManager(options) {
  40975. this.options = options || {};
  40976. this.livesLeft = this.options.lives || Infinity;
  40977. }
  40978. TransportManager.prototype.getAssistant = function (transport) {
  40979. return factory.createAssistantToTheTransportManager(this, transport, {
  40980. minPingDelay: this.options.minPingDelay,
  40981. maxPingDelay: this.options.maxPingDelay
  40982. });
  40983. };
  40984. TransportManager.prototype.isAlive = function () {
  40985. return this.livesLeft > 0;
  40986. };
  40987. TransportManager.prototype.reportDeath = function () {
  40988. this.livesLeft -= 1;
  40989. };
  40990. return TransportManager;
  40991. }());
  40992. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  40993. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  40994. var sequential_strategy_SequentialStrategy = (function () {
  40995. function SequentialStrategy(strategies, options) {
  40996. this.strategies = strategies;
  40997. this.loop = Boolean(options.loop);
  40998. this.failFast = Boolean(options.failFast);
  40999. this.timeout = options.timeout;
  41000. this.timeoutLimit = options.timeoutLimit;
  41001. }
  41002. SequentialStrategy.prototype.isSupported = function () {
  41003. return any(this.strategies, util.method("isSupported"));
  41004. };
  41005. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41006. var _this = this;
  41007. var strategies = this.strategies;
  41008. var current = 0;
  41009. var timeout = this.timeout;
  41010. var runner = null;
  41011. var tryNextStrategy = function (error, handshake) {
  41012. if (handshake) {
  41013. callback(null, handshake);
  41014. }
  41015. else {
  41016. current = current + 1;
  41017. if (_this.loop) {
  41018. current = current % strategies.length;
  41019. }
  41020. if (current < strategies.length) {
  41021. if (timeout) {
  41022. timeout = timeout * 2;
  41023. if (_this.timeoutLimit) {
  41024. timeout = Math.min(timeout, _this.timeoutLimit);
  41025. }
  41026. }
  41027. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41028. }
  41029. else {
  41030. callback(true);
  41031. }
  41032. }
  41033. };
  41034. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41035. return {
  41036. abort: function () {
  41037. runner.abort();
  41038. },
  41039. forceMinPriority: function (p) {
  41040. minPriority = p;
  41041. if (runner) {
  41042. runner.forceMinPriority(p);
  41043. }
  41044. }
  41045. };
  41046. };
  41047. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41048. var timer = null;
  41049. var runner = null;
  41050. if (options.timeout > 0) {
  41051. timer = new OneOffTimer(options.timeout, function () {
  41052. runner.abort();
  41053. callback(true);
  41054. });
  41055. }
  41056. runner = strategy.connect(minPriority, function (error, handshake) {
  41057. if (error && timer && timer.isRunning() && !options.failFast) {
  41058. return;
  41059. }
  41060. if (timer) {
  41061. timer.ensureAborted();
  41062. }
  41063. callback(error, handshake);
  41064. });
  41065. return {
  41066. abort: function () {
  41067. if (timer) {
  41068. timer.ensureAborted();
  41069. }
  41070. runner.abort();
  41071. },
  41072. forceMinPriority: function (p) {
  41073. runner.forceMinPriority(p);
  41074. }
  41075. };
  41076. };
  41077. return SequentialStrategy;
  41078. }());
  41079. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41080. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41081. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41082. function BestConnectedEverStrategy(strategies) {
  41083. this.strategies = strategies;
  41084. }
  41085. BestConnectedEverStrategy.prototype.isSupported = function () {
  41086. return any(this.strategies, util.method("isSupported"));
  41087. };
  41088. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41089. return connect(this.strategies, minPriority, function (i, runners) {
  41090. return function (error, handshake) {
  41091. runners[i].error = error;
  41092. if (error) {
  41093. if (allRunnersFailed(runners)) {
  41094. callback(true);
  41095. }
  41096. return;
  41097. }
  41098. apply(runners, function (runner) {
  41099. runner.forceMinPriority(handshake.transport.priority);
  41100. });
  41101. callback(null, handshake);
  41102. };
  41103. });
  41104. };
  41105. return BestConnectedEverStrategy;
  41106. }());
  41107. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41108. function connect(strategies, minPriority, callbackBuilder) {
  41109. var runners = map(strategies, function (strategy, i, _, rs) {
  41110. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41111. });
  41112. return {
  41113. abort: function () {
  41114. apply(runners, abortRunner);
  41115. },
  41116. forceMinPriority: function (p) {
  41117. apply(runners, function (runner) {
  41118. runner.forceMinPriority(p);
  41119. });
  41120. }
  41121. };
  41122. }
  41123. function allRunnersFailed(runners) {
  41124. return collections_all(runners, function (runner) {
  41125. return Boolean(runner.error);
  41126. });
  41127. }
  41128. function abortRunner(runner) {
  41129. if (!runner.error && !runner.aborted) {
  41130. runner.abort();
  41131. runner.aborted = true;
  41132. }
  41133. }
  41134. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41135. var cached_strategy_CachedStrategy = (function () {
  41136. function CachedStrategy(strategy, transports, options) {
  41137. this.strategy = strategy;
  41138. this.transports = transports;
  41139. this.ttl = options.ttl || 1800 * 1000;
  41140. this.usingTLS = options.useTLS;
  41141. this.timeline = options.timeline;
  41142. }
  41143. CachedStrategy.prototype.isSupported = function () {
  41144. return this.strategy.isSupported();
  41145. };
  41146. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41147. var usingTLS = this.usingTLS;
  41148. var info = fetchTransportCache(usingTLS);
  41149. var strategies = [this.strategy];
  41150. if (info && info.timestamp + this.ttl >= util.now()) {
  41151. var transport = this.transports[info.transport];
  41152. if (transport) {
  41153. this.timeline.info({
  41154. cached: true,
  41155. transport: info.transport,
  41156. latency: info.latency
  41157. });
  41158. strategies.push(new sequential_strategy([transport], {
  41159. timeout: info.latency * 2 + 1000,
  41160. failFast: true
  41161. }));
  41162. }
  41163. }
  41164. var startTimestamp = util.now();
  41165. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41166. if (error) {
  41167. flushTransportCache(usingTLS);
  41168. if (strategies.length > 0) {
  41169. startTimestamp = util.now();
  41170. runner = strategies.pop().connect(minPriority, cb);
  41171. }
  41172. else {
  41173. callback(error);
  41174. }
  41175. }
  41176. else {
  41177. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41178. callback(null, handshake);
  41179. }
  41180. });
  41181. return {
  41182. abort: function () {
  41183. runner.abort();
  41184. },
  41185. forceMinPriority: function (p) {
  41186. minPriority = p;
  41187. if (runner) {
  41188. runner.forceMinPriority(p);
  41189. }
  41190. }
  41191. };
  41192. };
  41193. return CachedStrategy;
  41194. }());
  41195. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41196. function getTransportCacheKey(usingTLS) {
  41197. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41198. }
  41199. function fetchTransportCache(usingTLS) {
  41200. var storage = runtime.getLocalStorage();
  41201. if (storage) {
  41202. try {
  41203. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41204. if (serializedCache) {
  41205. return JSON.parse(serializedCache);
  41206. }
  41207. }
  41208. catch (e) {
  41209. flushTransportCache(usingTLS);
  41210. }
  41211. }
  41212. return null;
  41213. }
  41214. function storeTransportCache(usingTLS, transport, latency) {
  41215. var storage = runtime.getLocalStorage();
  41216. if (storage) {
  41217. try {
  41218. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41219. timestamp: util.now(),
  41220. transport: transport,
  41221. latency: latency
  41222. });
  41223. }
  41224. catch (e) {
  41225. }
  41226. }
  41227. }
  41228. function flushTransportCache(usingTLS) {
  41229. var storage = runtime.getLocalStorage();
  41230. if (storage) {
  41231. try {
  41232. delete storage[getTransportCacheKey(usingTLS)];
  41233. }
  41234. catch (e) {
  41235. }
  41236. }
  41237. }
  41238. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41239. var delayed_strategy_DelayedStrategy = (function () {
  41240. function DelayedStrategy(strategy, _a) {
  41241. var number = _a.delay;
  41242. this.strategy = strategy;
  41243. this.options = { delay: number };
  41244. }
  41245. DelayedStrategy.prototype.isSupported = function () {
  41246. return this.strategy.isSupported();
  41247. };
  41248. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41249. var strategy = this.strategy;
  41250. var runner;
  41251. var timer = new OneOffTimer(this.options.delay, function () {
  41252. runner = strategy.connect(minPriority, callback);
  41253. });
  41254. return {
  41255. abort: function () {
  41256. timer.ensureAborted();
  41257. if (runner) {
  41258. runner.abort();
  41259. }
  41260. },
  41261. forceMinPriority: function (p) {
  41262. minPriority = p;
  41263. if (runner) {
  41264. runner.forceMinPriority(p);
  41265. }
  41266. }
  41267. };
  41268. };
  41269. return DelayedStrategy;
  41270. }());
  41271. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41272. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41273. var IfStrategy = (function () {
  41274. function IfStrategy(test, trueBranch, falseBranch) {
  41275. this.test = test;
  41276. this.trueBranch = trueBranch;
  41277. this.falseBranch = falseBranch;
  41278. }
  41279. IfStrategy.prototype.isSupported = function () {
  41280. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41281. return branch.isSupported();
  41282. };
  41283. IfStrategy.prototype.connect = function (minPriority, callback) {
  41284. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41285. return branch.connect(minPriority, callback);
  41286. };
  41287. return IfStrategy;
  41288. }());
  41289. /* harmony default export */ var if_strategy = (IfStrategy);
  41290. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41291. var FirstConnectedStrategy = (function () {
  41292. function FirstConnectedStrategy(strategy) {
  41293. this.strategy = strategy;
  41294. }
  41295. FirstConnectedStrategy.prototype.isSupported = function () {
  41296. return this.strategy.isSupported();
  41297. };
  41298. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41299. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41300. if (handshake) {
  41301. runner.abort();
  41302. }
  41303. callback(error, handshake);
  41304. });
  41305. return runner;
  41306. };
  41307. return FirstConnectedStrategy;
  41308. }());
  41309. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41310. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41311. function testSupportsStrategy(strategy) {
  41312. return function () {
  41313. return strategy.isSupported();
  41314. };
  41315. }
  41316. var getDefaultStrategy = function (config, defineTransport) {
  41317. var definedTransports = {};
  41318. function defineTransportStrategy(name, type, priority, options, manager) {
  41319. var transport = defineTransport(config, name, type, priority, options, manager);
  41320. definedTransports[name] = transport;
  41321. return transport;
  41322. }
  41323. var ws_options = {
  41324. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41325. hostTLS: config.wsHost + ":" + config.wssPort,
  41326. httpPath: config.wsPath
  41327. };
  41328. var wss_options = extend({}, ws_options, {
  41329. useTLS: true
  41330. });
  41331. var sockjs_options = {
  41332. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41333. hostTLS: config.httpHost + ":" + config.httpsPort,
  41334. httpPath: config.httpPath
  41335. };
  41336. var timeouts = {
  41337. loop: true,
  41338. timeout: 15000,
  41339. timeoutLimit: 60000
  41340. };
  41341. var ws_manager = new transport_manager({
  41342. lives: 2,
  41343. minPingDelay: 10000,
  41344. maxPingDelay: config.activity_timeout
  41345. });
  41346. var streaming_manager = new transport_manager({
  41347. lives: 2,
  41348. minPingDelay: 10000,
  41349. maxPingDelay: config.activity_timeout
  41350. });
  41351. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41352. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41353. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41354. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41355. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41356. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41357. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41358. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41359. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41360. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41361. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41362. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41363. 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);
  41364. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41365. var wsStrategy;
  41366. if (config.useTLS) {
  41367. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41368. }
  41369. else {
  41370. wsStrategy = new best_connected_ever_strategy([
  41371. ws_loop,
  41372. new delayed_strategy(wss_loop, { delay: 2000 }),
  41373. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41374. ]);
  41375. }
  41376. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41377. ttl: 1800000,
  41378. timeline: config.timeline,
  41379. useTLS: config.useTLS
  41380. });
  41381. };
  41382. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41383. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41384. /* harmony default export */ var transport_connection_initializer = (function () {
  41385. var self = this;
  41386. self.timeline.info(self.buildTimelineMessage({
  41387. transport: self.name + (self.options.useTLS ? "s" : "")
  41388. }));
  41389. if (self.hooks.isInitialized()) {
  41390. self.changeState("initialized");
  41391. }
  41392. else if (self.hooks.file) {
  41393. self.changeState("initializing");
  41394. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41395. if (self.hooks.isInitialized()) {
  41396. self.changeState("initialized");
  41397. callback(true);
  41398. }
  41399. else {
  41400. if (error) {
  41401. self.onError(error);
  41402. }
  41403. self.onClose();
  41404. callback(false);
  41405. }
  41406. });
  41407. }
  41408. else {
  41409. self.onClose();
  41410. }
  41411. });
  41412. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41413. var http_xdomain_request_hooks = {
  41414. getRequest: function (socket) {
  41415. var xdr = new window.XDomainRequest();
  41416. xdr.ontimeout = function () {
  41417. socket.emit("error", new RequestTimedOut());
  41418. socket.close();
  41419. };
  41420. xdr.onerror = function (e) {
  41421. socket.emit("error", e);
  41422. socket.close();
  41423. };
  41424. xdr.onprogress = function () {
  41425. if (xdr.responseText && xdr.responseText.length > 0) {
  41426. socket.onChunk(200, xdr.responseText);
  41427. }
  41428. };
  41429. xdr.onload = function () {
  41430. if (xdr.responseText && xdr.responseText.length > 0) {
  41431. socket.onChunk(200, xdr.responseText);
  41432. }
  41433. socket.emit("finished", 200);
  41434. socket.close();
  41435. };
  41436. return xdr;
  41437. },
  41438. abortRequest: function (xdr) {
  41439. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41440. xdr.abort();
  41441. }
  41442. };
  41443. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41444. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41445. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41446. var extendStatics = function (d, b) {
  41447. extendStatics = Object.setPrototypeOf ||
  41448. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41449. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41450. return extendStatics(d, b);
  41451. };
  41452. return function (d, b) {
  41453. extendStatics(d, b);
  41454. function __() { this.constructor = d; }
  41455. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41456. };
  41457. })();
  41458. var MAX_BUFFER_LENGTH = 256 * 1024;
  41459. var http_request_HTTPRequest = (function (_super) {
  41460. http_request_extends(HTTPRequest, _super);
  41461. function HTTPRequest(hooks, method, url) {
  41462. var _this = _super.call(this) || this;
  41463. _this.hooks = hooks;
  41464. _this.method = method;
  41465. _this.url = url;
  41466. return _this;
  41467. }
  41468. HTTPRequest.prototype.start = function (payload) {
  41469. var _this = this;
  41470. this.position = 0;
  41471. this.xhr = this.hooks.getRequest(this);
  41472. this.unloader = function () {
  41473. _this.close();
  41474. };
  41475. runtime.addUnloadListener(this.unloader);
  41476. this.xhr.open(this.method, this.url, true);
  41477. if (this.xhr.setRequestHeader) {
  41478. this.xhr.setRequestHeader("Content-Type", "application/json");
  41479. }
  41480. this.xhr.send(payload);
  41481. };
  41482. HTTPRequest.prototype.close = function () {
  41483. if (this.unloader) {
  41484. runtime.removeUnloadListener(this.unloader);
  41485. this.unloader = null;
  41486. }
  41487. if (this.xhr) {
  41488. this.hooks.abortRequest(this.xhr);
  41489. this.xhr = null;
  41490. }
  41491. };
  41492. HTTPRequest.prototype.onChunk = function (status, data) {
  41493. while (true) {
  41494. var chunk = this.advanceBuffer(data);
  41495. if (chunk) {
  41496. this.emit("chunk", { status: status, data: chunk });
  41497. }
  41498. else {
  41499. break;
  41500. }
  41501. }
  41502. if (this.isBufferTooLong(data)) {
  41503. this.emit("buffer_too_long");
  41504. }
  41505. };
  41506. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41507. var unreadData = buffer.slice(this.position);
  41508. var endOfLinePosition = unreadData.indexOf("\n");
  41509. if (endOfLinePosition !== -1) {
  41510. this.position += endOfLinePosition + 1;
  41511. return unreadData.slice(0, endOfLinePosition);
  41512. }
  41513. else {
  41514. return null;
  41515. }
  41516. };
  41517. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41518. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41519. };
  41520. return HTTPRequest;
  41521. }(dispatcher));
  41522. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41523. // CONCATENATED MODULE: ./src/core/http/state.ts
  41524. var State;
  41525. (function (State) {
  41526. State[State["CONNECTING"] = 0] = "CONNECTING";
  41527. State[State["OPEN"] = 1] = "OPEN";
  41528. State[State["CLOSED"] = 3] = "CLOSED";
  41529. })(State || (State = {}));
  41530. /* harmony default export */ var state = (State);
  41531. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41532. var autoIncrement = 1;
  41533. var http_socket_HTTPSocket = (function () {
  41534. function HTTPSocket(hooks, url) {
  41535. this.hooks = hooks;
  41536. this.session = randomNumber(1000) + "/" + randomString(8);
  41537. this.location = getLocation(url);
  41538. this.readyState = state.CONNECTING;
  41539. this.openStream();
  41540. }
  41541. HTTPSocket.prototype.send = function (payload) {
  41542. return this.sendRaw(JSON.stringify([payload]));
  41543. };
  41544. HTTPSocket.prototype.ping = function () {
  41545. this.hooks.sendHeartbeat(this);
  41546. };
  41547. HTTPSocket.prototype.close = function (code, reason) {
  41548. this.onClose(code, reason, true);
  41549. };
  41550. HTTPSocket.prototype.sendRaw = function (payload) {
  41551. if (this.readyState === state.OPEN) {
  41552. try {
  41553. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41554. return true;
  41555. }
  41556. catch (e) {
  41557. return false;
  41558. }
  41559. }
  41560. else {
  41561. return false;
  41562. }
  41563. };
  41564. HTTPSocket.prototype.reconnect = function () {
  41565. this.closeStream();
  41566. this.openStream();
  41567. };
  41568. ;
  41569. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41570. this.closeStream();
  41571. this.readyState = state.CLOSED;
  41572. if (this.onclose) {
  41573. this.onclose({
  41574. code: code,
  41575. reason: reason,
  41576. wasClean: wasClean
  41577. });
  41578. }
  41579. };
  41580. HTTPSocket.prototype.onChunk = function (chunk) {
  41581. if (chunk.status !== 200) {
  41582. return;
  41583. }
  41584. if (this.readyState === state.OPEN) {
  41585. this.onActivity();
  41586. }
  41587. var payload;
  41588. var type = chunk.data.slice(0, 1);
  41589. switch (type) {
  41590. case 'o':
  41591. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41592. this.onOpen(payload);
  41593. break;
  41594. case 'a':
  41595. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41596. for (var i = 0; i < payload.length; i++) {
  41597. this.onEvent(payload[i]);
  41598. }
  41599. break;
  41600. case 'm':
  41601. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41602. this.onEvent(payload);
  41603. break;
  41604. case 'h':
  41605. this.hooks.onHeartbeat(this);
  41606. break;
  41607. case 'c':
  41608. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41609. this.onClose(payload[0], payload[1], true);
  41610. break;
  41611. }
  41612. };
  41613. HTTPSocket.prototype.onOpen = function (options) {
  41614. if (this.readyState === state.CONNECTING) {
  41615. if (options && options.hostname) {
  41616. this.location.base = replaceHost(this.location.base, options.hostname);
  41617. }
  41618. this.readyState = state.OPEN;
  41619. if (this.onopen) {
  41620. this.onopen();
  41621. }
  41622. }
  41623. else {
  41624. this.onClose(1006, "Server lost session", true);
  41625. }
  41626. };
  41627. HTTPSocket.prototype.onEvent = function (event) {
  41628. if (this.readyState === state.OPEN && this.onmessage) {
  41629. this.onmessage({ data: event });
  41630. }
  41631. };
  41632. HTTPSocket.prototype.onActivity = function () {
  41633. if (this.onactivity) {
  41634. this.onactivity();
  41635. }
  41636. };
  41637. HTTPSocket.prototype.onError = function (error) {
  41638. if (this.onerror) {
  41639. this.onerror(error);
  41640. }
  41641. };
  41642. HTTPSocket.prototype.openStream = function () {
  41643. var _this = this;
  41644. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41645. this.stream.bind("chunk", function (chunk) {
  41646. _this.onChunk(chunk);
  41647. });
  41648. this.stream.bind("finished", function (status) {
  41649. _this.hooks.onFinished(_this, status);
  41650. });
  41651. this.stream.bind("buffer_too_long", function () {
  41652. _this.reconnect();
  41653. });
  41654. try {
  41655. this.stream.start();
  41656. }
  41657. catch (error) {
  41658. util.defer(function () {
  41659. _this.onError(error);
  41660. _this.onClose(1006, "Could not start streaming", false);
  41661. });
  41662. }
  41663. };
  41664. HTTPSocket.prototype.closeStream = function () {
  41665. if (this.stream) {
  41666. this.stream.unbind_all();
  41667. this.stream.close();
  41668. this.stream = null;
  41669. }
  41670. };
  41671. return HTTPSocket;
  41672. }());
  41673. function getLocation(url) {
  41674. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41675. return {
  41676. base: parts[1],
  41677. queryString: parts[2]
  41678. };
  41679. }
  41680. function getSendURL(url, session) {
  41681. return url.base + "/" + session + "/xhr_send";
  41682. }
  41683. function getUniqueURL(url) {
  41684. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41685. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41686. }
  41687. function replaceHost(url, hostname) {
  41688. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41689. return urlParts[1] + hostname + urlParts[3];
  41690. }
  41691. function randomNumber(max) {
  41692. return Math.floor(Math.random() * max);
  41693. }
  41694. function randomString(length) {
  41695. var result = [];
  41696. for (var i = 0; i < length; i++) {
  41697. result.push(randomNumber(32).toString(32));
  41698. }
  41699. return result.join('');
  41700. }
  41701. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41702. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41703. var http_streaming_socket_hooks = {
  41704. getReceiveURL: function (url, session) {
  41705. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41706. },
  41707. onHeartbeat: function (socket) {
  41708. socket.sendRaw("[]");
  41709. },
  41710. sendHeartbeat: function (socket) {
  41711. socket.sendRaw("[]");
  41712. },
  41713. onFinished: function (socket, status) {
  41714. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41715. }
  41716. };
  41717. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41718. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41719. var http_polling_socket_hooks = {
  41720. getReceiveURL: function (url, session) {
  41721. return url.base + "/" + session + "/xhr" + url.queryString;
  41722. },
  41723. onHeartbeat: function () {
  41724. },
  41725. sendHeartbeat: function (socket) {
  41726. socket.sendRaw("[]");
  41727. },
  41728. onFinished: function (socket, status) {
  41729. if (status === 200) {
  41730. socket.reconnect();
  41731. }
  41732. else {
  41733. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41734. }
  41735. }
  41736. };
  41737. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41738. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41739. var http_xhr_request_hooks = {
  41740. getRequest: function (socket) {
  41741. var Constructor = runtime.getXHRAPI();
  41742. var xhr = new Constructor();
  41743. xhr.onreadystatechange = xhr.onprogress = function () {
  41744. switch (xhr.readyState) {
  41745. case 3:
  41746. if (xhr.responseText && xhr.responseText.length > 0) {
  41747. socket.onChunk(xhr.status, xhr.responseText);
  41748. }
  41749. break;
  41750. case 4:
  41751. if (xhr.responseText && xhr.responseText.length > 0) {
  41752. socket.onChunk(xhr.status, xhr.responseText);
  41753. }
  41754. socket.emit("finished", xhr.status);
  41755. socket.close();
  41756. break;
  41757. }
  41758. };
  41759. return xhr;
  41760. },
  41761. abortRequest: function (xhr) {
  41762. xhr.onreadystatechange = null;
  41763. xhr.abort();
  41764. }
  41765. };
  41766. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41767. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41768. var HTTP = {
  41769. createStreamingSocket: function (url) {
  41770. return this.createSocket(http_streaming_socket, url);
  41771. },
  41772. createPollingSocket: function (url) {
  41773. return this.createSocket(http_polling_socket, url);
  41774. },
  41775. createSocket: function (hooks, url) {
  41776. return new http_socket(hooks, url);
  41777. },
  41778. createXHR: function (method, url) {
  41779. return this.createRequest(http_xhr_request, method, url);
  41780. },
  41781. createRequest: function (hooks, method, url) {
  41782. return new http_request(hooks, method, url);
  41783. }
  41784. };
  41785. /* harmony default export */ var http_http = (HTTP);
  41786. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41787. http_http.createXDR = function (method, url) {
  41788. return this.createRequest(http_xdomain_request, method, url);
  41789. };
  41790. /* harmony default export */ var web_http_http = (http_http);
  41791. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41792. var Runtime = {
  41793. nextAuthCallbackID: 1,
  41794. auth_callbacks: {},
  41795. ScriptReceivers: ScriptReceivers,
  41796. DependenciesReceivers: DependenciesReceivers,
  41797. getDefaultStrategy: default_strategy,
  41798. Transports: transports_transports,
  41799. transportConnectionInitializer: transport_connection_initializer,
  41800. HTTPFactory: web_http_http,
  41801. TimelineTransport: jsonp_timeline,
  41802. getXHRAPI: function () {
  41803. return window.XMLHttpRequest;
  41804. },
  41805. getWebSocketAPI: function () {
  41806. return window.WebSocket || window.MozWebSocket;
  41807. },
  41808. setup: function (PusherClass) {
  41809. var _this = this;
  41810. window.Pusher = PusherClass;
  41811. var initializeOnDocumentBody = function () {
  41812. _this.onDocumentBody(PusherClass.ready);
  41813. };
  41814. if (!window.JSON) {
  41815. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41816. }
  41817. else {
  41818. initializeOnDocumentBody();
  41819. }
  41820. },
  41821. getDocument: function () {
  41822. return document;
  41823. },
  41824. getProtocol: function () {
  41825. return this.getDocument().location.protocol;
  41826. },
  41827. getAuthorizers: function () {
  41828. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41829. },
  41830. onDocumentBody: function (callback) {
  41831. var _this = this;
  41832. if (document.body) {
  41833. callback();
  41834. }
  41835. else {
  41836. setTimeout(function () {
  41837. _this.onDocumentBody(callback);
  41838. }, 0);
  41839. }
  41840. },
  41841. createJSONPRequest: function (url, data) {
  41842. return new jsonp_request(url, data);
  41843. },
  41844. createScriptRequest: function (src) {
  41845. return new script_request(src);
  41846. },
  41847. getLocalStorage: function () {
  41848. try {
  41849. return window.localStorage;
  41850. }
  41851. catch (e) {
  41852. return undefined;
  41853. }
  41854. },
  41855. createXHR: function () {
  41856. if (this.getXHRAPI()) {
  41857. return this.createXMLHttpRequest();
  41858. }
  41859. else {
  41860. return this.createMicrosoftXHR();
  41861. }
  41862. },
  41863. createXMLHttpRequest: function () {
  41864. var Constructor = this.getXHRAPI();
  41865. return new Constructor();
  41866. },
  41867. createMicrosoftXHR: function () {
  41868. return new ActiveXObject("Microsoft.XMLHTTP");
  41869. },
  41870. getNetwork: function () {
  41871. return net_info_Network;
  41872. },
  41873. createWebSocket: function (url) {
  41874. var Constructor = this.getWebSocketAPI();
  41875. return new Constructor(url);
  41876. },
  41877. createSocketRequest: function (method, url) {
  41878. if (this.isXHRSupported()) {
  41879. return this.HTTPFactory.createXHR(method, url);
  41880. }
  41881. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41882. return this.HTTPFactory.createXDR(method, url);
  41883. }
  41884. else {
  41885. throw "Cross-origin HTTP requests are not supported";
  41886. }
  41887. },
  41888. isXHRSupported: function () {
  41889. var Constructor = this.getXHRAPI();
  41890. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41891. },
  41892. isXDRSupported: function (useTLS) {
  41893. var protocol = useTLS ? "https:" : "http:";
  41894. var documentProtocol = this.getProtocol();
  41895. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41896. },
  41897. addUnloadListener: function (listener) {
  41898. if (window.addEventListener !== undefined) {
  41899. window.addEventListener("unload", listener, false);
  41900. }
  41901. else if (window.attachEvent !== undefined) {
  41902. window.attachEvent("onunload", listener);
  41903. }
  41904. },
  41905. removeUnloadListener: function (listener) {
  41906. if (window.addEventListener !== undefined) {
  41907. window.removeEventListener("unload", listener, false);
  41908. }
  41909. else if (window.detachEvent !== undefined) {
  41910. window.detachEvent("onunload", listener);
  41911. }
  41912. }
  41913. };
  41914. /* harmony default export */ var runtime = (Runtime);
  41915. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41916. var TimelineLevel;
  41917. (function (TimelineLevel) {
  41918. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41919. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41920. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41921. })(TimelineLevel || (TimelineLevel = {}));
  41922. /* harmony default export */ var timeline_level = (TimelineLevel);
  41923. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41924. var timeline_Timeline = (function () {
  41925. function Timeline(key, session, options) {
  41926. this.key = key;
  41927. this.session = session;
  41928. this.events = [];
  41929. this.options = options || {};
  41930. this.sent = 0;
  41931. this.uniqueID = 0;
  41932. }
  41933. Timeline.prototype.log = function (level, event) {
  41934. if (level <= this.options.level) {
  41935. this.events.push(extend({}, event, { timestamp: util.now() }));
  41936. if (this.options.limit && this.events.length > this.options.limit) {
  41937. this.events.shift();
  41938. }
  41939. }
  41940. };
  41941. Timeline.prototype.error = function (event) {
  41942. this.log(timeline_level.ERROR, event);
  41943. };
  41944. Timeline.prototype.info = function (event) {
  41945. this.log(timeline_level.INFO, event);
  41946. };
  41947. Timeline.prototype.debug = function (event) {
  41948. this.log(timeline_level.DEBUG, event);
  41949. };
  41950. Timeline.prototype.isEmpty = function () {
  41951. return this.events.length === 0;
  41952. };
  41953. Timeline.prototype.send = function (sendfn, callback) {
  41954. var _this = this;
  41955. var data = extend({
  41956. session: this.session,
  41957. bundle: this.sent + 1,
  41958. key: this.key,
  41959. lib: "js",
  41960. version: this.options.version,
  41961. cluster: this.options.cluster,
  41962. features: this.options.features,
  41963. timeline: this.events
  41964. }, this.options.params);
  41965. this.events = [];
  41966. sendfn(data, function (error, result) {
  41967. if (!error) {
  41968. _this.sent++;
  41969. }
  41970. if (callback) {
  41971. callback(error, result);
  41972. }
  41973. });
  41974. return true;
  41975. };
  41976. Timeline.prototype.generateUniqueID = function () {
  41977. this.uniqueID++;
  41978. return this.uniqueID;
  41979. };
  41980. return Timeline;
  41981. }());
  41982. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  41983. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  41984. var transport_strategy_TransportStrategy = (function () {
  41985. function TransportStrategy(name, priority, transport, options) {
  41986. this.name = name;
  41987. this.priority = priority;
  41988. this.transport = transport;
  41989. this.options = options || {};
  41990. }
  41991. TransportStrategy.prototype.isSupported = function () {
  41992. return this.transport.isSupported({
  41993. useTLS: this.options.useTLS
  41994. });
  41995. };
  41996. TransportStrategy.prototype.connect = function (minPriority, callback) {
  41997. var _this = this;
  41998. if (!this.isSupported()) {
  41999. return failAttempt(new UnsupportedStrategy(), callback);
  42000. }
  42001. else if (this.priority < minPriority) {
  42002. return failAttempt(new TransportPriorityTooLow(), callback);
  42003. }
  42004. var connected = false;
  42005. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42006. var handshake = null;
  42007. var onInitialized = function () {
  42008. transport.unbind("initialized", onInitialized);
  42009. transport.connect();
  42010. };
  42011. var onOpen = function () {
  42012. handshake = factory.createHandshake(transport, function (result) {
  42013. connected = true;
  42014. unbindListeners();
  42015. callback(null, result);
  42016. });
  42017. };
  42018. var onError = function (error) {
  42019. unbindListeners();
  42020. callback(error);
  42021. };
  42022. var onClosed = function () {
  42023. unbindListeners();
  42024. var serializedTransport;
  42025. serializedTransport = safeJSONStringify(transport);
  42026. callback(new TransportClosed(serializedTransport));
  42027. };
  42028. var unbindListeners = function () {
  42029. transport.unbind("initialized", onInitialized);
  42030. transport.unbind("open", onOpen);
  42031. transport.unbind("error", onError);
  42032. transport.unbind("closed", onClosed);
  42033. };
  42034. transport.bind("initialized", onInitialized);
  42035. transport.bind("open", onOpen);
  42036. transport.bind("error", onError);
  42037. transport.bind("closed", onClosed);
  42038. transport.initialize();
  42039. return {
  42040. abort: function () {
  42041. if (connected) {
  42042. return;
  42043. }
  42044. unbindListeners();
  42045. if (handshake) {
  42046. handshake.close();
  42047. }
  42048. else {
  42049. transport.close();
  42050. }
  42051. },
  42052. forceMinPriority: function (p) {
  42053. if (connected) {
  42054. return;
  42055. }
  42056. if (_this.priority < p) {
  42057. if (handshake) {
  42058. handshake.close();
  42059. }
  42060. else {
  42061. transport.close();
  42062. }
  42063. }
  42064. }
  42065. };
  42066. };
  42067. return TransportStrategy;
  42068. }());
  42069. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42070. function failAttempt(error, callback) {
  42071. util.defer(function () {
  42072. callback(error);
  42073. });
  42074. return {
  42075. abort: function () { },
  42076. forceMinPriority: function () { }
  42077. };
  42078. }
  42079. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42080. var strategy_builder_Transports = runtime.Transports;
  42081. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42082. var transportClass = strategy_builder_Transports[type];
  42083. if (!transportClass) {
  42084. throw new UnsupportedTransport(type);
  42085. }
  42086. var enabled = (!config.enabledTransports ||
  42087. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42088. (!config.disabledTransports ||
  42089. arrayIndexOf(config.disabledTransports, name) === -1);
  42090. var transport;
  42091. if (enabled) {
  42092. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42093. key: config.key,
  42094. useTLS: config.useTLS,
  42095. timeline: config.timeline,
  42096. ignoreNullOrigin: config.ignoreNullOrigin
  42097. }, options));
  42098. }
  42099. else {
  42100. transport = strategy_builder_UnsupportedStrategy;
  42101. }
  42102. return transport;
  42103. };
  42104. var strategy_builder_UnsupportedStrategy = {
  42105. isSupported: function () {
  42106. return false;
  42107. },
  42108. connect: function (_, callback) {
  42109. var deferred = util.defer(function () {
  42110. callback(new UnsupportedStrategy());
  42111. });
  42112. return {
  42113. abort: function () {
  42114. deferred.ensureAborted();
  42115. },
  42116. forceMinPriority: function () { }
  42117. };
  42118. }
  42119. };
  42120. // CONCATENATED MODULE: ./src/core/config.ts
  42121. var getGlobalConfig = function () {
  42122. return {
  42123. wsHost: defaults.host,
  42124. wsPort: defaults.ws_port,
  42125. wssPort: defaults.wss_port,
  42126. wsPath: defaults.ws_path,
  42127. httpHost: defaults.sockjs_host,
  42128. httpPort: defaults.sockjs_http_port,
  42129. httpsPort: defaults.sockjs_https_port,
  42130. httpPath: defaults.sockjs_path,
  42131. statsHost: defaults.stats_host,
  42132. authEndpoint: defaults.channel_auth_endpoint,
  42133. authTransport: defaults.channel_auth_transport,
  42134. activity_timeout: defaults.activity_timeout,
  42135. pong_timeout: defaults.pong_timeout,
  42136. unavailable_timeout: defaults.unavailable_timeout
  42137. };
  42138. };
  42139. var getClusterConfig = function (clusterName) {
  42140. return {
  42141. wsHost: 'ws-' + clusterName + '.pusher.com',
  42142. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42143. };
  42144. };
  42145. // CONCATENATED MODULE: ./src/core/pusher.ts
  42146. var pusher_Pusher = (function () {
  42147. function Pusher(app_key, options) {
  42148. var _this = this;
  42149. checkAppKey(app_key);
  42150. options = options || {};
  42151. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42152. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42153. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42154. }
  42155. this.key = app_key;
  42156. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42157. this.channels = factory.createChannels();
  42158. this.global_emitter = new dispatcher();
  42159. this.sessionID = Math.floor(Math.random() * 1000000000);
  42160. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42161. cluster: this.config.cluster,
  42162. features: Pusher.getClientFeatures(),
  42163. params: this.config.timelineParams || {},
  42164. limit: 50,
  42165. level: timeline_level.INFO,
  42166. version: defaults.VERSION
  42167. });
  42168. if (!this.config.disableStats) {
  42169. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42170. host: this.config.statsHost,
  42171. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42172. });
  42173. }
  42174. var getStrategy = function (options) {
  42175. var config = extend({}, _this.config, options);
  42176. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42177. };
  42178. this.connection = factory.createConnectionManager(this.key, extend({
  42179. getStrategy: getStrategy,
  42180. timeline: this.timeline,
  42181. activityTimeout: this.config.activity_timeout,
  42182. pongTimeout: this.config.pong_timeout,
  42183. unavailableTimeout: this.config.unavailable_timeout
  42184. }, this.config, { useTLS: this.shouldUseTLS() }));
  42185. this.connection.bind('connected', function () {
  42186. _this.subscribeAll();
  42187. if (_this.timelineSender) {
  42188. _this.timelineSender.send(_this.connection.isUsingTLS());
  42189. }
  42190. });
  42191. this.connection.bind('message', function (event) {
  42192. var eventName = event.event;
  42193. var internal = eventName.indexOf('pusher_internal:') === 0;
  42194. if (event.channel) {
  42195. var channel = _this.channel(event.channel);
  42196. if (channel) {
  42197. channel.handleEvent(event);
  42198. }
  42199. }
  42200. if (!internal) {
  42201. _this.global_emitter.emit(event.event, event.data);
  42202. }
  42203. });
  42204. this.connection.bind('connecting', function () {
  42205. _this.channels.disconnect();
  42206. });
  42207. this.connection.bind('disconnected', function () {
  42208. _this.channels.disconnect();
  42209. });
  42210. this.connection.bind('error', function (err) {
  42211. logger.warn(err);
  42212. });
  42213. Pusher.instances.push(this);
  42214. this.timeline.info({ instances: Pusher.instances.length });
  42215. if (Pusher.isReady) {
  42216. this.connect();
  42217. }
  42218. }
  42219. Pusher.ready = function () {
  42220. Pusher.isReady = true;
  42221. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42222. Pusher.instances[i].connect();
  42223. }
  42224. };
  42225. Pusher.getClientFeatures = function () {
  42226. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42227. return t.isSupported({});
  42228. }));
  42229. };
  42230. Pusher.prototype.channel = function (name) {
  42231. return this.channels.find(name);
  42232. };
  42233. Pusher.prototype.allChannels = function () {
  42234. return this.channels.all();
  42235. };
  42236. Pusher.prototype.connect = function () {
  42237. this.connection.connect();
  42238. if (this.timelineSender) {
  42239. if (!this.timelineSenderTimer) {
  42240. var usingTLS = this.connection.isUsingTLS();
  42241. var timelineSender = this.timelineSender;
  42242. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42243. timelineSender.send(usingTLS);
  42244. });
  42245. }
  42246. }
  42247. };
  42248. Pusher.prototype.disconnect = function () {
  42249. this.connection.disconnect();
  42250. if (this.timelineSenderTimer) {
  42251. this.timelineSenderTimer.ensureAborted();
  42252. this.timelineSenderTimer = null;
  42253. }
  42254. };
  42255. Pusher.prototype.bind = function (event_name, callback, context) {
  42256. this.global_emitter.bind(event_name, callback, context);
  42257. return this;
  42258. };
  42259. Pusher.prototype.unbind = function (event_name, callback, context) {
  42260. this.global_emitter.unbind(event_name, callback, context);
  42261. return this;
  42262. };
  42263. Pusher.prototype.bind_global = function (callback) {
  42264. this.global_emitter.bind_global(callback);
  42265. return this;
  42266. };
  42267. Pusher.prototype.unbind_global = function (callback) {
  42268. this.global_emitter.unbind_global(callback);
  42269. return this;
  42270. };
  42271. Pusher.prototype.unbind_all = function (callback) {
  42272. this.global_emitter.unbind_all();
  42273. return this;
  42274. };
  42275. Pusher.prototype.subscribeAll = function () {
  42276. var channelName;
  42277. for (channelName in this.channels.channels) {
  42278. if (this.channels.channels.hasOwnProperty(channelName)) {
  42279. this.subscribe(channelName);
  42280. }
  42281. }
  42282. };
  42283. Pusher.prototype.subscribe = function (channel_name) {
  42284. var channel = this.channels.add(channel_name, this);
  42285. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42286. channel.reinstateSubscription();
  42287. }
  42288. else if (!channel.subscriptionPending &&
  42289. this.connection.state === 'connected') {
  42290. channel.subscribe();
  42291. }
  42292. return channel;
  42293. };
  42294. Pusher.prototype.unsubscribe = function (channel_name) {
  42295. var channel = this.channels.find(channel_name);
  42296. if (channel && channel.subscriptionPending) {
  42297. channel.cancelSubscription();
  42298. }
  42299. else {
  42300. channel = this.channels.remove(channel_name);
  42301. if (channel && this.connection.state === 'connected') {
  42302. channel.unsubscribe();
  42303. }
  42304. }
  42305. };
  42306. Pusher.prototype.send_event = function (event_name, data, channel) {
  42307. return this.connection.send_event(event_name, data, channel);
  42308. };
  42309. Pusher.prototype.shouldUseTLS = function () {
  42310. if (runtime.getProtocol() === 'https:') {
  42311. return true;
  42312. }
  42313. else if (this.config.forceTLS === true) {
  42314. return true;
  42315. }
  42316. else {
  42317. return Boolean(this.config.encrypted);
  42318. }
  42319. };
  42320. Pusher.instances = [];
  42321. Pusher.isReady = false;
  42322. Pusher.logToConsole = false;
  42323. Pusher.Runtime = runtime;
  42324. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42325. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42326. Pusher.auth_callbacks = runtime.auth_callbacks;
  42327. return Pusher;
  42328. }());
  42329. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42330. function checkAppKey(key) {
  42331. if (key === null || key === undefined) {
  42332. throw 'You must pass your app key when you instantiate Pusher.';
  42333. }
  42334. }
  42335. runtime.setup(pusher_Pusher);
  42336. /***/ })
  42337. /******/ ]);
  42338. });
  42339. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42340. /***/ }),
  42341. /***/ "./node_modules/setimmediate/setImmediate.js":
  42342. /*!***************************************************!*\
  42343. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42344. \***************************************************/
  42345. /*! no static exports found */
  42346. /***/ (function(module, exports, __webpack_require__) {
  42347. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42348. "use strict";
  42349. if (global.setImmediate) {
  42350. return;
  42351. }
  42352. var nextHandle = 1; // Spec says greater than zero
  42353. var tasksByHandle = {};
  42354. var currentlyRunningATask = false;
  42355. var doc = global.document;
  42356. var registerImmediate;
  42357. function setImmediate(callback) {
  42358. // Callback can either be a function or a string
  42359. if (typeof callback !== "function") {
  42360. callback = new Function("" + callback);
  42361. }
  42362. // Copy function arguments
  42363. var args = new Array(arguments.length - 1);
  42364. for (var i = 0; i < args.length; i++) {
  42365. args[i] = arguments[i + 1];
  42366. }
  42367. // Store and register the task
  42368. var task = { callback: callback, args: args };
  42369. tasksByHandle[nextHandle] = task;
  42370. registerImmediate(nextHandle);
  42371. return nextHandle++;
  42372. }
  42373. function clearImmediate(handle) {
  42374. delete tasksByHandle[handle];
  42375. }
  42376. function run(task) {
  42377. var callback = task.callback;
  42378. var args = task.args;
  42379. switch (args.length) {
  42380. case 0:
  42381. callback();
  42382. break;
  42383. case 1:
  42384. callback(args[0]);
  42385. break;
  42386. case 2:
  42387. callback(args[0], args[1]);
  42388. break;
  42389. case 3:
  42390. callback(args[0], args[1], args[2]);
  42391. break;
  42392. default:
  42393. callback.apply(undefined, args);
  42394. break;
  42395. }
  42396. }
  42397. function runIfPresent(handle) {
  42398. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42399. // So if we're currently running a task, we'll need to delay this invocation.
  42400. if (currentlyRunningATask) {
  42401. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42402. // "too much recursion" error.
  42403. setTimeout(runIfPresent, 0, handle);
  42404. } else {
  42405. var task = tasksByHandle[handle];
  42406. if (task) {
  42407. currentlyRunningATask = true;
  42408. try {
  42409. run(task);
  42410. } finally {
  42411. clearImmediate(handle);
  42412. currentlyRunningATask = false;
  42413. }
  42414. }
  42415. }
  42416. }
  42417. function installNextTickImplementation() {
  42418. registerImmediate = function(handle) {
  42419. process.nextTick(function () { runIfPresent(handle); });
  42420. };
  42421. }
  42422. function canUsePostMessage() {
  42423. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42424. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42425. if (global.postMessage && !global.importScripts) {
  42426. var postMessageIsAsynchronous = true;
  42427. var oldOnMessage = global.onmessage;
  42428. global.onmessage = function() {
  42429. postMessageIsAsynchronous = false;
  42430. };
  42431. global.postMessage("", "*");
  42432. global.onmessage = oldOnMessage;
  42433. return postMessageIsAsynchronous;
  42434. }
  42435. }
  42436. function installPostMessageImplementation() {
  42437. // Installs an event handler on `global` for the `message` event: see
  42438. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42439. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42440. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42441. var onGlobalMessage = function(event) {
  42442. if (event.source === global &&
  42443. typeof event.data === "string" &&
  42444. event.data.indexOf(messagePrefix) === 0) {
  42445. runIfPresent(+event.data.slice(messagePrefix.length));
  42446. }
  42447. };
  42448. if (global.addEventListener) {
  42449. global.addEventListener("message", onGlobalMessage, false);
  42450. } else {
  42451. global.attachEvent("onmessage", onGlobalMessage);
  42452. }
  42453. registerImmediate = function(handle) {
  42454. global.postMessage(messagePrefix + handle, "*");
  42455. };
  42456. }
  42457. function installMessageChannelImplementation() {
  42458. var channel = new MessageChannel();
  42459. channel.port1.onmessage = function(event) {
  42460. var handle = event.data;
  42461. runIfPresent(handle);
  42462. };
  42463. registerImmediate = function(handle) {
  42464. channel.port2.postMessage(handle);
  42465. };
  42466. }
  42467. function installReadyStateChangeImplementation() {
  42468. var html = doc.documentElement;
  42469. registerImmediate = function(handle) {
  42470. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42471. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42472. var script = doc.createElement("script");
  42473. script.onreadystatechange = function () {
  42474. runIfPresent(handle);
  42475. script.onreadystatechange = null;
  42476. html.removeChild(script);
  42477. script = null;
  42478. };
  42479. html.appendChild(script);
  42480. };
  42481. }
  42482. function installSetTimeoutImplementation() {
  42483. registerImmediate = function(handle) {
  42484. setTimeout(runIfPresent, 0, handle);
  42485. };
  42486. }
  42487. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42488. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42489. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42490. // Don't get fooled by e.g. browserify environments.
  42491. if ({}.toString.call(global.process) === "[object process]") {
  42492. // For Node.js before 0.9
  42493. installNextTickImplementation();
  42494. } else if (canUsePostMessage()) {
  42495. // For non-IE10 modern browsers
  42496. installPostMessageImplementation();
  42497. } else if (global.MessageChannel) {
  42498. // For web workers, where supported
  42499. installMessageChannelImplementation();
  42500. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42501. // For IE 6–8
  42502. installReadyStateChangeImplementation();
  42503. } else {
  42504. // For older browsers
  42505. installSetTimeoutImplementation();
  42506. }
  42507. attachTo.setImmediate = setImmediate;
  42508. attachTo.clearImmediate = clearImmediate;
  42509. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42510. /* 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")))
  42511. /***/ }),
  42512. /***/ "./node_modules/timers-browserify/main.js":
  42513. /*!************************************************!*\
  42514. !*** ./node_modules/timers-browserify/main.js ***!
  42515. \************************************************/
  42516. /*! no static exports found */
  42517. /***/ (function(module, exports, __webpack_require__) {
  42518. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42519. (typeof self !== "undefined" && self) ||
  42520. window;
  42521. var apply = Function.prototype.apply;
  42522. // DOM APIs, for completeness
  42523. exports.setTimeout = function() {
  42524. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42525. };
  42526. exports.setInterval = function() {
  42527. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42528. };
  42529. exports.clearTimeout =
  42530. exports.clearInterval = function(timeout) {
  42531. if (timeout) {
  42532. timeout.close();
  42533. }
  42534. };
  42535. function Timeout(id, clearFn) {
  42536. this._id = id;
  42537. this._clearFn = clearFn;
  42538. }
  42539. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42540. Timeout.prototype.close = function() {
  42541. this._clearFn.call(scope, this._id);
  42542. };
  42543. // Does not start the time, just sets up the members needed.
  42544. exports.enroll = function(item, msecs) {
  42545. clearTimeout(item._idleTimeoutId);
  42546. item._idleTimeout = msecs;
  42547. };
  42548. exports.unenroll = function(item) {
  42549. clearTimeout(item._idleTimeoutId);
  42550. item._idleTimeout = -1;
  42551. };
  42552. exports._unrefActive = exports.active = function(item) {
  42553. clearTimeout(item._idleTimeoutId);
  42554. var msecs = item._idleTimeout;
  42555. if (msecs >= 0) {
  42556. item._idleTimeoutId = setTimeout(function onTimeout() {
  42557. if (item._onTimeout)
  42558. item._onTimeout();
  42559. }, msecs);
  42560. }
  42561. };
  42562. // setimmediate attaches itself to the global object
  42563. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42564. // On some exotic environments, it's not clear which object `setimmediate` was
  42565. // able to install onto. Search each possibility in the same order as the
  42566. // `setimmediate` library.
  42567. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42568. (typeof global !== "undefined" && global.setImmediate) ||
  42569. (this && this.setImmediate);
  42570. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42571. (typeof global !== "undefined" && global.clearImmediate) ||
  42572. (this && this.clearImmediate);
  42573. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42574. /***/ }),
  42575. /***/ "./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&":
  42576. /*!*******************************************************************************************************************************************************************************************************************!*\
  42577. !*** ./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& ***!
  42578. \*******************************************************************************************************************************************************************************************************************/
  42579. /*! exports provided: render, staticRenderFns */
  42580. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42581. "use strict";
  42582. __webpack_require__.r(__webpack_exports__);
  42583. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42584. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42585. var render = function() {
  42586. var _vm = this
  42587. var _h = _vm.$createElement
  42588. var _c = _vm._self._c || _h
  42589. return _vm._m(0)
  42590. }
  42591. var staticRenderFns = [
  42592. function() {
  42593. var _vm = this
  42594. var _h = _vm.$createElement
  42595. var _c = _vm._self._c || _h
  42596. return _c("div", { staticClass: "container" }, [
  42597. _c("div", { staticClass: "row justify-content-center" }, [
  42598. _c("div", { staticClass: "col-md-8" }, [
  42599. _c("div", { staticClass: "card" }, [
  42600. _c("div", { staticClass: "card-header" }, [
  42601. _vm._v("Example Component")
  42602. ]),
  42603. _vm._v(" "),
  42604. _c("div", { staticClass: "card-body" }, [
  42605. _vm._v(
  42606. "\n I'm an example component.\n "
  42607. )
  42608. ])
  42609. ])
  42610. ])
  42611. ])
  42612. ])
  42613. }
  42614. ]
  42615. render._withStripped = true
  42616. /***/ }),
  42617. /***/ "./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&":
  42618. /*!************************************************************************************************************************************************************************************************************!*\
  42619. !*** ./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& ***!
  42620. \************************************************************************************************************************************************************************************************************/
  42621. /*! exports provided: render, staticRenderFns */
  42622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42623. "use strict";
  42624. __webpack_require__.r(__webpack_exports__);
  42625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42627. var render = function() {
  42628. var _vm = this
  42629. var _h = _vm.$createElement
  42630. var _c = _vm._self._c || _h
  42631. return _c(
  42632. "div",
  42633. [
  42634. _c(
  42635. "modal",
  42636. {
  42637. attrs: {
  42638. id: "asseteditModal",
  42639. tabindex: "-1",
  42640. role: "dialog",
  42641. "aria-labelledby": "asseteditModalLabel"
  42642. }
  42643. },
  42644. [
  42645. _c(
  42646. "h5",
  42647. {
  42648. staticClass: "modal-title",
  42649. attrs: { slot: "header", id: "asseteditModalLabel" },
  42650. slot: "header"
  42651. },
  42652. [_vm._v("\n Edit Work Order Information\n ")]
  42653. ),
  42654. _vm._v(" "),
  42655. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42656. _c("div", { staticClass: "form-group" }, [
  42657. _c("label", { attrs: { for: "manufacturer" } }, [
  42658. _vm._v("Manufacturer")
  42659. ]),
  42660. _vm._v(" "),
  42661. _c("input", {
  42662. directives: [
  42663. {
  42664. name: "model",
  42665. rawName: "v-model",
  42666. value: _vm.data.pcmanu,
  42667. expression: "data.pcmanu"
  42668. }
  42669. ],
  42670. staticClass: "form-control",
  42671. attrs: {
  42672. type: "text",
  42673. name: "manufacturer",
  42674. id: "manufacturer"
  42675. },
  42676. domProps: { value: _vm.data.pcmanu },
  42677. on: {
  42678. input: function($event) {
  42679. if ($event.target.composing) {
  42680. return
  42681. }
  42682. _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42683. }
  42684. }
  42685. })
  42686. ]),
  42687. _vm._v(" "),
  42688. _c("div", { staticClass: "form-group" }, [
  42689. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42690. _vm._v(" "),
  42691. _c("input", {
  42692. directives: [
  42693. {
  42694. name: "model",
  42695. rawName: "v-model",
  42696. value: _vm.data.pcmake,
  42697. expression: "data.pcmake"
  42698. }
  42699. ],
  42700. staticClass: "form-control",
  42701. attrs: { type: "text", name: "make", id: "make" },
  42702. domProps: { value: _vm.data.pcmake },
  42703. on: {
  42704. input: function($event) {
  42705. if ($event.target.composing) {
  42706. return
  42707. }
  42708. _vm.$set(_vm.data, "pcmake", $event.target.value)
  42709. }
  42710. }
  42711. })
  42712. ]),
  42713. _vm._v(" "),
  42714. _c("div", { staticClass: "form-group" }, [
  42715. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42716. _vm._v(" "),
  42717. _c("input", {
  42718. directives: [
  42719. {
  42720. name: "model",
  42721. rawName: "v-model",
  42722. value: _vm.data.pcnickname,
  42723. expression: "data.pcnickname"
  42724. }
  42725. ],
  42726. staticClass: "form-control",
  42727. attrs: { type: "text", name: "nickname", id: "nickname" },
  42728. domProps: { value: _vm.data.pcnickname },
  42729. on: {
  42730. input: function($event) {
  42731. if ($event.target.composing) {
  42732. return
  42733. }
  42734. _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42735. }
  42736. }
  42737. })
  42738. ]),
  42739. _vm._v(" "),
  42740. _c("div", { staticClass: "form-group" }, [
  42741. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42742. _vm._v(" "),
  42743. _c("input", {
  42744. directives: [
  42745. {
  42746. name: "model",
  42747. rawName: "v-model",
  42748. value: _vm.pcextra[2],
  42749. expression: "pcextra[2]"
  42750. }
  42751. ],
  42752. staticClass: "form-control",
  42753. attrs: { type: "text", name: "os", id: "os" },
  42754. domProps: { value: _vm.pcextra[2] },
  42755. on: {
  42756. input: function($event) {
  42757. if ($event.target.composing) {
  42758. return
  42759. }
  42760. _vm.$set(_vm.pcextra, 2, $event.target.value)
  42761. }
  42762. }
  42763. })
  42764. ]),
  42765. _vm._v(" "),
  42766. _c("div", { staticClass: "form-group" }, [
  42767. _c("label", { attrs: { for: "serial" } }, [
  42768. _vm._v("Serial Number")
  42769. ]),
  42770. _vm._v(" "),
  42771. _c("input", {
  42772. directives: [
  42773. {
  42774. name: "model",
  42775. rawName: "v-model",
  42776. value: _vm.pcextra[104],
  42777. expression: "pcextra[104]"
  42778. }
  42779. ],
  42780. staticClass: "form-control",
  42781. attrs: { type: "text", id: "serial", name: "serial" },
  42782. domProps: { value: _vm.pcextra[104] },
  42783. on: {
  42784. input: function($event) {
  42785. if ($event.target.composing) {
  42786. return
  42787. }
  42788. _vm.$set(_vm.pcextra, 104, $event.target.value)
  42789. }
  42790. }
  42791. })
  42792. ]),
  42793. _vm._v(" "),
  42794. _c("div", { staticClass: "form-group" }, [
  42795. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42796. _vm._v(" "),
  42797. _c("input", {
  42798. directives: [
  42799. {
  42800. name: "model",
  42801. rawName: "v-model",
  42802. value: _vm.pcextra[101],
  42803. expression: "pcextra[101]"
  42804. }
  42805. ],
  42806. staticClass: "form-control",
  42807. attrs: { type: "text", id: "cpu", name: "cpu" },
  42808. domProps: { value: _vm.pcextra[101] },
  42809. on: {
  42810. input: function($event) {
  42811. if ($event.target.composing) {
  42812. return
  42813. }
  42814. _vm.$set(_vm.pcextra, 101, $event.target.value)
  42815. }
  42816. }
  42817. })
  42818. ]),
  42819. _vm._v(" "),
  42820. _c("div", { staticClass: "form-group" }, [
  42821. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42822. _vm._v(" "),
  42823. _c("input", {
  42824. directives: [
  42825. {
  42826. name: "model",
  42827. rawName: "v-model",
  42828. value: _vm.pcextra[100],
  42829. expression: "pcextra[100]"
  42830. }
  42831. ],
  42832. staticClass: "form-control",
  42833. attrs: { type: "text", name: "ram", id: "ram" },
  42834. domProps: { value: _vm.pcextra[100] },
  42835. on: {
  42836. input: function($event) {
  42837. if ($event.target.composing) {
  42838. return
  42839. }
  42840. _vm.$set(_vm.pcextra, 100, $event.target.value)
  42841. }
  42842. }
  42843. })
  42844. ]),
  42845. _vm._v(" "),
  42846. _c("div", { staticClass: "form-group" }, [
  42847. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42848. _vm._v(" "),
  42849. _c("input", {
  42850. directives: [
  42851. {
  42852. name: "model",
  42853. rawName: "v-model",
  42854. value: _vm.pcextra[4],
  42855. expression: "pcextra[4]"
  42856. }
  42857. ],
  42858. staticClass: "form-control",
  42859. attrs: { type: "text", name: "graphics", id: "grapics" },
  42860. domProps: { value: _vm.pcextra[4] },
  42861. on: {
  42862. input: function($event) {
  42863. if ($event.target.composing) {
  42864. return
  42865. }
  42866. _vm.$set(_vm.pcextra, 4, $event.target.value)
  42867. }
  42868. }
  42869. })
  42870. ])
  42871. ]),
  42872. _vm._v(" "),
  42873. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42874. _c(
  42875. "button",
  42876. {
  42877. staticClass: "btn btn-secondary",
  42878. attrs: { type: "button", "data-dismiss": "modal" }
  42879. },
  42880. [_vm._v("Close")]
  42881. ),
  42882. _vm._v(" "),
  42883. _c(
  42884. "button",
  42885. {
  42886. staticClass: "btn btn-primary",
  42887. attrs: { type: "button" },
  42888. on: {
  42889. click: function($event) {
  42890. return _vm.updateAsset()
  42891. }
  42892. }
  42893. },
  42894. [_vm._v("Save")]
  42895. )
  42896. ])
  42897. ]
  42898. ),
  42899. _vm._v(" "),
  42900. _c("h4", { staticClass: "text-center" }, [
  42901. _vm._v(
  42902. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  42903. ),
  42904. _c("small", { staticClass: "text-muted" }, [
  42905. _vm._v(_vm._s(this.data.pcnickname))
  42906. ])
  42907. ]),
  42908. _vm._v(" "),
  42909. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  42910. _vm._v(" "),
  42911. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  42912. _vm._v(" "),
  42913. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  42914. _vm._v(" "),
  42915. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  42916. _vm._v(" "),
  42917. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  42918. _vm._v(" "),
  42919. _c(
  42920. "button",
  42921. {
  42922. staticClass: "btn btn-primary",
  42923. attrs: {
  42924. type: "button",
  42925. "data-toggle": "modal",
  42926. "data-target": "#asseteditModal"
  42927. }
  42928. },
  42929. [_vm._v("Edit")]
  42930. )
  42931. ],
  42932. 1
  42933. )
  42934. }
  42935. var staticRenderFns = []
  42936. render._withStripped = true
  42937. /***/ }),
  42938. /***/ "./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&":
  42939. /*!*************************************************************************************************************************************************************************************************************!*\
  42940. !*** ./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& ***!
  42941. \*************************************************************************************************************************************************************************************************************/
  42942. /*! exports provided: render, staticRenderFns */
  42943. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42944. "use strict";
  42945. __webpack_require__.r(__webpack_exports__);
  42946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42947. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42948. var render = function() {
  42949. var _vm = this
  42950. var _h = _vm.$createElement
  42951. var _c = _vm._self._c || _h
  42952. return _c(
  42953. "div",
  42954. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42955. [
  42956. _c("div", { staticClass: "row no-gutters" }, [
  42957. _c("div", { staticClass: "h5 col-3 text-left" }, [
  42958. _vm._v(_vm._s(this.data.creddesc))
  42959. ]),
  42960. _vm._v(" "),
  42961. _c("div", { staticClass: "col-9 text-right" }, [
  42962. _vm._v(_vm._s(this.data.creddate))
  42963. ])
  42964. ]),
  42965. _vm._v(" "),
  42966. _c("div", { staticClass: "row" }, [
  42967. _c("div", { staticClass: "col-lg-9" }, [
  42968. _c("div", [
  42969. _vm._m(0),
  42970. _vm._v(" "),
  42971. _c("input", {
  42972. staticClass: "border-0 credential",
  42973. attrs: {
  42974. type: "text",
  42975. id: "username" + this.data.credid,
  42976. readonly: ""
  42977. },
  42978. domProps: { value: this.data.creduser }
  42979. }),
  42980. _vm._v(" "),
  42981. _c(
  42982. "button",
  42983. {
  42984. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42985. attrs: {
  42986. id: "btn-username" + this.data.credid,
  42987. "data-clipboard-target": "#username" + this.data.credid
  42988. }
  42989. },
  42990. [_c("i", { staticClass: "far fa-clone" })]
  42991. )
  42992. ]),
  42993. _vm._v(" "),
  42994. _c("div", [
  42995. _vm._m(1),
  42996. _vm._v(" "),
  42997. _c("input", {
  42998. staticClass: "border-0 credential",
  42999. attrs: {
  43000. type: "text",
  43001. id: "password" + this.data.credid,
  43002. readonly: ""
  43003. },
  43004. domProps: { value: this.data.credpass }
  43005. }),
  43006. _vm._v(" "),
  43007. _c(
  43008. "button",
  43009. {
  43010. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43011. attrs: {
  43012. id: "btn-password" + this.data.credid,
  43013. "data-clipboard-target": "#password" + this.data.credid
  43014. }
  43015. },
  43016. [_c("i", { staticClass: "far fa-clone" })]
  43017. )
  43018. ])
  43019. ]),
  43020. _vm._v(" "),
  43021. _vm._m(2)
  43022. ])
  43023. ]
  43024. )
  43025. }
  43026. var staticRenderFns = [
  43027. function() {
  43028. var _vm = this
  43029. var _h = _vm.$createElement
  43030. var _c = _vm._self._c || _h
  43031. return _c("label", { attrs: { for: "username" } }, [
  43032. _c("i", { staticClass: "fas fa-fw fa-user" })
  43033. ])
  43034. },
  43035. function() {
  43036. var _vm = this
  43037. var _h = _vm.$createElement
  43038. var _c = _vm._self._c || _h
  43039. return _c("label", { attrs: { for: "password" } }, [
  43040. _c("i", { staticClass: "fas fa-fw fa-key" })
  43041. ])
  43042. },
  43043. function() {
  43044. var _vm = this
  43045. var _h = _vm.$createElement
  43046. var _c = _vm._self._c || _h
  43047. return _c(
  43048. "div",
  43049. {
  43050. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43051. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43052. },
  43053. [
  43054. _c(
  43055. "button",
  43056. {
  43057. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43058. attrs: { type: "button" }
  43059. },
  43060. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43061. ),
  43062. _vm._v(" "),
  43063. _c(
  43064. "button",
  43065. {
  43066. staticClass: "btn btn-sm btn-danger p-lg-1",
  43067. attrs: { type: "button" }
  43068. },
  43069. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43070. )
  43071. ]
  43072. )
  43073. }
  43074. ]
  43075. render._withStripped = true
  43076. /***/ }),
  43077. /***/ "./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&":
  43078. /*!********************************************************************************************************************************************************************************************************!*\
  43079. !*** ./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& ***!
  43080. \********************************************************************************************************************************************************************************************************/
  43081. /*! exports provided: render, staticRenderFns */
  43082. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43083. "use strict";
  43084. __webpack_require__.r(__webpack_exports__);
  43085. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43086. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43087. var render = function() {
  43088. var _vm = this
  43089. var _h = _vm.$createElement
  43090. var _c = _vm._self._c || _h
  43091. return _c("div", { staticClass: "modal fade" }, [
  43092. _c(
  43093. "div",
  43094. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43095. [
  43096. _c("div", { staticClass: "modal-content" }, [
  43097. _c(
  43098. "div",
  43099. { staticClass: "modal-header" },
  43100. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43101. 2
  43102. ),
  43103. _vm._v(" "),
  43104. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43105. _vm._v(" "),
  43106. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43107. ])
  43108. ]
  43109. )
  43110. ])
  43111. }
  43112. var staticRenderFns = [
  43113. function() {
  43114. var _vm = this
  43115. var _h = _vm.$createElement
  43116. var _c = _vm._self._c || _h
  43117. return _c(
  43118. "button",
  43119. {
  43120. staticClass: "close",
  43121. attrs: {
  43122. type: "button",
  43123. "data-dismiss": "modal",
  43124. "aria-label": "Close"
  43125. }
  43126. },
  43127. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43128. )
  43129. }
  43130. ]
  43131. render._withStripped = true
  43132. /***/ }),
  43133. /***/ "./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&":
  43134. /*!********************************************************************************************************************************************************************************************************!*\
  43135. !*** ./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& ***!
  43136. \********************************************************************************************************************************************************************************************************/
  43137. /*! exports provided: render, staticRenderFns */
  43138. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43139. "use strict";
  43140. __webpack_require__.r(__webpack_exports__);
  43141. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43142. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43143. var render = function() {
  43144. var _vm = this
  43145. var _h = _vm.$createElement
  43146. var _c = _vm._self._c || _h
  43147. return _c(
  43148. "ul",
  43149. { staticClass: "list-unstyled" },
  43150. _vm._l(this.notes, function(note) {
  43151. return _c(
  43152. "li",
  43153. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43154. [
  43155. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43156. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43157. _vm._v(_vm._s(note.noteuser))
  43158. ]),
  43159. _vm._v(" "),
  43160. _c(
  43161. "div",
  43162. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43163. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43164. ),
  43165. _vm._v(" "),
  43166. _c(
  43167. "div",
  43168. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43169. [
  43170. _vm.authusername === note.noteuser ||
  43171. _vm.authusername === "admin"
  43172. ? [
  43173. _vm._m(0, true),
  43174. _vm._v(" "),
  43175. _vm._m(1, true),
  43176. _vm._v(" "),
  43177. _vm._m(2, true)
  43178. ]
  43179. : _vm._e()
  43180. ],
  43181. 2
  43182. )
  43183. ]),
  43184. _vm._v(" "),
  43185. _c("div", { staticClass: "col-md-10" }, [
  43186. _c("div", { staticClass: "card m-2" }, [
  43187. _c("div", { staticClass: "card-body p-2" }, [
  43188. _vm._v(
  43189. "\n " +
  43190. _vm._s(note.thenote) +
  43191. "\n "
  43192. )
  43193. ])
  43194. ])
  43195. ])
  43196. ]
  43197. )
  43198. }),
  43199. 0
  43200. )
  43201. }
  43202. var staticRenderFns = [
  43203. function() {
  43204. var _vm = this
  43205. var _h = _vm.$createElement
  43206. var _c = _vm._self._c || _h
  43207. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43208. _c("i", { staticClass: "fas fa-fw fa-edit" })
  43209. ])
  43210. },
  43211. function() {
  43212. var _vm = this
  43213. var _h = _vm.$createElement
  43214. var _c = _vm._self._c || _h
  43215. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43216. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43217. ])
  43218. },
  43219. function() {
  43220. var _vm = this
  43221. var _h = _vm.$createElement
  43222. var _c = _vm._self._c || _h
  43223. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43224. _c("i", { staticClass: "fa fa-fw fa-random" })
  43225. ])
  43226. }
  43227. ]
  43228. render._withStripped = true
  43229. /***/ }),
  43230. /***/ "./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&":
  43231. /*!*********************************************************************************************************************************************************************************************************!*\
  43232. !*** ./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& ***!
  43233. \*********************************************************************************************************************************************************************************************************/
  43234. /*! exports provided: render, staticRenderFns */
  43235. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43236. "use strict";
  43237. __webpack_require__.r(__webpack_exports__);
  43238. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43239. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43240. var render = function() {
  43241. var _vm = this
  43242. var _h = _vm.$createElement
  43243. var _c = _vm._self._c || _h
  43244. return _c(
  43245. "div",
  43246. [
  43247. _c(
  43248. "modal",
  43249. {
  43250. attrs: {
  43251. id: "workordereditModal",
  43252. tabindex: "-1",
  43253. role: "dialog",
  43254. "aria-labelledby": "workordereditModalLabel"
  43255. }
  43256. },
  43257. [
  43258. _c(
  43259. "h5",
  43260. {
  43261. staticClass: "modal-title",
  43262. attrs: { slot: "header", id: "workordereditModalLabel" },
  43263. slot: "header"
  43264. },
  43265. [_vm._v("\n Edit Work Order Information\n ")]
  43266. ),
  43267. _vm._v(" "),
  43268. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43269. _c("div", { staticClass: "form-group" }, [
  43270. _c("label", { attrs: { for: "probdesc" } }, [
  43271. _vm._v("Problem Description")
  43272. ]),
  43273. _vm._v(" "),
  43274. _c("textarea", {
  43275. directives: [
  43276. {
  43277. name: "model",
  43278. rawName: "v-model",
  43279. value: _vm.data.probdesc,
  43280. expression: "data.probdesc"
  43281. }
  43282. ],
  43283. staticClass: "form-control",
  43284. attrs: { id: "probdesc", name: "probdesc" },
  43285. domProps: { value: _vm.data.probdesc },
  43286. on: {
  43287. input: function($event) {
  43288. if ($event.target.composing) {
  43289. return
  43290. }
  43291. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43292. }
  43293. }
  43294. })
  43295. ]),
  43296. _vm._v(" "),
  43297. _c("div", { staticClass: "form-group" }, [
  43298. _c("label", { attrs: { for: "suggested" } }, [
  43299. _vm._v("Suggested Solution")
  43300. ]),
  43301. _vm._v(" "),
  43302. _c("textarea", {
  43303. directives: [
  43304. {
  43305. name: "model",
  43306. rawName: "v-model",
  43307. value: _vm.data.suggested,
  43308. expression: "data.suggested"
  43309. }
  43310. ],
  43311. staticClass: "form-control",
  43312. attrs: { id: "suggested", name: "suggested" },
  43313. domProps: { value: _vm.data.suggested },
  43314. on: {
  43315. input: function($event) {
  43316. if ($event.target.composing) {
  43317. return
  43318. }
  43319. _vm.$set(_vm.data, "suggested", $event.target.value)
  43320. }
  43321. }
  43322. })
  43323. ]),
  43324. _vm._v(" "),
  43325. _c("div", { staticClass: "form-group" }, [
  43326. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43327. _vm._v(" "),
  43328. _c(
  43329. "select",
  43330. {
  43331. directives: [
  43332. {
  43333. name: "model",
  43334. rawName: "v-model",
  43335. value: _vm.data.storeid,
  43336. expression: "data.storeid"
  43337. }
  43338. ],
  43339. staticClass: "form-control",
  43340. attrs: { name: "storelist", id: "storelist" },
  43341. on: {
  43342. change: function($event) {
  43343. var $$selectedVal = Array.prototype.filter
  43344. .call($event.target.options, function(o) {
  43345. return o.selected
  43346. })
  43347. .map(function(o) {
  43348. var val = "_value" in o ? o._value : o.value
  43349. return val
  43350. })
  43351. _vm.$set(
  43352. _vm.data,
  43353. "storeid",
  43354. $event.target.multiple
  43355. ? $$selectedVal
  43356. : $$selectedVal[0]
  43357. )
  43358. }
  43359. }
  43360. },
  43361. _vm._l(_vm.storeList, function(store) {
  43362. return _c(
  43363. "option",
  43364. { key: store.storeid, domProps: { value: store.storeid } },
  43365. [
  43366. _vm._v(
  43367. "\n " +
  43368. _vm._s(store.storesname) +
  43369. "\n "
  43370. )
  43371. ]
  43372. )
  43373. }),
  43374. 0
  43375. )
  43376. ])
  43377. ]),
  43378. _vm._v(" "),
  43379. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43380. _c(
  43381. "button",
  43382. {
  43383. staticClass: "btn btn-secondary",
  43384. attrs: { type: "button", "data-dismiss": "modal" }
  43385. },
  43386. [_vm._v("Close")]
  43387. ),
  43388. _vm._v(" "),
  43389. _c(
  43390. "button",
  43391. {
  43392. staticClass: "btn btn-primary",
  43393. attrs: { type: "button" },
  43394. on: {
  43395. click: function($event) {
  43396. return _vm.updateWorkOrder()
  43397. }
  43398. }
  43399. },
  43400. [_vm._v("Save")]
  43401. )
  43402. ])
  43403. ]
  43404. ),
  43405. _vm._v(" "),
  43406. _c("p", [
  43407. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43408. _vm._v(" "),
  43409. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43410. ]),
  43411. _vm._v(" "),
  43412. _c("p", [
  43413. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43414. _vm._v(" "),
  43415. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43416. ]),
  43417. _vm._v(" "),
  43418. _c("p", [
  43419. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43420. _vm._v(" "),
  43421. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43422. ]),
  43423. _vm._v(" "),
  43424. _c("p", [
  43425. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43426. _vm._v(" "),
  43427. _c("span", [_vm._v(_vm._s(_vm.storeName))])
  43428. ]),
  43429. _vm._v(" "),
  43430. _c("p", [
  43431. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43432. _vm._v(" "),
  43433. _c(
  43434. "span",
  43435. {
  43436. staticClass: "dashed-underline",
  43437. attrs: {
  43438. "data-toggle": "tooltip",
  43439. "data-placement": "bottom",
  43440. title: this.getHRDate(this.data.dropdate)
  43441. }
  43442. },
  43443. [
  43444. _vm._v(
  43445. "\n " +
  43446. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43447. " days ago\n "
  43448. )
  43449. ]
  43450. )
  43451. ]),
  43452. _vm._v(" "),
  43453. _c("p", [
  43454. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43455. _vm._v(" "),
  43456. !this.isZero(this.data.pickupdate)
  43457. ? _c(
  43458. "span",
  43459. {
  43460. staticClass: "dashed-underline",
  43461. attrs: {
  43462. "data-toggle": "tooltip",
  43463. "data-placement": "bottom",
  43464. title: this.getHRDate(this.data.pickupdate)
  43465. }
  43466. },
  43467. [
  43468. _vm._v(
  43469. "\n " +
  43470. _vm._s(
  43471. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43472. ) +
  43473. " days ago\n "
  43474. )
  43475. ]
  43476. )
  43477. : _vm._e()
  43478. ]),
  43479. _vm._v(" "),
  43480. _c(
  43481. "button",
  43482. {
  43483. staticClass: "btn btn-primary",
  43484. attrs: {
  43485. type: "button",
  43486. "data-toggle": "modal",
  43487. "data-target": "#workordereditModal"
  43488. }
  43489. },
  43490. [_vm._v("Edit")]
  43491. )
  43492. ],
  43493. 1
  43494. )
  43495. }
  43496. var staticRenderFns = []
  43497. render._withStripped = true
  43498. /***/ }),
  43499. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43500. /*!********************************************************************!*\
  43501. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43502. \********************************************************************/
  43503. /*! exports provided: default */
  43504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43505. "use strict";
  43506. __webpack_require__.r(__webpack_exports__);
  43507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43508. /* globals __VUE_SSR_CONTEXT__ */
  43509. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43510. // This module is a runtime utility for cleaner component module output and will
  43511. // be included in the final webpack user bundle.
  43512. function normalizeComponent (
  43513. scriptExports,
  43514. render,
  43515. staticRenderFns,
  43516. functionalTemplate,
  43517. injectStyles,
  43518. scopeId,
  43519. moduleIdentifier, /* server only */
  43520. shadowMode /* vue-cli only */
  43521. ) {
  43522. // Vue.extend constructor export interop
  43523. var options = typeof scriptExports === 'function'
  43524. ? scriptExports.options
  43525. : scriptExports
  43526. // render functions
  43527. if (render) {
  43528. options.render = render
  43529. options.staticRenderFns = staticRenderFns
  43530. options._compiled = true
  43531. }
  43532. // functional template
  43533. if (functionalTemplate) {
  43534. options.functional = true
  43535. }
  43536. // scopedId
  43537. if (scopeId) {
  43538. options._scopeId = 'data-v-' + scopeId
  43539. }
  43540. var hook
  43541. if (moduleIdentifier) { // server build
  43542. hook = function (context) {
  43543. // 2.3 injection
  43544. context =
  43545. context || // cached call
  43546. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43547. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43548. // 2.2 with runInNewContext: true
  43549. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43550. context = __VUE_SSR_CONTEXT__
  43551. }
  43552. // inject component styles
  43553. if (injectStyles) {
  43554. injectStyles.call(this, context)
  43555. }
  43556. // register component module identifier for async chunk inferrence
  43557. if (context && context._registeredComponents) {
  43558. context._registeredComponents.add(moduleIdentifier)
  43559. }
  43560. }
  43561. // used by ssr in case component is cached and beforeCreate
  43562. // never gets called
  43563. options._ssrRegister = hook
  43564. } else if (injectStyles) {
  43565. hook = shadowMode
  43566. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43567. : injectStyles
  43568. }
  43569. if (hook) {
  43570. if (options.functional) {
  43571. // for template-only hot-reload because in that case the render fn doesn't
  43572. // go through the normalizer
  43573. options._injectStyles = hook
  43574. // register for functioal component in vue file
  43575. var originalRender = options.render
  43576. options.render = function renderWithStyleInjection (h, context) {
  43577. hook.call(context)
  43578. return originalRender(h, context)
  43579. }
  43580. } else {
  43581. // inject component registration as beforeCreate hook
  43582. var existing = options.beforeCreate
  43583. options.beforeCreate = existing
  43584. ? [].concat(existing, hook)
  43585. : [hook]
  43586. }
  43587. }
  43588. return {
  43589. exports: scriptExports,
  43590. options: options
  43591. }
  43592. }
  43593. /***/ }),
  43594. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43595. /*!*************************************************!*\
  43596. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  43597. \*************************************************/
  43598. /*! no static exports found */
  43599. /***/ (function(module, exports, __webpack_require__) {
  43600. "use strict";
  43601. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  43602. * Vue.js v2.6.11
  43603. * (c) 2014-2019 Evan You
  43604. * Released under the MIT License.
  43605. */
  43606. /* */
  43607. var emptyObject = Object.freeze({});
  43608. // These helpers produce better VM code in JS engines due to their
  43609. // explicitness and function inlining.
  43610. function isUndef (v) {
  43611. return v === undefined || v === null
  43612. }
  43613. function isDef (v) {
  43614. return v !== undefined && v !== null
  43615. }
  43616. function isTrue (v) {
  43617. return v === true
  43618. }
  43619. function isFalse (v) {
  43620. return v === false
  43621. }
  43622. /**
  43623. * Check if value is primitive.
  43624. */
  43625. function isPrimitive (value) {
  43626. return (
  43627. typeof value === 'string' ||
  43628. typeof value === 'number' ||
  43629. // $flow-disable-line
  43630. typeof value === 'symbol' ||
  43631. typeof value === 'boolean'
  43632. )
  43633. }
  43634. /**
  43635. * Quick object check - this is primarily used to tell
  43636. * Objects from primitive values when we know the value
  43637. * is a JSON-compliant type.
  43638. */
  43639. function isObject (obj) {
  43640. return obj !== null && typeof obj === 'object'
  43641. }
  43642. /**
  43643. * Get the raw type string of a value, e.g., [object Object].
  43644. */
  43645. var _toString = Object.prototype.toString;
  43646. function toRawType (value) {
  43647. return _toString.call(value).slice(8, -1)
  43648. }
  43649. /**
  43650. * Strict object type check. Only returns true
  43651. * for plain JavaScript objects.
  43652. */
  43653. function isPlainObject (obj) {
  43654. return _toString.call(obj) === '[object Object]'
  43655. }
  43656. function isRegExp (v) {
  43657. return _toString.call(v) === '[object RegExp]'
  43658. }
  43659. /**
  43660. * Check if val is a valid array index.
  43661. */
  43662. function isValidArrayIndex (val) {
  43663. var n = parseFloat(String(val));
  43664. return n >= 0 && Math.floor(n) === n && isFinite(val)
  43665. }
  43666. function isPromise (val) {
  43667. return (
  43668. isDef(val) &&
  43669. typeof val.then === 'function' &&
  43670. typeof val.catch === 'function'
  43671. )
  43672. }
  43673. /**
  43674. * Convert a value to a string that is actually rendered.
  43675. */
  43676. function toString (val) {
  43677. return val == null
  43678. ? ''
  43679. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  43680. ? JSON.stringify(val, null, 2)
  43681. : String(val)
  43682. }
  43683. /**
  43684. * Convert an input value to a number for persistence.
  43685. * If the conversion fails, return original string.
  43686. */
  43687. function toNumber (val) {
  43688. var n = parseFloat(val);
  43689. return isNaN(n) ? val : n
  43690. }
  43691. /**
  43692. * Make a map and return a function for checking if a key
  43693. * is in that map.
  43694. */
  43695. function makeMap (
  43696. str,
  43697. expectsLowerCase
  43698. ) {
  43699. var map = Object.create(null);
  43700. var list = str.split(',');
  43701. for (var i = 0; i < list.length; i++) {
  43702. map[list[i]] = true;
  43703. }
  43704. return expectsLowerCase
  43705. ? function (val) { return map[val.toLowerCase()]; }
  43706. : function (val) { return map[val]; }
  43707. }
  43708. /**
  43709. * Check if a tag is a built-in tag.
  43710. */
  43711. var isBuiltInTag = makeMap('slot,component', true);
  43712. /**
  43713. * Check if an attribute is a reserved attribute.
  43714. */
  43715. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  43716. /**
  43717. * Remove an item from an array.
  43718. */
  43719. function remove (arr, item) {
  43720. if (arr.length) {
  43721. var index = arr.indexOf(item);
  43722. if (index > -1) {
  43723. return arr.splice(index, 1)
  43724. }
  43725. }
  43726. }
  43727. /**
  43728. * Check whether an object has the property.
  43729. */
  43730. var hasOwnProperty = Object.prototype.hasOwnProperty;
  43731. function hasOwn (obj, key) {
  43732. return hasOwnProperty.call(obj, key)
  43733. }
  43734. /**
  43735. * Create a cached version of a pure function.
  43736. */
  43737. function cached (fn) {
  43738. var cache = Object.create(null);
  43739. return (function cachedFn (str) {
  43740. var hit = cache[str];
  43741. return hit || (cache[str] = fn(str))
  43742. })
  43743. }
  43744. /**
  43745. * Camelize a hyphen-delimited string.
  43746. */
  43747. var camelizeRE = /-(\w)/g;
  43748. var camelize = cached(function (str) {
  43749. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  43750. });
  43751. /**
  43752. * Capitalize a string.
  43753. */
  43754. var capitalize = cached(function (str) {
  43755. return str.charAt(0).toUpperCase() + str.slice(1)
  43756. });
  43757. /**
  43758. * Hyphenate a camelCase string.
  43759. */
  43760. var hyphenateRE = /\B([A-Z])/g;
  43761. var hyphenate = cached(function (str) {
  43762. return str.replace(hyphenateRE, '-$1').toLowerCase()
  43763. });
  43764. /**
  43765. * Simple bind polyfill for environments that do not support it,
  43766. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43767. * since native bind is now performant enough in most browsers.
  43768. * But removing it would mean breaking code that was able to run in
  43769. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43770. */
  43771. /* istanbul ignore next */
  43772. function polyfillBind (fn, ctx) {
  43773. function boundFn (a) {
  43774. var l = arguments.length;
  43775. return l
  43776. ? l > 1
  43777. ? fn.apply(ctx, arguments)
  43778. : fn.call(ctx, a)
  43779. : fn.call(ctx)
  43780. }
  43781. boundFn._length = fn.length;
  43782. return boundFn
  43783. }
  43784. function nativeBind (fn, ctx) {
  43785. return fn.bind(ctx)
  43786. }
  43787. var bind = Function.prototype.bind
  43788. ? nativeBind
  43789. : polyfillBind;
  43790. /**
  43791. * Convert an Array-like object to a real Array.
  43792. */
  43793. function toArray (list, start) {
  43794. start = start || 0;
  43795. var i = list.length - start;
  43796. var ret = new Array(i);
  43797. while (i--) {
  43798. ret[i] = list[i + start];
  43799. }
  43800. return ret
  43801. }
  43802. /**
  43803. * Mix properties into target object.
  43804. */
  43805. function extend (to, _from) {
  43806. for (var key in _from) {
  43807. to[key] = _from[key];
  43808. }
  43809. return to
  43810. }
  43811. /**
  43812. * Merge an Array of Objects into a single Object.
  43813. */
  43814. function toObject (arr) {
  43815. var res = {};
  43816. for (var i = 0; i < arr.length; i++) {
  43817. if (arr[i]) {
  43818. extend(res, arr[i]);
  43819. }
  43820. }
  43821. return res
  43822. }
  43823. /* eslint-disable no-unused-vars */
  43824. /**
  43825. * Perform no operation.
  43826. * Stubbing args to make Flow happy without leaving useless transpiled code
  43827. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  43828. */
  43829. function noop (a, b, c) {}
  43830. /**
  43831. * Always return false.
  43832. */
  43833. var no = function (a, b, c) { return false; };
  43834. /* eslint-enable no-unused-vars */
  43835. /**
  43836. * Return the same value.
  43837. */
  43838. var identity = function (_) { return _; };
  43839. /**
  43840. * Generate a string containing static keys from compiler modules.
  43841. */
  43842. function genStaticKeys (modules) {
  43843. return modules.reduce(function (keys, m) {
  43844. return keys.concat(m.staticKeys || [])
  43845. }, []).join(',')
  43846. }
  43847. /**
  43848. * Check if two values are loosely equal - that is,
  43849. * if they are plain objects, do they have the same shape?
  43850. */
  43851. function looseEqual (a, b) {
  43852. if (a === b) { return true }
  43853. var isObjectA = isObject(a);
  43854. var isObjectB = isObject(b);
  43855. if (isObjectA && isObjectB) {
  43856. try {
  43857. var isArrayA = Array.isArray(a);
  43858. var isArrayB = Array.isArray(b);
  43859. if (isArrayA && isArrayB) {
  43860. return a.length === b.length && a.every(function (e, i) {
  43861. return looseEqual(e, b[i])
  43862. })
  43863. } else if (a instanceof Date && b instanceof Date) {
  43864. return a.getTime() === b.getTime()
  43865. } else if (!isArrayA && !isArrayB) {
  43866. var keysA = Object.keys(a);
  43867. var keysB = Object.keys(b);
  43868. return keysA.length === keysB.length && keysA.every(function (key) {
  43869. return looseEqual(a[key], b[key])
  43870. })
  43871. } else {
  43872. /* istanbul ignore next */
  43873. return false
  43874. }
  43875. } catch (e) {
  43876. /* istanbul ignore next */
  43877. return false
  43878. }
  43879. } else if (!isObjectA && !isObjectB) {
  43880. return String(a) === String(b)
  43881. } else {
  43882. return false
  43883. }
  43884. }
  43885. /**
  43886. * Return the first index at which a loosely equal value can be
  43887. * found in the array (if value is a plain object, the array must
  43888. * contain an object of the same shape), or -1 if it is not present.
  43889. */
  43890. function looseIndexOf (arr, val) {
  43891. for (var i = 0; i < arr.length; i++) {
  43892. if (looseEqual(arr[i], val)) { return i }
  43893. }
  43894. return -1
  43895. }
  43896. /**
  43897. * Ensure a function is called only once.
  43898. */
  43899. function once (fn) {
  43900. var called = false;
  43901. return function () {
  43902. if (!called) {
  43903. called = true;
  43904. fn.apply(this, arguments);
  43905. }
  43906. }
  43907. }
  43908. var SSR_ATTR = 'data-server-rendered';
  43909. var ASSET_TYPES = [
  43910. 'component',
  43911. 'directive',
  43912. 'filter'
  43913. ];
  43914. var LIFECYCLE_HOOKS = [
  43915. 'beforeCreate',
  43916. 'created',
  43917. 'beforeMount',
  43918. 'mounted',
  43919. 'beforeUpdate',
  43920. 'updated',
  43921. 'beforeDestroy',
  43922. 'destroyed',
  43923. 'activated',
  43924. 'deactivated',
  43925. 'errorCaptured',
  43926. 'serverPrefetch'
  43927. ];
  43928. /* */
  43929. var config = ({
  43930. /**
  43931. * Option merge strategies (used in core/util/options)
  43932. */
  43933. // $flow-disable-line
  43934. optionMergeStrategies: Object.create(null),
  43935. /**
  43936. * Whether to suppress warnings.
  43937. */
  43938. silent: false,
  43939. /**
  43940. * Show production mode tip message on boot?
  43941. */
  43942. productionTip: "development" !== 'production',
  43943. /**
  43944. * Whether to enable devtools
  43945. */
  43946. devtools: "development" !== 'production',
  43947. /**
  43948. * Whether to record perf
  43949. */
  43950. performance: false,
  43951. /**
  43952. * Error handler for watcher errors
  43953. */
  43954. errorHandler: null,
  43955. /**
  43956. * Warn handler for watcher warns
  43957. */
  43958. warnHandler: null,
  43959. /**
  43960. * Ignore certain custom elements
  43961. */
  43962. ignoredElements: [],
  43963. /**
  43964. * Custom user key aliases for v-on
  43965. */
  43966. // $flow-disable-line
  43967. keyCodes: Object.create(null),
  43968. /**
  43969. * Check if a tag is reserved so that it cannot be registered as a
  43970. * component. This is platform-dependent and may be overwritten.
  43971. */
  43972. isReservedTag: no,
  43973. /**
  43974. * Check if an attribute is reserved so that it cannot be used as a component
  43975. * prop. This is platform-dependent and may be overwritten.
  43976. */
  43977. isReservedAttr: no,
  43978. /**
  43979. * Check if a tag is an unknown element.
  43980. * Platform-dependent.
  43981. */
  43982. isUnknownElement: no,
  43983. /**
  43984. * Get the namespace of an element
  43985. */
  43986. getTagNamespace: noop,
  43987. /**
  43988. * Parse the real tag name for the specific platform.
  43989. */
  43990. parsePlatformTagName: identity,
  43991. /**
  43992. * Check if an attribute must be bound using property, e.g. value
  43993. * Platform-dependent.
  43994. */
  43995. mustUseProp: no,
  43996. /**
  43997. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  43998. * This will significantly reduce performance if set to false.
  43999. */
  44000. async: true,
  44001. /**
  44002. * Exposed for legacy reasons
  44003. */
  44004. _lifecycleHooks: LIFECYCLE_HOOKS
  44005. });
  44006. /* */
  44007. /**
  44008. * unicode letters used for parsing html tags, component names and property paths.
  44009. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44010. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44011. */
  44012. 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/;
  44013. /**
  44014. * Check if a string starts with $ or _
  44015. */
  44016. function isReserved (str) {
  44017. var c = (str + '').charCodeAt(0);
  44018. return c === 0x24 || c === 0x5F
  44019. }
  44020. /**
  44021. * Define a property.
  44022. */
  44023. function def (obj, key, val, enumerable) {
  44024. Object.defineProperty(obj, key, {
  44025. value: val,
  44026. enumerable: !!enumerable,
  44027. writable: true,
  44028. configurable: true
  44029. });
  44030. }
  44031. /**
  44032. * Parse simple path.
  44033. */
  44034. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44035. function parsePath (path) {
  44036. if (bailRE.test(path)) {
  44037. return
  44038. }
  44039. var segments = path.split('.');
  44040. return function (obj) {
  44041. for (var i = 0; i < segments.length; i++) {
  44042. if (!obj) { return }
  44043. obj = obj[segments[i]];
  44044. }
  44045. return obj
  44046. }
  44047. }
  44048. /* */
  44049. // can we use __proto__?
  44050. var hasProto = '__proto__' in {};
  44051. // Browser environment sniffing
  44052. var inBrowser = typeof window !== 'undefined';
  44053. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44054. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44055. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44056. var isIE = UA && /msie|trident/.test(UA);
  44057. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44058. var isEdge = UA && UA.indexOf('edge/') > 0;
  44059. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44060. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44061. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44062. var isPhantomJS = UA && /phantomjs/.test(UA);
  44063. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44064. // Firefox has a "watch" function on Object.prototype...
  44065. var nativeWatch = ({}).watch;
  44066. var supportsPassive = false;
  44067. if (inBrowser) {
  44068. try {
  44069. var opts = {};
  44070. Object.defineProperty(opts, 'passive', ({
  44071. get: function get () {
  44072. /* istanbul ignore next */
  44073. supportsPassive = true;
  44074. }
  44075. })); // https://github.com/facebook/flow/issues/285
  44076. window.addEventListener('test-passive', null, opts);
  44077. } catch (e) {}
  44078. }
  44079. // this needs to be lazy-evaled because vue may be required before
  44080. // vue-server-renderer can set VUE_ENV
  44081. var _isServer;
  44082. var isServerRendering = function () {
  44083. if (_isServer === undefined) {
  44084. /* istanbul ignore if */
  44085. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44086. // detect presence of vue-server-renderer and avoid
  44087. // Webpack shimming the process
  44088. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44089. } else {
  44090. _isServer = false;
  44091. }
  44092. }
  44093. return _isServer
  44094. };
  44095. // detect devtools
  44096. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44097. /* istanbul ignore next */
  44098. function isNative (Ctor) {
  44099. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44100. }
  44101. var hasSymbol =
  44102. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44103. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44104. var _Set;
  44105. /* istanbul ignore if */ // $flow-disable-line
  44106. if (typeof Set !== 'undefined' && isNative(Set)) {
  44107. // use native Set when available.
  44108. _Set = Set;
  44109. } else {
  44110. // a non-standard Set polyfill that only works with primitive keys.
  44111. _Set = /*@__PURE__*/(function () {
  44112. function Set () {
  44113. this.set = Object.create(null);
  44114. }
  44115. Set.prototype.has = function has (key) {
  44116. return this.set[key] === true
  44117. };
  44118. Set.prototype.add = function add (key) {
  44119. this.set[key] = true;
  44120. };
  44121. Set.prototype.clear = function clear () {
  44122. this.set = Object.create(null);
  44123. };
  44124. return Set;
  44125. }());
  44126. }
  44127. /* */
  44128. var warn = noop;
  44129. var tip = noop;
  44130. var generateComponentTrace = (noop); // work around flow check
  44131. var formatComponentName = (noop);
  44132. {
  44133. var hasConsole = typeof console !== 'undefined';
  44134. var classifyRE = /(?:^|[-_])(\w)/g;
  44135. var classify = function (str) { return str
  44136. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44137. .replace(/[-_]/g, ''); };
  44138. warn = function (msg, vm) {
  44139. var trace = vm ? generateComponentTrace(vm) : '';
  44140. if (config.warnHandler) {
  44141. config.warnHandler.call(null, msg, vm, trace);
  44142. } else if (hasConsole && (!config.silent)) {
  44143. console.error(("[Vue warn]: " + msg + trace));
  44144. }
  44145. };
  44146. tip = function (msg, vm) {
  44147. if (hasConsole && (!config.silent)) {
  44148. console.warn("[Vue tip]: " + msg + (
  44149. vm ? generateComponentTrace(vm) : ''
  44150. ));
  44151. }
  44152. };
  44153. formatComponentName = function (vm, includeFile) {
  44154. if (vm.$root === vm) {
  44155. return '<Root>'
  44156. }
  44157. var options = typeof vm === 'function' && vm.cid != null
  44158. ? vm.options
  44159. : vm._isVue
  44160. ? vm.$options || vm.constructor.options
  44161. : vm;
  44162. var name = options.name || options._componentTag;
  44163. var file = options.__file;
  44164. if (!name && file) {
  44165. var match = file.match(/([^/\\]+)\.vue$/);
  44166. name = match && match[1];
  44167. }
  44168. return (
  44169. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44170. (file && includeFile !== false ? (" at " + file) : '')
  44171. )
  44172. };
  44173. var repeat = function (str, n) {
  44174. var res = '';
  44175. while (n) {
  44176. if (n % 2 === 1) { res += str; }
  44177. if (n > 1) { str += str; }
  44178. n >>= 1;
  44179. }
  44180. return res
  44181. };
  44182. generateComponentTrace = function (vm) {
  44183. if (vm._isVue && vm.$parent) {
  44184. var tree = [];
  44185. var currentRecursiveSequence = 0;
  44186. while (vm) {
  44187. if (tree.length > 0) {
  44188. var last = tree[tree.length - 1];
  44189. if (last.constructor === vm.constructor) {
  44190. currentRecursiveSequence++;
  44191. vm = vm.$parent;
  44192. continue
  44193. } else if (currentRecursiveSequence > 0) {
  44194. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44195. currentRecursiveSequence = 0;
  44196. }
  44197. }
  44198. tree.push(vm);
  44199. vm = vm.$parent;
  44200. }
  44201. return '\n\nfound in\n\n' + tree
  44202. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44203. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44204. : formatComponentName(vm))); })
  44205. .join('\n')
  44206. } else {
  44207. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44208. }
  44209. };
  44210. }
  44211. /* */
  44212. var uid = 0;
  44213. /**
  44214. * A dep is an observable that can have multiple
  44215. * directives subscribing to it.
  44216. */
  44217. var Dep = function Dep () {
  44218. this.id = uid++;
  44219. this.subs = [];
  44220. };
  44221. Dep.prototype.addSub = function addSub (sub) {
  44222. this.subs.push(sub);
  44223. };
  44224. Dep.prototype.removeSub = function removeSub (sub) {
  44225. remove(this.subs, sub);
  44226. };
  44227. Dep.prototype.depend = function depend () {
  44228. if (Dep.target) {
  44229. Dep.target.addDep(this);
  44230. }
  44231. };
  44232. Dep.prototype.notify = function notify () {
  44233. // stabilize the subscriber list first
  44234. var subs = this.subs.slice();
  44235. if (!config.async) {
  44236. // subs aren't sorted in scheduler if not running async
  44237. // we need to sort them now to make sure they fire in correct
  44238. // order
  44239. subs.sort(function (a, b) { return a.id - b.id; });
  44240. }
  44241. for (var i = 0, l = subs.length; i < l; i++) {
  44242. subs[i].update();
  44243. }
  44244. };
  44245. // The current target watcher being evaluated.
  44246. // This is globally unique because only one watcher
  44247. // can be evaluated at a time.
  44248. Dep.target = null;
  44249. var targetStack = [];
  44250. function pushTarget (target) {
  44251. targetStack.push(target);
  44252. Dep.target = target;
  44253. }
  44254. function popTarget () {
  44255. targetStack.pop();
  44256. Dep.target = targetStack[targetStack.length - 1];
  44257. }
  44258. /* */
  44259. var VNode = function VNode (
  44260. tag,
  44261. data,
  44262. children,
  44263. text,
  44264. elm,
  44265. context,
  44266. componentOptions,
  44267. asyncFactory
  44268. ) {
  44269. this.tag = tag;
  44270. this.data = data;
  44271. this.children = children;
  44272. this.text = text;
  44273. this.elm = elm;
  44274. this.ns = undefined;
  44275. this.context = context;
  44276. this.fnContext = undefined;
  44277. this.fnOptions = undefined;
  44278. this.fnScopeId = undefined;
  44279. this.key = data && data.key;
  44280. this.componentOptions = componentOptions;
  44281. this.componentInstance = undefined;
  44282. this.parent = undefined;
  44283. this.raw = false;
  44284. this.isStatic = false;
  44285. this.isRootInsert = true;
  44286. this.isComment = false;
  44287. this.isCloned = false;
  44288. this.isOnce = false;
  44289. this.asyncFactory = asyncFactory;
  44290. this.asyncMeta = undefined;
  44291. this.isAsyncPlaceholder = false;
  44292. };
  44293. var prototypeAccessors = { child: { configurable: true } };
  44294. // DEPRECATED: alias for componentInstance for backwards compat.
  44295. /* istanbul ignore next */
  44296. prototypeAccessors.child.get = function () {
  44297. return this.componentInstance
  44298. };
  44299. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44300. var createEmptyVNode = function (text) {
  44301. if ( text === void 0 ) text = '';
  44302. var node = new VNode();
  44303. node.text = text;
  44304. node.isComment = true;
  44305. return node
  44306. };
  44307. function createTextVNode (val) {
  44308. return new VNode(undefined, undefined, undefined, String(val))
  44309. }
  44310. // optimized shallow clone
  44311. // used for static nodes and slot nodes because they may be reused across
  44312. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44313. // on their elm reference.
  44314. function cloneVNode (vnode) {
  44315. var cloned = new VNode(
  44316. vnode.tag,
  44317. vnode.data,
  44318. // #7975
  44319. // clone children array to avoid mutating original in case of cloning
  44320. // a child.
  44321. vnode.children && vnode.children.slice(),
  44322. vnode.text,
  44323. vnode.elm,
  44324. vnode.context,
  44325. vnode.componentOptions,
  44326. vnode.asyncFactory
  44327. );
  44328. cloned.ns = vnode.ns;
  44329. cloned.isStatic = vnode.isStatic;
  44330. cloned.key = vnode.key;
  44331. cloned.isComment = vnode.isComment;
  44332. cloned.fnContext = vnode.fnContext;
  44333. cloned.fnOptions = vnode.fnOptions;
  44334. cloned.fnScopeId = vnode.fnScopeId;
  44335. cloned.asyncMeta = vnode.asyncMeta;
  44336. cloned.isCloned = true;
  44337. return cloned
  44338. }
  44339. /*
  44340. * not type checking this file because flow doesn't play well with
  44341. * dynamically accessing methods on Array prototype
  44342. */
  44343. var arrayProto = Array.prototype;
  44344. var arrayMethods = Object.create(arrayProto);
  44345. var methodsToPatch = [
  44346. 'push',
  44347. 'pop',
  44348. 'shift',
  44349. 'unshift',
  44350. 'splice',
  44351. 'sort',
  44352. 'reverse'
  44353. ];
  44354. /**
  44355. * Intercept mutating methods and emit events
  44356. */
  44357. methodsToPatch.forEach(function (method) {
  44358. // cache original method
  44359. var original = arrayProto[method];
  44360. def(arrayMethods, method, function mutator () {
  44361. var args = [], len = arguments.length;
  44362. while ( len-- ) args[ len ] = arguments[ len ];
  44363. var result = original.apply(this, args);
  44364. var ob = this.__ob__;
  44365. var inserted;
  44366. switch (method) {
  44367. case 'push':
  44368. case 'unshift':
  44369. inserted = args;
  44370. break
  44371. case 'splice':
  44372. inserted = args.slice(2);
  44373. break
  44374. }
  44375. if (inserted) { ob.observeArray(inserted); }
  44376. // notify change
  44377. ob.dep.notify();
  44378. return result
  44379. });
  44380. });
  44381. /* */
  44382. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44383. /**
  44384. * In some cases we may want to disable observation inside a component's
  44385. * update computation.
  44386. */
  44387. var shouldObserve = true;
  44388. function toggleObserving (value) {
  44389. shouldObserve = value;
  44390. }
  44391. /**
  44392. * Observer class that is attached to each observed
  44393. * object. Once attached, the observer converts the target
  44394. * object's property keys into getter/setters that
  44395. * collect dependencies and dispatch updates.
  44396. */
  44397. var Observer = function Observer (value) {
  44398. this.value = value;
  44399. this.dep = new Dep();
  44400. this.vmCount = 0;
  44401. def(value, '__ob__', this);
  44402. if (Array.isArray(value)) {
  44403. if (hasProto) {
  44404. protoAugment(value, arrayMethods);
  44405. } else {
  44406. copyAugment(value, arrayMethods, arrayKeys);
  44407. }
  44408. this.observeArray(value);
  44409. } else {
  44410. this.walk(value);
  44411. }
  44412. };
  44413. /**
  44414. * Walk through all properties and convert them into
  44415. * getter/setters. This method should only be called when
  44416. * value type is Object.
  44417. */
  44418. Observer.prototype.walk = function walk (obj) {
  44419. var keys = Object.keys(obj);
  44420. for (var i = 0; i < keys.length; i++) {
  44421. defineReactive$$1(obj, keys[i]);
  44422. }
  44423. };
  44424. /**
  44425. * Observe a list of Array items.
  44426. */
  44427. Observer.prototype.observeArray = function observeArray (items) {
  44428. for (var i = 0, l = items.length; i < l; i++) {
  44429. observe(items[i]);
  44430. }
  44431. };
  44432. // helpers
  44433. /**
  44434. * Augment a target Object or Array by intercepting
  44435. * the prototype chain using __proto__
  44436. */
  44437. function protoAugment (target, src) {
  44438. /* eslint-disable no-proto */
  44439. target.__proto__ = src;
  44440. /* eslint-enable no-proto */
  44441. }
  44442. /**
  44443. * Augment a target Object or Array by defining
  44444. * hidden properties.
  44445. */
  44446. /* istanbul ignore next */
  44447. function copyAugment (target, src, keys) {
  44448. for (var i = 0, l = keys.length; i < l; i++) {
  44449. var key = keys[i];
  44450. def(target, key, src[key]);
  44451. }
  44452. }
  44453. /**
  44454. * Attempt to create an observer instance for a value,
  44455. * returns the new observer if successfully observed,
  44456. * or the existing observer if the value already has one.
  44457. */
  44458. function observe (value, asRootData) {
  44459. if (!isObject(value) || value instanceof VNode) {
  44460. return
  44461. }
  44462. var ob;
  44463. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44464. ob = value.__ob__;
  44465. } else if (
  44466. shouldObserve &&
  44467. !isServerRendering() &&
  44468. (Array.isArray(value) || isPlainObject(value)) &&
  44469. Object.isExtensible(value) &&
  44470. !value._isVue
  44471. ) {
  44472. ob = new Observer(value);
  44473. }
  44474. if (asRootData && ob) {
  44475. ob.vmCount++;
  44476. }
  44477. return ob
  44478. }
  44479. /**
  44480. * Define a reactive property on an Object.
  44481. */
  44482. function defineReactive$$1 (
  44483. obj,
  44484. key,
  44485. val,
  44486. customSetter,
  44487. shallow
  44488. ) {
  44489. var dep = new Dep();
  44490. var property = Object.getOwnPropertyDescriptor(obj, key);
  44491. if (property && property.configurable === false) {
  44492. return
  44493. }
  44494. // cater for pre-defined getter/setters
  44495. var getter = property && property.get;
  44496. var setter = property && property.set;
  44497. if ((!getter || setter) && arguments.length === 2) {
  44498. val = obj[key];
  44499. }
  44500. var childOb = !shallow && observe(val);
  44501. Object.defineProperty(obj, key, {
  44502. enumerable: true,
  44503. configurable: true,
  44504. get: function reactiveGetter () {
  44505. var value = getter ? getter.call(obj) : val;
  44506. if (Dep.target) {
  44507. dep.depend();
  44508. if (childOb) {
  44509. childOb.dep.depend();
  44510. if (Array.isArray(value)) {
  44511. dependArray(value);
  44512. }
  44513. }
  44514. }
  44515. return value
  44516. },
  44517. set: function reactiveSetter (newVal) {
  44518. var value = getter ? getter.call(obj) : val;
  44519. /* eslint-disable no-self-compare */
  44520. if (newVal === value || (newVal !== newVal && value !== value)) {
  44521. return
  44522. }
  44523. /* eslint-enable no-self-compare */
  44524. if (customSetter) {
  44525. customSetter();
  44526. }
  44527. // #7981: for accessor properties without setter
  44528. if (getter && !setter) { return }
  44529. if (setter) {
  44530. setter.call(obj, newVal);
  44531. } else {
  44532. val = newVal;
  44533. }
  44534. childOb = !shallow && observe(newVal);
  44535. dep.notify();
  44536. }
  44537. });
  44538. }
  44539. /**
  44540. * Set a property on an object. Adds the new property and
  44541. * triggers change notification if the property doesn't
  44542. * already exist.
  44543. */
  44544. function set (target, key, val) {
  44545. if (isUndef(target) || isPrimitive(target)
  44546. ) {
  44547. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44548. }
  44549. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44550. target.length = Math.max(target.length, key);
  44551. target.splice(key, 1, val);
  44552. return val
  44553. }
  44554. if (key in target && !(key in Object.prototype)) {
  44555. target[key] = val;
  44556. return val
  44557. }
  44558. var ob = (target).__ob__;
  44559. if (target._isVue || (ob && ob.vmCount)) {
  44560. warn(
  44561. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44562. 'at runtime - declare it upfront in the data option.'
  44563. );
  44564. return val
  44565. }
  44566. if (!ob) {
  44567. target[key] = val;
  44568. return val
  44569. }
  44570. defineReactive$$1(ob.value, key, val);
  44571. ob.dep.notify();
  44572. return val
  44573. }
  44574. /**
  44575. * Delete a property and trigger change if necessary.
  44576. */
  44577. function del (target, key) {
  44578. if (isUndef(target) || isPrimitive(target)
  44579. ) {
  44580. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44581. }
  44582. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44583. target.splice(key, 1);
  44584. return
  44585. }
  44586. var ob = (target).__ob__;
  44587. if (target._isVue || (ob && ob.vmCount)) {
  44588. warn(
  44589. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44590. '- just set it to null.'
  44591. );
  44592. return
  44593. }
  44594. if (!hasOwn(target, key)) {
  44595. return
  44596. }
  44597. delete target[key];
  44598. if (!ob) {
  44599. return
  44600. }
  44601. ob.dep.notify();
  44602. }
  44603. /**
  44604. * Collect dependencies on array elements when the array is touched, since
  44605. * we cannot intercept array element access like property getters.
  44606. */
  44607. function dependArray (value) {
  44608. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  44609. e = value[i];
  44610. e && e.__ob__ && e.__ob__.dep.depend();
  44611. if (Array.isArray(e)) {
  44612. dependArray(e);
  44613. }
  44614. }
  44615. }
  44616. /* */
  44617. /**
  44618. * Option overwriting strategies are functions that handle
  44619. * how to merge a parent option value and a child option
  44620. * value into the final value.
  44621. */
  44622. var strats = config.optionMergeStrategies;
  44623. /**
  44624. * Options with restrictions
  44625. */
  44626. {
  44627. strats.el = strats.propsData = function (parent, child, vm, key) {
  44628. if (!vm) {
  44629. warn(
  44630. "option \"" + key + "\" can only be used during instance " +
  44631. 'creation with the `new` keyword.'
  44632. );
  44633. }
  44634. return defaultStrat(parent, child)
  44635. };
  44636. }
  44637. /**
  44638. * Helper that recursively merges two data objects together.
  44639. */
  44640. function mergeData (to, from) {
  44641. if (!from) { return to }
  44642. var key, toVal, fromVal;
  44643. var keys = hasSymbol
  44644. ? Reflect.ownKeys(from)
  44645. : Object.keys(from);
  44646. for (var i = 0; i < keys.length; i++) {
  44647. key = keys[i];
  44648. // in case the object is already observed...
  44649. if (key === '__ob__') { continue }
  44650. toVal = to[key];
  44651. fromVal = from[key];
  44652. if (!hasOwn(to, key)) {
  44653. set(to, key, fromVal);
  44654. } else if (
  44655. toVal !== fromVal &&
  44656. isPlainObject(toVal) &&
  44657. isPlainObject(fromVal)
  44658. ) {
  44659. mergeData(toVal, fromVal);
  44660. }
  44661. }
  44662. return to
  44663. }
  44664. /**
  44665. * Data
  44666. */
  44667. function mergeDataOrFn (
  44668. parentVal,
  44669. childVal,
  44670. vm
  44671. ) {
  44672. if (!vm) {
  44673. // in a Vue.extend merge, both should be functions
  44674. if (!childVal) {
  44675. return parentVal
  44676. }
  44677. if (!parentVal) {
  44678. return childVal
  44679. }
  44680. // when parentVal & childVal are both present,
  44681. // we need to return a function that returns the
  44682. // merged result of both functions... no need to
  44683. // check if parentVal is a function here because
  44684. // it has to be a function to pass previous merges.
  44685. return function mergedDataFn () {
  44686. return mergeData(
  44687. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  44688. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  44689. )
  44690. }
  44691. } else {
  44692. return function mergedInstanceDataFn () {
  44693. // instance merge
  44694. var instanceData = typeof childVal === 'function'
  44695. ? childVal.call(vm, vm)
  44696. : childVal;
  44697. var defaultData = typeof parentVal === 'function'
  44698. ? parentVal.call(vm, vm)
  44699. : parentVal;
  44700. if (instanceData) {
  44701. return mergeData(instanceData, defaultData)
  44702. } else {
  44703. return defaultData
  44704. }
  44705. }
  44706. }
  44707. }
  44708. strats.data = function (
  44709. parentVal,
  44710. childVal,
  44711. vm
  44712. ) {
  44713. if (!vm) {
  44714. if (childVal && typeof childVal !== 'function') {
  44715. warn(
  44716. 'The "data" option should be a function ' +
  44717. 'that returns a per-instance value in component ' +
  44718. 'definitions.',
  44719. vm
  44720. );
  44721. return parentVal
  44722. }
  44723. return mergeDataOrFn(parentVal, childVal)
  44724. }
  44725. return mergeDataOrFn(parentVal, childVal, vm)
  44726. };
  44727. /**
  44728. * Hooks and props are merged as arrays.
  44729. */
  44730. function mergeHook (
  44731. parentVal,
  44732. childVal
  44733. ) {
  44734. var res = childVal
  44735. ? parentVal
  44736. ? parentVal.concat(childVal)
  44737. : Array.isArray(childVal)
  44738. ? childVal
  44739. : [childVal]
  44740. : parentVal;
  44741. return res
  44742. ? dedupeHooks(res)
  44743. : res
  44744. }
  44745. function dedupeHooks (hooks) {
  44746. var res = [];
  44747. for (var i = 0; i < hooks.length; i++) {
  44748. if (res.indexOf(hooks[i]) === -1) {
  44749. res.push(hooks[i]);
  44750. }
  44751. }
  44752. return res
  44753. }
  44754. LIFECYCLE_HOOKS.forEach(function (hook) {
  44755. strats[hook] = mergeHook;
  44756. });
  44757. /**
  44758. * Assets
  44759. *
  44760. * When a vm is present (instance creation), we need to do
  44761. * a three-way merge between constructor options, instance
  44762. * options and parent options.
  44763. */
  44764. function mergeAssets (
  44765. parentVal,
  44766. childVal,
  44767. vm,
  44768. key
  44769. ) {
  44770. var res = Object.create(parentVal || null);
  44771. if (childVal) {
  44772. assertObjectType(key, childVal, vm);
  44773. return extend(res, childVal)
  44774. } else {
  44775. return res
  44776. }
  44777. }
  44778. ASSET_TYPES.forEach(function (type) {
  44779. strats[type + 's'] = mergeAssets;
  44780. });
  44781. /**
  44782. * Watchers.
  44783. *
  44784. * Watchers hashes should not overwrite one
  44785. * another, so we merge them as arrays.
  44786. */
  44787. strats.watch = function (
  44788. parentVal,
  44789. childVal,
  44790. vm,
  44791. key
  44792. ) {
  44793. // work around Firefox's Object.prototype.watch...
  44794. if (parentVal === nativeWatch) { parentVal = undefined; }
  44795. if (childVal === nativeWatch) { childVal = undefined; }
  44796. /* istanbul ignore if */
  44797. if (!childVal) { return Object.create(parentVal || null) }
  44798. {
  44799. assertObjectType(key, childVal, vm);
  44800. }
  44801. if (!parentVal) { return childVal }
  44802. var ret = {};
  44803. extend(ret, parentVal);
  44804. for (var key$1 in childVal) {
  44805. var parent = ret[key$1];
  44806. var child = childVal[key$1];
  44807. if (parent && !Array.isArray(parent)) {
  44808. parent = [parent];
  44809. }
  44810. ret[key$1] = parent
  44811. ? parent.concat(child)
  44812. : Array.isArray(child) ? child : [child];
  44813. }
  44814. return ret
  44815. };
  44816. /**
  44817. * Other object hashes.
  44818. */
  44819. strats.props =
  44820. strats.methods =
  44821. strats.inject =
  44822. strats.computed = function (
  44823. parentVal,
  44824. childVal,
  44825. vm,
  44826. key
  44827. ) {
  44828. if (childVal && "development" !== 'production') {
  44829. assertObjectType(key, childVal, vm);
  44830. }
  44831. if (!parentVal) { return childVal }
  44832. var ret = Object.create(null);
  44833. extend(ret, parentVal);
  44834. if (childVal) { extend(ret, childVal); }
  44835. return ret
  44836. };
  44837. strats.provide = mergeDataOrFn;
  44838. /**
  44839. * Default strategy.
  44840. */
  44841. var defaultStrat = function (parentVal, childVal) {
  44842. return childVal === undefined
  44843. ? parentVal
  44844. : childVal
  44845. };
  44846. /**
  44847. * Validate component names
  44848. */
  44849. function checkComponents (options) {
  44850. for (var key in options.components) {
  44851. validateComponentName(key);
  44852. }
  44853. }
  44854. function validateComponentName (name) {
  44855. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  44856. warn(
  44857. 'Invalid component name: "' + name + '". Component names ' +
  44858. 'should conform to valid custom element name in html5 specification.'
  44859. );
  44860. }
  44861. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  44862. warn(
  44863. 'Do not use built-in or reserved HTML elements as component ' +
  44864. 'id: ' + name
  44865. );
  44866. }
  44867. }
  44868. /**
  44869. * Ensure all props option syntax are normalized into the
  44870. * Object-based format.
  44871. */
  44872. function normalizeProps (options, vm) {
  44873. var props = options.props;
  44874. if (!props) { return }
  44875. var res = {};
  44876. var i, val, name;
  44877. if (Array.isArray(props)) {
  44878. i = props.length;
  44879. while (i--) {
  44880. val = props[i];
  44881. if (typeof val === 'string') {
  44882. name = camelize(val);
  44883. res[name] = { type: null };
  44884. } else {
  44885. warn('props must be strings when using array syntax.');
  44886. }
  44887. }
  44888. } else if (isPlainObject(props)) {
  44889. for (var key in props) {
  44890. val = props[key];
  44891. name = camelize(key);
  44892. res[name] = isPlainObject(val)
  44893. ? val
  44894. : { type: val };
  44895. }
  44896. } else {
  44897. warn(
  44898. "Invalid value for option \"props\": expected an Array or an Object, " +
  44899. "but got " + (toRawType(props)) + ".",
  44900. vm
  44901. );
  44902. }
  44903. options.props = res;
  44904. }
  44905. /**
  44906. * Normalize all injections into Object-based format
  44907. */
  44908. function normalizeInject (options, vm) {
  44909. var inject = options.inject;
  44910. if (!inject) { return }
  44911. var normalized = options.inject = {};
  44912. if (Array.isArray(inject)) {
  44913. for (var i = 0; i < inject.length; i++) {
  44914. normalized[inject[i]] = { from: inject[i] };
  44915. }
  44916. } else if (isPlainObject(inject)) {
  44917. for (var key in inject) {
  44918. var val = inject[key];
  44919. normalized[key] = isPlainObject(val)
  44920. ? extend({ from: key }, val)
  44921. : { from: val };
  44922. }
  44923. } else {
  44924. warn(
  44925. "Invalid value for option \"inject\": expected an Array or an Object, " +
  44926. "but got " + (toRawType(inject)) + ".",
  44927. vm
  44928. );
  44929. }
  44930. }
  44931. /**
  44932. * Normalize raw function directives into object format.
  44933. */
  44934. function normalizeDirectives (options) {
  44935. var dirs = options.directives;
  44936. if (dirs) {
  44937. for (var key in dirs) {
  44938. var def$$1 = dirs[key];
  44939. if (typeof def$$1 === 'function') {
  44940. dirs[key] = { bind: def$$1, update: def$$1 };
  44941. }
  44942. }
  44943. }
  44944. }
  44945. function assertObjectType (name, value, vm) {
  44946. if (!isPlainObject(value)) {
  44947. warn(
  44948. "Invalid value for option \"" + name + "\": expected an Object, " +
  44949. "but got " + (toRawType(value)) + ".",
  44950. vm
  44951. );
  44952. }
  44953. }
  44954. /**
  44955. * Merge two option objects into a new one.
  44956. * Core utility used in both instantiation and inheritance.
  44957. */
  44958. function mergeOptions (
  44959. parent,
  44960. child,
  44961. vm
  44962. ) {
  44963. {
  44964. checkComponents(child);
  44965. }
  44966. if (typeof child === 'function') {
  44967. child = child.options;
  44968. }
  44969. normalizeProps(child, vm);
  44970. normalizeInject(child, vm);
  44971. normalizeDirectives(child);
  44972. // Apply extends and mixins on the child options,
  44973. // but only if it is a raw options object that isn't
  44974. // the result of another mergeOptions call.
  44975. // Only merged options has the _base property.
  44976. if (!child._base) {
  44977. if (child.extends) {
  44978. parent = mergeOptions(parent, child.extends, vm);
  44979. }
  44980. if (child.mixins) {
  44981. for (var i = 0, l = child.mixins.length; i < l; i++) {
  44982. parent = mergeOptions(parent, child.mixins[i], vm);
  44983. }
  44984. }
  44985. }
  44986. var options = {};
  44987. var key;
  44988. for (key in parent) {
  44989. mergeField(key);
  44990. }
  44991. for (key in child) {
  44992. if (!hasOwn(parent, key)) {
  44993. mergeField(key);
  44994. }
  44995. }
  44996. function mergeField (key) {
  44997. var strat = strats[key] || defaultStrat;
  44998. options[key] = strat(parent[key], child[key], vm, key);
  44999. }
  45000. return options
  45001. }
  45002. /**
  45003. * Resolve an asset.
  45004. * This function is used because child instances need access
  45005. * to assets defined in its ancestor chain.
  45006. */
  45007. function resolveAsset (
  45008. options,
  45009. type,
  45010. id,
  45011. warnMissing
  45012. ) {
  45013. /* istanbul ignore if */
  45014. if (typeof id !== 'string') {
  45015. return
  45016. }
  45017. var assets = options[type];
  45018. // check local registration variations first
  45019. if (hasOwn(assets, id)) { return assets[id] }
  45020. var camelizedId = camelize(id);
  45021. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45022. var PascalCaseId = capitalize(camelizedId);
  45023. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45024. // fallback to prototype chain
  45025. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45026. if (warnMissing && !res) {
  45027. warn(
  45028. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45029. options
  45030. );
  45031. }
  45032. return res
  45033. }
  45034. /* */
  45035. function validateProp (
  45036. key,
  45037. propOptions,
  45038. propsData,
  45039. vm
  45040. ) {
  45041. var prop = propOptions[key];
  45042. var absent = !hasOwn(propsData, key);
  45043. var value = propsData[key];
  45044. // boolean casting
  45045. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45046. if (booleanIndex > -1) {
  45047. if (absent && !hasOwn(prop, 'default')) {
  45048. value = false;
  45049. } else if (value === '' || value === hyphenate(key)) {
  45050. // only cast empty string / same name to boolean if
  45051. // boolean has higher priority
  45052. var stringIndex = getTypeIndex(String, prop.type);
  45053. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45054. value = true;
  45055. }
  45056. }
  45057. }
  45058. // check default value
  45059. if (value === undefined) {
  45060. value = getPropDefaultValue(vm, prop, key);
  45061. // since the default value is a fresh copy,
  45062. // make sure to observe it.
  45063. var prevShouldObserve = shouldObserve;
  45064. toggleObserving(true);
  45065. observe(value);
  45066. toggleObserving(prevShouldObserve);
  45067. }
  45068. {
  45069. assertProp(prop, key, value, vm, absent);
  45070. }
  45071. return value
  45072. }
  45073. /**
  45074. * Get the default value of a prop.
  45075. */
  45076. function getPropDefaultValue (vm, prop, key) {
  45077. // no default, return undefined
  45078. if (!hasOwn(prop, 'default')) {
  45079. return undefined
  45080. }
  45081. var def = prop.default;
  45082. // warn against non-factory defaults for Object & Array
  45083. if (isObject(def)) {
  45084. warn(
  45085. 'Invalid default value for prop "' + key + '": ' +
  45086. 'Props with type Object/Array must use a factory function ' +
  45087. 'to return the default value.',
  45088. vm
  45089. );
  45090. }
  45091. // the raw prop value was also undefined from previous render,
  45092. // return previous default value to avoid unnecessary watcher trigger
  45093. if (vm && vm.$options.propsData &&
  45094. vm.$options.propsData[key] === undefined &&
  45095. vm._props[key] !== undefined
  45096. ) {
  45097. return vm._props[key]
  45098. }
  45099. // call factory function for non-Function types
  45100. // a value is Function if its prototype is function even across different execution context
  45101. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45102. ? def.call(vm)
  45103. : def
  45104. }
  45105. /**
  45106. * Assert whether a prop is valid.
  45107. */
  45108. function assertProp (
  45109. prop,
  45110. name,
  45111. value,
  45112. vm,
  45113. absent
  45114. ) {
  45115. if (prop.required && absent) {
  45116. warn(
  45117. 'Missing required prop: "' + name + '"',
  45118. vm
  45119. );
  45120. return
  45121. }
  45122. if (value == null && !prop.required) {
  45123. return
  45124. }
  45125. var type = prop.type;
  45126. var valid = !type || type === true;
  45127. var expectedTypes = [];
  45128. if (type) {
  45129. if (!Array.isArray(type)) {
  45130. type = [type];
  45131. }
  45132. for (var i = 0; i < type.length && !valid; i++) {
  45133. var assertedType = assertType(value, type[i]);
  45134. expectedTypes.push(assertedType.expectedType || '');
  45135. valid = assertedType.valid;
  45136. }
  45137. }
  45138. if (!valid) {
  45139. warn(
  45140. getInvalidTypeMessage(name, value, expectedTypes),
  45141. vm
  45142. );
  45143. return
  45144. }
  45145. var validator = prop.validator;
  45146. if (validator) {
  45147. if (!validator(value)) {
  45148. warn(
  45149. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45150. vm
  45151. );
  45152. }
  45153. }
  45154. }
  45155. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45156. function assertType (value, type) {
  45157. var valid;
  45158. var expectedType = getType(type);
  45159. if (simpleCheckRE.test(expectedType)) {
  45160. var t = typeof value;
  45161. valid = t === expectedType.toLowerCase();
  45162. // for primitive wrapper objects
  45163. if (!valid && t === 'object') {
  45164. valid = value instanceof type;
  45165. }
  45166. } else if (expectedType === 'Object') {
  45167. valid = isPlainObject(value);
  45168. } else if (expectedType === 'Array') {
  45169. valid = Array.isArray(value);
  45170. } else {
  45171. valid = value instanceof type;
  45172. }
  45173. return {
  45174. valid: valid,
  45175. expectedType: expectedType
  45176. }
  45177. }
  45178. /**
  45179. * Use function string name to check built-in types,
  45180. * because a simple equality check will fail when running
  45181. * across different vms / iframes.
  45182. */
  45183. function getType (fn) {
  45184. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45185. return match ? match[1] : ''
  45186. }
  45187. function isSameType (a, b) {
  45188. return getType(a) === getType(b)
  45189. }
  45190. function getTypeIndex (type, expectedTypes) {
  45191. if (!Array.isArray(expectedTypes)) {
  45192. return isSameType(expectedTypes, type) ? 0 : -1
  45193. }
  45194. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45195. if (isSameType(expectedTypes[i], type)) {
  45196. return i
  45197. }
  45198. }
  45199. return -1
  45200. }
  45201. function getInvalidTypeMessage (name, value, expectedTypes) {
  45202. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45203. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45204. var expectedType = expectedTypes[0];
  45205. var receivedType = toRawType(value);
  45206. var expectedValue = styleValue(value, expectedType);
  45207. var receivedValue = styleValue(value, receivedType);
  45208. // check if we need to specify expected value
  45209. if (expectedTypes.length === 1 &&
  45210. isExplicable(expectedType) &&
  45211. !isBoolean(expectedType, receivedType)) {
  45212. message += " with value " + expectedValue;
  45213. }
  45214. message += ", got " + receivedType + " ";
  45215. // check if we need to specify received value
  45216. if (isExplicable(receivedType)) {
  45217. message += "with value " + receivedValue + ".";
  45218. }
  45219. return message
  45220. }
  45221. function styleValue (value, type) {
  45222. if (type === 'String') {
  45223. return ("\"" + value + "\"")
  45224. } else if (type === 'Number') {
  45225. return ("" + (Number(value)))
  45226. } else {
  45227. return ("" + value)
  45228. }
  45229. }
  45230. function isExplicable (value) {
  45231. var explicitTypes = ['string', 'number', 'boolean'];
  45232. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45233. }
  45234. function isBoolean () {
  45235. var args = [], len = arguments.length;
  45236. while ( len-- ) args[ len ] = arguments[ len ];
  45237. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45238. }
  45239. /* */
  45240. function handleError (err, vm, info) {
  45241. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45242. // See: https://github.com/vuejs/vuex/issues/1505
  45243. pushTarget();
  45244. try {
  45245. if (vm) {
  45246. var cur = vm;
  45247. while ((cur = cur.$parent)) {
  45248. var hooks = cur.$options.errorCaptured;
  45249. if (hooks) {
  45250. for (var i = 0; i < hooks.length; i++) {
  45251. try {
  45252. var capture = hooks[i].call(cur, err, vm, info) === false;
  45253. if (capture) { return }
  45254. } catch (e) {
  45255. globalHandleError(e, cur, 'errorCaptured hook');
  45256. }
  45257. }
  45258. }
  45259. }
  45260. }
  45261. globalHandleError(err, vm, info);
  45262. } finally {
  45263. popTarget();
  45264. }
  45265. }
  45266. function invokeWithErrorHandling (
  45267. handler,
  45268. context,
  45269. args,
  45270. vm,
  45271. info
  45272. ) {
  45273. var res;
  45274. try {
  45275. res = args ? handler.apply(context, args) : handler.call(context);
  45276. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45277. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45278. // issue #9511
  45279. // avoid catch triggering multiple times when nested calls
  45280. res._handled = true;
  45281. }
  45282. } catch (e) {
  45283. handleError(e, vm, info);
  45284. }
  45285. return res
  45286. }
  45287. function globalHandleError (err, vm, info) {
  45288. if (config.errorHandler) {
  45289. try {
  45290. return config.errorHandler.call(null, err, vm, info)
  45291. } catch (e) {
  45292. // if the user intentionally throws the original error in the handler,
  45293. // do not log it twice
  45294. if (e !== err) {
  45295. logError(e, null, 'config.errorHandler');
  45296. }
  45297. }
  45298. }
  45299. logError(err, vm, info);
  45300. }
  45301. function logError (err, vm, info) {
  45302. {
  45303. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45304. }
  45305. /* istanbul ignore else */
  45306. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45307. console.error(err);
  45308. } else {
  45309. throw err
  45310. }
  45311. }
  45312. /* */
  45313. var isUsingMicroTask = false;
  45314. var callbacks = [];
  45315. var pending = false;
  45316. function flushCallbacks () {
  45317. pending = false;
  45318. var copies = callbacks.slice(0);
  45319. callbacks.length = 0;
  45320. for (var i = 0; i < copies.length; i++) {
  45321. copies[i]();
  45322. }
  45323. }
  45324. // Here we have async deferring wrappers using microtasks.
  45325. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45326. // However, it has subtle problems when state is changed right before repaint
  45327. // (e.g. #6813, out-in transitions).
  45328. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45329. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45330. // So we now use microtasks everywhere, again.
  45331. // A major drawback of this tradeoff is that there are some scenarios
  45332. // where microtasks have too high a priority and fire in between supposedly
  45333. // sequential events (e.g. #4521, #6690, which have workarounds)
  45334. // or even between bubbling of the same event (#6566).
  45335. var timerFunc;
  45336. // The nextTick behavior leverages the microtask queue, which can be accessed
  45337. // via either native Promise.then or MutationObserver.
  45338. // MutationObserver has wider support, however it is seriously bugged in
  45339. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45340. // completely stops working after triggering a few times... so, if native
  45341. // Promise is available, we will use it:
  45342. /* istanbul ignore next, $flow-disable-line */
  45343. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45344. var p = Promise.resolve();
  45345. timerFunc = function () {
  45346. p.then(flushCallbacks);
  45347. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45348. // it can get stuck in a weird state where callbacks are pushed into the
  45349. // microtask queue but the queue isn't being flushed, until the browser
  45350. // needs to do some other work, e.g. handle a timer. Therefore we can
  45351. // "force" the microtask queue to be flushed by adding an empty timer.
  45352. if (isIOS) { setTimeout(noop); }
  45353. };
  45354. isUsingMicroTask = true;
  45355. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45356. isNative(MutationObserver) ||
  45357. // PhantomJS and iOS 7.x
  45358. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45359. )) {
  45360. // Use MutationObserver where native Promise is not available,
  45361. // e.g. PhantomJS, iOS7, Android 4.4
  45362. // (#6466 MutationObserver is unreliable in IE11)
  45363. var counter = 1;
  45364. var observer = new MutationObserver(flushCallbacks);
  45365. var textNode = document.createTextNode(String(counter));
  45366. observer.observe(textNode, {
  45367. characterData: true
  45368. });
  45369. timerFunc = function () {
  45370. counter = (counter + 1) % 2;
  45371. textNode.data = String(counter);
  45372. };
  45373. isUsingMicroTask = true;
  45374. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45375. // Fallback to setImmediate.
  45376. // Technically it leverages the (macro) task queue,
  45377. // but it is still a better choice than setTimeout.
  45378. timerFunc = function () {
  45379. setImmediate(flushCallbacks);
  45380. };
  45381. } else {
  45382. // Fallback to setTimeout.
  45383. timerFunc = function () {
  45384. setTimeout(flushCallbacks, 0);
  45385. };
  45386. }
  45387. function nextTick (cb, ctx) {
  45388. var _resolve;
  45389. callbacks.push(function () {
  45390. if (cb) {
  45391. try {
  45392. cb.call(ctx);
  45393. } catch (e) {
  45394. handleError(e, ctx, 'nextTick');
  45395. }
  45396. } else if (_resolve) {
  45397. _resolve(ctx);
  45398. }
  45399. });
  45400. if (!pending) {
  45401. pending = true;
  45402. timerFunc();
  45403. }
  45404. // $flow-disable-line
  45405. if (!cb && typeof Promise !== 'undefined') {
  45406. return new Promise(function (resolve) {
  45407. _resolve = resolve;
  45408. })
  45409. }
  45410. }
  45411. /* */
  45412. var mark;
  45413. var measure;
  45414. {
  45415. var perf = inBrowser && window.performance;
  45416. /* istanbul ignore if */
  45417. if (
  45418. perf &&
  45419. perf.mark &&
  45420. perf.measure &&
  45421. perf.clearMarks &&
  45422. perf.clearMeasures
  45423. ) {
  45424. mark = function (tag) { return perf.mark(tag); };
  45425. measure = function (name, startTag, endTag) {
  45426. perf.measure(name, startTag, endTag);
  45427. perf.clearMarks(startTag);
  45428. perf.clearMarks(endTag);
  45429. // perf.clearMeasures(name)
  45430. };
  45431. }
  45432. }
  45433. /* not type checking this file because flow doesn't play well with Proxy */
  45434. var initProxy;
  45435. {
  45436. var allowedGlobals = makeMap(
  45437. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45438. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45439. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45440. 'require' // for Webpack/Browserify
  45441. );
  45442. var warnNonPresent = function (target, key) {
  45443. warn(
  45444. "Property or method \"" + key + "\" is not defined on the instance but " +
  45445. 'referenced during render. Make sure that this property is reactive, ' +
  45446. 'either in the data option, or for class-based components, by ' +
  45447. 'initializing the property. ' +
  45448. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45449. target
  45450. );
  45451. };
  45452. var warnReservedPrefix = function (target, key) {
  45453. warn(
  45454. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45455. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45456. 'prevent conflicts with Vue internals. ' +
  45457. 'See: https://vuejs.org/v2/api/#data',
  45458. target
  45459. );
  45460. };
  45461. var hasProxy =
  45462. typeof Proxy !== 'undefined' && isNative(Proxy);
  45463. if (hasProxy) {
  45464. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45465. config.keyCodes = new Proxy(config.keyCodes, {
  45466. set: function set (target, key, value) {
  45467. if (isBuiltInModifier(key)) {
  45468. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45469. return false
  45470. } else {
  45471. target[key] = value;
  45472. return true
  45473. }
  45474. }
  45475. });
  45476. }
  45477. var hasHandler = {
  45478. has: function has (target, key) {
  45479. var has = key in target;
  45480. var isAllowed = allowedGlobals(key) ||
  45481. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45482. if (!has && !isAllowed) {
  45483. if (key in target.$data) { warnReservedPrefix(target, key); }
  45484. else { warnNonPresent(target, key); }
  45485. }
  45486. return has || !isAllowed
  45487. }
  45488. };
  45489. var getHandler = {
  45490. get: function get (target, key) {
  45491. if (typeof key === 'string' && !(key in target)) {
  45492. if (key in target.$data) { warnReservedPrefix(target, key); }
  45493. else { warnNonPresent(target, key); }
  45494. }
  45495. return target[key]
  45496. }
  45497. };
  45498. initProxy = function initProxy (vm) {
  45499. if (hasProxy) {
  45500. // determine which proxy handler to use
  45501. var options = vm.$options;
  45502. var handlers = options.render && options.render._withStripped
  45503. ? getHandler
  45504. : hasHandler;
  45505. vm._renderProxy = new Proxy(vm, handlers);
  45506. } else {
  45507. vm._renderProxy = vm;
  45508. }
  45509. };
  45510. }
  45511. /* */
  45512. var seenObjects = new _Set();
  45513. /**
  45514. * Recursively traverse an object to evoke all converted
  45515. * getters, so that every nested property inside the object
  45516. * is collected as a "deep" dependency.
  45517. */
  45518. function traverse (val) {
  45519. _traverse(val, seenObjects);
  45520. seenObjects.clear();
  45521. }
  45522. function _traverse (val, seen) {
  45523. var i, keys;
  45524. var isA = Array.isArray(val);
  45525. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45526. return
  45527. }
  45528. if (val.__ob__) {
  45529. var depId = val.__ob__.dep.id;
  45530. if (seen.has(depId)) {
  45531. return
  45532. }
  45533. seen.add(depId);
  45534. }
  45535. if (isA) {
  45536. i = val.length;
  45537. while (i--) { _traverse(val[i], seen); }
  45538. } else {
  45539. keys = Object.keys(val);
  45540. i = keys.length;
  45541. while (i--) { _traverse(val[keys[i]], seen); }
  45542. }
  45543. }
  45544. /* */
  45545. var normalizeEvent = cached(function (name) {
  45546. var passive = name.charAt(0) === '&';
  45547. name = passive ? name.slice(1) : name;
  45548. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45549. name = once$$1 ? name.slice(1) : name;
  45550. var capture = name.charAt(0) === '!';
  45551. name = capture ? name.slice(1) : name;
  45552. return {
  45553. name: name,
  45554. once: once$$1,
  45555. capture: capture,
  45556. passive: passive
  45557. }
  45558. });
  45559. function createFnInvoker (fns, vm) {
  45560. function invoker () {
  45561. var arguments$1 = arguments;
  45562. var fns = invoker.fns;
  45563. if (Array.isArray(fns)) {
  45564. var cloned = fns.slice();
  45565. for (var i = 0; i < cloned.length; i++) {
  45566. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45567. }
  45568. } else {
  45569. // return handler return value for single handlers
  45570. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45571. }
  45572. }
  45573. invoker.fns = fns;
  45574. return invoker
  45575. }
  45576. function updateListeners (
  45577. on,
  45578. oldOn,
  45579. add,
  45580. remove$$1,
  45581. createOnceHandler,
  45582. vm
  45583. ) {
  45584. var name, def$$1, cur, old, event;
  45585. for (name in on) {
  45586. def$$1 = cur = on[name];
  45587. old = oldOn[name];
  45588. event = normalizeEvent(name);
  45589. if (isUndef(cur)) {
  45590. warn(
  45591. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45592. vm
  45593. );
  45594. } else if (isUndef(old)) {
  45595. if (isUndef(cur.fns)) {
  45596. cur = on[name] = createFnInvoker(cur, vm);
  45597. }
  45598. if (isTrue(event.once)) {
  45599. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  45600. }
  45601. add(event.name, cur, event.capture, event.passive, event.params);
  45602. } else if (cur !== old) {
  45603. old.fns = cur;
  45604. on[name] = old;
  45605. }
  45606. }
  45607. for (name in oldOn) {
  45608. if (isUndef(on[name])) {
  45609. event = normalizeEvent(name);
  45610. remove$$1(event.name, oldOn[name], event.capture);
  45611. }
  45612. }
  45613. }
  45614. /* */
  45615. function mergeVNodeHook (def, hookKey, hook) {
  45616. if (def instanceof VNode) {
  45617. def = def.data.hook || (def.data.hook = {});
  45618. }
  45619. var invoker;
  45620. var oldHook = def[hookKey];
  45621. function wrappedHook () {
  45622. hook.apply(this, arguments);
  45623. // important: remove merged hook to ensure it's called only once
  45624. // and prevent memory leak
  45625. remove(invoker.fns, wrappedHook);
  45626. }
  45627. if (isUndef(oldHook)) {
  45628. // no existing hook
  45629. invoker = createFnInvoker([wrappedHook]);
  45630. } else {
  45631. /* istanbul ignore if */
  45632. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  45633. // already a merged invoker
  45634. invoker = oldHook;
  45635. invoker.fns.push(wrappedHook);
  45636. } else {
  45637. // existing plain hook
  45638. invoker = createFnInvoker([oldHook, wrappedHook]);
  45639. }
  45640. }
  45641. invoker.merged = true;
  45642. def[hookKey] = invoker;
  45643. }
  45644. /* */
  45645. function extractPropsFromVNodeData (
  45646. data,
  45647. Ctor,
  45648. tag
  45649. ) {
  45650. // we are only extracting raw values here.
  45651. // validation and default values are handled in the child
  45652. // component itself.
  45653. var propOptions = Ctor.options.props;
  45654. if (isUndef(propOptions)) {
  45655. return
  45656. }
  45657. var res = {};
  45658. var attrs = data.attrs;
  45659. var props = data.props;
  45660. if (isDef(attrs) || isDef(props)) {
  45661. for (var key in propOptions) {
  45662. var altKey = hyphenate(key);
  45663. {
  45664. var keyInLowerCase = key.toLowerCase();
  45665. if (
  45666. key !== keyInLowerCase &&
  45667. attrs && hasOwn(attrs, keyInLowerCase)
  45668. ) {
  45669. tip(
  45670. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  45671. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  45672. " \"" + key + "\". " +
  45673. "Note that HTML attributes are case-insensitive and camelCased " +
  45674. "props need to use their kebab-case equivalents when using in-DOM " +
  45675. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  45676. );
  45677. }
  45678. }
  45679. checkProp(res, props, key, altKey, true) ||
  45680. checkProp(res, attrs, key, altKey, false);
  45681. }
  45682. }
  45683. return res
  45684. }
  45685. function checkProp (
  45686. res,
  45687. hash,
  45688. key,
  45689. altKey,
  45690. preserve
  45691. ) {
  45692. if (isDef(hash)) {
  45693. if (hasOwn(hash, key)) {
  45694. res[key] = hash[key];
  45695. if (!preserve) {
  45696. delete hash[key];
  45697. }
  45698. return true
  45699. } else if (hasOwn(hash, altKey)) {
  45700. res[key] = hash[altKey];
  45701. if (!preserve) {
  45702. delete hash[altKey];
  45703. }
  45704. return true
  45705. }
  45706. }
  45707. return false
  45708. }
  45709. /* */
  45710. // The template compiler attempts to minimize the need for normalization by
  45711. // statically analyzing the template at compile time.
  45712. //
  45713. // For plain HTML markup, normalization can be completely skipped because the
  45714. // generated render function is guaranteed to return Array<VNode>. There are
  45715. // two cases where extra normalization is needed:
  45716. // 1. When the children contains components - because a functional component
  45717. // may return an Array instead of a single root. In this case, just a simple
  45718. // normalization is needed - if any child is an Array, we flatten the whole
  45719. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  45720. // because functional components already normalize their own children.
  45721. function simpleNormalizeChildren (children) {
  45722. for (var i = 0; i < children.length; i++) {
  45723. if (Array.isArray(children[i])) {
  45724. return Array.prototype.concat.apply([], children)
  45725. }
  45726. }
  45727. return children
  45728. }
  45729. // 2. When the children contains constructs that always generated nested Arrays,
  45730. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  45731. // with hand-written render functions / JSX. In such cases a full normalization
  45732. // is needed to cater to all possible types of children values.
  45733. function normalizeChildren (children) {
  45734. return isPrimitive(children)
  45735. ? [createTextVNode(children)]
  45736. : Array.isArray(children)
  45737. ? normalizeArrayChildren(children)
  45738. : undefined
  45739. }
  45740. function isTextNode (node) {
  45741. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  45742. }
  45743. function normalizeArrayChildren (children, nestedIndex) {
  45744. var res = [];
  45745. var i, c, lastIndex, last;
  45746. for (i = 0; i < children.length; i++) {
  45747. c = children[i];
  45748. if (isUndef(c) || typeof c === 'boolean') { continue }
  45749. lastIndex = res.length - 1;
  45750. last = res[lastIndex];
  45751. // nested
  45752. if (Array.isArray(c)) {
  45753. if (c.length > 0) {
  45754. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  45755. // merge adjacent text nodes
  45756. if (isTextNode(c[0]) && isTextNode(last)) {
  45757. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  45758. c.shift();
  45759. }
  45760. res.push.apply(res, c);
  45761. }
  45762. } else if (isPrimitive(c)) {
  45763. if (isTextNode(last)) {
  45764. // merge adjacent text nodes
  45765. // this is necessary for SSR hydration because text nodes are
  45766. // essentially merged when rendered to HTML strings
  45767. res[lastIndex] = createTextVNode(last.text + c);
  45768. } else if (c !== '') {
  45769. // convert primitive to vnode
  45770. res.push(createTextVNode(c));
  45771. }
  45772. } else {
  45773. if (isTextNode(c) && isTextNode(last)) {
  45774. // merge adjacent text nodes
  45775. res[lastIndex] = createTextVNode(last.text + c.text);
  45776. } else {
  45777. // default key for nested array children (likely generated by v-for)
  45778. if (isTrue(children._isVList) &&
  45779. isDef(c.tag) &&
  45780. isUndef(c.key) &&
  45781. isDef(nestedIndex)) {
  45782. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45783. }
  45784. res.push(c);
  45785. }
  45786. }
  45787. }
  45788. return res
  45789. }
  45790. /* */
  45791. function initProvide (vm) {
  45792. var provide = vm.$options.provide;
  45793. if (provide) {
  45794. vm._provided = typeof provide === 'function'
  45795. ? provide.call(vm)
  45796. : provide;
  45797. }
  45798. }
  45799. function initInjections (vm) {
  45800. var result = resolveInject(vm.$options.inject, vm);
  45801. if (result) {
  45802. toggleObserving(false);
  45803. Object.keys(result).forEach(function (key) {
  45804. /* istanbul ignore else */
  45805. {
  45806. defineReactive$$1(vm, key, result[key], function () {
  45807. warn(
  45808. "Avoid mutating an injected value directly since the changes will be " +
  45809. "overwritten whenever the provided component re-renders. " +
  45810. "injection being mutated: \"" + key + "\"",
  45811. vm
  45812. );
  45813. });
  45814. }
  45815. });
  45816. toggleObserving(true);
  45817. }
  45818. }
  45819. function resolveInject (inject, vm) {
  45820. if (inject) {
  45821. // inject is :any because flow is not smart enough to figure out cached
  45822. var result = Object.create(null);
  45823. var keys = hasSymbol
  45824. ? Reflect.ownKeys(inject)
  45825. : Object.keys(inject);
  45826. for (var i = 0; i < keys.length; i++) {
  45827. var key = keys[i];
  45828. // #6574 in case the inject object is observed...
  45829. if (key === '__ob__') { continue }
  45830. var provideKey = inject[key].from;
  45831. var source = vm;
  45832. while (source) {
  45833. if (source._provided && hasOwn(source._provided, provideKey)) {
  45834. result[key] = source._provided[provideKey];
  45835. break
  45836. }
  45837. source = source.$parent;
  45838. }
  45839. if (!source) {
  45840. if ('default' in inject[key]) {
  45841. var provideDefault = inject[key].default;
  45842. result[key] = typeof provideDefault === 'function'
  45843. ? provideDefault.call(vm)
  45844. : provideDefault;
  45845. } else {
  45846. warn(("Injection \"" + key + "\" not found"), vm);
  45847. }
  45848. }
  45849. }
  45850. return result
  45851. }
  45852. }
  45853. /* */
  45854. /**
  45855. * Runtime helper for resolving raw children VNodes into a slot object.
  45856. */
  45857. function resolveSlots (
  45858. children,
  45859. context
  45860. ) {
  45861. if (!children || !children.length) {
  45862. return {}
  45863. }
  45864. var slots = {};
  45865. for (var i = 0, l = children.length; i < l; i++) {
  45866. var child = children[i];
  45867. var data = child.data;
  45868. // remove slot attribute if the node is resolved as a Vue slot node
  45869. if (data && data.attrs && data.attrs.slot) {
  45870. delete data.attrs.slot;
  45871. }
  45872. // named slots should only be respected if the vnode was rendered in the
  45873. // same context.
  45874. if ((child.context === context || child.fnContext === context) &&
  45875. data && data.slot != null
  45876. ) {
  45877. var name = data.slot;
  45878. var slot = (slots[name] || (slots[name] = []));
  45879. if (child.tag === 'template') {
  45880. slot.push.apply(slot, child.children || []);
  45881. } else {
  45882. slot.push(child);
  45883. }
  45884. } else {
  45885. (slots.default || (slots.default = [])).push(child);
  45886. }
  45887. }
  45888. // ignore slots that contains only whitespace
  45889. for (var name$1 in slots) {
  45890. if (slots[name$1].every(isWhitespace)) {
  45891. delete slots[name$1];
  45892. }
  45893. }
  45894. return slots
  45895. }
  45896. function isWhitespace (node) {
  45897. return (node.isComment && !node.asyncFactory) || node.text === ' '
  45898. }
  45899. /* */
  45900. function normalizeScopedSlots (
  45901. slots,
  45902. normalSlots,
  45903. prevSlots
  45904. ) {
  45905. var res;
  45906. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  45907. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  45908. var key = slots && slots.$key;
  45909. if (!slots) {
  45910. res = {};
  45911. } else if (slots._normalized) {
  45912. // fast path 1: child component re-render only, parent did not change
  45913. return slots._normalized
  45914. } else if (
  45915. isStable &&
  45916. prevSlots &&
  45917. prevSlots !== emptyObject &&
  45918. key === prevSlots.$key &&
  45919. !hasNormalSlots &&
  45920. !prevSlots.$hasNormal
  45921. ) {
  45922. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  45923. // only need to normalize once
  45924. return prevSlots
  45925. } else {
  45926. res = {};
  45927. for (var key$1 in slots) {
  45928. if (slots[key$1] && key$1[0] !== '$') {
  45929. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  45930. }
  45931. }
  45932. }
  45933. // expose normal slots on scopedSlots
  45934. for (var key$2 in normalSlots) {
  45935. if (!(key$2 in res)) {
  45936. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  45937. }
  45938. }
  45939. // avoriaz seems to mock a non-extensible $scopedSlots object
  45940. // and when that is passed down this would cause an error
  45941. if (slots && Object.isExtensible(slots)) {
  45942. (slots)._normalized = res;
  45943. }
  45944. def(res, '$stable', isStable);
  45945. def(res, '$key', key);
  45946. def(res, '$hasNormal', hasNormalSlots);
  45947. return res
  45948. }
  45949. function normalizeScopedSlot(normalSlots, key, fn) {
  45950. var normalized = function () {
  45951. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  45952. res = res && typeof res === 'object' && !Array.isArray(res)
  45953. ? [res] // single vnode
  45954. : normalizeChildren(res);
  45955. return res && (
  45956. res.length === 0 ||
  45957. (res.length === 1 && res[0].isComment) // #9658
  45958. ) ? undefined
  45959. : res
  45960. };
  45961. // this is a slot using the new v-slot syntax without scope. although it is
  45962. // compiled as a scoped slot, render fn users would expect it to be present
  45963. // on this.$slots because the usage is semantically a normal slot.
  45964. if (fn.proxy) {
  45965. Object.defineProperty(normalSlots, key, {
  45966. get: normalized,
  45967. enumerable: true,
  45968. configurable: true
  45969. });
  45970. }
  45971. return normalized
  45972. }
  45973. function proxyNormalSlot(slots, key) {
  45974. return function () { return slots[key]; }
  45975. }
  45976. /* */
  45977. /**
  45978. * Runtime helper for rendering v-for lists.
  45979. */
  45980. function renderList (
  45981. val,
  45982. render
  45983. ) {
  45984. var ret, i, l, keys, key;
  45985. if (Array.isArray(val) || typeof val === 'string') {
  45986. ret = new Array(val.length);
  45987. for (i = 0, l = val.length; i < l; i++) {
  45988. ret[i] = render(val[i], i);
  45989. }
  45990. } else if (typeof val === 'number') {
  45991. ret = new Array(val);
  45992. for (i = 0; i < val; i++) {
  45993. ret[i] = render(i + 1, i);
  45994. }
  45995. } else if (isObject(val)) {
  45996. if (hasSymbol && val[Symbol.iterator]) {
  45997. ret = [];
  45998. var iterator = val[Symbol.iterator]();
  45999. var result = iterator.next();
  46000. while (!result.done) {
  46001. ret.push(render(result.value, ret.length));
  46002. result = iterator.next();
  46003. }
  46004. } else {
  46005. keys = Object.keys(val);
  46006. ret = new Array(keys.length);
  46007. for (i = 0, l = keys.length; i < l; i++) {
  46008. key = keys[i];
  46009. ret[i] = render(val[key], key, i);
  46010. }
  46011. }
  46012. }
  46013. if (!isDef(ret)) {
  46014. ret = [];
  46015. }
  46016. (ret)._isVList = true;
  46017. return ret
  46018. }
  46019. /* */
  46020. /**
  46021. * Runtime helper for rendering <slot>
  46022. */
  46023. function renderSlot (
  46024. name,
  46025. fallback,
  46026. props,
  46027. bindObject
  46028. ) {
  46029. var scopedSlotFn = this.$scopedSlots[name];
  46030. var nodes;
  46031. if (scopedSlotFn) { // scoped slot
  46032. props = props || {};
  46033. if (bindObject) {
  46034. if (!isObject(bindObject)) {
  46035. warn(
  46036. 'slot v-bind without argument expects an Object',
  46037. this
  46038. );
  46039. }
  46040. props = extend(extend({}, bindObject), props);
  46041. }
  46042. nodes = scopedSlotFn(props) || fallback;
  46043. } else {
  46044. nodes = this.$slots[name] || fallback;
  46045. }
  46046. var target = props && props.slot;
  46047. if (target) {
  46048. return this.$createElement('template', { slot: target }, nodes)
  46049. } else {
  46050. return nodes
  46051. }
  46052. }
  46053. /* */
  46054. /**
  46055. * Runtime helper for resolving filters
  46056. */
  46057. function resolveFilter (id) {
  46058. return resolveAsset(this.$options, 'filters', id, true) || identity
  46059. }
  46060. /* */
  46061. function isKeyNotMatch (expect, actual) {
  46062. if (Array.isArray(expect)) {
  46063. return expect.indexOf(actual) === -1
  46064. } else {
  46065. return expect !== actual
  46066. }
  46067. }
  46068. /**
  46069. * Runtime helper for checking keyCodes from config.
  46070. * exposed as Vue.prototype._k
  46071. * passing in eventKeyName as last argument separately for backwards compat
  46072. */
  46073. function checkKeyCodes (
  46074. eventKeyCode,
  46075. key,
  46076. builtInKeyCode,
  46077. eventKeyName,
  46078. builtInKeyName
  46079. ) {
  46080. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46081. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46082. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46083. } else if (mappedKeyCode) {
  46084. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46085. } else if (eventKeyName) {
  46086. return hyphenate(eventKeyName) !== key
  46087. }
  46088. }
  46089. /* */
  46090. /**
  46091. * Runtime helper for merging v-bind="object" into a VNode's data.
  46092. */
  46093. function bindObjectProps (
  46094. data,
  46095. tag,
  46096. value,
  46097. asProp,
  46098. isSync
  46099. ) {
  46100. if (value) {
  46101. if (!isObject(value)) {
  46102. warn(
  46103. 'v-bind without argument expects an Object or Array value',
  46104. this
  46105. );
  46106. } else {
  46107. if (Array.isArray(value)) {
  46108. value = toObject(value);
  46109. }
  46110. var hash;
  46111. var loop = function ( key ) {
  46112. if (
  46113. key === 'class' ||
  46114. key === 'style' ||
  46115. isReservedAttribute(key)
  46116. ) {
  46117. hash = data;
  46118. } else {
  46119. var type = data.attrs && data.attrs.type;
  46120. hash = asProp || config.mustUseProp(tag, type, key)
  46121. ? data.domProps || (data.domProps = {})
  46122. : data.attrs || (data.attrs = {});
  46123. }
  46124. var camelizedKey = camelize(key);
  46125. var hyphenatedKey = hyphenate(key);
  46126. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46127. hash[key] = value[key];
  46128. if (isSync) {
  46129. var on = data.on || (data.on = {});
  46130. on[("update:" + key)] = function ($event) {
  46131. value[key] = $event;
  46132. };
  46133. }
  46134. }
  46135. };
  46136. for (var key in value) loop( key );
  46137. }
  46138. }
  46139. return data
  46140. }
  46141. /* */
  46142. /**
  46143. * Runtime helper for rendering static trees.
  46144. */
  46145. function renderStatic (
  46146. index,
  46147. isInFor
  46148. ) {
  46149. var cached = this._staticTrees || (this._staticTrees = []);
  46150. var tree = cached[index];
  46151. // if has already-rendered static tree and not inside v-for,
  46152. // we can reuse the same tree.
  46153. if (tree && !isInFor) {
  46154. return tree
  46155. }
  46156. // otherwise, render a fresh tree.
  46157. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46158. this._renderProxy,
  46159. null,
  46160. this // for render fns generated for functional component templates
  46161. );
  46162. markStatic(tree, ("__static__" + index), false);
  46163. return tree
  46164. }
  46165. /**
  46166. * Runtime helper for v-once.
  46167. * Effectively it means marking the node as static with a unique key.
  46168. */
  46169. function markOnce (
  46170. tree,
  46171. index,
  46172. key
  46173. ) {
  46174. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46175. return tree
  46176. }
  46177. function markStatic (
  46178. tree,
  46179. key,
  46180. isOnce
  46181. ) {
  46182. if (Array.isArray(tree)) {
  46183. for (var i = 0; i < tree.length; i++) {
  46184. if (tree[i] && typeof tree[i] !== 'string') {
  46185. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46186. }
  46187. }
  46188. } else {
  46189. markStaticNode(tree, key, isOnce);
  46190. }
  46191. }
  46192. function markStaticNode (node, key, isOnce) {
  46193. node.isStatic = true;
  46194. node.key = key;
  46195. node.isOnce = isOnce;
  46196. }
  46197. /* */
  46198. function bindObjectListeners (data, value) {
  46199. if (value) {
  46200. if (!isPlainObject(value)) {
  46201. warn(
  46202. 'v-on without argument expects an Object value',
  46203. this
  46204. );
  46205. } else {
  46206. var on = data.on = data.on ? extend({}, data.on) : {};
  46207. for (var key in value) {
  46208. var existing = on[key];
  46209. var ours = value[key];
  46210. on[key] = existing ? [].concat(existing, ours) : ours;
  46211. }
  46212. }
  46213. }
  46214. return data
  46215. }
  46216. /* */
  46217. function resolveScopedSlots (
  46218. fns, // see flow/vnode
  46219. res,
  46220. // the following are added in 2.6
  46221. hasDynamicKeys,
  46222. contentHashKey
  46223. ) {
  46224. res = res || { $stable: !hasDynamicKeys };
  46225. for (var i = 0; i < fns.length; i++) {
  46226. var slot = fns[i];
  46227. if (Array.isArray(slot)) {
  46228. resolveScopedSlots(slot, res, hasDynamicKeys);
  46229. } else if (slot) {
  46230. // marker for reverse proxying v-slot without scope on this.$slots
  46231. if (slot.proxy) {
  46232. slot.fn.proxy = true;
  46233. }
  46234. res[slot.key] = slot.fn;
  46235. }
  46236. }
  46237. if (contentHashKey) {
  46238. (res).$key = contentHashKey;
  46239. }
  46240. return res
  46241. }
  46242. /* */
  46243. function bindDynamicKeys (baseObj, values) {
  46244. for (var i = 0; i < values.length; i += 2) {
  46245. var key = values[i];
  46246. if (typeof key === 'string' && key) {
  46247. baseObj[values[i]] = values[i + 1];
  46248. } else if (key !== '' && key !== null) {
  46249. // null is a special value for explicitly removing a binding
  46250. warn(
  46251. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46252. this
  46253. );
  46254. }
  46255. }
  46256. return baseObj
  46257. }
  46258. // helper to dynamically append modifier runtime markers to event names.
  46259. // ensure only append when value is already string, otherwise it will be cast
  46260. // to string and cause the type check to miss.
  46261. function prependModifier (value, symbol) {
  46262. return typeof value === 'string' ? symbol + value : value
  46263. }
  46264. /* */
  46265. function installRenderHelpers (target) {
  46266. target._o = markOnce;
  46267. target._n = toNumber;
  46268. target._s = toString;
  46269. target._l = renderList;
  46270. target._t = renderSlot;
  46271. target._q = looseEqual;
  46272. target._i = looseIndexOf;
  46273. target._m = renderStatic;
  46274. target._f = resolveFilter;
  46275. target._k = checkKeyCodes;
  46276. target._b = bindObjectProps;
  46277. target._v = createTextVNode;
  46278. target._e = createEmptyVNode;
  46279. target._u = resolveScopedSlots;
  46280. target._g = bindObjectListeners;
  46281. target._d = bindDynamicKeys;
  46282. target._p = prependModifier;
  46283. }
  46284. /* */
  46285. function FunctionalRenderContext (
  46286. data,
  46287. props,
  46288. children,
  46289. parent,
  46290. Ctor
  46291. ) {
  46292. var this$1 = this;
  46293. var options = Ctor.options;
  46294. // ensure the createElement function in functional components
  46295. // gets a unique context - this is necessary for correct named slot check
  46296. var contextVm;
  46297. if (hasOwn(parent, '_uid')) {
  46298. contextVm = Object.create(parent);
  46299. // $flow-disable-line
  46300. contextVm._original = parent;
  46301. } else {
  46302. // the context vm passed in is a functional context as well.
  46303. // in this case we want to make sure we are able to get a hold to the
  46304. // real context instance.
  46305. contextVm = parent;
  46306. // $flow-disable-line
  46307. parent = parent._original;
  46308. }
  46309. var isCompiled = isTrue(options._compiled);
  46310. var needNormalization = !isCompiled;
  46311. this.data = data;
  46312. this.props = props;
  46313. this.children = children;
  46314. this.parent = parent;
  46315. this.listeners = data.on || emptyObject;
  46316. this.injections = resolveInject(options.inject, parent);
  46317. this.slots = function () {
  46318. if (!this$1.$slots) {
  46319. normalizeScopedSlots(
  46320. data.scopedSlots,
  46321. this$1.$slots = resolveSlots(children, parent)
  46322. );
  46323. }
  46324. return this$1.$slots
  46325. };
  46326. Object.defineProperty(this, 'scopedSlots', ({
  46327. enumerable: true,
  46328. get: function get () {
  46329. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46330. }
  46331. }));
  46332. // support for compiled functional template
  46333. if (isCompiled) {
  46334. // exposing $options for renderStatic()
  46335. this.$options = options;
  46336. // pre-resolve slots for renderSlot()
  46337. this.$slots = this.slots();
  46338. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46339. }
  46340. if (options._scopeId) {
  46341. this._c = function (a, b, c, d) {
  46342. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46343. if (vnode && !Array.isArray(vnode)) {
  46344. vnode.fnScopeId = options._scopeId;
  46345. vnode.fnContext = parent;
  46346. }
  46347. return vnode
  46348. };
  46349. } else {
  46350. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46351. }
  46352. }
  46353. installRenderHelpers(FunctionalRenderContext.prototype);
  46354. function createFunctionalComponent (
  46355. Ctor,
  46356. propsData,
  46357. data,
  46358. contextVm,
  46359. children
  46360. ) {
  46361. var options = Ctor.options;
  46362. var props = {};
  46363. var propOptions = options.props;
  46364. if (isDef(propOptions)) {
  46365. for (var key in propOptions) {
  46366. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46367. }
  46368. } else {
  46369. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46370. if (isDef(data.props)) { mergeProps(props, data.props); }
  46371. }
  46372. var renderContext = new FunctionalRenderContext(
  46373. data,
  46374. props,
  46375. children,
  46376. contextVm,
  46377. Ctor
  46378. );
  46379. var vnode = options.render.call(null, renderContext._c, renderContext);
  46380. if (vnode instanceof VNode) {
  46381. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46382. } else if (Array.isArray(vnode)) {
  46383. var vnodes = normalizeChildren(vnode) || [];
  46384. var res = new Array(vnodes.length);
  46385. for (var i = 0; i < vnodes.length; i++) {
  46386. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46387. }
  46388. return res
  46389. }
  46390. }
  46391. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46392. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46393. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46394. // that should not be matched to match.
  46395. var clone = cloneVNode(vnode);
  46396. clone.fnContext = contextVm;
  46397. clone.fnOptions = options;
  46398. {
  46399. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46400. }
  46401. if (data.slot) {
  46402. (clone.data || (clone.data = {})).slot = data.slot;
  46403. }
  46404. return clone
  46405. }
  46406. function mergeProps (to, from) {
  46407. for (var key in from) {
  46408. to[camelize(key)] = from[key];
  46409. }
  46410. }
  46411. /* */
  46412. /* */
  46413. /* */
  46414. /* */
  46415. // inline hooks to be invoked on component VNodes during patch
  46416. var componentVNodeHooks = {
  46417. init: function init (vnode, hydrating) {
  46418. if (
  46419. vnode.componentInstance &&
  46420. !vnode.componentInstance._isDestroyed &&
  46421. vnode.data.keepAlive
  46422. ) {
  46423. // kept-alive components, treat as a patch
  46424. var mountedNode = vnode; // work around flow
  46425. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46426. } else {
  46427. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46428. vnode,
  46429. activeInstance
  46430. );
  46431. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46432. }
  46433. },
  46434. prepatch: function prepatch (oldVnode, vnode) {
  46435. var options = vnode.componentOptions;
  46436. var child = vnode.componentInstance = oldVnode.componentInstance;
  46437. updateChildComponent(
  46438. child,
  46439. options.propsData, // updated props
  46440. options.listeners, // updated listeners
  46441. vnode, // new parent vnode
  46442. options.children // new children
  46443. );
  46444. },
  46445. insert: function insert (vnode) {
  46446. var context = vnode.context;
  46447. var componentInstance = vnode.componentInstance;
  46448. if (!componentInstance._isMounted) {
  46449. componentInstance._isMounted = true;
  46450. callHook(componentInstance, 'mounted');
  46451. }
  46452. if (vnode.data.keepAlive) {
  46453. if (context._isMounted) {
  46454. // vue-router#1212
  46455. // During updates, a kept-alive component's child components may
  46456. // change, so directly walking the tree here may call activated hooks
  46457. // on incorrect children. Instead we push them into a queue which will
  46458. // be processed after the whole patch process ended.
  46459. queueActivatedComponent(componentInstance);
  46460. } else {
  46461. activateChildComponent(componentInstance, true /* direct */);
  46462. }
  46463. }
  46464. },
  46465. destroy: function destroy (vnode) {
  46466. var componentInstance = vnode.componentInstance;
  46467. if (!componentInstance._isDestroyed) {
  46468. if (!vnode.data.keepAlive) {
  46469. componentInstance.$destroy();
  46470. } else {
  46471. deactivateChildComponent(componentInstance, true /* direct */);
  46472. }
  46473. }
  46474. }
  46475. };
  46476. var hooksToMerge = Object.keys(componentVNodeHooks);
  46477. function createComponent (
  46478. Ctor,
  46479. data,
  46480. context,
  46481. children,
  46482. tag
  46483. ) {
  46484. if (isUndef(Ctor)) {
  46485. return
  46486. }
  46487. var baseCtor = context.$options._base;
  46488. // plain options object: turn it into a constructor
  46489. if (isObject(Ctor)) {
  46490. Ctor = baseCtor.extend(Ctor);
  46491. }
  46492. // if at this stage it's not a constructor or an async component factory,
  46493. // reject.
  46494. if (typeof Ctor !== 'function') {
  46495. {
  46496. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46497. }
  46498. return
  46499. }
  46500. // async component
  46501. var asyncFactory;
  46502. if (isUndef(Ctor.cid)) {
  46503. asyncFactory = Ctor;
  46504. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46505. if (Ctor === undefined) {
  46506. // return a placeholder node for async component, which is rendered
  46507. // as a comment node but preserves all the raw information for the node.
  46508. // the information will be used for async server-rendering and hydration.
  46509. return createAsyncPlaceholder(
  46510. asyncFactory,
  46511. data,
  46512. context,
  46513. children,
  46514. tag
  46515. )
  46516. }
  46517. }
  46518. data = data || {};
  46519. // resolve constructor options in case global mixins are applied after
  46520. // component constructor creation
  46521. resolveConstructorOptions(Ctor);
  46522. // transform component v-model data into props & events
  46523. if (isDef(data.model)) {
  46524. transformModel(Ctor.options, data);
  46525. }
  46526. // extract props
  46527. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46528. // functional component
  46529. if (isTrue(Ctor.options.functional)) {
  46530. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46531. }
  46532. // extract listeners, since these needs to be treated as
  46533. // child component listeners instead of DOM listeners
  46534. var listeners = data.on;
  46535. // replace with listeners with .native modifier
  46536. // so it gets processed during parent component patch.
  46537. data.on = data.nativeOn;
  46538. if (isTrue(Ctor.options.abstract)) {
  46539. // abstract components do not keep anything
  46540. // other than props & listeners & slot
  46541. // work around flow
  46542. var slot = data.slot;
  46543. data = {};
  46544. if (slot) {
  46545. data.slot = slot;
  46546. }
  46547. }
  46548. // install component management hooks onto the placeholder node
  46549. installComponentHooks(data);
  46550. // return a placeholder vnode
  46551. var name = Ctor.options.name || tag;
  46552. var vnode = new VNode(
  46553. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46554. data, undefined, undefined, undefined, context,
  46555. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46556. asyncFactory
  46557. );
  46558. return vnode
  46559. }
  46560. function createComponentInstanceForVnode (
  46561. vnode, // we know it's MountedComponentVNode but flow doesn't
  46562. parent // activeInstance in lifecycle state
  46563. ) {
  46564. var options = {
  46565. _isComponent: true,
  46566. _parentVnode: vnode,
  46567. parent: parent
  46568. };
  46569. // check inline-template render functions
  46570. var inlineTemplate = vnode.data.inlineTemplate;
  46571. if (isDef(inlineTemplate)) {
  46572. options.render = inlineTemplate.render;
  46573. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46574. }
  46575. return new vnode.componentOptions.Ctor(options)
  46576. }
  46577. function installComponentHooks (data) {
  46578. var hooks = data.hook || (data.hook = {});
  46579. for (var i = 0; i < hooksToMerge.length; i++) {
  46580. var key = hooksToMerge[i];
  46581. var existing = hooks[key];
  46582. var toMerge = componentVNodeHooks[key];
  46583. if (existing !== toMerge && !(existing && existing._merged)) {
  46584. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46585. }
  46586. }
  46587. }
  46588. function mergeHook$1 (f1, f2) {
  46589. var merged = function (a, b) {
  46590. // flow complains about extra args which is why we use any
  46591. f1(a, b);
  46592. f2(a, b);
  46593. };
  46594. merged._merged = true;
  46595. return merged
  46596. }
  46597. // transform component v-model info (value and callback) into
  46598. // prop and event handler respectively.
  46599. function transformModel (options, data) {
  46600. var prop = (options.model && options.model.prop) || 'value';
  46601. var event = (options.model && options.model.event) || 'input'
  46602. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  46603. var on = data.on || (data.on = {});
  46604. var existing = on[event];
  46605. var callback = data.model.callback;
  46606. if (isDef(existing)) {
  46607. if (
  46608. Array.isArray(existing)
  46609. ? existing.indexOf(callback) === -1
  46610. : existing !== callback
  46611. ) {
  46612. on[event] = [callback].concat(existing);
  46613. }
  46614. } else {
  46615. on[event] = callback;
  46616. }
  46617. }
  46618. /* */
  46619. var SIMPLE_NORMALIZE = 1;
  46620. var ALWAYS_NORMALIZE = 2;
  46621. // wrapper function for providing a more flexible interface
  46622. // without getting yelled at by flow
  46623. function createElement (
  46624. context,
  46625. tag,
  46626. data,
  46627. children,
  46628. normalizationType,
  46629. alwaysNormalize
  46630. ) {
  46631. if (Array.isArray(data) || isPrimitive(data)) {
  46632. normalizationType = children;
  46633. children = data;
  46634. data = undefined;
  46635. }
  46636. if (isTrue(alwaysNormalize)) {
  46637. normalizationType = ALWAYS_NORMALIZE;
  46638. }
  46639. return _createElement(context, tag, data, children, normalizationType)
  46640. }
  46641. function _createElement (
  46642. context,
  46643. tag,
  46644. data,
  46645. children,
  46646. normalizationType
  46647. ) {
  46648. if (isDef(data) && isDef((data).__ob__)) {
  46649. warn(
  46650. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  46651. 'Always create fresh vnode data objects in each render!',
  46652. context
  46653. );
  46654. return createEmptyVNode()
  46655. }
  46656. // object syntax in v-bind
  46657. if (isDef(data) && isDef(data.is)) {
  46658. tag = data.is;
  46659. }
  46660. if (!tag) {
  46661. // in case of component :is set to falsy value
  46662. return createEmptyVNode()
  46663. }
  46664. // warn against non-primitive key
  46665. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  46666. ) {
  46667. {
  46668. warn(
  46669. 'Avoid using non-primitive value as key, ' +
  46670. 'use string/number value instead.',
  46671. context
  46672. );
  46673. }
  46674. }
  46675. // support single function children as default scoped slot
  46676. if (Array.isArray(children) &&
  46677. typeof children[0] === 'function'
  46678. ) {
  46679. data = data || {};
  46680. data.scopedSlots = { default: children[0] };
  46681. children.length = 0;
  46682. }
  46683. if (normalizationType === ALWAYS_NORMALIZE) {
  46684. children = normalizeChildren(children);
  46685. } else if (normalizationType === SIMPLE_NORMALIZE) {
  46686. children = simpleNormalizeChildren(children);
  46687. }
  46688. var vnode, ns;
  46689. if (typeof tag === 'string') {
  46690. var Ctor;
  46691. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  46692. if (config.isReservedTag(tag)) {
  46693. // platform built-in elements
  46694. if (isDef(data) && isDef(data.nativeOn)) {
  46695. warn(
  46696. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  46697. context
  46698. );
  46699. }
  46700. vnode = new VNode(
  46701. config.parsePlatformTagName(tag), data, children,
  46702. undefined, undefined, context
  46703. );
  46704. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  46705. // component
  46706. vnode = createComponent(Ctor, data, context, children, tag);
  46707. } else {
  46708. // unknown or unlisted namespaced elements
  46709. // check at runtime because it may get assigned a namespace when its
  46710. // parent normalizes children
  46711. vnode = new VNode(
  46712. tag, data, children,
  46713. undefined, undefined, context
  46714. );
  46715. }
  46716. } else {
  46717. // direct component options / constructor
  46718. vnode = createComponent(tag, data, context, children);
  46719. }
  46720. if (Array.isArray(vnode)) {
  46721. return vnode
  46722. } else if (isDef(vnode)) {
  46723. if (isDef(ns)) { applyNS(vnode, ns); }
  46724. if (isDef(data)) { registerDeepBindings(data); }
  46725. return vnode
  46726. } else {
  46727. return createEmptyVNode()
  46728. }
  46729. }
  46730. function applyNS (vnode, ns, force) {
  46731. vnode.ns = ns;
  46732. if (vnode.tag === 'foreignObject') {
  46733. // use default namespace inside foreignObject
  46734. ns = undefined;
  46735. force = true;
  46736. }
  46737. if (isDef(vnode.children)) {
  46738. for (var i = 0, l = vnode.children.length; i < l; i++) {
  46739. var child = vnode.children[i];
  46740. if (isDef(child.tag) && (
  46741. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  46742. applyNS(child, ns, force);
  46743. }
  46744. }
  46745. }
  46746. }
  46747. // ref #5318
  46748. // necessary to ensure parent re-render when deep bindings like :style and
  46749. // :class are used on slot nodes
  46750. function registerDeepBindings (data) {
  46751. if (isObject(data.style)) {
  46752. traverse(data.style);
  46753. }
  46754. if (isObject(data.class)) {
  46755. traverse(data.class);
  46756. }
  46757. }
  46758. /* */
  46759. function initRender (vm) {
  46760. vm._vnode = null; // the root of the child tree
  46761. vm._staticTrees = null; // v-once cached trees
  46762. var options = vm.$options;
  46763. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  46764. var renderContext = parentVnode && parentVnode.context;
  46765. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  46766. vm.$scopedSlots = emptyObject;
  46767. // bind the createElement fn to this instance
  46768. // so that we get proper render context inside it.
  46769. // args order: tag, data, children, normalizationType, alwaysNormalize
  46770. // internal version is used by render functions compiled from templates
  46771. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46772. // normalization is always applied for the public version, used in
  46773. // user-written render functions.
  46774. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46775. // $attrs & $listeners are exposed for easier HOC creation.
  46776. // they need to be reactive so that HOCs using them are always updated
  46777. var parentData = parentVnode && parentVnode.data;
  46778. /* istanbul ignore else */
  46779. {
  46780. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46781. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46782. }, true);
  46783. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46784. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46785. }, true);
  46786. }
  46787. }
  46788. var currentRenderingInstance = null;
  46789. function renderMixin (Vue) {
  46790. // install runtime convenience helpers
  46791. installRenderHelpers(Vue.prototype);
  46792. Vue.prototype.$nextTick = function (fn) {
  46793. return nextTick(fn, this)
  46794. };
  46795. Vue.prototype._render = function () {
  46796. var vm = this;
  46797. var ref = vm.$options;
  46798. var render = ref.render;
  46799. var _parentVnode = ref._parentVnode;
  46800. if (_parentVnode) {
  46801. vm.$scopedSlots = normalizeScopedSlots(
  46802. _parentVnode.data.scopedSlots,
  46803. vm.$slots,
  46804. vm.$scopedSlots
  46805. );
  46806. }
  46807. // set parent vnode. this allows render functions to have access
  46808. // to the data on the placeholder node.
  46809. vm.$vnode = _parentVnode;
  46810. // render self
  46811. var vnode;
  46812. try {
  46813. // There's no need to maintain a stack because all render fns are called
  46814. // separately from one another. Nested component's render fns are called
  46815. // when parent component is patched.
  46816. currentRenderingInstance = vm;
  46817. vnode = render.call(vm._renderProxy, vm.$createElement);
  46818. } catch (e) {
  46819. handleError(e, vm, "render");
  46820. // return error render result,
  46821. // or previous vnode to prevent render error causing blank component
  46822. /* istanbul ignore else */
  46823. if (vm.$options.renderError) {
  46824. try {
  46825. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46826. } catch (e) {
  46827. handleError(e, vm, "renderError");
  46828. vnode = vm._vnode;
  46829. }
  46830. } else {
  46831. vnode = vm._vnode;
  46832. }
  46833. } finally {
  46834. currentRenderingInstance = null;
  46835. }
  46836. // if the returned array contains only a single node, allow it
  46837. if (Array.isArray(vnode) && vnode.length === 1) {
  46838. vnode = vnode[0];
  46839. }
  46840. // return empty vnode in case the render function errored out
  46841. if (!(vnode instanceof VNode)) {
  46842. if (Array.isArray(vnode)) {
  46843. warn(
  46844. 'Multiple root nodes returned from render function. Render function ' +
  46845. 'should return a single root node.',
  46846. vm
  46847. );
  46848. }
  46849. vnode = createEmptyVNode();
  46850. }
  46851. // set parent
  46852. vnode.parent = _parentVnode;
  46853. return vnode
  46854. };
  46855. }
  46856. /* */
  46857. function ensureCtor (comp, base) {
  46858. if (
  46859. comp.__esModule ||
  46860. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  46861. ) {
  46862. comp = comp.default;
  46863. }
  46864. return isObject(comp)
  46865. ? base.extend(comp)
  46866. : comp
  46867. }
  46868. function createAsyncPlaceholder (
  46869. factory,
  46870. data,
  46871. context,
  46872. children,
  46873. tag
  46874. ) {
  46875. var node = createEmptyVNode();
  46876. node.asyncFactory = factory;
  46877. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  46878. return node
  46879. }
  46880. function resolveAsyncComponent (
  46881. factory,
  46882. baseCtor
  46883. ) {
  46884. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  46885. return factory.errorComp
  46886. }
  46887. if (isDef(factory.resolved)) {
  46888. return factory.resolved
  46889. }
  46890. var owner = currentRenderingInstance;
  46891. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  46892. // already pending
  46893. factory.owners.push(owner);
  46894. }
  46895. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  46896. return factory.loadingComp
  46897. }
  46898. if (owner && !isDef(factory.owners)) {
  46899. var owners = factory.owners = [owner];
  46900. var sync = true;
  46901. var timerLoading = null;
  46902. var timerTimeout = null
  46903. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  46904. var forceRender = function (renderCompleted) {
  46905. for (var i = 0, l = owners.length; i < l; i++) {
  46906. (owners[i]).$forceUpdate();
  46907. }
  46908. if (renderCompleted) {
  46909. owners.length = 0;
  46910. if (timerLoading !== null) {
  46911. clearTimeout(timerLoading);
  46912. timerLoading = null;
  46913. }
  46914. if (timerTimeout !== null) {
  46915. clearTimeout(timerTimeout);
  46916. timerTimeout = null;
  46917. }
  46918. }
  46919. };
  46920. var resolve = once(function (res) {
  46921. // cache resolved
  46922. factory.resolved = ensureCtor(res, baseCtor);
  46923. // invoke callbacks only if this is not a synchronous resolve
  46924. // (async resolves are shimmed as synchronous during SSR)
  46925. if (!sync) {
  46926. forceRender(true);
  46927. } else {
  46928. owners.length = 0;
  46929. }
  46930. });
  46931. var reject = once(function (reason) {
  46932. warn(
  46933. "Failed to resolve async component: " + (String(factory)) +
  46934. (reason ? ("\nReason: " + reason) : '')
  46935. );
  46936. if (isDef(factory.errorComp)) {
  46937. factory.error = true;
  46938. forceRender(true);
  46939. }
  46940. });
  46941. var res = factory(resolve, reject);
  46942. if (isObject(res)) {
  46943. if (isPromise(res)) {
  46944. // () => Promise
  46945. if (isUndef(factory.resolved)) {
  46946. res.then(resolve, reject);
  46947. }
  46948. } else if (isPromise(res.component)) {
  46949. res.component.then(resolve, reject);
  46950. if (isDef(res.error)) {
  46951. factory.errorComp = ensureCtor(res.error, baseCtor);
  46952. }
  46953. if (isDef(res.loading)) {
  46954. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  46955. if (res.delay === 0) {
  46956. factory.loading = true;
  46957. } else {
  46958. timerLoading = setTimeout(function () {
  46959. timerLoading = null;
  46960. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  46961. factory.loading = true;
  46962. forceRender(false);
  46963. }
  46964. }, res.delay || 200);
  46965. }
  46966. }
  46967. if (isDef(res.timeout)) {
  46968. timerTimeout = setTimeout(function () {
  46969. timerTimeout = null;
  46970. if (isUndef(factory.resolved)) {
  46971. reject(
  46972. "timeout (" + (res.timeout) + "ms)"
  46973. );
  46974. }
  46975. }, res.timeout);
  46976. }
  46977. }
  46978. }
  46979. sync = false;
  46980. // return in case resolved synchronously
  46981. return factory.loading
  46982. ? factory.loadingComp
  46983. : factory.resolved
  46984. }
  46985. }
  46986. /* */
  46987. function isAsyncPlaceholder (node) {
  46988. return node.isComment && node.asyncFactory
  46989. }
  46990. /* */
  46991. function getFirstComponentChild (children) {
  46992. if (Array.isArray(children)) {
  46993. for (var i = 0; i < children.length; i++) {
  46994. var c = children[i];
  46995. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  46996. return c
  46997. }
  46998. }
  46999. }
  47000. }
  47001. /* */
  47002. /* */
  47003. function initEvents (vm) {
  47004. vm._events = Object.create(null);
  47005. vm._hasHookEvent = false;
  47006. // init parent attached events
  47007. var listeners = vm.$options._parentListeners;
  47008. if (listeners) {
  47009. updateComponentListeners(vm, listeners);
  47010. }
  47011. }
  47012. var target;
  47013. function add (event, fn) {
  47014. target.$on(event, fn);
  47015. }
  47016. function remove$1 (event, fn) {
  47017. target.$off(event, fn);
  47018. }
  47019. function createOnceHandler (event, fn) {
  47020. var _target = target;
  47021. return function onceHandler () {
  47022. var res = fn.apply(null, arguments);
  47023. if (res !== null) {
  47024. _target.$off(event, onceHandler);
  47025. }
  47026. }
  47027. }
  47028. function updateComponentListeners (
  47029. vm,
  47030. listeners,
  47031. oldListeners
  47032. ) {
  47033. target = vm;
  47034. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47035. target = undefined;
  47036. }
  47037. function eventsMixin (Vue) {
  47038. var hookRE = /^hook:/;
  47039. Vue.prototype.$on = function (event, fn) {
  47040. var vm = this;
  47041. if (Array.isArray(event)) {
  47042. for (var i = 0, l = event.length; i < l; i++) {
  47043. vm.$on(event[i], fn);
  47044. }
  47045. } else {
  47046. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47047. // optimize hook:event cost by using a boolean flag marked at registration
  47048. // instead of a hash lookup
  47049. if (hookRE.test(event)) {
  47050. vm._hasHookEvent = true;
  47051. }
  47052. }
  47053. return vm
  47054. };
  47055. Vue.prototype.$once = function (event, fn) {
  47056. var vm = this;
  47057. function on () {
  47058. vm.$off(event, on);
  47059. fn.apply(vm, arguments);
  47060. }
  47061. on.fn = fn;
  47062. vm.$on(event, on);
  47063. return vm
  47064. };
  47065. Vue.prototype.$off = function (event, fn) {
  47066. var vm = this;
  47067. // all
  47068. if (!arguments.length) {
  47069. vm._events = Object.create(null);
  47070. return vm
  47071. }
  47072. // array of events
  47073. if (Array.isArray(event)) {
  47074. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47075. vm.$off(event[i$1], fn);
  47076. }
  47077. return vm
  47078. }
  47079. // specific event
  47080. var cbs = vm._events[event];
  47081. if (!cbs) {
  47082. return vm
  47083. }
  47084. if (!fn) {
  47085. vm._events[event] = null;
  47086. return vm
  47087. }
  47088. // specific handler
  47089. var cb;
  47090. var i = cbs.length;
  47091. while (i--) {
  47092. cb = cbs[i];
  47093. if (cb === fn || cb.fn === fn) {
  47094. cbs.splice(i, 1);
  47095. break
  47096. }
  47097. }
  47098. return vm
  47099. };
  47100. Vue.prototype.$emit = function (event) {
  47101. var vm = this;
  47102. {
  47103. var lowerCaseEvent = event.toLowerCase();
  47104. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47105. tip(
  47106. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47107. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47108. "Note that HTML attributes are case-insensitive and you cannot use " +
  47109. "v-on to listen to camelCase events when using in-DOM templates. " +
  47110. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47111. );
  47112. }
  47113. }
  47114. var cbs = vm._events[event];
  47115. if (cbs) {
  47116. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47117. var args = toArray(arguments, 1);
  47118. var info = "event handler for \"" + event + "\"";
  47119. for (var i = 0, l = cbs.length; i < l; i++) {
  47120. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47121. }
  47122. }
  47123. return vm
  47124. };
  47125. }
  47126. /* */
  47127. var activeInstance = null;
  47128. var isUpdatingChildComponent = false;
  47129. function setActiveInstance(vm) {
  47130. var prevActiveInstance = activeInstance;
  47131. activeInstance = vm;
  47132. return function () {
  47133. activeInstance = prevActiveInstance;
  47134. }
  47135. }
  47136. function initLifecycle (vm) {
  47137. var options = vm.$options;
  47138. // locate first non-abstract parent
  47139. var parent = options.parent;
  47140. if (parent && !options.abstract) {
  47141. while (parent.$options.abstract && parent.$parent) {
  47142. parent = parent.$parent;
  47143. }
  47144. parent.$children.push(vm);
  47145. }
  47146. vm.$parent = parent;
  47147. vm.$root = parent ? parent.$root : vm;
  47148. vm.$children = [];
  47149. vm.$refs = {};
  47150. vm._watcher = null;
  47151. vm._inactive = null;
  47152. vm._directInactive = false;
  47153. vm._isMounted = false;
  47154. vm._isDestroyed = false;
  47155. vm._isBeingDestroyed = false;
  47156. }
  47157. function lifecycleMixin (Vue) {
  47158. Vue.prototype._update = function (vnode, hydrating) {
  47159. var vm = this;
  47160. var prevEl = vm.$el;
  47161. var prevVnode = vm._vnode;
  47162. var restoreActiveInstance = setActiveInstance(vm);
  47163. vm._vnode = vnode;
  47164. // Vue.prototype.__patch__ is injected in entry points
  47165. // based on the rendering backend used.
  47166. if (!prevVnode) {
  47167. // initial render
  47168. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47169. } else {
  47170. // updates
  47171. vm.$el = vm.__patch__(prevVnode, vnode);
  47172. }
  47173. restoreActiveInstance();
  47174. // update __vue__ reference
  47175. if (prevEl) {
  47176. prevEl.__vue__ = null;
  47177. }
  47178. if (vm.$el) {
  47179. vm.$el.__vue__ = vm;
  47180. }
  47181. // if parent is an HOC, update its $el as well
  47182. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47183. vm.$parent.$el = vm.$el;
  47184. }
  47185. // updated hook is called by the scheduler to ensure that children are
  47186. // updated in a parent's updated hook.
  47187. };
  47188. Vue.prototype.$forceUpdate = function () {
  47189. var vm = this;
  47190. if (vm._watcher) {
  47191. vm._watcher.update();
  47192. }
  47193. };
  47194. Vue.prototype.$destroy = function () {
  47195. var vm = this;
  47196. if (vm._isBeingDestroyed) {
  47197. return
  47198. }
  47199. callHook(vm, 'beforeDestroy');
  47200. vm._isBeingDestroyed = true;
  47201. // remove self from parent
  47202. var parent = vm.$parent;
  47203. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47204. remove(parent.$children, vm);
  47205. }
  47206. // teardown watchers
  47207. if (vm._watcher) {
  47208. vm._watcher.teardown();
  47209. }
  47210. var i = vm._watchers.length;
  47211. while (i--) {
  47212. vm._watchers[i].teardown();
  47213. }
  47214. // remove reference from data ob
  47215. // frozen object may not have observer.
  47216. if (vm._data.__ob__) {
  47217. vm._data.__ob__.vmCount--;
  47218. }
  47219. // call the last hook...
  47220. vm._isDestroyed = true;
  47221. // invoke destroy hooks on current rendered tree
  47222. vm.__patch__(vm._vnode, null);
  47223. // fire destroyed hook
  47224. callHook(vm, 'destroyed');
  47225. // turn off all instance listeners.
  47226. vm.$off();
  47227. // remove __vue__ reference
  47228. if (vm.$el) {
  47229. vm.$el.__vue__ = null;
  47230. }
  47231. // release circular reference (#6759)
  47232. if (vm.$vnode) {
  47233. vm.$vnode.parent = null;
  47234. }
  47235. };
  47236. }
  47237. function mountComponent (
  47238. vm,
  47239. el,
  47240. hydrating
  47241. ) {
  47242. vm.$el = el;
  47243. if (!vm.$options.render) {
  47244. vm.$options.render = createEmptyVNode;
  47245. {
  47246. /* istanbul ignore if */
  47247. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47248. vm.$options.el || el) {
  47249. warn(
  47250. 'You are using the runtime-only build of Vue where the template ' +
  47251. 'compiler is not available. Either pre-compile the templates into ' +
  47252. 'render functions, or use the compiler-included build.',
  47253. vm
  47254. );
  47255. } else {
  47256. warn(
  47257. 'Failed to mount component: template or render function not defined.',
  47258. vm
  47259. );
  47260. }
  47261. }
  47262. }
  47263. callHook(vm, 'beforeMount');
  47264. var updateComponent;
  47265. /* istanbul ignore if */
  47266. if (config.performance && mark) {
  47267. updateComponent = function () {
  47268. var name = vm._name;
  47269. var id = vm._uid;
  47270. var startTag = "vue-perf-start:" + id;
  47271. var endTag = "vue-perf-end:" + id;
  47272. mark(startTag);
  47273. var vnode = vm._render();
  47274. mark(endTag);
  47275. measure(("vue " + name + " render"), startTag, endTag);
  47276. mark(startTag);
  47277. vm._update(vnode, hydrating);
  47278. mark(endTag);
  47279. measure(("vue " + name + " patch"), startTag, endTag);
  47280. };
  47281. } else {
  47282. updateComponent = function () {
  47283. vm._update(vm._render(), hydrating);
  47284. };
  47285. }
  47286. // we set this to vm._watcher inside the watcher's constructor
  47287. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47288. // component's mounted hook), which relies on vm._watcher being already defined
  47289. new Watcher(vm, updateComponent, noop, {
  47290. before: function before () {
  47291. if (vm._isMounted && !vm._isDestroyed) {
  47292. callHook(vm, 'beforeUpdate');
  47293. }
  47294. }
  47295. }, true /* isRenderWatcher */);
  47296. hydrating = false;
  47297. // manually mounted instance, call mounted on self
  47298. // mounted is called for render-created child components in its inserted hook
  47299. if (vm.$vnode == null) {
  47300. vm._isMounted = true;
  47301. callHook(vm, 'mounted');
  47302. }
  47303. return vm
  47304. }
  47305. function updateChildComponent (
  47306. vm,
  47307. propsData,
  47308. listeners,
  47309. parentVnode,
  47310. renderChildren
  47311. ) {
  47312. {
  47313. isUpdatingChildComponent = true;
  47314. }
  47315. // determine whether component has slot children
  47316. // we need to do this before overwriting $options._renderChildren.
  47317. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47318. // dynamic slot names). Static scoped slots compiled from template has the
  47319. // "$stable" marker.
  47320. var newScopedSlots = parentVnode.data.scopedSlots;
  47321. var oldScopedSlots = vm.$scopedSlots;
  47322. var hasDynamicScopedSlot = !!(
  47323. (newScopedSlots && !newScopedSlots.$stable) ||
  47324. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47325. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47326. );
  47327. // Any static slot children from the parent may have changed during parent's
  47328. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47329. // update is necessary to ensure correctness.
  47330. var needsForceUpdate = !!(
  47331. renderChildren || // has new static slots
  47332. vm.$options._renderChildren || // has old static slots
  47333. hasDynamicScopedSlot
  47334. );
  47335. vm.$options._parentVnode = parentVnode;
  47336. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47337. if (vm._vnode) { // update child tree's parent
  47338. vm._vnode.parent = parentVnode;
  47339. }
  47340. vm.$options._renderChildren = renderChildren;
  47341. // update $attrs and $listeners hash
  47342. // these are also reactive so they may trigger child update if the child
  47343. // used them during render
  47344. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47345. vm.$listeners = listeners || emptyObject;
  47346. // update props
  47347. if (propsData && vm.$options.props) {
  47348. toggleObserving(false);
  47349. var props = vm._props;
  47350. var propKeys = vm.$options._propKeys || [];
  47351. for (var i = 0; i < propKeys.length; i++) {
  47352. var key = propKeys[i];
  47353. var propOptions = vm.$options.props; // wtf flow?
  47354. props[key] = validateProp(key, propOptions, propsData, vm);
  47355. }
  47356. toggleObserving(true);
  47357. // keep a copy of raw propsData
  47358. vm.$options.propsData = propsData;
  47359. }
  47360. // update listeners
  47361. listeners = listeners || emptyObject;
  47362. var oldListeners = vm.$options._parentListeners;
  47363. vm.$options._parentListeners = listeners;
  47364. updateComponentListeners(vm, listeners, oldListeners);
  47365. // resolve slots + force update if has children
  47366. if (needsForceUpdate) {
  47367. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47368. vm.$forceUpdate();
  47369. }
  47370. {
  47371. isUpdatingChildComponent = false;
  47372. }
  47373. }
  47374. function isInInactiveTree (vm) {
  47375. while (vm && (vm = vm.$parent)) {
  47376. if (vm._inactive) { return true }
  47377. }
  47378. return false
  47379. }
  47380. function activateChildComponent (vm, direct) {
  47381. if (direct) {
  47382. vm._directInactive = false;
  47383. if (isInInactiveTree(vm)) {
  47384. return
  47385. }
  47386. } else if (vm._directInactive) {
  47387. return
  47388. }
  47389. if (vm._inactive || vm._inactive === null) {
  47390. vm._inactive = false;
  47391. for (var i = 0; i < vm.$children.length; i++) {
  47392. activateChildComponent(vm.$children[i]);
  47393. }
  47394. callHook(vm, 'activated');
  47395. }
  47396. }
  47397. function deactivateChildComponent (vm, direct) {
  47398. if (direct) {
  47399. vm._directInactive = true;
  47400. if (isInInactiveTree(vm)) {
  47401. return
  47402. }
  47403. }
  47404. if (!vm._inactive) {
  47405. vm._inactive = true;
  47406. for (var i = 0; i < vm.$children.length; i++) {
  47407. deactivateChildComponent(vm.$children[i]);
  47408. }
  47409. callHook(vm, 'deactivated');
  47410. }
  47411. }
  47412. function callHook (vm, hook) {
  47413. // #7573 disable dep collection when invoking lifecycle hooks
  47414. pushTarget();
  47415. var handlers = vm.$options[hook];
  47416. var info = hook + " hook";
  47417. if (handlers) {
  47418. for (var i = 0, j = handlers.length; i < j; i++) {
  47419. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47420. }
  47421. }
  47422. if (vm._hasHookEvent) {
  47423. vm.$emit('hook:' + hook);
  47424. }
  47425. popTarget();
  47426. }
  47427. /* */
  47428. var MAX_UPDATE_COUNT = 100;
  47429. var queue = [];
  47430. var activatedChildren = [];
  47431. var has = {};
  47432. var circular = {};
  47433. var waiting = false;
  47434. var flushing = false;
  47435. var index = 0;
  47436. /**
  47437. * Reset the scheduler's state.
  47438. */
  47439. function resetSchedulerState () {
  47440. index = queue.length = activatedChildren.length = 0;
  47441. has = {};
  47442. {
  47443. circular = {};
  47444. }
  47445. waiting = flushing = false;
  47446. }
  47447. // Async edge case #6566 requires saving the timestamp when event listeners are
  47448. // attached. However, calling performance.now() has a perf overhead especially
  47449. // if the page has thousands of event listeners. Instead, we take a timestamp
  47450. // every time the scheduler flushes and use that for all event listeners
  47451. // attached during that flush.
  47452. var currentFlushTimestamp = 0;
  47453. // Async edge case fix requires storing an event listener's attach timestamp.
  47454. var getNow = Date.now;
  47455. // Determine what event timestamp the browser is using. Annoyingly, the
  47456. // timestamp can either be hi-res (relative to page load) or low-res
  47457. // (relative to UNIX epoch), so in order to compare time we have to use the
  47458. // same timestamp type when saving the flush timestamp.
  47459. // All IE versions use low-res event timestamps, and have problematic clock
  47460. // implementations (#9632)
  47461. if (inBrowser && !isIE) {
  47462. var performance = window.performance;
  47463. if (
  47464. performance &&
  47465. typeof performance.now === 'function' &&
  47466. getNow() > document.createEvent('Event').timeStamp
  47467. ) {
  47468. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47469. // smaller than it, it means the event is using a hi-res timestamp,
  47470. // and we need to use the hi-res version for event listener timestamps as
  47471. // well.
  47472. getNow = function () { return performance.now(); };
  47473. }
  47474. }
  47475. /**
  47476. * Flush both queues and run the watchers.
  47477. */
  47478. function flushSchedulerQueue () {
  47479. currentFlushTimestamp = getNow();
  47480. flushing = true;
  47481. var watcher, id;
  47482. // Sort queue before flush.
  47483. // This ensures that:
  47484. // 1. Components are updated from parent to child. (because parent is always
  47485. // created before the child)
  47486. // 2. A component's user watchers are run before its render watcher (because
  47487. // user watchers are created before the render watcher)
  47488. // 3. If a component is destroyed during a parent component's watcher run,
  47489. // its watchers can be skipped.
  47490. queue.sort(function (a, b) { return a.id - b.id; });
  47491. // do not cache length because more watchers might be pushed
  47492. // as we run existing watchers
  47493. for (index = 0; index < queue.length; index++) {
  47494. watcher = queue[index];
  47495. if (watcher.before) {
  47496. watcher.before();
  47497. }
  47498. id = watcher.id;
  47499. has[id] = null;
  47500. watcher.run();
  47501. // in dev build, check and stop circular updates.
  47502. if (has[id] != null) {
  47503. circular[id] = (circular[id] || 0) + 1;
  47504. if (circular[id] > MAX_UPDATE_COUNT) {
  47505. warn(
  47506. 'You may have an infinite update loop ' + (
  47507. watcher.user
  47508. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47509. : "in a component render function."
  47510. ),
  47511. watcher.vm
  47512. );
  47513. break
  47514. }
  47515. }
  47516. }
  47517. // keep copies of post queues before resetting state
  47518. var activatedQueue = activatedChildren.slice();
  47519. var updatedQueue = queue.slice();
  47520. resetSchedulerState();
  47521. // call component updated and activated hooks
  47522. callActivatedHooks(activatedQueue);
  47523. callUpdatedHooks(updatedQueue);
  47524. // devtool hook
  47525. /* istanbul ignore if */
  47526. if (devtools && config.devtools) {
  47527. devtools.emit('flush');
  47528. }
  47529. }
  47530. function callUpdatedHooks (queue) {
  47531. var i = queue.length;
  47532. while (i--) {
  47533. var watcher = queue[i];
  47534. var vm = watcher.vm;
  47535. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47536. callHook(vm, 'updated');
  47537. }
  47538. }
  47539. }
  47540. /**
  47541. * Queue a kept-alive component that was activated during patch.
  47542. * The queue will be processed after the entire tree has been patched.
  47543. */
  47544. function queueActivatedComponent (vm) {
  47545. // setting _inactive to false here so that a render function can
  47546. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47547. vm._inactive = false;
  47548. activatedChildren.push(vm);
  47549. }
  47550. function callActivatedHooks (queue) {
  47551. for (var i = 0; i < queue.length; i++) {
  47552. queue[i]._inactive = true;
  47553. activateChildComponent(queue[i], true /* true */);
  47554. }
  47555. }
  47556. /**
  47557. * Push a watcher into the watcher queue.
  47558. * Jobs with duplicate IDs will be skipped unless it's
  47559. * pushed when the queue is being flushed.
  47560. */
  47561. function queueWatcher (watcher) {
  47562. var id = watcher.id;
  47563. if (has[id] == null) {
  47564. has[id] = true;
  47565. if (!flushing) {
  47566. queue.push(watcher);
  47567. } else {
  47568. // if already flushing, splice the watcher based on its id
  47569. // if already past its id, it will be run next immediately.
  47570. var i = queue.length - 1;
  47571. while (i > index && queue[i].id > watcher.id) {
  47572. i--;
  47573. }
  47574. queue.splice(i + 1, 0, watcher);
  47575. }
  47576. // queue the flush
  47577. if (!waiting) {
  47578. waiting = true;
  47579. if (!config.async) {
  47580. flushSchedulerQueue();
  47581. return
  47582. }
  47583. nextTick(flushSchedulerQueue);
  47584. }
  47585. }
  47586. }
  47587. /* */
  47588. var uid$2 = 0;
  47589. /**
  47590. * A watcher parses an expression, collects dependencies,
  47591. * and fires callback when the expression value changes.
  47592. * This is used for both the $watch() api and directives.
  47593. */
  47594. var Watcher = function Watcher (
  47595. vm,
  47596. expOrFn,
  47597. cb,
  47598. options,
  47599. isRenderWatcher
  47600. ) {
  47601. this.vm = vm;
  47602. if (isRenderWatcher) {
  47603. vm._watcher = this;
  47604. }
  47605. vm._watchers.push(this);
  47606. // options
  47607. if (options) {
  47608. this.deep = !!options.deep;
  47609. this.user = !!options.user;
  47610. this.lazy = !!options.lazy;
  47611. this.sync = !!options.sync;
  47612. this.before = options.before;
  47613. } else {
  47614. this.deep = this.user = this.lazy = this.sync = false;
  47615. }
  47616. this.cb = cb;
  47617. this.id = ++uid$2; // uid for batching
  47618. this.active = true;
  47619. this.dirty = this.lazy; // for lazy watchers
  47620. this.deps = [];
  47621. this.newDeps = [];
  47622. this.depIds = new _Set();
  47623. this.newDepIds = new _Set();
  47624. this.expression = expOrFn.toString();
  47625. // parse expression for getter
  47626. if (typeof expOrFn === 'function') {
  47627. this.getter = expOrFn;
  47628. } else {
  47629. this.getter = parsePath(expOrFn);
  47630. if (!this.getter) {
  47631. this.getter = noop;
  47632. warn(
  47633. "Failed watching path: \"" + expOrFn + "\" " +
  47634. 'Watcher only accepts simple dot-delimited paths. ' +
  47635. 'For full control, use a function instead.',
  47636. vm
  47637. );
  47638. }
  47639. }
  47640. this.value = this.lazy
  47641. ? undefined
  47642. : this.get();
  47643. };
  47644. /**
  47645. * Evaluate the getter, and re-collect dependencies.
  47646. */
  47647. Watcher.prototype.get = function get () {
  47648. pushTarget(this);
  47649. var value;
  47650. var vm = this.vm;
  47651. try {
  47652. value = this.getter.call(vm, vm);
  47653. } catch (e) {
  47654. if (this.user) {
  47655. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  47656. } else {
  47657. throw e
  47658. }
  47659. } finally {
  47660. // "touch" every property so they are all tracked as
  47661. // dependencies for deep watching
  47662. if (this.deep) {
  47663. traverse(value);
  47664. }
  47665. popTarget();
  47666. this.cleanupDeps();
  47667. }
  47668. return value
  47669. };
  47670. /**
  47671. * Add a dependency to this directive.
  47672. */
  47673. Watcher.prototype.addDep = function addDep (dep) {
  47674. var id = dep.id;
  47675. if (!this.newDepIds.has(id)) {
  47676. this.newDepIds.add(id);
  47677. this.newDeps.push(dep);
  47678. if (!this.depIds.has(id)) {
  47679. dep.addSub(this);
  47680. }
  47681. }
  47682. };
  47683. /**
  47684. * Clean up for dependency collection.
  47685. */
  47686. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  47687. var i = this.deps.length;
  47688. while (i--) {
  47689. var dep = this.deps[i];
  47690. if (!this.newDepIds.has(dep.id)) {
  47691. dep.removeSub(this);
  47692. }
  47693. }
  47694. var tmp = this.depIds;
  47695. this.depIds = this.newDepIds;
  47696. this.newDepIds = tmp;
  47697. this.newDepIds.clear();
  47698. tmp = this.deps;
  47699. this.deps = this.newDeps;
  47700. this.newDeps = tmp;
  47701. this.newDeps.length = 0;
  47702. };
  47703. /**
  47704. * Subscriber interface.
  47705. * Will be called when a dependency changes.
  47706. */
  47707. Watcher.prototype.update = function update () {
  47708. /* istanbul ignore else */
  47709. if (this.lazy) {
  47710. this.dirty = true;
  47711. } else if (this.sync) {
  47712. this.run();
  47713. } else {
  47714. queueWatcher(this);
  47715. }
  47716. };
  47717. /**
  47718. * Scheduler job interface.
  47719. * Will be called by the scheduler.
  47720. */
  47721. Watcher.prototype.run = function run () {
  47722. if (this.active) {
  47723. var value = this.get();
  47724. if (
  47725. value !== this.value ||
  47726. // Deep watchers and watchers on Object/Arrays should fire even
  47727. // when the value is the same, because the value may
  47728. // have mutated.
  47729. isObject(value) ||
  47730. this.deep
  47731. ) {
  47732. // set new value
  47733. var oldValue = this.value;
  47734. this.value = value;
  47735. if (this.user) {
  47736. try {
  47737. this.cb.call(this.vm, value, oldValue);
  47738. } catch (e) {
  47739. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  47740. }
  47741. } else {
  47742. this.cb.call(this.vm, value, oldValue);
  47743. }
  47744. }
  47745. }
  47746. };
  47747. /**
  47748. * Evaluate the value of the watcher.
  47749. * This only gets called for lazy watchers.
  47750. */
  47751. Watcher.prototype.evaluate = function evaluate () {
  47752. this.value = this.get();
  47753. this.dirty = false;
  47754. };
  47755. /**
  47756. * Depend on all deps collected by this watcher.
  47757. */
  47758. Watcher.prototype.depend = function depend () {
  47759. var i = this.deps.length;
  47760. while (i--) {
  47761. this.deps[i].depend();
  47762. }
  47763. };
  47764. /**
  47765. * Remove self from all dependencies' subscriber list.
  47766. */
  47767. Watcher.prototype.teardown = function teardown () {
  47768. if (this.active) {
  47769. // remove self from vm's watcher list
  47770. // this is a somewhat expensive operation so we skip it
  47771. // if the vm is being destroyed.
  47772. if (!this.vm._isBeingDestroyed) {
  47773. remove(this.vm._watchers, this);
  47774. }
  47775. var i = this.deps.length;
  47776. while (i--) {
  47777. this.deps[i].removeSub(this);
  47778. }
  47779. this.active = false;
  47780. }
  47781. };
  47782. /* */
  47783. var sharedPropertyDefinition = {
  47784. enumerable: true,
  47785. configurable: true,
  47786. get: noop,
  47787. set: noop
  47788. };
  47789. function proxy (target, sourceKey, key) {
  47790. sharedPropertyDefinition.get = function proxyGetter () {
  47791. return this[sourceKey][key]
  47792. };
  47793. sharedPropertyDefinition.set = function proxySetter (val) {
  47794. this[sourceKey][key] = val;
  47795. };
  47796. Object.defineProperty(target, key, sharedPropertyDefinition);
  47797. }
  47798. function initState (vm) {
  47799. vm._watchers = [];
  47800. var opts = vm.$options;
  47801. if (opts.props) { initProps(vm, opts.props); }
  47802. if (opts.methods) { initMethods(vm, opts.methods); }
  47803. if (opts.data) {
  47804. initData(vm);
  47805. } else {
  47806. observe(vm._data = {}, true /* asRootData */);
  47807. }
  47808. if (opts.computed) { initComputed(vm, opts.computed); }
  47809. if (opts.watch && opts.watch !== nativeWatch) {
  47810. initWatch(vm, opts.watch);
  47811. }
  47812. }
  47813. function initProps (vm, propsOptions) {
  47814. var propsData = vm.$options.propsData || {};
  47815. var props = vm._props = {};
  47816. // cache prop keys so that future props updates can iterate using Array
  47817. // instead of dynamic object key enumeration.
  47818. var keys = vm.$options._propKeys = [];
  47819. var isRoot = !vm.$parent;
  47820. // root instance props should be converted
  47821. if (!isRoot) {
  47822. toggleObserving(false);
  47823. }
  47824. var loop = function ( key ) {
  47825. keys.push(key);
  47826. var value = validateProp(key, propsOptions, propsData, vm);
  47827. /* istanbul ignore else */
  47828. {
  47829. var hyphenatedKey = hyphenate(key);
  47830. if (isReservedAttribute(hyphenatedKey) ||
  47831. config.isReservedAttr(hyphenatedKey)) {
  47832. warn(
  47833. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  47834. vm
  47835. );
  47836. }
  47837. defineReactive$$1(props, key, value, function () {
  47838. if (!isRoot && !isUpdatingChildComponent) {
  47839. warn(
  47840. "Avoid mutating a prop directly since the value will be " +
  47841. "overwritten whenever the parent component re-renders. " +
  47842. "Instead, use a data or computed property based on the prop's " +
  47843. "value. Prop being mutated: \"" + key + "\"",
  47844. vm
  47845. );
  47846. }
  47847. });
  47848. }
  47849. // static props are already proxied on the component's prototype
  47850. // during Vue.extend(). We only need to proxy props defined at
  47851. // instantiation here.
  47852. if (!(key in vm)) {
  47853. proxy(vm, "_props", key);
  47854. }
  47855. };
  47856. for (var key in propsOptions) loop( key );
  47857. toggleObserving(true);
  47858. }
  47859. function initData (vm) {
  47860. var data = vm.$options.data;
  47861. data = vm._data = typeof data === 'function'
  47862. ? getData(data, vm)
  47863. : data || {};
  47864. if (!isPlainObject(data)) {
  47865. data = {};
  47866. warn(
  47867. 'data functions should return an object:\n' +
  47868. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  47869. vm
  47870. );
  47871. }
  47872. // proxy data on instance
  47873. var keys = Object.keys(data);
  47874. var props = vm.$options.props;
  47875. var methods = vm.$options.methods;
  47876. var i = keys.length;
  47877. while (i--) {
  47878. var key = keys[i];
  47879. {
  47880. if (methods && hasOwn(methods, key)) {
  47881. warn(
  47882. ("Method \"" + key + "\" has already been defined as a data property."),
  47883. vm
  47884. );
  47885. }
  47886. }
  47887. if (props && hasOwn(props, key)) {
  47888. warn(
  47889. "The data property \"" + key + "\" is already declared as a prop. " +
  47890. "Use prop default value instead.",
  47891. vm
  47892. );
  47893. } else if (!isReserved(key)) {
  47894. proxy(vm, "_data", key);
  47895. }
  47896. }
  47897. // observe data
  47898. observe(data, true /* asRootData */);
  47899. }
  47900. function getData (data, vm) {
  47901. // #7573 disable dep collection when invoking data getters
  47902. pushTarget();
  47903. try {
  47904. return data.call(vm, vm)
  47905. } catch (e) {
  47906. handleError(e, vm, "data()");
  47907. return {}
  47908. } finally {
  47909. popTarget();
  47910. }
  47911. }
  47912. var computedWatcherOptions = { lazy: true };
  47913. function initComputed (vm, computed) {
  47914. // $flow-disable-line
  47915. var watchers = vm._computedWatchers = Object.create(null);
  47916. // computed properties are just getters during SSR
  47917. var isSSR = isServerRendering();
  47918. for (var key in computed) {
  47919. var userDef = computed[key];
  47920. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  47921. if (getter == null) {
  47922. warn(
  47923. ("Getter is missing for computed property \"" + key + "\"."),
  47924. vm
  47925. );
  47926. }
  47927. if (!isSSR) {
  47928. // create internal watcher for the computed property.
  47929. watchers[key] = new Watcher(
  47930. vm,
  47931. getter || noop,
  47932. noop,
  47933. computedWatcherOptions
  47934. );
  47935. }
  47936. // component-defined computed properties are already defined on the
  47937. // component prototype. We only need to define computed properties defined
  47938. // at instantiation here.
  47939. if (!(key in vm)) {
  47940. defineComputed(vm, key, userDef);
  47941. } else {
  47942. if (key in vm.$data) {
  47943. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  47944. } else if (vm.$options.props && key in vm.$options.props) {
  47945. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  47946. }
  47947. }
  47948. }
  47949. }
  47950. function defineComputed (
  47951. target,
  47952. key,
  47953. userDef
  47954. ) {
  47955. var shouldCache = !isServerRendering();
  47956. if (typeof userDef === 'function') {
  47957. sharedPropertyDefinition.get = shouldCache
  47958. ? createComputedGetter(key)
  47959. : createGetterInvoker(userDef);
  47960. sharedPropertyDefinition.set = noop;
  47961. } else {
  47962. sharedPropertyDefinition.get = userDef.get
  47963. ? shouldCache && userDef.cache !== false
  47964. ? createComputedGetter(key)
  47965. : createGetterInvoker(userDef.get)
  47966. : noop;
  47967. sharedPropertyDefinition.set = userDef.set || noop;
  47968. }
  47969. if (sharedPropertyDefinition.set === noop) {
  47970. sharedPropertyDefinition.set = function () {
  47971. warn(
  47972. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  47973. this
  47974. );
  47975. };
  47976. }
  47977. Object.defineProperty(target, key, sharedPropertyDefinition);
  47978. }
  47979. function createComputedGetter (key) {
  47980. return function computedGetter () {
  47981. var watcher = this._computedWatchers && this._computedWatchers[key];
  47982. if (watcher) {
  47983. if (watcher.dirty) {
  47984. watcher.evaluate();
  47985. }
  47986. if (Dep.target) {
  47987. watcher.depend();
  47988. }
  47989. return watcher.value
  47990. }
  47991. }
  47992. }
  47993. function createGetterInvoker(fn) {
  47994. return function computedGetter () {
  47995. return fn.call(this, this)
  47996. }
  47997. }
  47998. function initMethods (vm, methods) {
  47999. var props = vm.$options.props;
  48000. for (var key in methods) {
  48001. {
  48002. if (typeof methods[key] !== 'function') {
  48003. warn(
  48004. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48005. "Did you reference the function correctly?",
  48006. vm
  48007. );
  48008. }
  48009. if (props && hasOwn(props, key)) {
  48010. warn(
  48011. ("Method \"" + key + "\" has already been defined as a prop."),
  48012. vm
  48013. );
  48014. }
  48015. if ((key in vm) && isReserved(key)) {
  48016. warn(
  48017. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48018. "Avoid defining component methods that start with _ or $."
  48019. );
  48020. }
  48021. }
  48022. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48023. }
  48024. }
  48025. function initWatch (vm, watch) {
  48026. for (var key in watch) {
  48027. var handler = watch[key];
  48028. if (Array.isArray(handler)) {
  48029. for (var i = 0; i < handler.length; i++) {
  48030. createWatcher(vm, key, handler[i]);
  48031. }
  48032. } else {
  48033. createWatcher(vm, key, handler);
  48034. }
  48035. }
  48036. }
  48037. function createWatcher (
  48038. vm,
  48039. expOrFn,
  48040. handler,
  48041. options
  48042. ) {
  48043. if (isPlainObject(handler)) {
  48044. options = handler;
  48045. handler = handler.handler;
  48046. }
  48047. if (typeof handler === 'string') {
  48048. handler = vm[handler];
  48049. }
  48050. return vm.$watch(expOrFn, handler, options)
  48051. }
  48052. function stateMixin (Vue) {
  48053. // flow somehow has problems with directly declared definition object
  48054. // when using Object.defineProperty, so we have to procedurally build up
  48055. // the object here.
  48056. var dataDef = {};
  48057. dataDef.get = function () { return this._data };
  48058. var propsDef = {};
  48059. propsDef.get = function () { return this._props };
  48060. {
  48061. dataDef.set = function () {
  48062. warn(
  48063. 'Avoid replacing instance root $data. ' +
  48064. 'Use nested data properties instead.',
  48065. this
  48066. );
  48067. };
  48068. propsDef.set = function () {
  48069. warn("$props is readonly.", this);
  48070. };
  48071. }
  48072. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48073. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48074. Vue.prototype.$set = set;
  48075. Vue.prototype.$delete = del;
  48076. Vue.prototype.$watch = function (
  48077. expOrFn,
  48078. cb,
  48079. options
  48080. ) {
  48081. var vm = this;
  48082. if (isPlainObject(cb)) {
  48083. return createWatcher(vm, expOrFn, cb, options)
  48084. }
  48085. options = options || {};
  48086. options.user = true;
  48087. var watcher = new Watcher(vm, expOrFn, cb, options);
  48088. if (options.immediate) {
  48089. try {
  48090. cb.call(vm, watcher.value);
  48091. } catch (error) {
  48092. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48093. }
  48094. }
  48095. return function unwatchFn () {
  48096. watcher.teardown();
  48097. }
  48098. };
  48099. }
  48100. /* */
  48101. var uid$3 = 0;
  48102. function initMixin (Vue) {
  48103. Vue.prototype._init = function (options) {
  48104. var vm = this;
  48105. // a uid
  48106. vm._uid = uid$3++;
  48107. var startTag, endTag;
  48108. /* istanbul ignore if */
  48109. if (config.performance && mark) {
  48110. startTag = "vue-perf-start:" + (vm._uid);
  48111. endTag = "vue-perf-end:" + (vm._uid);
  48112. mark(startTag);
  48113. }
  48114. // a flag to avoid this being observed
  48115. vm._isVue = true;
  48116. // merge options
  48117. if (options && options._isComponent) {
  48118. // optimize internal component instantiation
  48119. // since dynamic options merging is pretty slow, and none of the
  48120. // internal component options needs special treatment.
  48121. initInternalComponent(vm, options);
  48122. } else {
  48123. vm.$options = mergeOptions(
  48124. resolveConstructorOptions(vm.constructor),
  48125. options || {},
  48126. vm
  48127. );
  48128. }
  48129. /* istanbul ignore else */
  48130. {
  48131. initProxy(vm);
  48132. }
  48133. // expose real self
  48134. vm._self = vm;
  48135. initLifecycle(vm);
  48136. initEvents(vm);
  48137. initRender(vm);
  48138. callHook(vm, 'beforeCreate');
  48139. initInjections(vm); // resolve injections before data/props
  48140. initState(vm);
  48141. initProvide(vm); // resolve provide after data/props
  48142. callHook(vm, 'created');
  48143. /* istanbul ignore if */
  48144. if (config.performance && mark) {
  48145. vm._name = formatComponentName(vm, false);
  48146. mark(endTag);
  48147. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48148. }
  48149. if (vm.$options.el) {
  48150. vm.$mount(vm.$options.el);
  48151. }
  48152. };
  48153. }
  48154. function initInternalComponent (vm, options) {
  48155. var opts = vm.$options = Object.create(vm.constructor.options);
  48156. // doing this because it's faster than dynamic enumeration.
  48157. var parentVnode = options._parentVnode;
  48158. opts.parent = options.parent;
  48159. opts._parentVnode = parentVnode;
  48160. var vnodeComponentOptions = parentVnode.componentOptions;
  48161. opts.propsData = vnodeComponentOptions.propsData;
  48162. opts._parentListeners = vnodeComponentOptions.listeners;
  48163. opts._renderChildren = vnodeComponentOptions.children;
  48164. opts._componentTag = vnodeComponentOptions.tag;
  48165. if (options.render) {
  48166. opts.render = options.render;
  48167. opts.staticRenderFns = options.staticRenderFns;
  48168. }
  48169. }
  48170. function resolveConstructorOptions (Ctor) {
  48171. var options = Ctor.options;
  48172. if (Ctor.super) {
  48173. var superOptions = resolveConstructorOptions(Ctor.super);
  48174. var cachedSuperOptions = Ctor.superOptions;
  48175. if (superOptions !== cachedSuperOptions) {
  48176. // super option changed,
  48177. // need to resolve new options.
  48178. Ctor.superOptions = superOptions;
  48179. // check if there are any late-modified/attached options (#4976)
  48180. var modifiedOptions = resolveModifiedOptions(Ctor);
  48181. // update base extend options
  48182. if (modifiedOptions) {
  48183. extend(Ctor.extendOptions, modifiedOptions);
  48184. }
  48185. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48186. if (options.name) {
  48187. options.components[options.name] = Ctor;
  48188. }
  48189. }
  48190. }
  48191. return options
  48192. }
  48193. function resolveModifiedOptions (Ctor) {
  48194. var modified;
  48195. var latest = Ctor.options;
  48196. var sealed = Ctor.sealedOptions;
  48197. for (var key in latest) {
  48198. if (latest[key] !== sealed[key]) {
  48199. if (!modified) { modified = {}; }
  48200. modified[key] = latest[key];
  48201. }
  48202. }
  48203. return modified
  48204. }
  48205. function Vue (options) {
  48206. if (!(this instanceof Vue)
  48207. ) {
  48208. warn('Vue is a constructor and should be called with the `new` keyword');
  48209. }
  48210. this._init(options);
  48211. }
  48212. initMixin(Vue);
  48213. stateMixin(Vue);
  48214. eventsMixin(Vue);
  48215. lifecycleMixin(Vue);
  48216. renderMixin(Vue);
  48217. /* */
  48218. function initUse (Vue) {
  48219. Vue.use = function (plugin) {
  48220. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48221. if (installedPlugins.indexOf(plugin) > -1) {
  48222. return this
  48223. }
  48224. // additional parameters
  48225. var args = toArray(arguments, 1);
  48226. args.unshift(this);
  48227. if (typeof plugin.install === 'function') {
  48228. plugin.install.apply(plugin, args);
  48229. } else if (typeof plugin === 'function') {
  48230. plugin.apply(null, args);
  48231. }
  48232. installedPlugins.push(plugin);
  48233. return this
  48234. };
  48235. }
  48236. /* */
  48237. function initMixin$1 (Vue) {
  48238. Vue.mixin = function (mixin) {
  48239. this.options = mergeOptions(this.options, mixin);
  48240. return this
  48241. };
  48242. }
  48243. /* */
  48244. function initExtend (Vue) {
  48245. /**
  48246. * Each instance constructor, including Vue, has a unique
  48247. * cid. This enables us to create wrapped "child
  48248. * constructors" for prototypal inheritance and cache them.
  48249. */
  48250. Vue.cid = 0;
  48251. var cid = 1;
  48252. /**
  48253. * Class inheritance
  48254. */
  48255. Vue.extend = function (extendOptions) {
  48256. extendOptions = extendOptions || {};
  48257. var Super = this;
  48258. var SuperId = Super.cid;
  48259. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48260. if (cachedCtors[SuperId]) {
  48261. return cachedCtors[SuperId]
  48262. }
  48263. var name = extendOptions.name || Super.options.name;
  48264. if (name) {
  48265. validateComponentName(name);
  48266. }
  48267. var Sub = function VueComponent (options) {
  48268. this._init(options);
  48269. };
  48270. Sub.prototype = Object.create(Super.prototype);
  48271. Sub.prototype.constructor = Sub;
  48272. Sub.cid = cid++;
  48273. Sub.options = mergeOptions(
  48274. Super.options,
  48275. extendOptions
  48276. );
  48277. Sub['super'] = Super;
  48278. // For props and computed properties, we define the proxy getters on
  48279. // the Vue instances at extension time, on the extended prototype. This
  48280. // avoids Object.defineProperty calls for each instance created.
  48281. if (Sub.options.props) {
  48282. initProps$1(Sub);
  48283. }
  48284. if (Sub.options.computed) {
  48285. initComputed$1(Sub);
  48286. }
  48287. // allow further extension/mixin/plugin usage
  48288. Sub.extend = Super.extend;
  48289. Sub.mixin = Super.mixin;
  48290. Sub.use = Super.use;
  48291. // create asset registers, so extended classes
  48292. // can have their private assets too.
  48293. ASSET_TYPES.forEach(function (type) {
  48294. Sub[type] = Super[type];
  48295. });
  48296. // enable recursive self-lookup
  48297. if (name) {
  48298. Sub.options.components[name] = Sub;
  48299. }
  48300. // keep a reference to the super options at extension time.
  48301. // later at instantiation we can check if Super's options have
  48302. // been updated.
  48303. Sub.superOptions = Super.options;
  48304. Sub.extendOptions = extendOptions;
  48305. Sub.sealedOptions = extend({}, Sub.options);
  48306. // cache constructor
  48307. cachedCtors[SuperId] = Sub;
  48308. return Sub
  48309. };
  48310. }
  48311. function initProps$1 (Comp) {
  48312. var props = Comp.options.props;
  48313. for (var key in props) {
  48314. proxy(Comp.prototype, "_props", key);
  48315. }
  48316. }
  48317. function initComputed$1 (Comp) {
  48318. var computed = Comp.options.computed;
  48319. for (var key in computed) {
  48320. defineComputed(Comp.prototype, key, computed[key]);
  48321. }
  48322. }
  48323. /* */
  48324. function initAssetRegisters (Vue) {
  48325. /**
  48326. * Create asset registration methods.
  48327. */
  48328. ASSET_TYPES.forEach(function (type) {
  48329. Vue[type] = function (
  48330. id,
  48331. definition
  48332. ) {
  48333. if (!definition) {
  48334. return this.options[type + 's'][id]
  48335. } else {
  48336. /* istanbul ignore if */
  48337. if (type === 'component') {
  48338. validateComponentName(id);
  48339. }
  48340. if (type === 'component' && isPlainObject(definition)) {
  48341. definition.name = definition.name || id;
  48342. definition = this.options._base.extend(definition);
  48343. }
  48344. if (type === 'directive' && typeof definition === 'function') {
  48345. definition = { bind: definition, update: definition };
  48346. }
  48347. this.options[type + 's'][id] = definition;
  48348. return definition
  48349. }
  48350. };
  48351. });
  48352. }
  48353. /* */
  48354. function getComponentName (opts) {
  48355. return opts && (opts.Ctor.options.name || opts.tag)
  48356. }
  48357. function matches (pattern, name) {
  48358. if (Array.isArray(pattern)) {
  48359. return pattern.indexOf(name) > -1
  48360. } else if (typeof pattern === 'string') {
  48361. return pattern.split(',').indexOf(name) > -1
  48362. } else if (isRegExp(pattern)) {
  48363. return pattern.test(name)
  48364. }
  48365. /* istanbul ignore next */
  48366. return false
  48367. }
  48368. function pruneCache (keepAliveInstance, filter) {
  48369. var cache = keepAliveInstance.cache;
  48370. var keys = keepAliveInstance.keys;
  48371. var _vnode = keepAliveInstance._vnode;
  48372. for (var key in cache) {
  48373. var cachedNode = cache[key];
  48374. if (cachedNode) {
  48375. var name = getComponentName(cachedNode.componentOptions);
  48376. if (name && !filter(name)) {
  48377. pruneCacheEntry(cache, key, keys, _vnode);
  48378. }
  48379. }
  48380. }
  48381. }
  48382. function pruneCacheEntry (
  48383. cache,
  48384. key,
  48385. keys,
  48386. current
  48387. ) {
  48388. var cached$$1 = cache[key];
  48389. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48390. cached$$1.componentInstance.$destroy();
  48391. }
  48392. cache[key] = null;
  48393. remove(keys, key);
  48394. }
  48395. var patternTypes = [String, RegExp, Array];
  48396. var KeepAlive = {
  48397. name: 'keep-alive',
  48398. abstract: true,
  48399. props: {
  48400. include: patternTypes,
  48401. exclude: patternTypes,
  48402. max: [String, Number]
  48403. },
  48404. created: function created () {
  48405. this.cache = Object.create(null);
  48406. this.keys = [];
  48407. },
  48408. destroyed: function destroyed () {
  48409. for (var key in this.cache) {
  48410. pruneCacheEntry(this.cache, key, this.keys);
  48411. }
  48412. },
  48413. mounted: function mounted () {
  48414. var this$1 = this;
  48415. this.$watch('include', function (val) {
  48416. pruneCache(this$1, function (name) { return matches(val, name); });
  48417. });
  48418. this.$watch('exclude', function (val) {
  48419. pruneCache(this$1, function (name) { return !matches(val, name); });
  48420. });
  48421. },
  48422. render: function render () {
  48423. var slot = this.$slots.default;
  48424. var vnode = getFirstComponentChild(slot);
  48425. var componentOptions = vnode && vnode.componentOptions;
  48426. if (componentOptions) {
  48427. // check pattern
  48428. var name = getComponentName(componentOptions);
  48429. var ref = this;
  48430. var include = ref.include;
  48431. var exclude = ref.exclude;
  48432. if (
  48433. // not included
  48434. (include && (!name || !matches(include, name))) ||
  48435. // excluded
  48436. (exclude && name && matches(exclude, name))
  48437. ) {
  48438. return vnode
  48439. }
  48440. var ref$1 = this;
  48441. var cache = ref$1.cache;
  48442. var keys = ref$1.keys;
  48443. var key = vnode.key == null
  48444. // same constructor may get registered as different local components
  48445. // so cid alone is not enough (#3269)
  48446. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48447. : vnode.key;
  48448. if (cache[key]) {
  48449. vnode.componentInstance = cache[key].componentInstance;
  48450. // make current key freshest
  48451. remove(keys, key);
  48452. keys.push(key);
  48453. } else {
  48454. cache[key] = vnode;
  48455. keys.push(key);
  48456. // prune oldest entry
  48457. if (this.max && keys.length > parseInt(this.max)) {
  48458. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48459. }
  48460. }
  48461. vnode.data.keepAlive = true;
  48462. }
  48463. return vnode || (slot && slot[0])
  48464. }
  48465. };
  48466. var builtInComponents = {
  48467. KeepAlive: KeepAlive
  48468. };
  48469. /* */
  48470. function initGlobalAPI (Vue) {
  48471. // config
  48472. var configDef = {};
  48473. configDef.get = function () { return config; };
  48474. {
  48475. configDef.set = function () {
  48476. warn(
  48477. 'Do not replace the Vue.config object, set individual fields instead.'
  48478. );
  48479. };
  48480. }
  48481. Object.defineProperty(Vue, 'config', configDef);
  48482. // exposed util methods.
  48483. // NOTE: these are not considered part of the public API - avoid relying on
  48484. // them unless you are aware of the risk.
  48485. Vue.util = {
  48486. warn: warn,
  48487. extend: extend,
  48488. mergeOptions: mergeOptions,
  48489. defineReactive: defineReactive$$1
  48490. };
  48491. Vue.set = set;
  48492. Vue.delete = del;
  48493. Vue.nextTick = nextTick;
  48494. // 2.6 explicit observable API
  48495. Vue.observable = function (obj) {
  48496. observe(obj);
  48497. return obj
  48498. };
  48499. Vue.options = Object.create(null);
  48500. ASSET_TYPES.forEach(function (type) {
  48501. Vue.options[type + 's'] = Object.create(null);
  48502. });
  48503. // this is used to identify the "base" constructor to extend all plain-object
  48504. // components with in Weex's multi-instance scenarios.
  48505. Vue.options._base = Vue;
  48506. extend(Vue.options.components, builtInComponents);
  48507. initUse(Vue);
  48508. initMixin$1(Vue);
  48509. initExtend(Vue);
  48510. initAssetRegisters(Vue);
  48511. }
  48512. initGlobalAPI(Vue);
  48513. Object.defineProperty(Vue.prototype, '$isServer', {
  48514. get: isServerRendering
  48515. });
  48516. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48517. get: function get () {
  48518. /* istanbul ignore next */
  48519. return this.$vnode && this.$vnode.ssrContext
  48520. }
  48521. });
  48522. // expose FunctionalRenderContext for ssr runtime helper installation
  48523. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48524. value: FunctionalRenderContext
  48525. });
  48526. Vue.version = '2.6.11';
  48527. /* */
  48528. // these are reserved for web because they are directly compiled away
  48529. // during template compilation
  48530. var isReservedAttr = makeMap('style,class');
  48531. // attributes that should be using props for binding
  48532. var acceptValue = makeMap('input,textarea,option,select,progress');
  48533. var mustUseProp = function (tag, type, attr) {
  48534. return (
  48535. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48536. (attr === 'selected' && tag === 'option') ||
  48537. (attr === 'checked' && tag === 'input') ||
  48538. (attr === 'muted' && tag === 'video')
  48539. )
  48540. };
  48541. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48542. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48543. var convertEnumeratedValue = function (key, value) {
  48544. return isFalsyAttrValue(value) || value === 'false'
  48545. ? 'false'
  48546. // allow arbitrary string value for contenteditable
  48547. : key === 'contenteditable' && isValidContentEditableValue(value)
  48548. ? value
  48549. : 'true'
  48550. };
  48551. var isBooleanAttr = makeMap(
  48552. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48553. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48554. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48555. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48556. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48557. 'truespeed,typemustmatch,visible'
  48558. );
  48559. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48560. var isXlink = function (name) {
  48561. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48562. };
  48563. var getXlinkProp = function (name) {
  48564. return isXlink(name) ? name.slice(6, name.length) : ''
  48565. };
  48566. var isFalsyAttrValue = function (val) {
  48567. return val == null || val === false
  48568. };
  48569. /* */
  48570. function genClassForVnode (vnode) {
  48571. var data = vnode.data;
  48572. var parentNode = vnode;
  48573. var childNode = vnode;
  48574. while (isDef(childNode.componentInstance)) {
  48575. childNode = childNode.componentInstance._vnode;
  48576. if (childNode && childNode.data) {
  48577. data = mergeClassData(childNode.data, data);
  48578. }
  48579. }
  48580. while (isDef(parentNode = parentNode.parent)) {
  48581. if (parentNode && parentNode.data) {
  48582. data = mergeClassData(data, parentNode.data);
  48583. }
  48584. }
  48585. return renderClass(data.staticClass, data.class)
  48586. }
  48587. function mergeClassData (child, parent) {
  48588. return {
  48589. staticClass: concat(child.staticClass, parent.staticClass),
  48590. class: isDef(child.class)
  48591. ? [child.class, parent.class]
  48592. : parent.class
  48593. }
  48594. }
  48595. function renderClass (
  48596. staticClass,
  48597. dynamicClass
  48598. ) {
  48599. if (isDef(staticClass) || isDef(dynamicClass)) {
  48600. return concat(staticClass, stringifyClass(dynamicClass))
  48601. }
  48602. /* istanbul ignore next */
  48603. return ''
  48604. }
  48605. function concat (a, b) {
  48606. return a ? b ? (a + ' ' + b) : a : (b || '')
  48607. }
  48608. function stringifyClass (value) {
  48609. if (Array.isArray(value)) {
  48610. return stringifyArray(value)
  48611. }
  48612. if (isObject(value)) {
  48613. return stringifyObject(value)
  48614. }
  48615. if (typeof value === 'string') {
  48616. return value
  48617. }
  48618. /* istanbul ignore next */
  48619. return ''
  48620. }
  48621. function stringifyArray (value) {
  48622. var res = '';
  48623. var stringified;
  48624. for (var i = 0, l = value.length; i < l; i++) {
  48625. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  48626. if (res) { res += ' '; }
  48627. res += stringified;
  48628. }
  48629. }
  48630. return res
  48631. }
  48632. function stringifyObject (value) {
  48633. var res = '';
  48634. for (var key in value) {
  48635. if (value[key]) {
  48636. if (res) { res += ' '; }
  48637. res += key;
  48638. }
  48639. }
  48640. return res
  48641. }
  48642. /* */
  48643. var namespaceMap = {
  48644. svg: 'http://www.w3.org/2000/svg',
  48645. math: 'http://www.w3.org/1998/Math/MathML'
  48646. };
  48647. var isHTMLTag = makeMap(
  48648. 'html,body,base,head,link,meta,style,title,' +
  48649. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  48650. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  48651. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  48652. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  48653. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  48654. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  48655. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  48656. 'output,progress,select,textarea,' +
  48657. 'details,dialog,menu,menuitem,summary,' +
  48658. 'content,element,shadow,template,blockquote,iframe,tfoot'
  48659. );
  48660. // this map is intentionally selective, only covering SVG elements that may
  48661. // contain child elements.
  48662. var isSVG = makeMap(
  48663. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  48664. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  48665. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  48666. true
  48667. );
  48668. var isPreTag = function (tag) { return tag === 'pre'; };
  48669. var isReservedTag = function (tag) {
  48670. return isHTMLTag(tag) || isSVG(tag)
  48671. };
  48672. function getTagNamespace (tag) {
  48673. if (isSVG(tag)) {
  48674. return 'svg'
  48675. }
  48676. // basic support for MathML
  48677. // note it doesn't support other MathML elements being component roots
  48678. if (tag === 'math') {
  48679. return 'math'
  48680. }
  48681. }
  48682. var unknownElementCache = Object.create(null);
  48683. function isUnknownElement (tag) {
  48684. /* istanbul ignore if */
  48685. if (!inBrowser) {
  48686. return true
  48687. }
  48688. if (isReservedTag(tag)) {
  48689. return false
  48690. }
  48691. tag = tag.toLowerCase();
  48692. /* istanbul ignore if */
  48693. if (unknownElementCache[tag] != null) {
  48694. return unknownElementCache[tag]
  48695. }
  48696. var el = document.createElement(tag);
  48697. if (tag.indexOf('-') > -1) {
  48698. // http://stackoverflow.com/a/28210364/1070244
  48699. return (unknownElementCache[tag] = (
  48700. el.constructor === window.HTMLUnknownElement ||
  48701. el.constructor === window.HTMLElement
  48702. ))
  48703. } else {
  48704. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  48705. }
  48706. }
  48707. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  48708. /* */
  48709. /**
  48710. * Query an element selector if it's not an element already.
  48711. */
  48712. function query (el) {
  48713. if (typeof el === 'string') {
  48714. var selected = document.querySelector(el);
  48715. if (!selected) {
  48716. warn(
  48717. 'Cannot find element: ' + el
  48718. );
  48719. return document.createElement('div')
  48720. }
  48721. return selected
  48722. } else {
  48723. return el
  48724. }
  48725. }
  48726. /* */
  48727. function createElement$1 (tagName, vnode) {
  48728. var elm = document.createElement(tagName);
  48729. if (tagName !== 'select') {
  48730. return elm
  48731. }
  48732. // false or null will remove the attribute but undefined will not
  48733. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  48734. elm.setAttribute('multiple', 'multiple');
  48735. }
  48736. return elm
  48737. }
  48738. function createElementNS (namespace, tagName) {
  48739. return document.createElementNS(namespaceMap[namespace], tagName)
  48740. }
  48741. function createTextNode (text) {
  48742. return document.createTextNode(text)
  48743. }
  48744. function createComment (text) {
  48745. return document.createComment(text)
  48746. }
  48747. function insertBefore (parentNode, newNode, referenceNode) {
  48748. parentNode.insertBefore(newNode, referenceNode);
  48749. }
  48750. function removeChild (node, child) {
  48751. node.removeChild(child);
  48752. }
  48753. function appendChild (node, child) {
  48754. node.appendChild(child);
  48755. }
  48756. function parentNode (node) {
  48757. return node.parentNode
  48758. }
  48759. function nextSibling (node) {
  48760. return node.nextSibling
  48761. }
  48762. function tagName (node) {
  48763. return node.tagName
  48764. }
  48765. function setTextContent (node, text) {
  48766. node.textContent = text;
  48767. }
  48768. function setStyleScope (node, scopeId) {
  48769. node.setAttribute(scopeId, '');
  48770. }
  48771. var nodeOps = /*#__PURE__*/Object.freeze({
  48772. createElement: createElement$1,
  48773. createElementNS: createElementNS,
  48774. createTextNode: createTextNode,
  48775. createComment: createComment,
  48776. insertBefore: insertBefore,
  48777. removeChild: removeChild,
  48778. appendChild: appendChild,
  48779. parentNode: parentNode,
  48780. nextSibling: nextSibling,
  48781. tagName: tagName,
  48782. setTextContent: setTextContent,
  48783. setStyleScope: setStyleScope
  48784. });
  48785. /* */
  48786. var ref = {
  48787. create: function create (_, vnode) {
  48788. registerRef(vnode);
  48789. },
  48790. update: function update (oldVnode, vnode) {
  48791. if (oldVnode.data.ref !== vnode.data.ref) {
  48792. registerRef(oldVnode, true);
  48793. registerRef(vnode);
  48794. }
  48795. },
  48796. destroy: function destroy (vnode) {
  48797. registerRef(vnode, true);
  48798. }
  48799. };
  48800. function registerRef (vnode, isRemoval) {
  48801. var key = vnode.data.ref;
  48802. if (!isDef(key)) { return }
  48803. var vm = vnode.context;
  48804. var ref = vnode.componentInstance || vnode.elm;
  48805. var refs = vm.$refs;
  48806. if (isRemoval) {
  48807. if (Array.isArray(refs[key])) {
  48808. remove(refs[key], ref);
  48809. } else if (refs[key] === ref) {
  48810. refs[key] = undefined;
  48811. }
  48812. } else {
  48813. if (vnode.data.refInFor) {
  48814. if (!Array.isArray(refs[key])) {
  48815. refs[key] = [ref];
  48816. } else if (refs[key].indexOf(ref) < 0) {
  48817. // $flow-disable-line
  48818. refs[key].push(ref);
  48819. }
  48820. } else {
  48821. refs[key] = ref;
  48822. }
  48823. }
  48824. }
  48825. /**
  48826. * Virtual DOM patching algorithm based on Snabbdom by
  48827. * Simon Friis Vindum (@paldepind)
  48828. * Licensed under the MIT License
  48829. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  48830. *
  48831. * modified by Evan You (@yyx990803)
  48832. *
  48833. * Not type-checking this because this file is perf-critical and the cost
  48834. * of making flow understand it is not worth it.
  48835. */
  48836. var emptyNode = new VNode('', {}, []);
  48837. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  48838. function sameVnode (a, b) {
  48839. return (
  48840. a.key === b.key && (
  48841. (
  48842. a.tag === b.tag &&
  48843. a.isComment === b.isComment &&
  48844. isDef(a.data) === isDef(b.data) &&
  48845. sameInputType(a, b)
  48846. ) || (
  48847. isTrue(a.isAsyncPlaceholder) &&
  48848. a.asyncFactory === b.asyncFactory &&
  48849. isUndef(b.asyncFactory.error)
  48850. )
  48851. )
  48852. )
  48853. }
  48854. function sameInputType (a, b) {
  48855. if (a.tag !== 'input') { return true }
  48856. var i;
  48857. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  48858. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  48859. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  48860. }
  48861. function createKeyToOldIdx (children, beginIdx, endIdx) {
  48862. var i, key;
  48863. var map = {};
  48864. for (i = beginIdx; i <= endIdx; ++i) {
  48865. key = children[i].key;
  48866. if (isDef(key)) { map[key] = i; }
  48867. }
  48868. return map
  48869. }
  48870. function createPatchFunction (backend) {
  48871. var i, j;
  48872. var cbs = {};
  48873. var modules = backend.modules;
  48874. var nodeOps = backend.nodeOps;
  48875. for (i = 0; i < hooks.length; ++i) {
  48876. cbs[hooks[i]] = [];
  48877. for (j = 0; j < modules.length; ++j) {
  48878. if (isDef(modules[j][hooks[i]])) {
  48879. cbs[hooks[i]].push(modules[j][hooks[i]]);
  48880. }
  48881. }
  48882. }
  48883. function emptyNodeAt (elm) {
  48884. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  48885. }
  48886. function createRmCb (childElm, listeners) {
  48887. function remove$$1 () {
  48888. if (--remove$$1.listeners === 0) {
  48889. removeNode(childElm);
  48890. }
  48891. }
  48892. remove$$1.listeners = listeners;
  48893. return remove$$1
  48894. }
  48895. function removeNode (el) {
  48896. var parent = nodeOps.parentNode(el);
  48897. // element may have already been removed due to v-html / v-text
  48898. if (isDef(parent)) {
  48899. nodeOps.removeChild(parent, el);
  48900. }
  48901. }
  48902. function isUnknownElement$$1 (vnode, inVPre) {
  48903. return (
  48904. !inVPre &&
  48905. !vnode.ns &&
  48906. !(
  48907. config.ignoredElements.length &&
  48908. config.ignoredElements.some(function (ignore) {
  48909. return isRegExp(ignore)
  48910. ? ignore.test(vnode.tag)
  48911. : ignore === vnode.tag
  48912. })
  48913. ) &&
  48914. config.isUnknownElement(vnode.tag)
  48915. )
  48916. }
  48917. var creatingElmInVPre = 0;
  48918. function createElm (
  48919. vnode,
  48920. insertedVnodeQueue,
  48921. parentElm,
  48922. refElm,
  48923. nested,
  48924. ownerArray,
  48925. index
  48926. ) {
  48927. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48928. // This vnode was used in a previous render!
  48929. // now it's used as a new node, overwriting its elm would cause
  48930. // potential patch errors down the road when it's used as an insertion
  48931. // reference node. Instead, we clone the node on-demand before creating
  48932. // associated DOM element for it.
  48933. vnode = ownerArray[index] = cloneVNode(vnode);
  48934. }
  48935. vnode.isRootInsert = !nested; // for transition enter check
  48936. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  48937. return
  48938. }
  48939. var data = vnode.data;
  48940. var children = vnode.children;
  48941. var tag = vnode.tag;
  48942. if (isDef(tag)) {
  48943. {
  48944. if (data && data.pre) {
  48945. creatingElmInVPre++;
  48946. }
  48947. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  48948. warn(
  48949. 'Unknown custom element: <' + tag + '> - did you ' +
  48950. 'register the component correctly? For recursive components, ' +
  48951. 'make sure to provide the "name" option.',
  48952. vnode.context
  48953. );
  48954. }
  48955. }
  48956. vnode.elm = vnode.ns
  48957. ? nodeOps.createElementNS(vnode.ns, tag)
  48958. : nodeOps.createElement(tag, vnode);
  48959. setScope(vnode);
  48960. /* istanbul ignore if */
  48961. {
  48962. createChildren(vnode, children, insertedVnodeQueue);
  48963. if (isDef(data)) {
  48964. invokeCreateHooks(vnode, insertedVnodeQueue);
  48965. }
  48966. insert(parentElm, vnode.elm, refElm);
  48967. }
  48968. if (data && data.pre) {
  48969. creatingElmInVPre--;
  48970. }
  48971. } else if (isTrue(vnode.isComment)) {
  48972. vnode.elm = nodeOps.createComment(vnode.text);
  48973. insert(parentElm, vnode.elm, refElm);
  48974. } else {
  48975. vnode.elm = nodeOps.createTextNode(vnode.text);
  48976. insert(parentElm, vnode.elm, refElm);
  48977. }
  48978. }
  48979. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48980. var i = vnode.data;
  48981. if (isDef(i)) {
  48982. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  48983. if (isDef(i = i.hook) && isDef(i = i.init)) {
  48984. i(vnode, false /* hydrating */);
  48985. }
  48986. // after calling the init hook, if the vnode is a child component
  48987. // it should've created a child instance and mounted it. the child
  48988. // component also has set the placeholder vnode's elm.
  48989. // in that case we can just return the element and be done.
  48990. if (isDef(vnode.componentInstance)) {
  48991. initComponent(vnode, insertedVnodeQueue);
  48992. insert(parentElm, vnode.elm, refElm);
  48993. if (isTrue(isReactivated)) {
  48994. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  48995. }
  48996. return true
  48997. }
  48998. }
  48999. }
  49000. function initComponent (vnode, insertedVnodeQueue) {
  49001. if (isDef(vnode.data.pendingInsert)) {
  49002. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49003. vnode.data.pendingInsert = null;
  49004. }
  49005. vnode.elm = vnode.componentInstance.$el;
  49006. if (isPatchable(vnode)) {
  49007. invokeCreateHooks(vnode, insertedVnodeQueue);
  49008. setScope(vnode);
  49009. } else {
  49010. // empty component root.
  49011. // skip all element-related modules except for ref (#3455)
  49012. registerRef(vnode);
  49013. // make sure to invoke the insert hook
  49014. insertedVnodeQueue.push(vnode);
  49015. }
  49016. }
  49017. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49018. var i;
  49019. // hack for #4339: a reactivated component with inner transition
  49020. // does not trigger because the inner node's created hooks are not called
  49021. // again. It's not ideal to involve module-specific logic in here but
  49022. // there doesn't seem to be a better way to do it.
  49023. var innerNode = vnode;
  49024. while (innerNode.componentInstance) {
  49025. innerNode = innerNode.componentInstance._vnode;
  49026. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49027. for (i = 0; i < cbs.activate.length; ++i) {
  49028. cbs.activate[i](emptyNode, innerNode);
  49029. }
  49030. insertedVnodeQueue.push(innerNode);
  49031. break
  49032. }
  49033. }
  49034. // unlike a newly created component,
  49035. // a reactivated keep-alive component doesn't insert itself
  49036. insert(parentElm, vnode.elm, refElm);
  49037. }
  49038. function insert (parent, elm, ref$$1) {
  49039. if (isDef(parent)) {
  49040. if (isDef(ref$$1)) {
  49041. if (nodeOps.parentNode(ref$$1) === parent) {
  49042. nodeOps.insertBefore(parent, elm, ref$$1);
  49043. }
  49044. } else {
  49045. nodeOps.appendChild(parent, elm);
  49046. }
  49047. }
  49048. }
  49049. function createChildren (vnode, children, insertedVnodeQueue) {
  49050. if (Array.isArray(children)) {
  49051. {
  49052. checkDuplicateKeys(children);
  49053. }
  49054. for (var i = 0; i < children.length; ++i) {
  49055. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49056. }
  49057. } else if (isPrimitive(vnode.text)) {
  49058. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49059. }
  49060. }
  49061. function isPatchable (vnode) {
  49062. while (vnode.componentInstance) {
  49063. vnode = vnode.componentInstance._vnode;
  49064. }
  49065. return isDef(vnode.tag)
  49066. }
  49067. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49068. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49069. cbs.create[i$1](emptyNode, vnode);
  49070. }
  49071. i = vnode.data.hook; // Reuse variable
  49072. if (isDef(i)) {
  49073. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49074. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49075. }
  49076. }
  49077. // set scope id attribute for scoped CSS.
  49078. // this is implemented as a special case to avoid the overhead
  49079. // of going through the normal attribute patching process.
  49080. function setScope (vnode) {
  49081. var i;
  49082. if (isDef(i = vnode.fnScopeId)) {
  49083. nodeOps.setStyleScope(vnode.elm, i);
  49084. } else {
  49085. var ancestor = vnode;
  49086. while (ancestor) {
  49087. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49088. nodeOps.setStyleScope(vnode.elm, i);
  49089. }
  49090. ancestor = ancestor.parent;
  49091. }
  49092. }
  49093. // for slot content they should also get the scopeId from the host instance.
  49094. if (isDef(i = activeInstance) &&
  49095. i !== vnode.context &&
  49096. i !== vnode.fnContext &&
  49097. isDef(i = i.$options._scopeId)
  49098. ) {
  49099. nodeOps.setStyleScope(vnode.elm, i);
  49100. }
  49101. }
  49102. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49103. for (; startIdx <= endIdx; ++startIdx) {
  49104. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49105. }
  49106. }
  49107. function invokeDestroyHook (vnode) {
  49108. var i, j;
  49109. var data = vnode.data;
  49110. if (isDef(data)) {
  49111. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49112. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49113. }
  49114. if (isDef(i = vnode.children)) {
  49115. for (j = 0; j < vnode.children.length; ++j) {
  49116. invokeDestroyHook(vnode.children[j]);
  49117. }
  49118. }
  49119. }
  49120. function removeVnodes (vnodes, startIdx, endIdx) {
  49121. for (; startIdx <= endIdx; ++startIdx) {
  49122. var ch = vnodes[startIdx];
  49123. if (isDef(ch)) {
  49124. if (isDef(ch.tag)) {
  49125. removeAndInvokeRemoveHook(ch);
  49126. invokeDestroyHook(ch);
  49127. } else { // Text node
  49128. removeNode(ch.elm);
  49129. }
  49130. }
  49131. }
  49132. }
  49133. function removeAndInvokeRemoveHook (vnode, rm) {
  49134. if (isDef(rm) || isDef(vnode.data)) {
  49135. var i;
  49136. var listeners = cbs.remove.length + 1;
  49137. if (isDef(rm)) {
  49138. // we have a recursively passed down rm callback
  49139. // increase the listeners count
  49140. rm.listeners += listeners;
  49141. } else {
  49142. // directly removing
  49143. rm = createRmCb(vnode.elm, listeners);
  49144. }
  49145. // recursively invoke hooks on child component root node
  49146. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49147. removeAndInvokeRemoveHook(i, rm);
  49148. }
  49149. for (i = 0; i < cbs.remove.length; ++i) {
  49150. cbs.remove[i](vnode, rm);
  49151. }
  49152. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49153. i(vnode, rm);
  49154. } else {
  49155. rm();
  49156. }
  49157. } else {
  49158. removeNode(vnode.elm);
  49159. }
  49160. }
  49161. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49162. var oldStartIdx = 0;
  49163. var newStartIdx = 0;
  49164. var oldEndIdx = oldCh.length - 1;
  49165. var oldStartVnode = oldCh[0];
  49166. var oldEndVnode = oldCh[oldEndIdx];
  49167. var newEndIdx = newCh.length - 1;
  49168. var newStartVnode = newCh[0];
  49169. var newEndVnode = newCh[newEndIdx];
  49170. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49171. // removeOnly is a special flag used only by <transition-group>
  49172. // to ensure removed elements stay in correct relative positions
  49173. // during leaving transitions
  49174. var canMove = !removeOnly;
  49175. {
  49176. checkDuplicateKeys(newCh);
  49177. }
  49178. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49179. if (isUndef(oldStartVnode)) {
  49180. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49181. } else if (isUndef(oldEndVnode)) {
  49182. oldEndVnode = oldCh[--oldEndIdx];
  49183. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49184. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49185. oldStartVnode = oldCh[++oldStartIdx];
  49186. newStartVnode = newCh[++newStartIdx];
  49187. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49188. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49189. oldEndVnode = oldCh[--oldEndIdx];
  49190. newEndVnode = newCh[--newEndIdx];
  49191. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49192. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49193. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49194. oldStartVnode = oldCh[++oldStartIdx];
  49195. newEndVnode = newCh[--newEndIdx];
  49196. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49197. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49198. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49199. oldEndVnode = oldCh[--oldEndIdx];
  49200. newStartVnode = newCh[++newStartIdx];
  49201. } else {
  49202. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49203. idxInOld = isDef(newStartVnode.key)
  49204. ? oldKeyToIdx[newStartVnode.key]
  49205. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49206. if (isUndef(idxInOld)) { // New element
  49207. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49208. } else {
  49209. vnodeToMove = oldCh[idxInOld];
  49210. if (sameVnode(vnodeToMove, newStartVnode)) {
  49211. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49212. oldCh[idxInOld] = undefined;
  49213. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49214. } else {
  49215. // same key but different element. treat as new element
  49216. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49217. }
  49218. }
  49219. newStartVnode = newCh[++newStartIdx];
  49220. }
  49221. }
  49222. if (oldStartIdx > oldEndIdx) {
  49223. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49224. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49225. } else if (newStartIdx > newEndIdx) {
  49226. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49227. }
  49228. }
  49229. function checkDuplicateKeys (children) {
  49230. var seenKeys = {};
  49231. for (var i = 0; i < children.length; i++) {
  49232. var vnode = children[i];
  49233. var key = vnode.key;
  49234. if (isDef(key)) {
  49235. if (seenKeys[key]) {
  49236. warn(
  49237. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49238. vnode.context
  49239. );
  49240. } else {
  49241. seenKeys[key] = true;
  49242. }
  49243. }
  49244. }
  49245. }
  49246. function findIdxInOld (node, oldCh, start, end) {
  49247. for (var i = start; i < end; i++) {
  49248. var c = oldCh[i];
  49249. if (isDef(c) && sameVnode(node, c)) { return i }
  49250. }
  49251. }
  49252. function patchVnode (
  49253. oldVnode,
  49254. vnode,
  49255. insertedVnodeQueue,
  49256. ownerArray,
  49257. index,
  49258. removeOnly
  49259. ) {
  49260. if (oldVnode === vnode) {
  49261. return
  49262. }
  49263. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49264. // clone reused vnode
  49265. vnode = ownerArray[index] = cloneVNode(vnode);
  49266. }
  49267. var elm = vnode.elm = oldVnode.elm;
  49268. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49269. if (isDef(vnode.asyncFactory.resolved)) {
  49270. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49271. } else {
  49272. vnode.isAsyncPlaceholder = true;
  49273. }
  49274. return
  49275. }
  49276. // reuse element for static trees.
  49277. // note we only do this if the vnode is cloned -
  49278. // if the new node is not cloned it means the render functions have been
  49279. // reset by the hot-reload-api and we need to do a proper re-render.
  49280. if (isTrue(vnode.isStatic) &&
  49281. isTrue(oldVnode.isStatic) &&
  49282. vnode.key === oldVnode.key &&
  49283. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49284. ) {
  49285. vnode.componentInstance = oldVnode.componentInstance;
  49286. return
  49287. }
  49288. var i;
  49289. var data = vnode.data;
  49290. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49291. i(oldVnode, vnode);
  49292. }
  49293. var oldCh = oldVnode.children;
  49294. var ch = vnode.children;
  49295. if (isDef(data) && isPatchable(vnode)) {
  49296. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49297. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49298. }
  49299. if (isUndef(vnode.text)) {
  49300. if (isDef(oldCh) && isDef(ch)) {
  49301. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49302. } else if (isDef(ch)) {
  49303. {
  49304. checkDuplicateKeys(ch);
  49305. }
  49306. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49307. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49308. } else if (isDef(oldCh)) {
  49309. removeVnodes(oldCh, 0, oldCh.length - 1);
  49310. } else if (isDef(oldVnode.text)) {
  49311. nodeOps.setTextContent(elm, '');
  49312. }
  49313. } else if (oldVnode.text !== vnode.text) {
  49314. nodeOps.setTextContent(elm, vnode.text);
  49315. }
  49316. if (isDef(data)) {
  49317. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49318. }
  49319. }
  49320. function invokeInsertHook (vnode, queue, initial) {
  49321. // delay insert hooks for component root nodes, invoke them after the
  49322. // element is really inserted
  49323. if (isTrue(initial) && isDef(vnode.parent)) {
  49324. vnode.parent.data.pendingInsert = queue;
  49325. } else {
  49326. for (var i = 0; i < queue.length; ++i) {
  49327. queue[i].data.hook.insert(queue[i]);
  49328. }
  49329. }
  49330. }
  49331. var hydrationBailed = false;
  49332. // list of modules that can skip create hook during hydration because they
  49333. // are already rendered on the client or has no need for initialization
  49334. // Note: style is excluded because it relies on initial clone for future
  49335. // deep updates (#7063).
  49336. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49337. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49338. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49339. var i;
  49340. var tag = vnode.tag;
  49341. var data = vnode.data;
  49342. var children = vnode.children;
  49343. inVPre = inVPre || (data && data.pre);
  49344. vnode.elm = elm;
  49345. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49346. vnode.isAsyncPlaceholder = true;
  49347. return true
  49348. }
  49349. // assert node match
  49350. {
  49351. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49352. return false
  49353. }
  49354. }
  49355. if (isDef(data)) {
  49356. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49357. if (isDef(i = vnode.componentInstance)) {
  49358. // child component. it should have hydrated its own tree.
  49359. initComponent(vnode, insertedVnodeQueue);
  49360. return true
  49361. }
  49362. }
  49363. if (isDef(tag)) {
  49364. if (isDef(children)) {
  49365. // empty element, allow client to pick up and populate children
  49366. if (!elm.hasChildNodes()) {
  49367. createChildren(vnode, children, insertedVnodeQueue);
  49368. } else {
  49369. // v-html and domProps: innerHTML
  49370. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49371. if (i !== elm.innerHTML) {
  49372. /* istanbul ignore if */
  49373. if (typeof console !== 'undefined' &&
  49374. !hydrationBailed
  49375. ) {
  49376. hydrationBailed = true;
  49377. console.warn('Parent: ', elm);
  49378. console.warn('server innerHTML: ', i);
  49379. console.warn('client innerHTML: ', elm.innerHTML);
  49380. }
  49381. return false
  49382. }
  49383. } else {
  49384. // iterate and compare children lists
  49385. var childrenMatch = true;
  49386. var childNode = elm.firstChild;
  49387. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49388. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49389. childrenMatch = false;
  49390. break
  49391. }
  49392. childNode = childNode.nextSibling;
  49393. }
  49394. // if childNode is not null, it means the actual childNodes list is
  49395. // longer than the virtual children list.
  49396. if (!childrenMatch || childNode) {
  49397. /* istanbul ignore if */
  49398. if (typeof console !== 'undefined' &&
  49399. !hydrationBailed
  49400. ) {
  49401. hydrationBailed = true;
  49402. console.warn('Parent: ', elm);
  49403. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49404. }
  49405. return false
  49406. }
  49407. }
  49408. }
  49409. }
  49410. if (isDef(data)) {
  49411. var fullInvoke = false;
  49412. for (var key in data) {
  49413. if (!isRenderedModule(key)) {
  49414. fullInvoke = true;
  49415. invokeCreateHooks(vnode, insertedVnodeQueue);
  49416. break
  49417. }
  49418. }
  49419. if (!fullInvoke && data['class']) {
  49420. // ensure collecting deps for deep class bindings for future updates
  49421. traverse(data['class']);
  49422. }
  49423. }
  49424. } else if (elm.data !== vnode.text) {
  49425. elm.data = vnode.text;
  49426. }
  49427. return true
  49428. }
  49429. function assertNodeMatch (node, vnode, inVPre) {
  49430. if (isDef(vnode.tag)) {
  49431. return vnode.tag.indexOf('vue-component') === 0 || (
  49432. !isUnknownElement$$1(vnode, inVPre) &&
  49433. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49434. )
  49435. } else {
  49436. return node.nodeType === (vnode.isComment ? 8 : 3)
  49437. }
  49438. }
  49439. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49440. if (isUndef(vnode)) {
  49441. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49442. return
  49443. }
  49444. var isInitialPatch = false;
  49445. var insertedVnodeQueue = [];
  49446. if (isUndef(oldVnode)) {
  49447. // empty mount (likely as component), create new root element
  49448. isInitialPatch = true;
  49449. createElm(vnode, insertedVnodeQueue);
  49450. } else {
  49451. var isRealElement = isDef(oldVnode.nodeType);
  49452. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49453. // patch existing root node
  49454. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49455. } else {
  49456. if (isRealElement) {
  49457. // mounting to a real element
  49458. // check if this is server-rendered content and if we can perform
  49459. // a successful hydration.
  49460. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49461. oldVnode.removeAttribute(SSR_ATTR);
  49462. hydrating = true;
  49463. }
  49464. if (isTrue(hydrating)) {
  49465. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49466. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49467. return oldVnode
  49468. } else {
  49469. warn(
  49470. 'The client-side rendered virtual DOM tree is not matching ' +
  49471. 'server-rendered content. This is likely caused by incorrect ' +
  49472. 'HTML markup, for example nesting block-level elements inside ' +
  49473. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49474. 'full client-side render.'
  49475. );
  49476. }
  49477. }
  49478. // either not server-rendered, or hydration failed.
  49479. // create an empty node and replace it
  49480. oldVnode = emptyNodeAt(oldVnode);
  49481. }
  49482. // replacing existing element
  49483. var oldElm = oldVnode.elm;
  49484. var parentElm = nodeOps.parentNode(oldElm);
  49485. // create new node
  49486. createElm(
  49487. vnode,
  49488. insertedVnodeQueue,
  49489. // extremely rare edge case: do not insert if old element is in a
  49490. // leaving transition. Only happens when combining transition +
  49491. // keep-alive + HOCs. (#4590)
  49492. oldElm._leaveCb ? null : parentElm,
  49493. nodeOps.nextSibling(oldElm)
  49494. );
  49495. // update parent placeholder node element, recursively
  49496. if (isDef(vnode.parent)) {
  49497. var ancestor = vnode.parent;
  49498. var patchable = isPatchable(vnode);
  49499. while (ancestor) {
  49500. for (var i = 0; i < cbs.destroy.length; ++i) {
  49501. cbs.destroy[i](ancestor);
  49502. }
  49503. ancestor.elm = vnode.elm;
  49504. if (patchable) {
  49505. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49506. cbs.create[i$1](emptyNode, ancestor);
  49507. }
  49508. // #6513
  49509. // invoke insert hooks that may have been merged by create hooks.
  49510. // e.g. for directives that uses the "inserted" hook.
  49511. var insert = ancestor.data.hook.insert;
  49512. if (insert.merged) {
  49513. // start at index 1 to avoid re-invoking component mounted hook
  49514. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49515. insert.fns[i$2]();
  49516. }
  49517. }
  49518. } else {
  49519. registerRef(ancestor);
  49520. }
  49521. ancestor = ancestor.parent;
  49522. }
  49523. }
  49524. // destroy old node
  49525. if (isDef(parentElm)) {
  49526. removeVnodes([oldVnode], 0, 0);
  49527. } else if (isDef(oldVnode.tag)) {
  49528. invokeDestroyHook(oldVnode);
  49529. }
  49530. }
  49531. }
  49532. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49533. return vnode.elm
  49534. }
  49535. }
  49536. /* */
  49537. var directives = {
  49538. create: updateDirectives,
  49539. update: updateDirectives,
  49540. destroy: function unbindDirectives (vnode) {
  49541. updateDirectives(vnode, emptyNode);
  49542. }
  49543. };
  49544. function updateDirectives (oldVnode, vnode) {
  49545. if (oldVnode.data.directives || vnode.data.directives) {
  49546. _update(oldVnode, vnode);
  49547. }
  49548. }
  49549. function _update (oldVnode, vnode) {
  49550. var isCreate = oldVnode === emptyNode;
  49551. var isDestroy = vnode === emptyNode;
  49552. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49553. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49554. var dirsWithInsert = [];
  49555. var dirsWithPostpatch = [];
  49556. var key, oldDir, dir;
  49557. for (key in newDirs) {
  49558. oldDir = oldDirs[key];
  49559. dir = newDirs[key];
  49560. if (!oldDir) {
  49561. // new directive, bind
  49562. callHook$1(dir, 'bind', vnode, oldVnode);
  49563. if (dir.def && dir.def.inserted) {
  49564. dirsWithInsert.push(dir);
  49565. }
  49566. } else {
  49567. // existing directive, update
  49568. dir.oldValue = oldDir.value;
  49569. dir.oldArg = oldDir.arg;
  49570. callHook$1(dir, 'update', vnode, oldVnode);
  49571. if (dir.def && dir.def.componentUpdated) {
  49572. dirsWithPostpatch.push(dir);
  49573. }
  49574. }
  49575. }
  49576. if (dirsWithInsert.length) {
  49577. var callInsert = function () {
  49578. for (var i = 0; i < dirsWithInsert.length; i++) {
  49579. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49580. }
  49581. };
  49582. if (isCreate) {
  49583. mergeVNodeHook(vnode, 'insert', callInsert);
  49584. } else {
  49585. callInsert();
  49586. }
  49587. }
  49588. if (dirsWithPostpatch.length) {
  49589. mergeVNodeHook(vnode, 'postpatch', function () {
  49590. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49591. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49592. }
  49593. });
  49594. }
  49595. if (!isCreate) {
  49596. for (key in oldDirs) {
  49597. if (!newDirs[key]) {
  49598. // no longer present, unbind
  49599. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  49600. }
  49601. }
  49602. }
  49603. }
  49604. var emptyModifiers = Object.create(null);
  49605. function normalizeDirectives$1 (
  49606. dirs,
  49607. vm
  49608. ) {
  49609. var res = Object.create(null);
  49610. if (!dirs) {
  49611. // $flow-disable-line
  49612. return res
  49613. }
  49614. var i, dir;
  49615. for (i = 0; i < dirs.length; i++) {
  49616. dir = dirs[i];
  49617. if (!dir.modifiers) {
  49618. // $flow-disable-line
  49619. dir.modifiers = emptyModifiers;
  49620. }
  49621. res[getRawDirName(dir)] = dir;
  49622. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  49623. }
  49624. // $flow-disable-line
  49625. return res
  49626. }
  49627. function getRawDirName (dir) {
  49628. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  49629. }
  49630. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  49631. var fn = dir.def && dir.def[hook];
  49632. if (fn) {
  49633. try {
  49634. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  49635. } catch (e) {
  49636. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  49637. }
  49638. }
  49639. }
  49640. var baseModules = [
  49641. ref,
  49642. directives
  49643. ];
  49644. /* */
  49645. function updateAttrs (oldVnode, vnode) {
  49646. var opts = vnode.componentOptions;
  49647. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  49648. return
  49649. }
  49650. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  49651. return
  49652. }
  49653. var key, cur, old;
  49654. var elm = vnode.elm;
  49655. var oldAttrs = oldVnode.data.attrs || {};
  49656. var attrs = vnode.data.attrs || {};
  49657. // clone observed objects, as the user probably wants to mutate it
  49658. if (isDef(attrs.__ob__)) {
  49659. attrs = vnode.data.attrs = extend({}, attrs);
  49660. }
  49661. for (key in attrs) {
  49662. cur = attrs[key];
  49663. old = oldAttrs[key];
  49664. if (old !== cur) {
  49665. setAttr(elm, key, cur);
  49666. }
  49667. }
  49668. // #4391: in IE9, setting type can reset value for input[type=radio]
  49669. // #6666: IE/Edge forces progress value down to 1 before setting a max
  49670. /* istanbul ignore if */
  49671. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  49672. setAttr(elm, 'value', attrs.value);
  49673. }
  49674. for (key in oldAttrs) {
  49675. if (isUndef(attrs[key])) {
  49676. if (isXlink(key)) {
  49677. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49678. } else if (!isEnumeratedAttr(key)) {
  49679. elm.removeAttribute(key);
  49680. }
  49681. }
  49682. }
  49683. }
  49684. function setAttr (el, key, value) {
  49685. if (el.tagName.indexOf('-') > -1) {
  49686. baseSetAttr(el, key, value);
  49687. } else if (isBooleanAttr(key)) {
  49688. // set attribute for blank value
  49689. // e.g. <option disabled>Select one</option>
  49690. if (isFalsyAttrValue(value)) {
  49691. el.removeAttribute(key);
  49692. } else {
  49693. // technically allowfullscreen is a boolean attribute for <iframe>,
  49694. // but Flash expects a value of "true" when used on <embed> tag
  49695. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  49696. ? 'true'
  49697. : key;
  49698. el.setAttribute(key, value);
  49699. }
  49700. } else if (isEnumeratedAttr(key)) {
  49701. el.setAttribute(key, convertEnumeratedValue(key, value));
  49702. } else if (isXlink(key)) {
  49703. if (isFalsyAttrValue(value)) {
  49704. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49705. } else {
  49706. el.setAttributeNS(xlinkNS, key, value);
  49707. }
  49708. } else {
  49709. baseSetAttr(el, key, value);
  49710. }
  49711. }
  49712. function baseSetAttr (el, key, value) {
  49713. if (isFalsyAttrValue(value)) {
  49714. el.removeAttribute(key);
  49715. } else {
  49716. // #7138: IE10 & 11 fires input event when setting placeholder on
  49717. // <textarea>... block the first input event and remove the blocker
  49718. // immediately.
  49719. /* istanbul ignore if */
  49720. if (
  49721. isIE && !isIE9 &&
  49722. el.tagName === 'TEXTAREA' &&
  49723. key === 'placeholder' && value !== '' && !el.__ieph
  49724. ) {
  49725. var blocker = function (e) {
  49726. e.stopImmediatePropagation();
  49727. el.removeEventListener('input', blocker);
  49728. };
  49729. el.addEventListener('input', blocker);
  49730. // $flow-disable-line
  49731. el.__ieph = true; /* IE placeholder patched */
  49732. }
  49733. el.setAttribute(key, value);
  49734. }
  49735. }
  49736. var attrs = {
  49737. create: updateAttrs,
  49738. update: updateAttrs
  49739. };
  49740. /* */
  49741. function updateClass (oldVnode, vnode) {
  49742. var el = vnode.elm;
  49743. var data = vnode.data;
  49744. var oldData = oldVnode.data;
  49745. if (
  49746. isUndef(data.staticClass) &&
  49747. isUndef(data.class) && (
  49748. isUndef(oldData) || (
  49749. isUndef(oldData.staticClass) &&
  49750. isUndef(oldData.class)
  49751. )
  49752. )
  49753. ) {
  49754. return
  49755. }
  49756. var cls = genClassForVnode(vnode);
  49757. // handle transition classes
  49758. var transitionClass = el._transitionClasses;
  49759. if (isDef(transitionClass)) {
  49760. cls = concat(cls, stringifyClass(transitionClass));
  49761. }
  49762. // set the class
  49763. if (cls !== el._prevClass) {
  49764. el.setAttribute('class', cls);
  49765. el._prevClass = cls;
  49766. }
  49767. }
  49768. var klass = {
  49769. create: updateClass,
  49770. update: updateClass
  49771. };
  49772. /* */
  49773. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49774. function parseFilters (exp) {
  49775. var inSingle = false;
  49776. var inDouble = false;
  49777. var inTemplateString = false;
  49778. var inRegex = false;
  49779. var curly = 0;
  49780. var square = 0;
  49781. var paren = 0;
  49782. var lastFilterIndex = 0;
  49783. var c, prev, i, expression, filters;
  49784. for (i = 0; i < exp.length; i++) {
  49785. prev = c;
  49786. c = exp.charCodeAt(i);
  49787. if (inSingle) {
  49788. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49789. } else if (inDouble) {
  49790. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49791. } else if (inTemplateString) {
  49792. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49793. } else if (inRegex) {
  49794. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49795. } else if (
  49796. c === 0x7C && // pipe
  49797. exp.charCodeAt(i + 1) !== 0x7C &&
  49798. exp.charCodeAt(i - 1) !== 0x7C &&
  49799. !curly && !square && !paren
  49800. ) {
  49801. if (expression === undefined) {
  49802. // first filter, end of expression
  49803. lastFilterIndex = i + 1;
  49804. expression = exp.slice(0, i).trim();
  49805. } else {
  49806. pushFilter();
  49807. }
  49808. } else {
  49809. switch (c) {
  49810. case 0x22: inDouble = true; break // "
  49811. case 0x27: inSingle = true; break // '
  49812. case 0x60: inTemplateString = true; break // `
  49813. case 0x28: paren++; break // (
  49814. case 0x29: paren--; break // )
  49815. case 0x5B: square++; break // [
  49816. case 0x5D: square--; break // ]
  49817. case 0x7B: curly++; break // {
  49818. case 0x7D: curly--; break // }
  49819. }
  49820. if (c === 0x2f) { // /
  49821. var j = i - 1;
  49822. var p = (void 0);
  49823. // find first non-whitespace prev char
  49824. for (; j >= 0; j--) {
  49825. p = exp.charAt(j);
  49826. if (p !== ' ') { break }
  49827. }
  49828. if (!p || !validDivisionCharRE.test(p)) {
  49829. inRegex = true;
  49830. }
  49831. }
  49832. }
  49833. }
  49834. if (expression === undefined) {
  49835. expression = exp.slice(0, i).trim();
  49836. } else if (lastFilterIndex !== 0) {
  49837. pushFilter();
  49838. }
  49839. function pushFilter () {
  49840. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  49841. lastFilterIndex = i + 1;
  49842. }
  49843. if (filters) {
  49844. for (i = 0; i < filters.length; i++) {
  49845. expression = wrapFilter(expression, filters[i]);
  49846. }
  49847. }
  49848. return expression
  49849. }
  49850. function wrapFilter (exp, filter) {
  49851. var i = filter.indexOf('(');
  49852. if (i < 0) {
  49853. // _f: resolveFilter
  49854. return ("_f(\"" + filter + "\")(" + exp + ")")
  49855. } else {
  49856. var name = filter.slice(0, i);
  49857. var args = filter.slice(i + 1);
  49858. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  49859. }
  49860. }
  49861. /* */
  49862. /* eslint-disable no-unused-vars */
  49863. function baseWarn (msg, range) {
  49864. console.error(("[Vue compiler]: " + msg));
  49865. }
  49866. /* eslint-enable no-unused-vars */
  49867. function pluckModuleFunction (
  49868. modules,
  49869. key
  49870. ) {
  49871. return modules
  49872. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  49873. : []
  49874. }
  49875. function addProp (el, name, value, range, dynamic) {
  49876. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49877. el.plain = false;
  49878. }
  49879. function addAttr (el, name, value, range, dynamic) {
  49880. var attrs = dynamic
  49881. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  49882. : (el.attrs || (el.attrs = []));
  49883. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49884. el.plain = false;
  49885. }
  49886. // add a raw attr (use this in preTransforms)
  49887. function addRawAttr (el, name, value, range) {
  49888. el.attrsMap[name] = value;
  49889. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  49890. }
  49891. function addDirective (
  49892. el,
  49893. name,
  49894. rawName,
  49895. value,
  49896. arg,
  49897. isDynamicArg,
  49898. modifiers,
  49899. range
  49900. ) {
  49901. (el.directives || (el.directives = [])).push(rangeSetItem({
  49902. name: name,
  49903. rawName: rawName,
  49904. value: value,
  49905. arg: arg,
  49906. isDynamicArg: isDynamicArg,
  49907. modifiers: modifiers
  49908. }, range));
  49909. el.plain = false;
  49910. }
  49911. function prependModifierMarker (symbol, name, dynamic) {
  49912. return dynamic
  49913. ? ("_p(" + name + ",\"" + symbol + "\")")
  49914. : symbol + name // mark the event as captured
  49915. }
  49916. function addHandler (
  49917. el,
  49918. name,
  49919. value,
  49920. modifiers,
  49921. important,
  49922. warn,
  49923. range,
  49924. dynamic
  49925. ) {
  49926. modifiers = modifiers || emptyObject;
  49927. // warn prevent and passive modifier
  49928. /* istanbul ignore if */
  49929. if (
  49930. warn &&
  49931. modifiers.prevent && modifiers.passive
  49932. ) {
  49933. warn(
  49934. 'passive and prevent can\'t be used together. ' +
  49935. 'Passive handler can\'t prevent default event.',
  49936. range
  49937. );
  49938. }
  49939. // normalize click.right and click.middle since they don't actually fire
  49940. // this is technically browser-specific, but at least for now browsers are
  49941. // the only target envs that have right/middle clicks.
  49942. if (modifiers.right) {
  49943. if (dynamic) {
  49944. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  49945. } else if (name === 'click') {
  49946. name = 'contextmenu';
  49947. delete modifiers.right;
  49948. }
  49949. } else if (modifiers.middle) {
  49950. if (dynamic) {
  49951. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  49952. } else if (name === 'click') {
  49953. name = 'mouseup';
  49954. }
  49955. }
  49956. // check capture modifier
  49957. if (modifiers.capture) {
  49958. delete modifiers.capture;
  49959. name = prependModifierMarker('!', name, dynamic);
  49960. }
  49961. if (modifiers.once) {
  49962. delete modifiers.once;
  49963. name = prependModifierMarker('~', name, dynamic);
  49964. }
  49965. /* istanbul ignore if */
  49966. if (modifiers.passive) {
  49967. delete modifiers.passive;
  49968. name = prependModifierMarker('&', name, dynamic);
  49969. }
  49970. var events;
  49971. if (modifiers.native) {
  49972. delete modifiers.native;
  49973. events = el.nativeEvents || (el.nativeEvents = {});
  49974. } else {
  49975. events = el.events || (el.events = {});
  49976. }
  49977. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  49978. if (modifiers !== emptyObject) {
  49979. newHandler.modifiers = modifiers;
  49980. }
  49981. var handlers = events[name];
  49982. /* istanbul ignore if */
  49983. if (Array.isArray(handlers)) {
  49984. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  49985. } else if (handlers) {
  49986. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  49987. } else {
  49988. events[name] = newHandler;
  49989. }
  49990. el.plain = false;
  49991. }
  49992. function getRawBindingAttr (
  49993. el,
  49994. name
  49995. ) {
  49996. return el.rawAttrsMap[':' + name] ||
  49997. el.rawAttrsMap['v-bind:' + name] ||
  49998. el.rawAttrsMap[name]
  49999. }
  50000. function getBindingAttr (
  50001. el,
  50002. name,
  50003. getStatic
  50004. ) {
  50005. var dynamicValue =
  50006. getAndRemoveAttr(el, ':' + name) ||
  50007. getAndRemoveAttr(el, 'v-bind:' + name);
  50008. if (dynamicValue != null) {
  50009. return parseFilters(dynamicValue)
  50010. } else if (getStatic !== false) {
  50011. var staticValue = getAndRemoveAttr(el, name);
  50012. if (staticValue != null) {
  50013. return JSON.stringify(staticValue)
  50014. }
  50015. }
  50016. }
  50017. // note: this only removes the attr from the Array (attrsList) so that it
  50018. // doesn't get processed by processAttrs.
  50019. // By default it does NOT remove it from the map (attrsMap) because the map is
  50020. // needed during codegen.
  50021. function getAndRemoveAttr (
  50022. el,
  50023. name,
  50024. removeFromMap
  50025. ) {
  50026. var val;
  50027. if ((val = el.attrsMap[name]) != null) {
  50028. var list = el.attrsList;
  50029. for (var i = 0, l = list.length; i < l; i++) {
  50030. if (list[i].name === name) {
  50031. list.splice(i, 1);
  50032. break
  50033. }
  50034. }
  50035. }
  50036. if (removeFromMap) {
  50037. delete el.attrsMap[name];
  50038. }
  50039. return val
  50040. }
  50041. function getAndRemoveAttrByRegex (
  50042. el,
  50043. name
  50044. ) {
  50045. var list = el.attrsList;
  50046. for (var i = 0, l = list.length; i < l; i++) {
  50047. var attr = list[i];
  50048. if (name.test(attr.name)) {
  50049. list.splice(i, 1);
  50050. return attr
  50051. }
  50052. }
  50053. }
  50054. function rangeSetItem (
  50055. item,
  50056. range
  50057. ) {
  50058. if (range) {
  50059. if (range.start != null) {
  50060. item.start = range.start;
  50061. }
  50062. if (range.end != null) {
  50063. item.end = range.end;
  50064. }
  50065. }
  50066. return item
  50067. }
  50068. /* */
  50069. /**
  50070. * Cross-platform code generation for component v-model
  50071. */
  50072. function genComponentModel (
  50073. el,
  50074. value,
  50075. modifiers
  50076. ) {
  50077. var ref = modifiers || {};
  50078. var number = ref.number;
  50079. var trim = ref.trim;
  50080. var baseValueExpression = '$$v';
  50081. var valueExpression = baseValueExpression;
  50082. if (trim) {
  50083. valueExpression =
  50084. "(typeof " + baseValueExpression + " === 'string'" +
  50085. "? " + baseValueExpression + ".trim()" +
  50086. ": " + baseValueExpression + ")";
  50087. }
  50088. if (number) {
  50089. valueExpression = "_n(" + valueExpression + ")";
  50090. }
  50091. var assignment = genAssignmentCode(value, valueExpression);
  50092. el.model = {
  50093. value: ("(" + value + ")"),
  50094. expression: JSON.stringify(value),
  50095. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50096. };
  50097. }
  50098. /**
  50099. * Cross-platform codegen helper for generating v-model value assignment code.
  50100. */
  50101. function genAssignmentCode (
  50102. value,
  50103. assignment
  50104. ) {
  50105. var res = parseModel(value);
  50106. if (res.key === null) {
  50107. return (value + "=" + assignment)
  50108. } else {
  50109. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50110. }
  50111. }
  50112. /**
  50113. * Parse a v-model expression into a base path and a final key segment.
  50114. * Handles both dot-path and possible square brackets.
  50115. *
  50116. * Possible cases:
  50117. *
  50118. * - test
  50119. * - test[key]
  50120. * - test[test1[key]]
  50121. * - test["a"][key]
  50122. * - xxx.test[a[a].test1[key]]
  50123. * - test.xxx.a["asa"][test1[key]]
  50124. *
  50125. */
  50126. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50127. function parseModel (val) {
  50128. // Fix https://github.com/vuejs/vue/pull/7730
  50129. // allow v-model="obj.val " (trailing whitespace)
  50130. val = val.trim();
  50131. len = val.length;
  50132. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50133. index$1 = val.lastIndexOf('.');
  50134. if (index$1 > -1) {
  50135. return {
  50136. exp: val.slice(0, index$1),
  50137. key: '"' + val.slice(index$1 + 1) + '"'
  50138. }
  50139. } else {
  50140. return {
  50141. exp: val,
  50142. key: null
  50143. }
  50144. }
  50145. }
  50146. str = val;
  50147. index$1 = expressionPos = expressionEndPos = 0;
  50148. while (!eof()) {
  50149. chr = next();
  50150. /* istanbul ignore if */
  50151. if (isStringStart(chr)) {
  50152. parseString(chr);
  50153. } else if (chr === 0x5B) {
  50154. parseBracket(chr);
  50155. }
  50156. }
  50157. return {
  50158. exp: val.slice(0, expressionPos),
  50159. key: val.slice(expressionPos + 1, expressionEndPos)
  50160. }
  50161. }
  50162. function next () {
  50163. return str.charCodeAt(++index$1)
  50164. }
  50165. function eof () {
  50166. return index$1 >= len
  50167. }
  50168. function isStringStart (chr) {
  50169. return chr === 0x22 || chr === 0x27
  50170. }
  50171. function parseBracket (chr) {
  50172. var inBracket = 1;
  50173. expressionPos = index$1;
  50174. while (!eof()) {
  50175. chr = next();
  50176. if (isStringStart(chr)) {
  50177. parseString(chr);
  50178. continue
  50179. }
  50180. if (chr === 0x5B) { inBracket++; }
  50181. if (chr === 0x5D) { inBracket--; }
  50182. if (inBracket === 0) {
  50183. expressionEndPos = index$1;
  50184. break
  50185. }
  50186. }
  50187. }
  50188. function parseString (chr) {
  50189. var stringQuote = chr;
  50190. while (!eof()) {
  50191. chr = next();
  50192. if (chr === stringQuote) {
  50193. break
  50194. }
  50195. }
  50196. }
  50197. /* */
  50198. var warn$1;
  50199. // in some cases, the event used has to be determined at runtime
  50200. // so we used some reserved tokens during compile.
  50201. var RANGE_TOKEN = '__r';
  50202. var CHECKBOX_RADIO_TOKEN = '__c';
  50203. function model (
  50204. el,
  50205. dir,
  50206. _warn
  50207. ) {
  50208. warn$1 = _warn;
  50209. var value = dir.value;
  50210. var modifiers = dir.modifiers;
  50211. var tag = el.tag;
  50212. var type = el.attrsMap.type;
  50213. {
  50214. // inputs with type="file" are read only and setting the input's
  50215. // value will throw an error.
  50216. if (tag === 'input' && type === 'file') {
  50217. warn$1(
  50218. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50219. "File inputs are read only. Use a v-on:change listener instead.",
  50220. el.rawAttrsMap['v-model']
  50221. );
  50222. }
  50223. }
  50224. if (el.component) {
  50225. genComponentModel(el, value, modifiers);
  50226. // component v-model doesn't need extra runtime
  50227. return false
  50228. } else if (tag === 'select') {
  50229. genSelect(el, value, modifiers);
  50230. } else if (tag === 'input' && type === 'checkbox') {
  50231. genCheckboxModel(el, value, modifiers);
  50232. } else if (tag === 'input' && type === 'radio') {
  50233. genRadioModel(el, value, modifiers);
  50234. } else if (tag === 'input' || tag === 'textarea') {
  50235. genDefaultModel(el, value, modifiers);
  50236. } else if (!config.isReservedTag(tag)) {
  50237. genComponentModel(el, value, modifiers);
  50238. // component v-model doesn't need extra runtime
  50239. return false
  50240. } else {
  50241. warn$1(
  50242. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50243. "v-model is not supported on this element type. " +
  50244. 'If you are working with contenteditable, it\'s recommended to ' +
  50245. 'wrap a library dedicated for that purpose inside a custom component.',
  50246. el.rawAttrsMap['v-model']
  50247. );
  50248. }
  50249. // ensure runtime directive metadata
  50250. return true
  50251. }
  50252. function genCheckboxModel (
  50253. el,
  50254. value,
  50255. modifiers
  50256. ) {
  50257. var number = modifiers && modifiers.number;
  50258. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50259. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50260. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50261. addProp(el, 'checked',
  50262. "Array.isArray(" + value + ")" +
  50263. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50264. trueValueBinding === 'true'
  50265. ? (":(" + value + ")")
  50266. : (":_q(" + value + "," + trueValueBinding + ")")
  50267. )
  50268. );
  50269. addHandler(el, 'change',
  50270. "var $$a=" + value + "," +
  50271. '$$el=$event.target,' +
  50272. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50273. 'if(Array.isArray($$a)){' +
  50274. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50275. '$$i=_i($$a,$$v);' +
  50276. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50277. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50278. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50279. null, true
  50280. );
  50281. }
  50282. function genRadioModel (
  50283. el,
  50284. value,
  50285. modifiers
  50286. ) {
  50287. var number = modifiers && modifiers.number;
  50288. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50289. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50290. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50291. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50292. }
  50293. function genSelect (
  50294. el,
  50295. value,
  50296. modifiers
  50297. ) {
  50298. var number = modifiers && modifiers.number;
  50299. var selectedVal = "Array.prototype.filter" +
  50300. ".call($event.target.options,function(o){return o.selected})" +
  50301. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50302. "return " + (number ? '_n(val)' : 'val') + "})";
  50303. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50304. var code = "var $$selectedVal = " + selectedVal + ";";
  50305. code = code + " " + (genAssignmentCode(value, assignment));
  50306. addHandler(el, 'change', code, null, true);
  50307. }
  50308. function genDefaultModel (
  50309. el,
  50310. value,
  50311. modifiers
  50312. ) {
  50313. var type = el.attrsMap.type;
  50314. // warn if v-bind:value conflicts with v-model
  50315. // except for inputs with v-bind:type
  50316. {
  50317. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50318. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50319. if (value$1 && !typeBinding) {
  50320. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50321. warn$1(
  50322. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50323. 'because the latter already expands to a value binding internally',
  50324. el.rawAttrsMap[binding]
  50325. );
  50326. }
  50327. }
  50328. var ref = modifiers || {};
  50329. var lazy = ref.lazy;
  50330. var number = ref.number;
  50331. var trim = ref.trim;
  50332. var needCompositionGuard = !lazy && type !== 'range';
  50333. var event = lazy
  50334. ? 'change'
  50335. : type === 'range'
  50336. ? RANGE_TOKEN
  50337. : 'input';
  50338. var valueExpression = '$event.target.value';
  50339. if (trim) {
  50340. valueExpression = "$event.target.value.trim()";
  50341. }
  50342. if (number) {
  50343. valueExpression = "_n(" + valueExpression + ")";
  50344. }
  50345. var code = genAssignmentCode(value, valueExpression);
  50346. if (needCompositionGuard) {
  50347. code = "if($event.target.composing)return;" + code;
  50348. }
  50349. addProp(el, 'value', ("(" + value + ")"));
  50350. addHandler(el, event, code, null, true);
  50351. if (trim || number) {
  50352. addHandler(el, 'blur', '$forceUpdate()');
  50353. }
  50354. }
  50355. /* */
  50356. // normalize v-model event tokens that can only be determined at runtime.
  50357. // it's important to place the event as the first in the array because
  50358. // the whole point is ensuring the v-model callback gets called before
  50359. // user-attached handlers.
  50360. function normalizeEvents (on) {
  50361. /* istanbul ignore if */
  50362. if (isDef(on[RANGE_TOKEN])) {
  50363. // IE input[type=range] only supports `change` event
  50364. var event = isIE ? 'change' : 'input';
  50365. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50366. delete on[RANGE_TOKEN];
  50367. }
  50368. // This was originally intended to fix #4521 but no longer necessary
  50369. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50370. /* istanbul ignore if */
  50371. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50372. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50373. delete on[CHECKBOX_RADIO_TOKEN];
  50374. }
  50375. }
  50376. var target$1;
  50377. function createOnceHandler$1 (event, handler, capture) {
  50378. var _target = target$1; // save current target element in closure
  50379. return function onceHandler () {
  50380. var res = handler.apply(null, arguments);
  50381. if (res !== null) {
  50382. remove$2(event, onceHandler, capture, _target);
  50383. }
  50384. }
  50385. }
  50386. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50387. // implementation and does not fire microtasks in between event propagation, so
  50388. // safe to exclude.
  50389. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50390. function add$1 (
  50391. name,
  50392. handler,
  50393. capture,
  50394. passive
  50395. ) {
  50396. // async edge case #6566: inner click event triggers patch, event handler
  50397. // attached to outer element during patch, and triggered again. This
  50398. // happens because browsers fire microtask ticks between event propagation.
  50399. // the solution is simple: we save the timestamp when a handler is attached,
  50400. // and the handler would only fire if the event passed to it was fired
  50401. // AFTER it was attached.
  50402. if (useMicrotaskFix) {
  50403. var attachedTimestamp = currentFlushTimestamp;
  50404. var original = handler;
  50405. handler = original._wrapper = function (e) {
  50406. if (
  50407. // no bubbling, should always fire.
  50408. // this is just a safety net in case event.timeStamp is unreliable in
  50409. // certain weird environments...
  50410. e.target === e.currentTarget ||
  50411. // event is fired after handler attachment
  50412. e.timeStamp >= attachedTimestamp ||
  50413. // bail for environments that have buggy event.timeStamp implementations
  50414. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50415. // #9681 QtWebEngine event.timeStamp is negative value
  50416. e.timeStamp <= 0 ||
  50417. // #9448 bail if event is fired in another document in a multi-page
  50418. // electron/nw.js app, since event.timeStamp will be using a different
  50419. // starting reference
  50420. e.target.ownerDocument !== document
  50421. ) {
  50422. return original.apply(this, arguments)
  50423. }
  50424. };
  50425. }
  50426. target$1.addEventListener(
  50427. name,
  50428. handler,
  50429. supportsPassive
  50430. ? { capture: capture, passive: passive }
  50431. : capture
  50432. );
  50433. }
  50434. function remove$2 (
  50435. name,
  50436. handler,
  50437. capture,
  50438. _target
  50439. ) {
  50440. (_target || target$1).removeEventListener(
  50441. name,
  50442. handler._wrapper || handler,
  50443. capture
  50444. );
  50445. }
  50446. function updateDOMListeners (oldVnode, vnode) {
  50447. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50448. return
  50449. }
  50450. var on = vnode.data.on || {};
  50451. var oldOn = oldVnode.data.on || {};
  50452. target$1 = vnode.elm;
  50453. normalizeEvents(on);
  50454. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50455. target$1 = undefined;
  50456. }
  50457. var events = {
  50458. create: updateDOMListeners,
  50459. update: updateDOMListeners
  50460. };
  50461. /* */
  50462. var svgContainer;
  50463. function updateDOMProps (oldVnode, vnode) {
  50464. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50465. return
  50466. }
  50467. var key, cur;
  50468. var elm = vnode.elm;
  50469. var oldProps = oldVnode.data.domProps || {};
  50470. var props = vnode.data.domProps || {};
  50471. // clone observed objects, as the user probably wants to mutate it
  50472. if (isDef(props.__ob__)) {
  50473. props = vnode.data.domProps = extend({}, props);
  50474. }
  50475. for (key in oldProps) {
  50476. if (!(key in props)) {
  50477. elm[key] = '';
  50478. }
  50479. }
  50480. for (key in props) {
  50481. cur = props[key];
  50482. // ignore children if the node has textContent or innerHTML,
  50483. // as these will throw away existing DOM nodes and cause removal errors
  50484. // on subsequent patches (#3360)
  50485. if (key === 'textContent' || key === 'innerHTML') {
  50486. if (vnode.children) { vnode.children.length = 0; }
  50487. if (cur === oldProps[key]) { continue }
  50488. // #6601 work around Chrome version <= 55 bug where single textNode
  50489. // replaced by innerHTML/textContent retains its parentNode property
  50490. if (elm.childNodes.length === 1) {
  50491. elm.removeChild(elm.childNodes[0]);
  50492. }
  50493. }
  50494. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50495. // store value as _value as well since
  50496. // non-string values will be stringified
  50497. elm._value = cur;
  50498. // avoid resetting cursor position when value is the same
  50499. var strCur = isUndef(cur) ? '' : String(cur);
  50500. if (shouldUpdateValue(elm, strCur)) {
  50501. elm.value = strCur;
  50502. }
  50503. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50504. // IE doesn't support innerHTML for SVG elements
  50505. svgContainer = svgContainer || document.createElement('div');
  50506. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50507. var svg = svgContainer.firstChild;
  50508. while (elm.firstChild) {
  50509. elm.removeChild(elm.firstChild);
  50510. }
  50511. while (svg.firstChild) {
  50512. elm.appendChild(svg.firstChild);
  50513. }
  50514. } else if (
  50515. // skip the update if old and new VDOM state is the same.
  50516. // `value` is handled separately because the DOM value may be temporarily
  50517. // out of sync with VDOM state due to focus, composition and modifiers.
  50518. // This #4521 by skipping the unnecesarry `checked` update.
  50519. cur !== oldProps[key]
  50520. ) {
  50521. // some property updates can throw
  50522. // e.g. `value` on <progress> w/ non-finite value
  50523. try {
  50524. elm[key] = cur;
  50525. } catch (e) {}
  50526. }
  50527. }
  50528. }
  50529. // check platforms/web/util/attrs.js acceptValue
  50530. function shouldUpdateValue (elm, checkVal) {
  50531. return (!elm.composing && (
  50532. elm.tagName === 'OPTION' ||
  50533. isNotInFocusAndDirty(elm, checkVal) ||
  50534. isDirtyWithModifiers(elm, checkVal)
  50535. ))
  50536. }
  50537. function isNotInFocusAndDirty (elm, checkVal) {
  50538. // return true when textbox (.number and .trim) loses focus and its value is
  50539. // not equal to the updated value
  50540. var notInFocus = true;
  50541. // #6157
  50542. // work around IE bug when accessing document.activeElement in an iframe
  50543. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50544. return notInFocus && elm.value !== checkVal
  50545. }
  50546. function isDirtyWithModifiers (elm, newVal) {
  50547. var value = elm.value;
  50548. var modifiers = elm._vModifiers; // injected by v-model runtime
  50549. if (isDef(modifiers)) {
  50550. if (modifiers.number) {
  50551. return toNumber(value) !== toNumber(newVal)
  50552. }
  50553. if (modifiers.trim) {
  50554. return value.trim() !== newVal.trim()
  50555. }
  50556. }
  50557. return value !== newVal
  50558. }
  50559. var domProps = {
  50560. create: updateDOMProps,
  50561. update: updateDOMProps
  50562. };
  50563. /* */
  50564. var parseStyleText = cached(function (cssText) {
  50565. var res = {};
  50566. var listDelimiter = /;(?![^(]*\))/g;
  50567. var propertyDelimiter = /:(.+)/;
  50568. cssText.split(listDelimiter).forEach(function (item) {
  50569. if (item) {
  50570. var tmp = item.split(propertyDelimiter);
  50571. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50572. }
  50573. });
  50574. return res
  50575. });
  50576. // merge static and dynamic style data on the same vnode
  50577. function normalizeStyleData (data) {
  50578. var style = normalizeStyleBinding(data.style);
  50579. // static style is pre-processed into an object during compilation
  50580. // and is always a fresh object, so it's safe to merge into it
  50581. return data.staticStyle
  50582. ? extend(data.staticStyle, style)
  50583. : style
  50584. }
  50585. // normalize possible array / string values into Object
  50586. function normalizeStyleBinding (bindingStyle) {
  50587. if (Array.isArray(bindingStyle)) {
  50588. return toObject(bindingStyle)
  50589. }
  50590. if (typeof bindingStyle === 'string') {
  50591. return parseStyleText(bindingStyle)
  50592. }
  50593. return bindingStyle
  50594. }
  50595. /**
  50596. * parent component style should be after child's
  50597. * so that parent component's style could override it
  50598. */
  50599. function getStyle (vnode, checkChild) {
  50600. var res = {};
  50601. var styleData;
  50602. if (checkChild) {
  50603. var childNode = vnode;
  50604. while (childNode.componentInstance) {
  50605. childNode = childNode.componentInstance._vnode;
  50606. if (
  50607. childNode && childNode.data &&
  50608. (styleData = normalizeStyleData(childNode.data))
  50609. ) {
  50610. extend(res, styleData);
  50611. }
  50612. }
  50613. }
  50614. if ((styleData = normalizeStyleData(vnode.data))) {
  50615. extend(res, styleData);
  50616. }
  50617. var parentNode = vnode;
  50618. while ((parentNode = parentNode.parent)) {
  50619. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  50620. extend(res, styleData);
  50621. }
  50622. }
  50623. return res
  50624. }
  50625. /* */
  50626. var cssVarRE = /^--/;
  50627. var importantRE = /\s*!important$/;
  50628. var setProp = function (el, name, val) {
  50629. /* istanbul ignore if */
  50630. if (cssVarRE.test(name)) {
  50631. el.style.setProperty(name, val);
  50632. } else if (importantRE.test(val)) {
  50633. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  50634. } else {
  50635. var normalizedName = normalize(name);
  50636. if (Array.isArray(val)) {
  50637. // Support values array created by autoprefixer, e.g.
  50638. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  50639. // Set them one by one, and the browser will only set those it can recognize
  50640. for (var i = 0, len = val.length; i < len; i++) {
  50641. el.style[normalizedName] = val[i];
  50642. }
  50643. } else {
  50644. el.style[normalizedName] = val;
  50645. }
  50646. }
  50647. };
  50648. var vendorNames = ['Webkit', 'Moz', 'ms'];
  50649. var emptyStyle;
  50650. var normalize = cached(function (prop) {
  50651. emptyStyle = emptyStyle || document.createElement('div').style;
  50652. prop = camelize(prop);
  50653. if (prop !== 'filter' && (prop in emptyStyle)) {
  50654. return prop
  50655. }
  50656. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  50657. for (var i = 0; i < vendorNames.length; i++) {
  50658. var name = vendorNames[i] + capName;
  50659. if (name in emptyStyle) {
  50660. return name
  50661. }
  50662. }
  50663. });
  50664. function updateStyle (oldVnode, vnode) {
  50665. var data = vnode.data;
  50666. var oldData = oldVnode.data;
  50667. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  50668. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  50669. ) {
  50670. return
  50671. }
  50672. var cur, name;
  50673. var el = vnode.elm;
  50674. var oldStaticStyle = oldData.staticStyle;
  50675. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  50676. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  50677. var oldStyle = oldStaticStyle || oldStyleBinding;
  50678. var style = normalizeStyleBinding(vnode.data.style) || {};
  50679. // store normalized style under a different key for next diff
  50680. // make sure to clone it if it's reactive, since the user likely wants
  50681. // to mutate it.
  50682. vnode.data.normalizedStyle = isDef(style.__ob__)
  50683. ? extend({}, style)
  50684. : style;
  50685. var newStyle = getStyle(vnode, true);
  50686. for (name in oldStyle) {
  50687. if (isUndef(newStyle[name])) {
  50688. setProp(el, name, '');
  50689. }
  50690. }
  50691. for (name in newStyle) {
  50692. cur = newStyle[name];
  50693. if (cur !== oldStyle[name]) {
  50694. // ie9 setting to null has no effect, must use empty string
  50695. setProp(el, name, cur == null ? '' : cur);
  50696. }
  50697. }
  50698. }
  50699. var style = {
  50700. create: updateStyle,
  50701. update: updateStyle
  50702. };
  50703. /* */
  50704. var whitespaceRE = /\s+/;
  50705. /**
  50706. * Add class with compatibility for SVG since classList is not supported on
  50707. * SVG elements in IE
  50708. */
  50709. function addClass (el, cls) {
  50710. /* istanbul ignore if */
  50711. if (!cls || !(cls = cls.trim())) {
  50712. return
  50713. }
  50714. /* istanbul ignore else */
  50715. if (el.classList) {
  50716. if (cls.indexOf(' ') > -1) {
  50717. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  50718. } else {
  50719. el.classList.add(cls);
  50720. }
  50721. } else {
  50722. var cur = " " + (el.getAttribute('class') || '') + " ";
  50723. if (cur.indexOf(' ' + cls + ' ') < 0) {
  50724. el.setAttribute('class', (cur + cls).trim());
  50725. }
  50726. }
  50727. }
  50728. /**
  50729. * Remove class with compatibility for SVG since classList is not supported on
  50730. * SVG elements in IE
  50731. */
  50732. function removeClass (el, cls) {
  50733. /* istanbul ignore if */
  50734. if (!cls || !(cls = cls.trim())) {
  50735. return
  50736. }
  50737. /* istanbul ignore else */
  50738. if (el.classList) {
  50739. if (cls.indexOf(' ') > -1) {
  50740. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  50741. } else {
  50742. el.classList.remove(cls);
  50743. }
  50744. if (!el.classList.length) {
  50745. el.removeAttribute('class');
  50746. }
  50747. } else {
  50748. var cur = " " + (el.getAttribute('class') || '') + " ";
  50749. var tar = ' ' + cls + ' ';
  50750. while (cur.indexOf(tar) >= 0) {
  50751. cur = cur.replace(tar, ' ');
  50752. }
  50753. cur = cur.trim();
  50754. if (cur) {
  50755. el.setAttribute('class', cur);
  50756. } else {
  50757. el.removeAttribute('class');
  50758. }
  50759. }
  50760. }
  50761. /* */
  50762. function resolveTransition (def$$1) {
  50763. if (!def$$1) {
  50764. return
  50765. }
  50766. /* istanbul ignore else */
  50767. if (typeof def$$1 === 'object') {
  50768. var res = {};
  50769. if (def$$1.css !== false) {
  50770. extend(res, autoCssTransition(def$$1.name || 'v'));
  50771. }
  50772. extend(res, def$$1);
  50773. return res
  50774. } else if (typeof def$$1 === 'string') {
  50775. return autoCssTransition(def$$1)
  50776. }
  50777. }
  50778. var autoCssTransition = cached(function (name) {
  50779. return {
  50780. enterClass: (name + "-enter"),
  50781. enterToClass: (name + "-enter-to"),
  50782. enterActiveClass: (name + "-enter-active"),
  50783. leaveClass: (name + "-leave"),
  50784. leaveToClass: (name + "-leave-to"),
  50785. leaveActiveClass: (name + "-leave-active")
  50786. }
  50787. });
  50788. var hasTransition = inBrowser && !isIE9;
  50789. var TRANSITION = 'transition';
  50790. var ANIMATION = 'animation';
  50791. // Transition property/event sniffing
  50792. var transitionProp = 'transition';
  50793. var transitionEndEvent = 'transitionend';
  50794. var animationProp = 'animation';
  50795. var animationEndEvent = 'animationend';
  50796. if (hasTransition) {
  50797. /* istanbul ignore if */
  50798. if (window.ontransitionend === undefined &&
  50799. window.onwebkittransitionend !== undefined
  50800. ) {
  50801. transitionProp = 'WebkitTransition';
  50802. transitionEndEvent = 'webkitTransitionEnd';
  50803. }
  50804. if (window.onanimationend === undefined &&
  50805. window.onwebkitanimationend !== undefined
  50806. ) {
  50807. animationProp = 'WebkitAnimation';
  50808. animationEndEvent = 'webkitAnimationEnd';
  50809. }
  50810. }
  50811. // binding to window is necessary to make hot reload work in IE in strict mode
  50812. var raf = inBrowser
  50813. ? window.requestAnimationFrame
  50814. ? window.requestAnimationFrame.bind(window)
  50815. : setTimeout
  50816. : /* istanbul ignore next */ function (fn) { return fn(); };
  50817. function nextFrame (fn) {
  50818. raf(function () {
  50819. raf(fn);
  50820. });
  50821. }
  50822. function addTransitionClass (el, cls) {
  50823. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50824. if (transitionClasses.indexOf(cls) < 0) {
  50825. transitionClasses.push(cls);
  50826. addClass(el, cls);
  50827. }
  50828. }
  50829. function removeTransitionClass (el, cls) {
  50830. if (el._transitionClasses) {
  50831. remove(el._transitionClasses, cls);
  50832. }
  50833. removeClass(el, cls);
  50834. }
  50835. function whenTransitionEnds (
  50836. el,
  50837. expectedType,
  50838. cb
  50839. ) {
  50840. var ref = getTransitionInfo(el, expectedType);
  50841. var type = ref.type;
  50842. var timeout = ref.timeout;
  50843. var propCount = ref.propCount;
  50844. if (!type) { return cb() }
  50845. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  50846. var ended = 0;
  50847. var end = function () {
  50848. el.removeEventListener(event, onEnd);
  50849. cb();
  50850. };
  50851. var onEnd = function (e) {
  50852. if (e.target === el) {
  50853. if (++ended >= propCount) {
  50854. end();
  50855. }
  50856. }
  50857. };
  50858. setTimeout(function () {
  50859. if (ended < propCount) {
  50860. end();
  50861. }
  50862. }, timeout + 1);
  50863. el.addEventListener(event, onEnd);
  50864. }
  50865. var transformRE = /\b(transform|all)(,|$)/;
  50866. function getTransitionInfo (el, expectedType) {
  50867. var styles = window.getComputedStyle(el);
  50868. // JSDOM may return undefined for transition properties
  50869. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  50870. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  50871. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  50872. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  50873. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  50874. var animationTimeout = getTimeout(animationDelays, animationDurations);
  50875. var type;
  50876. var timeout = 0;
  50877. var propCount = 0;
  50878. /* istanbul ignore if */
  50879. if (expectedType === TRANSITION) {
  50880. if (transitionTimeout > 0) {
  50881. type = TRANSITION;
  50882. timeout = transitionTimeout;
  50883. propCount = transitionDurations.length;
  50884. }
  50885. } else if (expectedType === ANIMATION) {
  50886. if (animationTimeout > 0) {
  50887. type = ANIMATION;
  50888. timeout = animationTimeout;
  50889. propCount = animationDurations.length;
  50890. }
  50891. } else {
  50892. timeout = Math.max(transitionTimeout, animationTimeout);
  50893. type = timeout > 0
  50894. ? transitionTimeout > animationTimeout
  50895. ? TRANSITION
  50896. : ANIMATION
  50897. : null;
  50898. propCount = type
  50899. ? type === TRANSITION
  50900. ? transitionDurations.length
  50901. : animationDurations.length
  50902. : 0;
  50903. }
  50904. var hasTransform =
  50905. type === TRANSITION &&
  50906. transformRE.test(styles[transitionProp + 'Property']);
  50907. return {
  50908. type: type,
  50909. timeout: timeout,
  50910. propCount: propCount,
  50911. hasTransform: hasTransform
  50912. }
  50913. }
  50914. function getTimeout (delays, durations) {
  50915. /* istanbul ignore next */
  50916. while (delays.length < durations.length) {
  50917. delays = delays.concat(delays);
  50918. }
  50919. return Math.max.apply(null, durations.map(function (d, i) {
  50920. return toMs(d) + toMs(delays[i])
  50921. }))
  50922. }
  50923. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  50924. // in a locale-dependent way, using a comma instead of a dot.
  50925. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  50926. // as a floor function) causing unexpected behaviors
  50927. function toMs (s) {
  50928. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  50929. }
  50930. /* */
  50931. function enter (vnode, toggleDisplay) {
  50932. var el = vnode.elm;
  50933. // call leave callback now
  50934. if (isDef(el._leaveCb)) {
  50935. el._leaveCb.cancelled = true;
  50936. el._leaveCb();
  50937. }
  50938. var data = resolveTransition(vnode.data.transition);
  50939. if (isUndef(data)) {
  50940. return
  50941. }
  50942. /* istanbul ignore if */
  50943. if (isDef(el._enterCb) || el.nodeType !== 1) {
  50944. return
  50945. }
  50946. var css = data.css;
  50947. var type = data.type;
  50948. var enterClass = data.enterClass;
  50949. var enterToClass = data.enterToClass;
  50950. var enterActiveClass = data.enterActiveClass;
  50951. var appearClass = data.appearClass;
  50952. var appearToClass = data.appearToClass;
  50953. var appearActiveClass = data.appearActiveClass;
  50954. var beforeEnter = data.beforeEnter;
  50955. var enter = data.enter;
  50956. var afterEnter = data.afterEnter;
  50957. var enterCancelled = data.enterCancelled;
  50958. var beforeAppear = data.beforeAppear;
  50959. var appear = data.appear;
  50960. var afterAppear = data.afterAppear;
  50961. var appearCancelled = data.appearCancelled;
  50962. var duration = data.duration;
  50963. // activeInstance will always be the <transition> component managing this
  50964. // transition. One edge case to check is when the <transition> is placed
  50965. // as the root node of a child component. In that case we need to check
  50966. // <transition>'s parent for appear check.
  50967. var context = activeInstance;
  50968. var transitionNode = activeInstance.$vnode;
  50969. while (transitionNode && transitionNode.parent) {
  50970. context = transitionNode.context;
  50971. transitionNode = transitionNode.parent;
  50972. }
  50973. var isAppear = !context._isMounted || !vnode.isRootInsert;
  50974. if (isAppear && !appear && appear !== '') {
  50975. return
  50976. }
  50977. var startClass = isAppear && appearClass
  50978. ? appearClass
  50979. : enterClass;
  50980. var activeClass = isAppear && appearActiveClass
  50981. ? appearActiveClass
  50982. : enterActiveClass;
  50983. var toClass = isAppear && appearToClass
  50984. ? appearToClass
  50985. : enterToClass;
  50986. var beforeEnterHook = isAppear
  50987. ? (beforeAppear || beforeEnter)
  50988. : beforeEnter;
  50989. var enterHook = isAppear
  50990. ? (typeof appear === 'function' ? appear : enter)
  50991. : enter;
  50992. var afterEnterHook = isAppear
  50993. ? (afterAppear || afterEnter)
  50994. : afterEnter;
  50995. var enterCancelledHook = isAppear
  50996. ? (appearCancelled || enterCancelled)
  50997. : enterCancelled;
  50998. var explicitEnterDuration = toNumber(
  50999. isObject(duration)
  51000. ? duration.enter
  51001. : duration
  51002. );
  51003. if (explicitEnterDuration != null) {
  51004. checkDuration(explicitEnterDuration, 'enter', vnode);
  51005. }
  51006. var expectsCSS = css !== false && !isIE9;
  51007. var userWantsControl = getHookArgumentsLength(enterHook);
  51008. var cb = el._enterCb = once(function () {
  51009. if (expectsCSS) {
  51010. removeTransitionClass(el, toClass);
  51011. removeTransitionClass(el, activeClass);
  51012. }
  51013. if (cb.cancelled) {
  51014. if (expectsCSS) {
  51015. removeTransitionClass(el, startClass);
  51016. }
  51017. enterCancelledHook && enterCancelledHook(el);
  51018. } else {
  51019. afterEnterHook && afterEnterHook(el);
  51020. }
  51021. el._enterCb = null;
  51022. });
  51023. if (!vnode.data.show) {
  51024. // remove pending leave element on enter by injecting an insert hook
  51025. mergeVNodeHook(vnode, 'insert', function () {
  51026. var parent = el.parentNode;
  51027. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51028. if (pendingNode &&
  51029. pendingNode.tag === vnode.tag &&
  51030. pendingNode.elm._leaveCb
  51031. ) {
  51032. pendingNode.elm._leaveCb();
  51033. }
  51034. enterHook && enterHook(el, cb);
  51035. });
  51036. }
  51037. // start enter transition
  51038. beforeEnterHook && beforeEnterHook(el);
  51039. if (expectsCSS) {
  51040. addTransitionClass(el, startClass);
  51041. addTransitionClass(el, activeClass);
  51042. nextFrame(function () {
  51043. removeTransitionClass(el, startClass);
  51044. if (!cb.cancelled) {
  51045. addTransitionClass(el, toClass);
  51046. if (!userWantsControl) {
  51047. if (isValidDuration(explicitEnterDuration)) {
  51048. setTimeout(cb, explicitEnterDuration);
  51049. } else {
  51050. whenTransitionEnds(el, type, cb);
  51051. }
  51052. }
  51053. }
  51054. });
  51055. }
  51056. if (vnode.data.show) {
  51057. toggleDisplay && toggleDisplay();
  51058. enterHook && enterHook(el, cb);
  51059. }
  51060. if (!expectsCSS && !userWantsControl) {
  51061. cb();
  51062. }
  51063. }
  51064. function leave (vnode, rm) {
  51065. var el = vnode.elm;
  51066. // call enter callback now
  51067. if (isDef(el._enterCb)) {
  51068. el._enterCb.cancelled = true;
  51069. el._enterCb();
  51070. }
  51071. var data = resolveTransition(vnode.data.transition);
  51072. if (isUndef(data) || el.nodeType !== 1) {
  51073. return rm()
  51074. }
  51075. /* istanbul ignore if */
  51076. if (isDef(el._leaveCb)) {
  51077. return
  51078. }
  51079. var css = data.css;
  51080. var type = data.type;
  51081. var leaveClass = data.leaveClass;
  51082. var leaveToClass = data.leaveToClass;
  51083. var leaveActiveClass = data.leaveActiveClass;
  51084. var beforeLeave = data.beforeLeave;
  51085. var leave = data.leave;
  51086. var afterLeave = data.afterLeave;
  51087. var leaveCancelled = data.leaveCancelled;
  51088. var delayLeave = data.delayLeave;
  51089. var duration = data.duration;
  51090. var expectsCSS = css !== false && !isIE9;
  51091. var userWantsControl = getHookArgumentsLength(leave);
  51092. var explicitLeaveDuration = toNumber(
  51093. isObject(duration)
  51094. ? duration.leave
  51095. : duration
  51096. );
  51097. if (isDef(explicitLeaveDuration)) {
  51098. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51099. }
  51100. var cb = el._leaveCb = once(function () {
  51101. if (el.parentNode && el.parentNode._pending) {
  51102. el.parentNode._pending[vnode.key] = null;
  51103. }
  51104. if (expectsCSS) {
  51105. removeTransitionClass(el, leaveToClass);
  51106. removeTransitionClass(el, leaveActiveClass);
  51107. }
  51108. if (cb.cancelled) {
  51109. if (expectsCSS) {
  51110. removeTransitionClass(el, leaveClass);
  51111. }
  51112. leaveCancelled && leaveCancelled(el);
  51113. } else {
  51114. rm();
  51115. afterLeave && afterLeave(el);
  51116. }
  51117. el._leaveCb = null;
  51118. });
  51119. if (delayLeave) {
  51120. delayLeave(performLeave);
  51121. } else {
  51122. performLeave();
  51123. }
  51124. function performLeave () {
  51125. // the delayed leave may have already been cancelled
  51126. if (cb.cancelled) {
  51127. return
  51128. }
  51129. // record leaving element
  51130. if (!vnode.data.show && el.parentNode) {
  51131. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51132. }
  51133. beforeLeave && beforeLeave(el);
  51134. if (expectsCSS) {
  51135. addTransitionClass(el, leaveClass);
  51136. addTransitionClass(el, leaveActiveClass);
  51137. nextFrame(function () {
  51138. removeTransitionClass(el, leaveClass);
  51139. if (!cb.cancelled) {
  51140. addTransitionClass(el, leaveToClass);
  51141. if (!userWantsControl) {
  51142. if (isValidDuration(explicitLeaveDuration)) {
  51143. setTimeout(cb, explicitLeaveDuration);
  51144. } else {
  51145. whenTransitionEnds(el, type, cb);
  51146. }
  51147. }
  51148. }
  51149. });
  51150. }
  51151. leave && leave(el, cb);
  51152. if (!expectsCSS && !userWantsControl) {
  51153. cb();
  51154. }
  51155. }
  51156. }
  51157. // only used in dev mode
  51158. function checkDuration (val, name, vnode) {
  51159. if (typeof val !== 'number') {
  51160. warn(
  51161. "<transition> explicit " + name + " duration is not a valid number - " +
  51162. "got " + (JSON.stringify(val)) + ".",
  51163. vnode.context
  51164. );
  51165. } else if (isNaN(val)) {
  51166. warn(
  51167. "<transition> explicit " + name + " duration is NaN - " +
  51168. 'the duration expression might be incorrect.',
  51169. vnode.context
  51170. );
  51171. }
  51172. }
  51173. function isValidDuration (val) {
  51174. return typeof val === 'number' && !isNaN(val)
  51175. }
  51176. /**
  51177. * Normalize a transition hook's argument length. The hook may be:
  51178. * - a merged hook (invoker) with the original in .fns
  51179. * - a wrapped component method (check ._length)
  51180. * - a plain function (.length)
  51181. */
  51182. function getHookArgumentsLength (fn) {
  51183. if (isUndef(fn)) {
  51184. return false
  51185. }
  51186. var invokerFns = fn.fns;
  51187. if (isDef(invokerFns)) {
  51188. // invoker
  51189. return getHookArgumentsLength(
  51190. Array.isArray(invokerFns)
  51191. ? invokerFns[0]
  51192. : invokerFns
  51193. )
  51194. } else {
  51195. return (fn._length || fn.length) > 1
  51196. }
  51197. }
  51198. function _enter (_, vnode) {
  51199. if (vnode.data.show !== true) {
  51200. enter(vnode);
  51201. }
  51202. }
  51203. var transition = inBrowser ? {
  51204. create: _enter,
  51205. activate: _enter,
  51206. remove: function remove$$1 (vnode, rm) {
  51207. /* istanbul ignore else */
  51208. if (vnode.data.show !== true) {
  51209. leave(vnode, rm);
  51210. } else {
  51211. rm();
  51212. }
  51213. }
  51214. } : {};
  51215. var platformModules = [
  51216. attrs,
  51217. klass,
  51218. events,
  51219. domProps,
  51220. style,
  51221. transition
  51222. ];
  51223. /* */
  51224. // the directive module should be applied last, after all
  51225. // built-in modules have been applied.
  51226. var modules = platformModules.concat(baseModules);
  51227. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51228. /**
  51229. * Not type checking this file because flow doesn't like attaching
  51230. * properties to Elements.
  51231. */
  51232. /* istanbul ignore if */
  51233. if (isIE9) {
  51234. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51235. document.addEventListener('selectionchange', function () {
  51236. var el = document.activeElement;
  51237. if (el && el.vmodel) {
  51238. trigger(el, 'input');
  51239. }
  51240. });
  51241. }
  51242. var directive = {
  51243. inserted: function inserted (el, binding, vnode, oldVnode) {
  51244. if (vnode.tag === 'select') {
  51245. // #6903
  51246. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51247. mergeVNodeHook(vnode, 'postpatch', function () {
  51248. directive.componentUpdated(el, binding, vnode);
  51249. });
  51250. } else {
  51251. setSelected(el, binding, vnode.context);
  51252. }
  51253. el._vOptions = [].map.call(el.options, getValue);
  51254. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51255. el._vModifiers = binding.modifiers;
  51256. if (!binding.modifiers.lazy) {
  51257. el.addEventListener('compositionstart', onCompositionStart);
  51258. el.addEventListener('compositionend', onCompositionEnd);
  51259. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51260. // switching focus before confirming composition choice
  51261. // this also fixes the issue where some browsers e.g. iOS Chrome
  51262. // fires "change" instead of "input" on autocomplete.
  51263. el.addEventListener('change', onCompositionEnd);
  51264. /* istanbul ignore if */
  51265. if (isIE9) {
  51266. el.vmodel = true;
  51267. }
  51268. }
  51269. }
  51270. },
  51271. componentUpdated: function componentUpdated (el, binding, vnode) {
  51272. if (vnode.tag === 'select') {
  51273. setSelected(el, binding, vnode.context);
  51274. // in case the options rendered by v-for have changed,
  51275. // it's possible that the value is out-of-sync with the rendered options.
  51276. // detect such cases and filter out values that no longer has a matching
  51277. // option in the DOM.
  51278. var prevOptions = el._vOptions;
  51279. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51280. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51281. // trigger change event if
  51282. // no matching option found for at least one value
  51283. var needReset = el.multiple
  51284. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51285. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51286. if (needReset) {
  51287. trigger(el, 'change');
  51288. }
  51289. }
  51290. }
  51291. }
  51292. };
  51293. function setSelected (el, binding, vm) {
  51294. actuallySetSelected(el, binding, vm);
  51295. /* istanbul ignore if */
  51296. if (isIE || isEdge) {
  51297. setTimeout(function () {
  51298. actuallySetSelected(el, binding, vm);
  51299. }, 0);
  51300. }
  51301. }
  51302. function actuallySetSelected (el, binding, vm) {
  51303. var value = binding.value;
  51304. var isMultiple = el.multiple;
  51305. if (isMultiple && !Array.isArray(value)) {
  51306. warn(
  51307. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51308. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51309. vm
  51310. );
  51311. return
  51312. }
  51313. var selected, option;
  51314. for (var i = 0, l = el.options.length; i < l; i++) {
  51315. option = el.options[i];
  51316. if (isMultiple) {
  51317. selected = looseIndexOf(value, getValue(option)) > -1;
  51318. if (option.selected !== selected) {
  51319. option.selected = selected;
  51320. }
  51321. } else {
  51322. if (looseEqual(getValue(option), value)) {
  51323. if (el.selectedIndex !== i) {
  51324. el.selectedIndex = i;
  51325. }
  51326. return
  51327. }
  51328. }
  51329. }
  51330. if (!isMultiple) {
  51331. el.selectedIndex = -1;
  51332. }
  51333. }
  51334. function hasNoMatchingOption (value, options) {
  51335. return options.every(function (o) { return !looseEqual(o, value); })
  51336. }
  51337. function getValue (option) {
  51338. return '_value' in option
  51339. ? option._value
  51340. : option.value
  51341. }
  51342. function onCompositionStart (e) {
  51343. e.target.composing = true;
  51344. }
  51345. function onCompositionEnd (e) {
  51346. // prevent triggering an input event for no reason
  51347. if (!e.target.composing) { return }
  51348. e.target.composing = false;
  51349. trigger(e.target, 'input');
  51350. }
  51351. function trigger (el, type) {
  51352. var e = document.createEvent('HTMLEvents');
  51353. e.initEvent(type, true, true);
  51354. el.dispatchEvent(e);
  51355. }
  51356. /* */
  51357. // recursively search for possible transition defined inside the component root
  51358. function locateNode (vnode) {
  51359. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51360. ? locateNode(vnode.componentInstance._vnode)
  51361. : vnode
  51362. }
  51363. var show = {
  51364. bind: function bind (el, ref, vnode) {
  51365. var value = ref.value;
  51366. vnode = locateNode(vnode);
  51367. var transition$$1 = vnode.data && vnode.data.transition;
  51368. var originalDisplay = el.__vOriginalDisplay =
  51369. el.style.display === 'none' ? '' : el.style.display;
  51370. if (value && transition$$1) {
  51371. vnode.data.show = true;
  51372. enter(vnode, function () {
  51373. el.style.display = originalDisplay;
  51374. });
  51375. } else {
  51376. el.style.display = value ? originalDisplay : 'none';
  51377. }
  51378. },
  51379. update: function update (el, ref, vnode) {
  51380. var value = ref.value;
  51381. var oldValue = ref.oldValue;
  51382. /* istanbul ignore if */
  51383. if (!value === !oldValue) { return }
  51384. vnode = locateNode(vnode);
  51385. var transition$$1 = vnode.data && vnode.data.transition;
  51386. if (transition$$1) {
  51387. vnode.data.show = true;
  51388. if (value) {
  51389. enter(vnode, function () {
  51390. el.style.display = el.__vOriginalDisplay;
  51391. });
  51392. } else {
  51393. leave(vnode, function () {
  51394. el.style.display = 'none';
  51395. });
  51396. }
  51397. } else {
  51398. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51399. }
  51400. },
  51401. unbind: function unbind (
  51402. el,
  51403. binding,
  51404. vnode,
  51405. oldVnode,
  51406. isDestroy
  51407. ) {
  51408. if (!isDestroy) {
  51409. el.style.display = el.__vOriginalDisplay;
  51410. }
  51411. }
  51412. };
  51413. var platformDirectives = {
  51414. model: directive,
  51415. show: show
  51416. };
  51417. /* */
  51418. var transitionProps = {
  51419. name: String,
  51420. appear: Boolean,
  51421. css: Boolean,
  51422. mode: String,
  51423. type: String,
  51424. enterClass: String,
  51425. leaveClass: String,
  51426. enterToClass: String,
  51427. leaveToClass: String,
  51428. enterActiveClass: String,
  51429. leaveActiveClass: String,
  51430. appearClass: String,
  51431. appearActiveClass: String,
  51432. appearToClass: String,
  51433. duration: [Number, String, Object]
  51434. };
  51435. // in case the child is also an abstract component, e.g. <keep-alive>
  51436. // we want to recursively retrieve the real component to be rendered
  51437. function getRealChild (vnode) {
  51438. var compOptions = vnode && vnode.componentOptions;
  51439. if (compOptions && compOptions.Ctor.options.abstract) {
  51440. return getRealChild(getFirstComponentChild(compOptions.children))
  51441. } else {
  51442. return vnode
  51443. }
  51444. }
  51445. function extractTransitionData (comp) {
  51446. var data = {};
  51447. var options = comp.$options;
  51448. // props
  51449. for (var key in options.propsData) {
  51450. data[key] = comp[key];
  51451. }
  51452. // events.
  51453. // extract listeners and pass them directly to the transition methods
  51454. var listeners = options._parentListeners;
  51455. for (var key$1 in listeners) {
  51456. data[camelize(key$1)] = listeners[key$1];
  51457. }
  51458. return data
  51459. }
  51460. function placeholder (h, rawChild) {
  51461. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51462. return h('keep-alive', {
  51463. props: rawChild.componentOptions.propsData
  51464. })
  51465. }
  51466. }
  51467. function hasParentTransition (vnode) {
  51468. while ((vnode = vnode.parent)) {
  51469. if (vnode.data.transition) {
  51470. return true
  51471. }
  51472. }
  51473. }
  51474. function isSameChild (child, oldChild) {
  51475. return oldChild.key === child.key && oldChild.tag === child.tag
  51476. }
  51477. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51478. var isVShowDirective = function (d) { return d.name === 'show'; };
  51479. var Transition = {
  51480. name: 'transition',
  51481. props: transitionProps,
  51482. abstract: true,
  51483. render: function render (h) {
  51484. var this$1 = this;
  51485. var children = this.$slots.default;
  51486. if (!children) {
  51487. return
  51488. }
  51489. // filter out text nodes (possible whitespaces)
  51490. children = children.filter(isNotTextNode);
  51491. /* istanbul ignore if */
  51492. if (!children.length) {
  51493. return
  51494. }
  51495. // warn multiple elements
  51496. if (children.length > 1) {
  51497. warn(
  51498. '<transition> can only be used on a single element. Use ' +
  51499. '<transition-group> for lists.',
  51500. this.$parent
  51501. );
  51502. }
  51503. var mode = this.mode;
  51504. // warn invalid mode
  51505. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51506. ) {
  51507. warn(
  51508. 'invalid <transition> mode: ' + mode,
  51509. this.$parent
  51510. );
  51511. }
  51512. var rawChild = children[0];
  51513. // if this is a component root node and the component's
  51514. // parent container node also has transition, skip.
  51515. if (hasParentTransition(this.$vnode)) {
  51516. return rawChild
  51517. }
  51518. // apply transition data to child
  51519. // use getRealChild() to ignore abstract components e.g. keep-alive
  51520. var child = getRealChild(rawChild);
  51521. /* istanbul ignore if */
  51522. if (!child) {
  51523. return rawChild
  51524. }
  51525. if (this._leaving) {
  51526. return placeholder(h, rawChild)
  51527. }
  51528. // ensure a key that is unique to the vnode type and to this transition
  51529. // component instance. This key will be used to remove pending leaving nodes
  51530. // during entering.
  51531. var id = "__transition-" + (this._uid) + "-";
  51532. child.key = child.key == null
  51533. ? child.isComment
  51534. ? id + 'comment'
  51535. : id + child.tag
  51536. : isPrimitive(child.key)
  51537. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51538. : child.key;
  51539. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51540. var oldRawChild = this._vnode;
  51541. var oldChild = getRealChild(oldRawChild);
  51542. // mark v-show
  51543. // so that the transition module can hand over the control to the directive
  51544. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51545. child.data.show = true;
  51546. }
  51547. if (
  51548. oldChild &&
  51549. oldChild.data &&
  51550. !isSameChild(child, oldChild) &&
  51551. !isAsyncPlaceholder(oldChild) &&
  51552. // #6687 component root is a comment node
  51553. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51554. ) {
  51555. // replace old child transition data with fresh one
  51556. // important for dynamic transitions!
  51557. var oldData = oldChild.data.transition = extend({}, data);
  51558. // handle transition mode
  51559. if (mode === 'out-in') {
  51560. // return placeholder node and queue update when leave finishes
  51561. this._leaving = true;
  51562. mergeVNodeHook(oldData, 'afterLeave', function () {
  51563. this$1._leaving = false;
  51564. this$1.$forceUpdate();
  51565. });
  51566. return placeholder(h, rawChild)
  51567. } else if (mode === 'in-out') {
  51568. if (isAsyncPlaceholder(child)) {
  51569. return oldRawChild
  51570. }
  51571. var delayedLeave;
  51572. var performLeave = function () { delayedLeave(); };
  51573. mergeVNodeHook(data, 'afterEnter', performLeave);
  51574. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51575. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51576. }
  51577. }
  51578. return rawChild
  51579. }
  51580. };
  51581. /* */
  51582. var props = extend({
  51583. tag: String,
  51584. moveClass: String
  51585. }, transitionProps);
  51586. delete props.mode;
  51587. var TransitionGroup = {
  51588. props: props,
  51589. beforeMount: function beforeMount () {
  51590. var this$1 = this;
  51591. var update = this._update;
  51592. this._update = function (vnode, hydrating) {
  51593. var restoreActiveInstance = setActiveInstance(this$1);
  51594. // force removing pass
  51595. this$1.__patch__(
  51596. this$1._vnode,
  51597. this$1.kept,
  51598. false, // hydrating
  51599. true // removeOnly (!important, avoids unnecessary moves)
  51600. );
  51601. this$1._vnode = this$1.kept;
  51602. restoreActiveInstance();
  51603. update.call(this$1, vnode, hydrating);
  51604. };
  51605. },
  51606. render: function render (h) {
  51607. var tag = this.tag || this.$vnode.data.tag || 'span';
  51608. var map = Object.create(null);
  51609. var prevChildren = this.prevChildren = this.children;
  51610. var rawChildren = this.$slots.default || [];
  51611. var children = this.children = [];
  51612. var transitionData = extractTransitionData(this);
  51613. for (var i = 0; i < rawChildren.length; i++) {
  51614. var c = rawChildren[i];
  51615. if (c.tag) {
  51616. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  51617. children.push(c);
  51618. map[c.key] = c
  51619. ;(c.data || (c.data = {})).transition = transitionData;
  51620. } else {
  51621. var opts = c.componentOptions;
  51622. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  51623. warn(("<transition-group> children must be keyed: <" + name + ">"));
  51624. }
  51625. }
  51626. }
  51627. if (prevChildren) {
  51628. var kept = [];
  51629. var removed = [];
  51630. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  51631. var c$1 = prevChildren[i$1];
  51632. c$1.data.transition = transitionData;
  51633. c$1.data.pos = c$1.elm.getBoundingClientRect();
  51634. if (map[c$1.key]) {
  51635. kept.push(c$1);
  51636. } else {
  51637. removed.push(c$1);
  51638. }
  51639. }
  51640. this.kept = h(tag, null, kept);
  51641. this.removed = removed;
  51642. }
  51643. return h(tag, null, children)
  51644. },
  51645. updated: function updated () {
  51646. var children = this.prevChildren;
  51647. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  51648. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  51649. return
  51650. }
  51651. // we divide the work into three loops to avoid mixing DOM reads and writes
  51652. // in each iteration - which helps prevent layout thrashing.
  51653. children.forEach(callPendingCbs);
  51654. children.forEach(recordPosition);
  51655. children.forEach(applyTranslation);
  51656. // force reflow to put everything in position
  51657. // assign to this to avoid being removed in tree-shaking
  51658. // $flow-disable-line
  51659. this._reflow = document.body.offsetHeight;
  51660. children.forEach(function (c) {
  51661. if (c.data.moved) {
  51662. var el = c.elm;
  51663. var s = el.style;
  51664. addTransitionClass(el, moveClass);
  51665. s.transform = s.WebkitTransform = s.transitionDuration = '';
  51666. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  51667. if (e && e.target !== el) {
  51668. return
  51669. }
  51670. if (!e || /transform$/.test(e.propertyName)) {
  51671. el.removeEventListener(transitionEndEvent, cb);
  51672. el._moveCb = null;
  51673. removeTransitionClass(el, moveClass);
  51674. }
  51675. });
  51676. }
  51677. });
  51678. },
  51679. methods: {
  51680. hasMove: function hasMove (el, moveClass) {
  51681. /* istanbul ignore if */
  51682. if (!hasTransition) {
  51683. return false
  51684. }
  51685. /* istanbul ignore if */
  51686. if (this._hasMove) {
  51687. return this._hasMove
  51688. }
  51689. // Detect whether an element with the move class applied has
  51690. // CSS transitions. Since the element may be inside an entering
  51691. // transition at this very moment, we make a clone of it and remove
  51692. // all other transition classes applied to ensure only the move class
  51693. // is applied.
  51694. var clone = el.cloneNode();
  51695. if (el._transitionClasses) {
  51696. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  51697. }
  51698. addClass(clone, moveClass);
  51699. clone.style.display = 'none';
  51700. this.$el.appendChild(clone);
  51701. var info = getTransitionInfo(clone);
  51702. this.$el.removeChild(clone);
  51703. return (this._hasMove = info.hasTransform)
  51704. }
  51705. }
  51706. };
  51707. function callPendingCbs (c) {
  51708. /* istanbul ignore if */
  51709. if (c.elm._moveCb) {
  51710. c.elm._moveCb();
  51711. }
  51712. /* istanbul ignore if */
  51713. if (c.elm._enterCb) {
  51714. c.elm._enterCb();
  51715. }
  51716. }
  51717. function recordPosition (c) {
  51718. c.data.newPos = c.elm.getBoundingClientRect();
  51719. }
  51720. function applyTranslation (c) {
  51721. var oldPos = c.data.pos;
  51722. var newPos = c.data.newPos;
  51723. var dx = oldPos.left - newPos.left;
  51724. var dy = oldPos.top - newPos.top;
  51725. if (dx || dy) {
  51726. c.data.moved = true;
  51727. var s = c.elm.style;
  51728. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  51729. s.transitionDuration = '0s';
  51730. }
  51731. }
  51732. var platformComponents = {
  51733. Transition: Transition,
  51734. TransitionGroup: TransitionGroup
  51735. };
  51736. /* */
  51737. // install platform specific utils
  51738. Vue.config.mustUseProp = mustUseProp;
  51739. Vue.config.isReservedTag = isReservedTag;
  51740. Vue.config.isReservedAttr = isReservedAttr;
  51741. Vue.config.getTagNamespace = getTagNamespace;
  51742. Vue.config.isUnknownElement = isUnknownElement;
  51743. // install platform runtime directives & components
  51744. extend(Vue.options.directives, platformDirectives);
  51745. extend(Vue.options.components, platformComponents);
  51746. // install platform patch function
  51747. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  51748. // public mount method
  51749. Vue.prototype.$mount = function (
  51750. el,
  51751. hydrating
  51752. ) {
  51753. el = el && inBrowser ? query(el) : undefined;
  51754. return mountComponent(this, el, hydrating)
  51755. };
  51756. // devtools global hook
  51757. /* istanbul ignore next */
  51758. if (inBrowser) {
  51759. setTimeout(function () {
  51760. if (config.devtools) {
  51761. if (devtools) {
  51762. devtools.emit('init', Vue);
  51763. } else {
  51764. console[console.info ? 'info' : 'log'](
  51765. 'Download the Vue Devtools extension for a better development experience:\n' +
  51766. 'https://github.com/vuejs/vue-devtools'
  51767. );
  51768. }
  51769. }
  51770. if (config.productionTip !== false &&
  51771. typeof console !== 'undefined'
  51772. ) {
  51773. console[console.info ? 'info' : 'log'](
  51774. "You are running Vue in development mode.\n" +
  51775. "Make sure to turn on production mode when deploying for production.\n" +
  51776. "See more tips at https://vuejs.org/guide/deployment.html"
  51777. );
  51778. }
  51779. }, 0);
  51780. }
  51781. /* */
  51782. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51783. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51784. var buildRegex = cached(function (delimiters) {
  51785. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51786. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51787. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51788. });
  51789. function parseText (
  51790. text,
  51791. delimiters
  51792. ) {
  51793. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51794. if (!tagRE.test(text)) {
  51795. return
  51796. }
  51797. var tokens = [];
  51798. var rawTokens = [];
  51799. var lastIndex = tagRE.lastIndex = 0;
  51800. var match, index, tokenValue;
  51801. while ((match = tagRE.exec(text))) {
  51802. index = match.index;
  51803. // push text token
  51804. if (index > lastIndex) {
  51805. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51806. tokens.push(JSON.stringify(tokenValue));
  51807. }
  51808. // tag token
  51809. var exp = parseFilters(match[1].trim());
  51810. tokens.push(("_s(" + exp + ")"));
  51811. rawTokens.push({ '@binding': exp });
  51812. lastIndex = index + match[0].length;
  51813. }
  51814. if (lastIndex < text.length) {
  51815. rawTokens.push(tokenValue = text.slice(lastIndex));
  51816. tokens.push(JSON.stringify(tokenValue));
  51817. }
  51818. return {
  51819. expression: tokens.join('+'),
  51820. tokens: rawTokens
  51821. }
  51822. }
  51823. /* */
  51824. function transformNode (el, options) {
  51825. var warn = options.warn || baseWarn;
  51826. var staticClass = getAndRemoveAttr(el, 'class');
  51827. if (staticClass) {
  51828. var res = parseText(staticClass, options.delimiters);
  51829. if (res) {
  51830. warn(
  51831. "class=\"" + staticClass + "\": " +
  51832. 'Interpolation inside attributes has been removed. ' +
  51833. 'Use v-bind or the colon shorthand instead. For example, ' +
  51834. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  51835. el.rawAttrsMap['class']
  51836. );
  51837. }
  51838. }
  51839. if (staticClass) {
  51840. el.staticClass = JSON.stringify(staticClass);
  51841. }
  51842. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  51843. if (classBinding) {
  51844. el.classBinding = classBinding;
  51845. }
  51846. }
  51847. function genData (el) {
  51848. var data = '';
  51849. if (el.staticClass) {
  51850. data += "staticClass:" + (el.staticClass) + ",";
  51851. }
  51852. if (el.classBinding) {
  51853. data += "class:" + (el.classBinding) + ",";
  51854. }
  51855. return data
  51856. }
  51857. var klass$1 = {
  51858. staticKeys: ['staticClass'],
  51859. transformNode: transformNode,
  51860. genData: genData
  51861. };
  51862. /* */
  51863. function transformNode$1 (el, options) {
  51864. var warn = options.warn || baseWarn;
  51865. var staticStyle = getAndRemoveAttr(el, 'style');
  51866. if (staticStyle) {
  51867. /* istanbul ignore if */
  51868. {
  51869. var res = parseText(staticStyle, options.delimiters);
  51870. if (res) {
  51871. warn(
  51872. "style=\"" + staticStyle + "\": " +
  51873. 'Interpolation inside attributes has been removed. ' +
  51874. 'Use v-bind or the colon shorthand instead. For example, ' +
  51875. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  51876. el.rawAttrsMap['style']
  51877. );
  51878. }
  51879. }
  51880. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  51881. }
  51882. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  51883. if (styleBinding) {
  51884. el.styleBinding = styleBinding;
  51885. }
  51886. }
  51887. function genData$1 (el) {
  51888. var data = '';
  51889. if (el.staticStyle) {
  51890. data += "staticStyle:" + (el.staticStyle) + ",";
  51891. }
  51892. if (el.styleBinding) {
  51893. data += "style:(" + (el.styleBinding) + "),";
  51894. }
  51895. return data
  51896. }
  51897. var style$1 = {
  51898. staticKeys: ['staticStyle'],
  51899. transformNode: transformNode$1,
  51900. genData: genData$1
  51901. };
  51902. /* */
  51903. var decoder;
  51904. var he = {
  51905. decode: function decode (html) {
  51906. decoder = decoder || document.createElement('div');
  51907. decoder.innerHTML = html;
  51908. return decoder.textContent
  51909. }
  51910. };
  51911. /* */
  51912. var isUnaryTag = makeMap(
  51913. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  51914. 'link,meta,param,source,track,wbr'
  51915. );
  51916. // Elements that you can, intentionally, leave open
  51917. // (and which close themselves)
  51918. var canBeLeftOpenTag = makeMap(
  51919. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  51920. );
  51921. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  51922. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  51923. var isNonPhrasingTag = makeMap(
  51924. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  51925. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  51926. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  51927. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  51928. 'title,tr,track'
  51929. );
  51930. /**
  51931. * Not type-checking this file because it's mostly vendor code.
  51932. */
  51933. // Regular Expressions for parsing tags and attributes
  51934. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51935. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51936. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  51937. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  51938. var startTagOpen = new RegExp(("^<" + qnameCapture));
  51939. var startTagClose = /^\s*(\/?)>/;
  51940. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  51941. var doctype = /^<!DOCTYPE [^>]+>/i;
  51942. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  51943. var comment = /^<!\--/;
  51944. var conditionalComment = /^<!\[/;
  51945. // Special Elements (can contain anything)
  51946. var isPlainTextElement = makeMap('script,style,textarea', true);
  51947. var reCache = {};
  51948. var decodingMap = {
  51949. '&lt;': '<',
  51950. '&gt;': '>',
  51951. '&quot;': '"',
  51952. '&amp;': '&',
  51953. '&#10;': '\n',
  51954. '&#9;': '\t',
  51955. '&#39;': "'"
  51956. };
  51957. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  51958. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  51959. // #5992
  51960. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  51961. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  51962. function decodeAttr (value, shouldDecodeNewlines) {
  51963. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  51964. return value.replace(re, function (match) { return decodingMap[match]; })
  51965. }
  51966. function parseHTML (html, options) {
  51967. var stack = [];
  51968. var expectHTML = options.expectHTML;
  51969. var isUnaryTag$$1 = options.isUnaryTag || no;
  51970. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  51971. var index = 0;
  51972. var last, lastTag;
  51973. while (html) {
  51974. last = html;
  51975. // Make sure we're not in a plaintext content element like script/style
  51976. if (!lastTag || !isPlainTextElement(lastTag)) {
  51977. var textEnd = html.indexOf('<');
  51978. if (textEnd === 0) {
  51979. // Comment:
  51980. if (comment.test(html)) {
  51981. var commentEnd = html.indexOf('-->');
  51982. if (commentEnd >= 0) {
  51983. if (options.shouldKeepComment) {
  51984. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  51985. }
  51986. advance(commentEnd + 3);
  51987. continue
  51988. }
  51989. }
  51990. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  51991. if (conditionalComment.test(html)) {
  51992. var conditionalEnd = html.indexOf(']>');
  51993. if (conditionalEnd >= 0) {
  51994. advance(conditionalEnd + 2);
  51995. continue
  51996. }
  51997. }
  51998. // Doctype:
  51999. var doctypeMatch = html.match(doctype);
  52000. if (doctypeMatch) {
  52001. advance(doctypeMatch[0].length);
  52002. continue
  52003. }
  52004. // End tag:
  52005. var endTagMatch = html.match(endTag);
  52006. if (endTagMatch) {
  52007. var curIndex = index;
  52008. advance(endTagMatch[0].length);
  52009. parseEndTag(endTagMatch[1], curIndex, index);
  52010. continue
  52011. }
  52012. // Start tag:
  52013. var startTagMatch = parseStartTag();
  52014. if (startTagMatch) {
  52015. handleStartTag(startTagMatch);
  52016. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52017. advance(1);
  52018. }
  52019. continue
  52020. }
  52021. }
  52022. var text = (void 0), rest = (void 0), next = (void 0);
  52023. if (textEnd >= 0) {
  52024. rest = html.slice(textEnd);
  52025. while (
  52026. !endTag.test(rest) &&
  52027. !startTagOpen.test(rest) &&
  52028. !comment.test(rest) &&
  52029. !conditionalComment.test(rest)
  52030. ) {
  52031. // < in plain text, be forgiving and treat it as text
  52032. next = rest.indexOf('<', 1);
  52033. if (next < 0) { break }
  52034. textEnd += next;
  52035. rest = html.slice(textEnd);
  52036. }
  52037. text = html.substring(0, textEnd);
  52038. }
  52039. if (textEnd < 0) {
  52040. text = html;
  52041. }
  52042. if (text) {
  52043. advance(text.length);
  52044. }
  52045. if (options.chars && text) {
  52046. options.chars(text, index - text.length, index);
  52047. }
  52048. } else {
  52049. var endTagLength = 0;
  52050. var stackedTag = lastTag.toLowerCase();
  52051. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52052. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52053. endTagLength = endTag.length;
  52054. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52055. text = text
  52056. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52057. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52058. }
  52059. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52060. text = text.slice(1);
  52061. }
  52062. if (options.chars) {
  52063. options.chars(text);
  52064. }
  52065. return ''
  52066. });
  52067. index += html.length - rest$1.length;
  52068. html = rest$1;
  52069. parseEndTag(stackedTag, index - endTagLength, index);
  52070. }
  52071. if (html === last) {
  52072. options.chars && options.chars(html);
  52073. if (!stack.length && options.warn) {
  52074. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52075. }
  52076. break
  52077. }
  52078. }
  52079. // Clean up any remaining tags
  52080. parseEndTag();
  52081. function advance (n) {
  52082. index += n;
  52083. html = html.substring(n);
  52084. }
  52085. function parseStartTag () {
  52086. var start = html.match(startTagOpen);
  52087. if (start) {
  52088. var match = {
  52089. tagName: start[1],
  52090. attrs: [],
  52091. start: index
  52092. };
  52093. advance(start[0].length);
  52094. var end, attr;
  52095. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52096. attr.start = index;
  52097. advance(attr[0].length);
  52098. attr.end = index;
  52099. match.attrs.push(attr);
  52100. }
  52101. if (end) {
  52102. match.unarySlash = end[1];
  52103. advance(end[0].length);
  52104. match.end = index;
  52105. return match
  52106. }
  52107. }
  52108. }
  52109. function handleStartTag (match) {
  52110. var tagName = match.tagName;
  52111. var unarySlash = match.unarySlash;
  52112. if (expectHTML) {
  52113. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52114. parseEndTag(lastTag);
  52115. }
  52116. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52117. parseEndTag(tagName);
  52118. }
  52119. }
  52120. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52121. var l = match.attrs.length;
  52122. var attrs = new Array(l);
  52123. for (var i = 0; i < l; i++) {
  52124. var args = match.attrs[i];
  52125. var value = args[3] || args[4] || args[5] || '';
  52126. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52127. ? options.shouldDecodeNewlinesForHref
  52128. : options.shouldDecodeNewlines;
  52129. attrs[i] = {
  52130. name: args[1],
  52131. value: decodeAttr(value, shouldDecodeNewlines)
  52132. };
  52133. if (options.outputSourceRange) {
  52134. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52135. attrs[i].end = args.end;
  52136. }
  52137. }
  52138. if (!unary) {
  52139. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52140. lastTag = tagName;
  52141. }
  52142. if (options.start) {
  52143. options.start(tagName, attrs, unary, match.start, match.end);
  52144. }
  52145. }
  52146. function parseEndTag (tagName, start, end) {
  52147. var pos, lowerCasedTagName;
  52148. if (start == null) { start = index; }
  52149. if (end == null) { end = index; }
  52150. // Find the closest opened tag of the same type
  52151. if (tagName) {
  52152. lowerCasedTagName = tagName.toLowerCase();
  52153. for (pos = stack.length - 1; pos >= 0; pos--) {
  52154. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52155. break
  52156. }
  52157. }
  52158. } else {
  52159. // If no tag name is provided, clean shop
  52160. pos = 0;
  52161. }
  52162. if (pos >= 0) {
  52163. // Close all the open elements, up the stack
  52164. for (var i = stack.length - 1; i >= pos; i--) {
  52165. if (i > pos || !tagName &&
  52166. options.warn
  52167. ) {
  52168. options.warn(
  52169. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52170. { start: stack[i].start, end: stack[i].end }
  52171. );
  52172. }
  52173. if (options.end) {
  52174. options.end(stack[i].tag, start, end);
  52175. }
  52176. }
  52177. // Remove the open elements from the stack
  52178. stack.length = pos;
  52179. lastTag = pos && stack[pos - 1].tag;
  52180. } else if (lowerCasedTagName === 'br') {
  52181. if (options.start) {
  52182. options.start(tagName, [], true, start, end);
  52183. }
  52184. } else if (lowerCasedTagName === 'p') {
  52185. if (options.start) {
  52186. options.start(tagName, [], false, start, end);
  52187. }
  52188. if (options.end) {
  52189. options.end(tagName, start, end);
  52190. }
  52191. }
  52192. }
  52193. }
  52194. /* */
  52195. var onRE = /^@|^v-on:/;
  52196. var dirRE = /^v-|^@|^:|^#/;
  52197. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52198. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52199. var stripParensRE = /^\(|\)$/g;
  52200. var dynamicArgRE = /^\[.*\]$/;
  52201. var argRE = /:(.*)$/;
  52202. var bindRE = /^:|^\.|^v-bind:/;
  52203. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52204. var slotRE = /^v-slot(:|$)|^#/;
  52205. var lineBreakRE = /[\r\n]/;
  52206. var whitespaceRE$1 = /\s+/g;
  52207. var invalidAttributeRE = /[\s"'<>\/=]/;
  52208. var decodeHTMLCached = cached(he.decode);
  52209. var emptySlotScopeToken = "_empty_";
  52210. // configurable state
  52211. var warn$2;
  52212. var delimiters;
  52213. var transforms;
  52214. var preTransforms;
  52215. var postTransforms;
  52216. var platformIsPreTag;
  52217. var platformMustUseProp;
  52218. var platformGetTagNamespace;
  52219. var maybeComponent;
  52220. function createASTElement (
  52221. tag,
  52222. attrs,
  52223. parent
  52224. ) {
  52225. return {
  52226. type: 1,
  52227. tag: tag,
  52228. attrsList: attrs,
  52229. attrsMap: makeAttrsMap(attrs),
  52230. rawAttrsMap: {},
  52231. parent: parent,
  52232. children: []
  52233. }
  52234. }
  52235. /**
  52236. * Convert HTML string to AST.
  52237. */
  52238. function parse (
  52239. template,
  52240. options
  52241. ) {
  52242. warn$2 = options.warn || baseWarn;
  52243. platformIsPreTag = options.isPreTag || no;
  52244. platformMustUseProp = options.mustUseProp || no;
  52245. platformGetTagNamespace = options.getTagNamespace || no;
  52246. var isReservedTag = options.isReservedTag || no;
  52247. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52248. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52249. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52250. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52251. delimiters = options.delimiters;
  52252. var stack = [];
  52253. var preserveWhitespace = options.preserveWhitespace !== false;
  52254. var whitespaceOption = options.whitespace;
  52255. var root;
  52256. var currentParent;
  52257. var inVPre = false;
  52258. var inPre = false;
  52259. var warned = false;
  52260. function warnOnce (msg, range) {
  52261. if (!warned) {
  52262. warned = true;
  52263. warn$2(msg, range);
  52264. }
  52265. }
  52266. function closeElement (element) {
  52267. trimEndingWhitespace(element);
  52268. if (!inVPre && !element.processed) {
  52269. element = processElement(element, options);
  52270. }
  52271. // tree management
  52272. if (!stack.length && element !== root) {
  52273. // allow root elements with v-if, v-else-if and v-else
  52274. if (root.if && (element.elseif || element.else)) {
  52275. {
  52276. checkRootConstraints(element);
  52277. }
  52278. addIfCondition(root, {
  52279. exp: element.elseif,
  52280. block: element
  52281. });
  52282. } else {
  52283. warnOnce(
  52284. "Component template should contain exactly one root element. " +
  52285. "If you are using v-if on multiple elements, " +
  52286. "use v-else-if to chain them instead.",
  52287. { start: element.start }
  52288. );
  52289. }
  52290. }
  52291. if (currentParent && !element.forbidden) {
  52292. if (element.elseif || element.else) {
  52293. processIfConditions(element, currentParent);
  52294. } else {
  52295. if (element.slotScope) {
  52296. // scoped slot
  52297. // keep it in the children list so that v-else(-if) conditions can
  52298. // find it as the prev node.
  52299. var name = element.slotTarget || '"default"'
  52300. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52301. }
  52302. currentParent.children.push(element);
  52303. element.parent = currentParent;
  52304. }
  52305. }
  52306. // final children cleanup
  52307. // filter out scoped slots
  52308. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52309. // remove trailing whitespace node again
  52310. trimEndingWhitespace(element);
  52311. // check pre state
  52312. if (element.pre) {
  52313. inVPre = false;
  52314. }
  52315. if (platformIsPreTag(element.tag)) {
  52316. inPre = false;
  52317. }
  52318. // apply post-transforms
  52319. for (var i = 0; i < postTransforms.length; i++) {
  52320. postTransforms[i](element, options);
  52321. }
  52322. }
  52323. function trimEndingWhitespace (el) {
  52324. // remove trailing whitespace node
  52325. if (!inPre) {
  52326. var lastNode;
  52327. while (
  52328. (lastNode = el.children[el.children.length - 1]) &&
  52329. lastNode.type === 3 &&
  52330. lastNode.text === ' '
  52331. ) {
  52332. el.children.pop();
  52333. }
  52334. }
  52335. }
  52336. function checkRootConstraints (el) {
  52337. if (el.tag === 'slot' || el.tag === 'template') {
  52338. warnOnce(
  52339. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52340. 'contain multiple nodes.',
  52341. { start: el.start }
  52342. );
  52343. }
  52344. if (el.attrsMap.hasOwnProperty('v-for')) {
  52345. warnOnce(
  52346. 'Cannot use v-for on stateful component root element because ' +
  52347. 'it renders multiple elements.',
  52348. el.rawAttrsMap['v-for']
  52349. );
  52350. }
  52351. }
  52352. parseHTML(template, {
  52353. warn: warn$2,
  52354. expectHTML: options.expectHTML,
  52355. isUnaryTag: options.isUnaryTag,
  52356. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52357. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52358. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52359. shouldKeepComment: options.comments,
  52360. outputSourceRange: options.outputSourceRange,
  52361. start: function start (tag, attrs, unary, start$1, end) {
  52362. // check namespace.
  52363. // inherit parent ns if there is one
  52364. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52365. // handle IE svg bug
  52366. /* istanbul ignore if */
  52367. if (isIE && ns === 'svg') {
  52368. attrs = guardIESVGBug(attrs);
  52369. }
  52370. var element = createASTElement(tag, attrs, currentParent);
  52371. if (ns) {
  52372. element.ns = ns;
  52373. }
  52374. {
  52375. if (options.outputSourceRange) {
  52376. element.start = start$1;
  52377. element.end = end;
  52378. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52379. cumulated[attr.name] = attr;
  52380. return cumulated
  52381. }, {});
  52382. }
  52383. attrs.forEach(function (attr) {
  52384. if (invalidAttributeRE.test(attr.name)) {
  52385. warn$2(
  52386. "Invalid dynamic argument expression: attribute names cannot contain " +
  52387. "spaces, quotes, <, >, / or =.",
  52388. {
  52389. start: attr.start + attr.name.indexOf("["),
  52390. end: attr.start + attr.name.length
  52391. }
  52392. );
  52393. }
  52394. });
  52395. }
  52396. if (isForbiddenTag(element) && !isServerRendering()) {
  52397. element.forbidden = true;
  52398. warn$2(
  52399. 'Templates should only be responsible for mapping the state to the ' +
  52400. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52401. "<" + tag + ">" + ', as they will not be parsed.',
  52402. { start: element.start }
  52403. );
  52404. }
  52405. // apply pre-transforms
  52406. for (var i = 0; i < preTransforms.length; i++) {
  52407. element = preTransforms[i](element, options) || element;
  52408. }
  52409. if (!inVPre) {
  52410. processPre(element);
  52411. if (element.pre) {
  52412. inVPre = true;
  52413. }
  52414. }
  52415. if (platformIsPreTag(element.tag)) {
  52416. inPre = true;
  52417. }
  52418. if (inVPre) {
  52419. processRawAttrs(element);
  52420. } else if (!element.processed) {
  52421. // structural directives
  52422. processFor(element);
  52423. processIf(element);
  52424. processOnce(element);
  52425. }
  52426. if (!root) {
  52427. root = element;
  52428. {
  52429. checkRootConstraints(root);
  52430. }
  52431. }
  52432. if (!unary) {
  52433. currentParent = element;
  52434. stack.push(element);
  52435. } else {
  52436. closeElement(element);
  52437. }
  52438. },
  52439. end: function end (tag, start, end$1) {
  52440. var element = stack[stack.length - 1];
  52441. // pop stack
  52442. stack.length -= 1;
  52443. currentParent = stack[stack.length - 1];
  52444. if (options.outputSourceRange) {
  52445. element.end = end$1;
  52446. }
  52447. closeElement(element);
  52448. },
  52449. chars: function chars (text, start, end) {
  52450. if (!currentParent) {
  52451. {
  52452. if (text === template) {
  52453. warnOnce(
  52454. 'Component template requires a root element, rather than just text.',
  52455. { start: start }
  52456. );
  52457. } else if ((text = text.trim())) {
  52458. warnOnce(
  52459. ("text \"" + text + "\" outside root element will be ignored."),
  52460. { start: start }
  52461. );
  52462. }
  52463. }
  52464. return
  52465. }
  52466. // IE textarea placeholder bug
  52467. /* istanbul ignore if */
  52468. if (isIE &&
  52469. currentParent.tag === 'textarea' &&
  52470. currentParent.attrsMap.placeholder === text
  52471. ) {
  52472. return
  52473. }
  52474. var children = currentParent.children;
  52475. if (inPre || text.trim()) {
  52476. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52477. } else if (!children.length) {
  52478. // remove the whitespace-only node right after an opening tag
  52479. text = '';
  52480. } else if (whitespaceOption) {
  52481. if (whitespaceOption === 'condense') {
  52482. // in condense mode, remove the whitespace node if it contains
  52483. // line break, otherwise condense to a single space
  52484. text = lineBreakRE.test(text) ? '' : ' ';
  52485. } else {
  52486. text = ' ';
  52487. }
  52488. } else {
  52489. text = preserveWhitespace ? ' ' : '';
  52490. }
  52491. if (text) {
  52492. if (!inPre && whitespaceOption === 'condense') {
  52493. // condense consecutive whitespaces into single space
  52494. text = text.replace(whitespaceRE$1, ' ');
  52495. }
  52496. var res;
  52497. var child;
  52498. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52499. child = {
  52500. type: 2,
  52501. expression: res.expression,
  52502. tokens: res.tokens,
  52503. text: text
  52504. };
  52505. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52506. child = {
  52507. type: 3,
  52508. text: text
  52509. };
  52510. }
  52511. if (child) {
  52512. if (options.outputSourceRange) {
  52513. child.start = start;
  52514. child.end = end;
  52515. }
  52516. children.push(child);
  52517. }
  52518. }
  52519. },
  52520. comment: function comment (text, start, end) {
  52521. // adding anyting as a sibling to the root node is forbidden
  52522. // comments should still be allowed, but ignored
  52523. if (currentParent) {
  52524. var child = {
  52525. type: 3,
  52526. text: text,
  52527. isComment: true
  52528. };
  52529. if (options.outputSourceRange) {
  52530. child.start = start;
  52531. child.end = end;
  52532. }
  52533. currentParent.children.push(child);
  52534. }
  52535. }
  52536. });
  52537. return root
  52538. }
  52539. function processPre (el) {
  52540. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52541. el.pre = true;
  52542. }
  52543. }
  52544. function processRawAttrs (el) {
  52545. var list = el.attrsList;
  52546. var len = list.length;
  52547. if (len) {
  52548. var attrs = el.attrs = new Array(len);
  52549. for (var i = 0; i < len; i++) {
  52550. attrs[i] = {
  52551. name: list[i].name,
  52552. value: JSON.stringify(list[i].value)
  52553. };
  52554. if (list[i].start != null) {
  52555. attrs[i].start = list[i].start;
  52556. attrs[i].end = list[i].end;
  52557. }
  52558. }
  52559. } else if (!el.pre) {
  52560. // non root node in pre blocks with no attributes
  52561. el.plain = true;
  52562. }
  52563. }
  52564. function processElement (
  52565. element,
  52566. options
  52567. ) {
  52568. processKey(element);
  52569. // determine whether this is a plain element after
  52570. // removing structural attributes
  52571. element.plain = (
  52572. !element.key &&
  52573. !element.scopedSlots &&
  52574. !element.attrsList.length
  52575. );
  52576. processRef(element);
  52577. processSlotContent(element);
  52578. processSlotOutlet(element);
  52579. processComponent(element);
  52580. for (var i = 0; i < transforms.length; i++) {
  52581. element = transforms[i](element, options) || element;
  52582. }
  52583. processAttrs(element);
  52584. return element
  52585. }
  52586. function processKey (el) {
  52587. var exp = getBindingAttr(el, 'key');
  52588. if (exp) {
  52589. {
  52590. if (el.tag === 'template') {
  52591. warn$2(
  52592. "<template> cannot be keyed. Place the key on real elements instead.",
  52593. getRawBindingAttr(el, 'key')
  52594. );
  52595. }
  52596. if (el.for) {
  52597. var iterator = el.iterator2 || el.iterator1;
  52598. var parent = el.parent;
  52599. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  52600. warn$2(
  52601. "Do not use v-for index as key on <transition-group> children, " +
  52602. "this is the same as not using keys.",
  52603. getRawBindingAttr(el, 'key'),
  52604. true /* tip */
  52605. );
  52606. }
  52607. }
  52608. }
  52609. el.key = exp;
  52610. }
  52611. }
  52612. function processRef (el) {
  52613. var ref = getBindingAttr(el, 'ref');
  52614. if (ref) {
  52615. el.ref = ref;
  52616. el.refInFor = checkInFor(el);
  52617. }
  52618. }
  52619. function processFor (el) {
  52620. var exp;
  52621. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  52622. var res = parseFor(exp);
  52623. if (res) {
  52624. extend(el, res);
  52625. } else {
  52626. warn$2(
  52627. ("Invalid v-for expression: " + exp),
  52628. el.rawAttrsMap['v-for']
  52629. );
  52630. }
  52631. }
  52632. }
  52633. function parseFor (exp) {
  52634. var inMatch = exp.match(forAliasRE);
  52635. if (!inMatch) { return }
  52636. var res = {};
  52637. res.for = inMatch[2].trim();
  52638. var alias = inMatch[1].trim().replace(stripParensRE, '');
  52639. var iteratorMatch = alias.match(forIteratorRE);
  52640. if (iteratorMatch) {
  52641. res.alias = alias.replace(forIteratorRE, '').trim();
  52642. res.iterator1 = iteratorMatch[1].trim();
  52643. if (iteratorMatch[2]) {
  52644. res.iterator2 = iteratorMatch[2].trim();
  52645. }
  52646. } else {
  52647. res.alias = alias;
  52648. }
  52649. return res
  52650. }
  52651. function processIf (el) {
  52652. var exp = getAndRemoveAttr(el, 'v-if');
  52653. if (exp) {
  52654. el.if = exp;
  52655. addIfCondition(el, {
  52656. exp: exp,
  52657. block: el
  52658. });
  52659. } else {
  52660. if (getAndRemoveAttr(el, 'v-else') != null) {
  52661. el.else = true;
  52662. }
  52663. var elseif = getAndRemoveAttr(el, 'v-else-if');
  52664. if (elseif) {
  52665. el.elseif = elseif;
  52666. }
  52667. }
  52668. }
  52669. function processIfConditions (el, parent) {
  52670. var prev = findPrevElement(parent.children);
  52671. if (prev && prev.if) {
  52672. addIfCondition(prev, {
  52673. exp: el.elseif,
  52674. block: el
  52675. });
  52676. } else {
  52677. warn$2(
  52678. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  52679. "used on element <" + (el.tag) + "> without corresponding v-if.",
  52680. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  52681. );
  52682. }
  52683. }
  52684. function findPrevElement (children) {
  52685. var i = children.length;
  52686. while (i--) {
  52687. if (children[i].type === 1) {
  52688. return children[i]
  52689. } else {
  52690. if (children[i].text !== ' ') {
  52691. warn$2(
  52692. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  52693. "will be ignored.",
  52694. children[i]
  52695. );
  52696. }
  52697. children.pop();
  52698. }
  52699. }
  52700. }
  52701. function addIfCondition (el, condition) {
  52702. if (!el.ifConditions) {
  52703. el.ifConditions = [];
  52704. }
  52705. el.ifConditions.push(condition);
  52706. }
  52707. function processOnce (el) {
  52708. var once$$1 = getAndRemoveAttr(el, 'v-once');
  52709. if (once$$1 != null) {
  52710. el.once = true;
  52711. }
  52712. }
  52713. // handle content being passed to a component as slot,
  52714. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  52715. function processSlotContent (el) {
  52716. var slotScope;
  52717. if (el.tag === 'template') {
  52718. slotScope = getAndRemoveAttr(el, 'scope');
  52719. /* istanbul ignore if */
  52720. if (slotScope) {
  52721. warn$2(
  52722. "the \"scope\" attribute for scoped slots have been deprecated and " +
  52723. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  52724. "can also be used on plain elements in addition to <template> to " +
  52725. "denote scoped slots.",
  52726. el.rawAttrsMap['scope'],
  52727. true
  52728. );
  52729. }
  52730. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  52731. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  52732. /* istanbul ignore if */
  52733. if (el.attrsMap['v-for']) {
  52734. warn$2(
  52735. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  52736. "(v-for takes higher priority). Use a wrapper <template> for the " +
  52737. "scoped slot to make it clearer.",
  52738. el.rawAttrsMap['slot-scope'],
  52739. true
  52740. );
  52741. }
  52742. el.slotScope = slotScope;
  52743. }
  52744. // slot="xxx"
  52745. var slotTarget = getBindingAttr(el, 'slot');
  52746. if (slotTarget) {
  52747. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  52748. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  52749. // preserve slot as an attribute for native shadow DOM compat
  52750. // only for non-scoped slots.
  52751. if (el.tag !== 'template' && !el.slotScope) {
  52752. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  52753. }
  52754. }
  52755. // 2.6 v-slot syntax
  52756. {
  52757. if (el.tag === 'template') {
  52758. // v-slot on <template>
  52759. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  52760. if (slotBinding) {
  52761. {
  52762. if (el.slotTarget || el.slotScope) {
  52763. warn$2(
  52764. "Unexpected mixed usage of different slot syntaxes.",
  52765. el
  52766. );
  52767. }
  52768. if (el.parent && !maybeComponent(el.parent)) {
  52769. warn$2(
  52770. "<template v-slot> can only appear at the root level inside " +
  52771. "the receiving component",
  52772. el
  52773. );
  52774. }
  52775. }
  52776. var ref = getSlotName(slotBinding);
  52777. var name = ref.name;
  52778. var dynamic = ref.dynamic;
  52779. el.slotTarget = name;
  52780. el.slotTargetDynamic = dynamic;
  52781. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52782. }
  52783. } else {
  52784. // v-slot on component, denotes default slot
  52785. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52786. if (slotBinding$1) {
  52787. {
  52788. if (!maybeComponent(el)) {
  52789. warn$2(
  52790. "v-slot can only be used on components or <template>.",
  52791. slotBinding$1
  52792. );
  52793. }
  52794. if (el.slotScope || el.slotTarget) {
  52795. warn$2(
  52796. "Unexpected mixed usage of different slot syntaxes.",
  52797. el
  52798. );
  52799. }
  52800. if (el.scopedSlots) {
  52801. warn$2(
  52802. "To avoid scope ambiguity, the default slot should also use " +
  52803. "<template> syntax when there are other named slots.",
  52804. slotBinding$1
  52805. );
  52806. }
  52807. }
  52808. // add the component's children to its default slot
  52809. var slots = el.scopedSlots || (el.scopedSlots = {});
  52810. var ref$1 = getSlotName(slotBinding$1);
  52811. var name$1 = ref$1.name;
  52812. var dynamic$1 = ref$1.dynamic;
  52813. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52814. slotContainer.slotTarget = name$1;
  52815. slotContainer.slotTargetDynamic = dynamic$1;
  52816. slotContainer.children = el.children.filter(function (c) {
  52817. if (!c.slotScope) {
  52818. c.parent = slotContainer;
  52819. return true
  52820. }
  52821. });
  52822. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52823. // remove children as they are returned from scopedSlots now
  52824. el.children = [];
  52825. // mark el non-plain so data gets generated
  52826. el.plain = false;
  52827. }
  52828. }
  52829. }
  52830. }
  52831. function getSlotName (binding) {
  52832. var name = binding.name.replace(slotRE, '');
  52833. if (!name) {
  52834. if (binding.name[0] !== '#') {
  52835. name = 'default';
  52836. } else {
  52837. warn$2(
  52838. "v-slot shorthand syntax requires a slot name.",
  52839. binding
  52840. );
  52841. }
  52842. }
  52843. return dynamicArgRE.test(name)
  52844. // dynamic [name]
  52845. ? { name: name.slice(1, -1), dynamic: true }
  52846. // static name
  52847. : { name: ("\"" + name + "\""), dynamic: false }
  52848. }
  52849. // handle <slot/> outlets
  52850. function processSlotOutlet (el) {
  52851. if (el.tag === 'slot') {
  52852. el.slotName = getBindingAttr(el, 'name');
  52853. if (el.key) {
  52854. warn$2(
  52855. "`key` does not work on <slot> because slots are abstract outlets " +
  52856. "and can possibly expand into multiple elements. " +
  52857. "Use the key on a wrapping element instead.",
  52858. getRawBindingAttr(el, 'key')
  52859. );
  52860. }
  52861. }
  52862. }
  52863. function processComponent (el) {
  52864. var binding;
  52865. if ((binding = getBindingAttr(el, 'is'))) {
  52866. el.component = binding;
  52867. }
  52868. if (getAndRemoveAttr(el, 'inline-template') != null) {
  52869. el.inlineTemplate = true;
  52870. }
  52871. }
  52872. function processAttrs (el) {
  52873. var list = el.attrsList;
  52874. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  52875. for (i = 0, l = list.length; i < l; i++) {
  52876. name = rawName = list[i].name;
  52877. value = list[i].value;
  52878. if (dirRE.test(name)) {
  52879. // mark element as dynamic
  52880. el.hasBindings = true;
  52881. // modifiers
  52882. modifiers = parseModifiers(name.replace(dirRE, ''));
  52883. // support .foo shorthand syntax for the .prop modifier
  52884. if (modifiers) {
  52885. name = name.replace(modifierRE, '');
  52886. }
  52887. if (bindRE.test(name)) { // v-bind
  52888. name = name.replace(bindRE, '');
  52889. value = parseFilters(value);
  52890. isDynamic = dynamicArgRE.test(name);
  52891. if (isDynamic) {
  52892. name = name.slice(1, -1);
  52893. }
  52894. if (
  52895. value.trim().length === 0
  52896. ) {
  52897. warn$2(
  52898. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  52899. );
  52900. }
  52901. if (modifiers) {
  52902. if (modifiers.prop && !isDynamic) {
  52903. name = camelize(name);
  52904. if (name === 'innerHtml') { name = 'innerHTML'; }
  52905. }
  52906. if (modifiers.camel && !isDynamic) {
  52907. name = camelize(name);
  52908. }
  52909. if (modifiers.sync) {
  52910. syncGen = genAssignmentCode(value, "$event");
  52911. if (!isDynamic) {
  52912. addHandler(
  52913. el,
  52914. ("update:" + (camelize(name))),
  52915. syncGen,
  52916. null,
  52917. false,
  52918. warn$2,
  52919. list[i]
  52920. );
  52921. if (hyphenate(name) !== camelize(name)) {
  52922. addHandler(
  52923. el,
  52924. ("update:" + (hyphenate(name))),
  52925. syncGen,
  52926. null,
  52927. false,
  52928. warn$2,
  52929. list[i]
  52930. );
  52931. }
  52932. } else {
  52933. // handler w/ dynamic event name
  52934. addHandler(
  52935. el,
  52936. ("\"update:\"+(" + name + ")"),
  52937. syncGen,
  52938. null,
  52939. false,
  52940. warn$2,
  52941. list[i],
  52942. true // dynamic
  52943. );
  52944. }
  52945. }
  52946. }
  52947. if ((modifiers && modifiers.prop) || (
  52948. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  52949. )) {
  52950. addProp(el, name, value, list[i], isDynamic);
  52951. } else {
  52952. addAttr(el, name, value, list[i], isDynamic);
  52953. }
  52954. } else if (onRE.test(name)) { // v-on
  52955. name = name.replace(onRE, '');
  52956. isDynamic = dynamicArgRE.test(name);
  52957. if (isDynamic) {
  52958. name = name.slice(1, -1);
  52959. }
  52960. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  52961. } else { // normal directives
  52962. name = name.replace(dirRE, '');
  52963. // parse arg
  52964. var argMatch = name.match(argRE);
  52965. var arg = argMatch && argMatch[1];
  52966. isDynamic = false;
  52967. if (arg) {
  52968. name = name.slice(0, -(arg.length + 1));
  52969. if (dynamicArgRE.test(arg)) {
  52970. arg = arg.slice(1, -1);
  52971. isDynamic = true;
  52972. }
  52973. }
  52974. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  52975. if (name === 'model') {
  52976. checkForAliasModel(el, value);
  52977. }
  52978. }
  52979. } else {
  52980. // literal attribute
  52981. {
  52982. var res = parseText(value, delimiters);
  52983. if (res) {
  52984. warn$2(
  52985. name + "=\"" + value + "\": " +
  52986. 'Interpolation inside attributes has been removed. ' +
  52987. 'Use v-bind or the colon shorthand instead. For example, ' +
  52988. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  52989. list[i]
  52990. );
  52991. }
  52992. }
  52993. addAttr(el, name, JSON.stringify(value), list[i]);
  52994. // #6887 firefox doesn't update muted state if set via attribute
  52995. // even immediately after element creation
  52996. if (!el.component &&
  52997. name === 'muted' &&
  52998. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  52999. addProp(el, name, 'true', list[i]);
  53000. }
  53001. }
  53002. }
  53003. }
  53004. function checkInFor (el) {
  53005. var parent = el;
  53006. while (parent) {
  53007. if (parent.for !== undefined) {
  53008. return true
  53009. }
  53010. parent = parent.parent;
  53011. }
  53012. return false
  53013. }
  53014. function parseModifiers (name) {
  53015. var match = name.match(modifierRE);
  53016. if (match) {
  53017. var ret = {};
  53018. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53019. return ret
  53020. }
  53021. }
  53022. function makeAttrsMap (attrs) {
  53023. var map = {};
  53024. for (var i = 0, l = attrs.length; i < l; i++) {
  53025. if (
  53026. map[attrs[i].name] && !isIE && !isEdge
  53027. ) {
  53028. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53029. }
  53030. map[attrs[i].name] = attrs[i].value;
  53031. }
  53032. return map
  53033. }
  53034. // for script (e.g. type="x/template") or style, do not decode content
  53035. function isTextTag (el) {
  53036. return el.tag === 'script' || el.tag === 'style'
  53037. }
  53038. function isForbiddenTag (el) {
  53039. return (
  53040. el.tag === 'style' ||
  53041. (el.tag === 'script' && (
  53042. !el.attrsMap.type ||
  53043. el.attrsMap.type === 'text/javascript'
  53044. ))
  53045. )
  53046. }
  53047. var ieNSBug = /^xmlns:NS\d+/;
  53048. var ieNSPrefix = /^NS\d+:/;
  53049. /* istanbul ignore next */
  53050. function guardIESVGBug (attrs) {
  53051. var res = [];
  53052. for (var i = 0; i < attrs.length; i++) {
  53053. var attr = attrs[i];
  53054. if (!ieNSBug.test(attr.name)) {
  53055. attr.name = attr.name.replace(ieNSPrefix, '');
  53056. res.push(attr);
  53057. }
  53058. }
  53059. return res
  53060. }
  53061. function checkForAliasModel (el, value) {
  53062. var _el = el;
  53063. while (_el) {
  53064. if (_el.for && _el.alias === value) {
  53065. warn$2(
  53066. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53067. "You are binding v-model directly to a v-for iteration alias. " +
  53068. "This will not be able to modify the v-for source array because " +
  53069. "writing to the alias is like modifying a function local variable. " +
  53070. "Consider using an array of objects and use v-model on an object property instead.",
  53071. el.rawAttrsMap['v-model']
  53072. );
  53073. }
  53074. _el = _el.parent;
  53075. }
  53076. }
  53077. /* */
  53078. function preTransformNode (el, options) {
  53079. if (el.tag === 'input') {
  53080. var map = el.attrsMap;
  53081. if (!map['v-model']) {
  53082. return
  53083. }
  53084. var typeBinding;
  53085. if (map[':type'] || map['v-bind:type']) {
  53086. typeBinding = getBindingAttr(el, 'type');
  53087. }
  53088. if (!map.type && !typeBinding && map['v-bind']) {
  53089. typeBinding = "(" + (map['v-bind']) + ").type";
  53090. }
  53091. if (typeBinding) {
  53092. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53093. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53094. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53095. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53096. // 1. checkbox
  53097. var branch0 = cloneASTElement(el);
  53098. // process for on the main node
  53099. processFor(branch0);
  53100. addRawAttr(branch0, 'type', 'checkbox');
  53101. processElement(branch0, options);
  53102. branch0.processed = true; // prevent it from double-processed
  53103. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53104. addIfCondition(branch0, {
  53105. exp: branch0.if,
  53106. block: branch0
  53107. });
  53108. // 2. add radio else-if condition
  53109. var branch1 = cloneASTElement(el);
  53110. getAndRemoveAttr(branch1, 'v-for', true);
  53111. addRawAttr(branch1, 'type', 'radio');
  53112. processElement(branch1, options);
  53113. addIfCondition(branch0, {
  53114. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53115. block: branch1
  53116. });
  53117. // 3. other
  53118. var branch2 = cloneASTElement(el);
  53119. getAndRemoveAttr(branch2, 'v-for', true);
  53120. addRawAttr(branch2, ':type', typeBinding);
  53121. processElement(branch2, options);
  53122. addIfCondition(branch0, {
  53123. exp: ifCondition,
  53124. block: branch2
  53125. });
  53126. if (hasElse) {
  53127. branch0.else = true;
  53128. } else if (elseIfCondition) {
  53129. branch0.elseif = elseIfCondition;
  53130. }
  53131. return branch0
  53132. }
  53133. }
  53134. }
  53135. function cloneASTElement (el) {
  53136. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53137. }
  53138. var model$1 = {
  53139. preTransformNode: preTransformNode
  53140. };
  53141. var modules$1 = [
  53142. klass$1,
  53143. style$1,
  53144. model$1
  53145. ];
  53146. /* */
  53147. function text (el, dir) {
  53148. if (dir.value) {
  53149. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53150. }
  53151. }
  53152. /* */
  53153. function html (el, dir) {
  53154. if (dir.value) {
  53155. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53156. }
  53157. }
  53158. var directives$1 = {
  53159. model: model,
  53160. text: text,
  53161. html: html
  53162. };
  53163. /* */
  53164. var baseOptions = {
  53165. expectHTML: true,
  53166. modules: modules$1,
  53167. directives: directives$1,
  53168. isPreTag: isPreTag,
  53169. isUnaryTag: isUnaryTag,
  53170. mustUseProp: mustUseProp,
  53171. canBeLeftOpenTag: canBeLeftOpenTag,
  53172. isReservedTag: isReservedTag,
  53173. getTagNamespace: getTagNamespace,
  53174. staticKeys: genStaticKeys(modules$1)
  53175. };
  53176. /* */
  53177. var isStaticKey;
  53178. var isPlatformReservedTag;
  53179. var genStaticKeysCached = cached(genStaticKeys$1);
  53180. /**
  53181. * Goal of the optimizer: walk the generated template AST tree
  53182. * and detect sub-trees that are purely static, i.e. parts of
  53183. * the DOM that never needs to change.
  53184. *
  53185. * Once we detect these sub-trees, we can:
  53186. *
  53187. * 1. Hoist them into constants, so that we no longer need to
  53188. * create fresh nodes for them on each re-render;
  53189. * 2. Completely skip them in the patching process.
  53190. */
  53191. function optimize (root, options) {
  53192. if (!root) { return }
  53193. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53194. isPlatformReservedTag = options.isReservedTag || no;
  53195. // first pass: mark all non-static nodes.
  53196. markStatic$1(root);
  53197. // second pass: mark static roots.
  53198. markStaticRoots(root, false);
  53199. }
  53200. function genStaticKeys$1 (keys) {
  53201. return makeMap(
  53202. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53203. (keys ? ',' + keys : '')
  53204. )
  53205. }
  53206. function markStatic$1 (node) {
  53207. node.static = isStatic(node);
  53208. if (node.type === 1) {
  53209. // do not make component slot content static. this avoids
  53210. // 1. components not able to mutate slot nodes
  53211. // 2. static slot content fails for hot-reloading
  53212. if (
  53213. !isPlatformReservedTag(node.tag) &&
  53214. node.tag !== 'slot' &&
  53215. node.attrsMap['inline-template'] == null
  53216. ) {
  53217. return
  53218. }
  53219. for (var i = 0, l = node.children.length; i < l; i++) {
  53220. var child = node.children[i];
  53221. markStatic$1(child);
  53222. if (!child.static) {
  53223. node.static = false;
  53224. }
  53225. }
  53226. if (node.ifConditions) {
  53227. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53228. var block = node.ifConditions[i$1].block;
  53229. markStatic$1(block);
  53230. if (!block.static) {
  53231. node.static = false;
  53232. }
  53233. }
  53234. }
  53235. }
  53236. }
  53237. function markStaticRoots (node, isInFor) {
  53238. if (node.type === 1) {
  53239. if (node.static || node.once) {
  53240. node.staticInFor = isInFor;
  53241. }
  53242. // For a node to qualify as a static root, it should have children that
  53243. // are not just static text. Otherwise the cost of hoisting out will
  53244. // outweigh the benefits and it's better off to just always render it fresh.
  53245. if (node.static && node.children.length && !(
  53246. node.children.length === 1 &&
  53247. node.children[0].type === 3
  53248. )) {
  53249. node.staticRoot = true;
  53250. return
  53251. } else {
  53252. node.staticRoot = false;
  53253. }
  53254. if (node.children) {
  53255. for (var i = 0, l = node.children.length; i < l; i++) {
  53256. markStaticRoots(node.children[i], isInFor || !!node.for);
  53257. }
  53258. }
  53259. if (node.ifConditions) {
  53260. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53261. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53262. }
  53263. }
  53264. }
  53265. }
  53266. function isStatic (node) {
  53267. if (node.type === 2) { // expression
  53268. return false
  53269. }
  53270. if (node.type === 3) { // text
  53271. return true
  53272. }
  53273. return !!(node.pre || (
  53274. !node.hasBindings && // no dynamic bindings
  53275. !node.if && !node.for && // not v-if or v-for or v-else
  53276. !isBuiltInTag(node.tag) && // not a built-in
  53277. isPlatformReservedTag(node.tag) && // not a component
  53278. !isDirectChildOfTemplateFor(node) &&
  53279. Object.keys(node).every(isStaticKey)
  53280. ))
  53281. }
  53282. function isDirectChildOfTemplateFor (node) {
  53283. while (node.parent) {
  53284. node = node.parent;
  53285. if (node.tag !== 'template') {
  53286. return false
  53287. }
  53288. if (node.for) {
  53289. return true
  53290. }
  53291. }
  53292. return false
  53293. }
  53294. /* */
  53295. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53296. var fnInvokeRE = /\([^)]*?\);*$/;
  53297. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53298. // KeyboardEvent.keyCode aliases
  53299. var keyCodes = {
  53300. esc: 27,
  53301. tab: 9,
  53302. enter: 13,
  53303. space: 32,
  53304. up: 38,
  53305. left: 37,
  53306. right: 39,
  53307. down: 40,
  53308. 'delete': [8, 46]
  53309. };
  53310. // KeyboardEvent.key aliases
  53311. var keyNames = {
  53312. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53313. esc: ['Esc', 'Escape'],
  53314. tab: 'Tab',
  53315. enter: 'Enter',
  53316. // #9112: IE11 uses `Spacebar` for Space key name.
  53317. space: [' ', 'Spacebar'],
  53318. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53319. up: ['Up', 'ArrowUp'],
  53320. left: ['Left', 'ArrowLeft'],
  53321. right: ['Right', 'ArrowRight'],
  53322. down: ['Down', 'ArrowDown'],
  53323. // #9112: IE11 uses `Del` for Delete key name.
  53324. 'delete': ['Backspace', 'Delete', 'Del']
  53325. };
  53326. // #4868: modifiers that prevent the execution of the listener
  53327. // need to explicitly return null so that we can determine whether to remove
  53328. // the listener for .once
  53329. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53330. var modifierCode = {
  53331. stop: '$event.stopPropagation();',
  53332. prevent: '$event.preventDefault();',
  53333. self: genGuard("$event.target !== $event.currentTarget"),
  53334. ctrl: genGuard("!$event.ctrlKey"),
  53335. shift: genGuard("!$event.shiftKey"),
  53336. alt: genGuard("!$event.altKey"),
  53337. meta: genGuard("!$event.metaKey"),
  53338. left: genGuard("'button' in $event && $event.button !== 0"),
  53339. middle: genGuard("'button' in $event && $event.button !== 1"),
  53340. right: genGuard("'button' in $event && $event.button !== 2")
  53341. };
  53342. function genHandlers (
  53343. events,
  53344. isNative
  53345. ) {
  53346. var prefix = isNative ? 'nativeOn:' : 'on:';
  53347. var staticHandlers = "";
  53348. var dynamicHandlers = "";
  53349. for (var name in events) {
  53350. var handlerCode = genHandler(events[name]);
  53351. if (events[name] && events[name].dynamic) {
  53352. dynamicHandlers += name + "," + handlerCode + ",";
  53353. } else {
  53354. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53355. }
  53356. }
  53357. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53358. if (dynamicHandlers) {
  53359. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53360. } else {
  53361. return prefix + staticHandlers
  53362. }
  53363. }
  53364. function genHandler (handler) {
  53365. if (!handler) {
  53366. return 'function(){}'
  53367. }
  53368. if (Array.isArray(handler)) {
  53369. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53370. }
  53371. var isMethodPath = simplePathRE.test(handler.value);
  53372. var isFunctionExpression = fnExpRE.test(handler.value);
  53373. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53374. if (!handler.modifiers) {
  53375. if (isMethodPath || isFunctionExpression) {
  53376. return handler.value
  53377. }
  53378. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53379. } else {
  53380. var code = '';
  53381. var genModifierCode = '';
  53382. var keys = [];
  53383. for (var key in handler.modifiers) {
  53384. if (modifierCode[key]) {
  53385. genModifierCode += modifierCode[key];
  53386. // left/right
  53387. if (keyCodes[key]) {
  53388. keys.push(key);
  53389. }
  53390. } else if (key === 'exact') {
  53391. var modifiers = (handler.modifiers);
  53392. genModifierCode += genGuard(
  53393. ['ctrl', 'shift', 'alt', 'meta']
  53394. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53395. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53396. .join('||')
  53397. );
  53398. } else {
  53399. keys.push(key);
  53400. }
  53401. }
  53402. if (keys.length) {
  53403. code += genKeyFilter(keys);
  53404. }
  53405. // Make sure modifiers like prevent and stop get executed after key filtering
  53406. if (genModifierCode) {
  53407. code += genModifierCode;
  53408. }
  53409. var handlerCode = isMethodPath
  53410. ? ("return " + (handler.value) + "($event)")
  53411. : isFunctionExpression
  53412. ? ("return (" + (handler.value) + ")($event)")
  53413. : isFunctionInvocation
  53414. ? ("return " + (handler.value))
  53415. : handler.value;
  53416. return ("function($event){" + code + handlerCode + "}")
  53417. }
  53418. }
  53419. function genKeyFilter (keys) {
  53420. return (
  53421. // make sure the key filters only apply to KeyboardEvents
  53422. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53423. // key events that do not have keyCode property...
  53424. "if(!$event.type.indexOf('key')&&" +
  53425. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53426. )
  53427. }
  53428. function genFilterCode (key) {
  53429. var keyVal = parseInt(key, 10);
  53430. if (keyVal) {
  53431. return ("$event.keyCode!==" + keyVal)
  53432. }
  53433. var keyCode = keyCodes[key];
  53434. var keyName = keyNames[key];
  53435. return (
  53436. "_k($event.keyCode," +
  53437. (JSON.stringify(key)) + "," +
  53438. (JSON.stringify(keyCode)) + "," +
  53439. "$event.key," +
  53440. "" + (JSON.stringify(keyName)) +
  53441. ")"
  53442. )
  53443. }
  53444. /* */
  53445. function on (el, dir) {
  53446. if (dir.modifiers) {
  53447. warn("v-on without argument does not support modifiers.");
  53448. }
  53449. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53450. }
  53451. /* */
  53452. function bind$1 (el, dir) {
  53453. el.wrapData = function (code) {
  53454. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53455. };
  53456. }
  53457. /* */
  53458. var baseDirectives = {
  53459. on: on,
  53460. bind: bind$1,
  53461. cloak: noop
  53462. };
  53463. /* */
  53464. var CodegenState = function CodegenState (options) {
  53465. this.options = options;
  53466. this.warn = options.warn || baseWarn;
  53467. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53468. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53469. this.directives = extend(extend({}, baseDirectives), options.directives);
  53470. var isReservedTag = options.isReservedTag || no;
  53471. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53472. this.onceId = 0;
  53473. this.staticRenderFns = [];
  53474. this.pre = false;
  53475. };
  53476. function generate (
  53477. ast,
  53478. options
  53479. ) {
  53480. var state = new CodegenState(options);
  53481. var code = ast ? genElement(ast, state) : '_c("div")';
  53482. return {
  53483. render: ("with(this){return " + code + "}"),
  53484. staticRenderFns: state.staticRenderFns
  53485. }
  53486. }
  53487. function genElement (el, state) {
  53488. if (el.parent) {
  53489. el.pre = el.pre || el.parent.pre;
  53490. }
  53491. if (el.staticRoot && !el.staticProcessed) {
  53492. return genStatic(el, state)
  53493. } else if (el.once && !el.onceProcessed) {
  53494. return genOnce(el, state)
  53495. } else if (el.for && !el.forProcessed) {
  53496. return genFor(el, state)
  53497. } else if (el.if && !el.ifProcessed) {
  53498. return genIf(el, state)
  53499. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53500. return genChildren(el, state) || 'void 0'
  53501. } else if (el.tag === 'slot') {
  53502. return genSlot(el, state)
  53503. } else {
  53504. // component or element
  53505. var code;
  53506. if (el.component) {
  53507. code = genComponent(el.component, el, state);
  53508. } else {
  53509. var data;
  53510. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53511. data = genData$2(el, state);
  53512. }
  53513. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53514. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53515. }
  53516. // module transforms
  53517. for (var i = 0; i < state.transforms.length; i++) {
  53518. code = state.transforms[i](el, code);
  53519. }
  53520. return code
  53521. }
  53522. }
  53523. // hoist static sub-trees out
  53524. function genStatic (el, state) {
  53525. el.staticProcessed = true;
  53526. // Some elements (templates) need to behave differently inside of a v-pre
  53527. // node. All pre nodes are static roots, so we can use this as a location to
  53528. // wrap a state change and reset it upon exiting the pre node.
  53529. var originalPreState = state.pre;
  53530. if (el.pre) {
  53531. state.pre = el.pre;
  53532. }
  53533. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53534. state.pre = originalPreState;
  53535. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53536. }
  53537. // v-once
  53538. function genOnce (el, state) {
  53539. el.onceProcessed = true;
  53540. if (el.if && !el.ifProcessed) {
  53541. return genIf(el, state)
  53542. } else if (el.staticInFor) {
  53543. var key = '';
  53544. var parent = el.parent;
  53545. while (parent) {
  53546. if (parent.for) {
  53547. key = parent.key;
  53548. break
  53549. }
  53550. parent = parent.parent;
  53551. }
  53552. if (!key) {
  53553. state.warn(
  53554. "v-once can only be used inside v-for that is keyed. ",
  53555. el.rawAttrsMap['v-once']
  53556. );
  53557. return genElement(el, state)
  53558. }
  53559. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53560. } else {
  53561. return genStatic(el, state)
  53562. }
  53563. }
  53564. function genIf (
  53565. el,
  53566. state,
  53567. altGen,
  53568. altEmpty
  53569. ) {
  53570. el.ifProcessed = true; // avoid recursion
  53571. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53572. }
  53573. function genIfConditions (
  53574. conditions,
  53575. state,
  53576. altGen,
  53577. altEmpty
  53578. ) {
  53579. if (!conditions.length) {
  53580. return altEmpty || '_e()'
  53581. }
  53582. var condition = conditions.shift();
  53583. if (condition.exp) {
  53584. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53585. } else {
  53586. return ("" + (genTernaryExp(condition.block)))
  53587. }
  53588. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53589. function genTernaryExp (el) {
  53590. return altGen
  53591. ? altGen(el, state)
  53592. : el.once
  53593. ? genOnce(el, state)
  53594. : genElement(el, state)
  53595. }
  53596. }
  53597. function genFor (
  53598. el,
  53599. state,
  53600. altGen,
  53601. altHelper
  53602. ) {
  53603. var exp = el.for;
  53604. var alias = el.alias;
  53605. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  53606. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  53607. if (state.maybeComponent(el) &&
  53608. el.tag !== 'slot' &&
  53609. el.tag !== 'template' &&
  53610. !el.key
  53611. ) {
  53612. state.warn(
  53613. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  53614. "v-for should have explicit keys. " +
  53615. "See https://vuejs.org/guide/list.html#key for more info.",
  53616. el.rawAttrsMap['v-for'],
  53617. true /* tip */
  53618. );
  53619. }
  53620. el.forProcessed = true; // avoid recursion
  53621. return (altHelper || '_l') + "((" + exp + ")," +
  53622. "function(" + alias + iterator1 + iterator2 + "){" +
  53623. "return " + ((altGen || genElement)(el, state)) +
  53624. '})'
  53625. }
  53626. function genData$2 (el, state) {
  53627. var data = '{';
  53628. // directives first.
  53629. // directives may mutate the el's other properties before they are generated.
  53630. var dirs = genDirectives(el, state);
  53631. if (dirs) { data += dirs + ','; }
  53632. // key
  53633. if (el.key) {
  53634. data += "key:" + (el.key) + ",";
  53635. }
  53636. // ref
  53637. if (el.ref) {
  53638. data += "ref:" + (el.ref) + ",";
  53639. }
  53640. if (el.refInFor) {
  53641. data += "refInFor:true,";
  53642. }
  53643. // pre
  53644. if (el.pre) {
  53645. data += "pre:true,";
  53646. }
  53647. // record original tag name for components using "is" attribute
  53648. if (el.component) {
  53649. data += "tag:\"" + (el.tag) + "\",";
  53650. }
  53651. // module data generation functions
  53652. for (var i = 0; i < state.dataGenFns.length; i++) {
  53653. data += state.dataGenFns[i](el);
  53654. }
  53655. // attributes
  53656. if (el.attrs) {
  53657. data += "attrs:" + (genProps(el.attrs)) + ",";
  53658. }
  53659. // DOM props
  53660. if (el.props) {
  53661. data += "domProps:" + (genProps(el.props)) + ",";
  53662. }
  53663. // event handlers
  53664. if (el.events) {
  53665. data += (genHandlers(el.events, false)) + ",";
  53666. }
  53667. if (el.nativeEvents) {
  53668. data += (genHandlers(el.nativeEvents, true)) + ",";
  53669. }
  53670. // slot target
  53671. // only for non-scoped slots
  53672. if (el.slotTarget && !el.slotScope) {
  53673. data += "slot:" + (el.slotTarget) + ",";
  53674. }
  53675. // scoped slots
  53676. if (el.scopedSlots) {
  53677. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  53678. }
  53679. // component v-model
  53680. if (el.model) {
  53681. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  53682. }
  53683. // inline-template
  53684. if (el.inlineTemplate) {
  53685. var inlineTemplate = genInlineTemplate(el, state);
  53686. if (inlineTemplate) {
  53687. data += inlineTemplate + ",";
  53688. }
  53689. }
  53690. data = data.replace(/,$/, '') + '}';
  53691. // v-bind dynamic argument wrap
  53692. // v-bind with dynamic arguments must be applied using the same v-bind object
  53693. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  53694. if (el.dynamicAttrs) {
  53695. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  53696. }
  53697. // v-bind data wrap
  53698. if (el.wrapData) {
  53699. data = el.wrapData(data);
  53700. }
  53701. // v-on data wrap
  53702. if (el.wrapListeners) {
  53703. data = el.wrapListeners(data);
  53704. }
  53705. return data
  53706. }
  53707. function genDirectives (el, state) {
  53708. var dirs = el.directives;
  53709. if (!dirs) { return }
  53710. var res = 'directives:[';
  53711. var hasRuntime = false;
  53712. var i, l, dir, needRuntime;
  53713. for (i = 0, l = dirs.length; i < l; i++) {
  53714. dir = dirs[i];
  53715. needRuntime = true;
  53716. var gen = state.directives[dir.name];
  53717. if (gen) {
  53718. // compile-time directive that manipulates AST.
  53719. // returns true if it also needs a runtime counterpart.
  53720. needRuntime = !!gen(el, dir, state.warn);
  53721. }
  53722. if (needRuntime) {
  53723. hasRuntime = true;
  53724. 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))) : '') + "},";
  53725. }
  53726. }
  53727. if (hasRuntime) {
  53728. return res.slice(0, -1) + ']'
  53729. }
  53730. }
  53731. function genInlineTemplate (el, state) {
  53732. var ast = el.children[0];
  53733. if (el.children.length !== 1 || ast.type !== 1) {
  53734. state.warn(
  53735. 'Inline-template components must have exactly one child element.',
  53736. { start: el.start }
  53737. );
  53738. }
  53739. if (ast && ast.type === 1) {
  53740. var inlineRenderFns = generate(ast, state.options);
  53741. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  53742. }
  53743. }
  53744. function genScopedSlots (
  53745. el,
  53746. slots,
  53747. state
  53748. ) {
  53749. // by default scoped slots are considered "stable", this allows child
  53750. // components with only scoped slots to skip forced updates from parent.
  53751. // but in some cases we have to bail-out of this optimization
  53752. // for example if the slot contains dynamic names, has v-if or v-for on them...
  53753. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  53754. var slot = slots[key];
  53755. return (
  53756. slot.slotTargetDynamic ||
  53757. slot.if ||
  53758. slot.for ||
  53759. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  53760. )
  53761. });
  53762. // #9534: if a component with scoped slots is inside a conditional branch,
  53763. // it's possible for the same component to be reused but with different
  53764. // compiled slot content. To avoid that, we generate a unique key based on
  53765. // the generated code of all the slot contents.
  53766. var needsKey = !!el.if;
  53767. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53768. // disconnected due to the intermediate scope variable)
  53769. // #9438, #9506
  53770. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53771. // and skip force updating ones that do not actually use scope variables.
  53772. if (!needsForceUpdate) {
  53773. var parent = el.parent;
  53774. while (parent) {
  53775. if (
  53776. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53777. parent.for
  53778. ) {
  53779. needsForceUpdate = true;
  53780. break
  53781. }
  53782. if (parent.if) {
  53783. needsKey = true;
  53784. }
  53785. parent = parent.parent;
  53786. }
  53787. }
  53788. var generatedSlots = Object.keys(slots)
  53789. .map(function (key) { return genScopedSlot(slots[key], state); })
  53790. .join(',');
  53791. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53792. }
  53793. function hash(str) {
  53794. var hash = 5381;
  53795. var i = str.length;
  53796. while(i) {
  53797. hash = (hash * 33) ^ str.charCodeAt(--i);
  53798. }
  53799. return hash >>> 0
  53800. }
  53801. function containsSlotChild (el) {
  53802. if (el.type === 1) {
  53803. if (el.tag === 'slot') {
  53804. return true
  53805. }
  53806. return el.children.some(containsSlotChild)
  53807. }
  53808. return false
  53809. }
  53810. function genScopedSlot (
  53811. el,
  53812. state
  53813. ) {
  53814. var isLegacySyntax = el.attrsMap['slot-scope'];
  53815. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53816. return genIf(el, state, genScopedSlot, "null")
  53817. }
  53818. if (el.for && !el.forProcessed) {
  53819. return genFor(el, state, genScopedSlot)
  53820. }
  53821. var slotScope = el.slotScope === emptySlotScopeToken
  53822. ? ""
  53823. : String(el.slotScope);
  53824. var fn = "function(" + slotScope + "){" +
  53825. "return " + (el.tag === 'template'
  53826. ? el.if && isLegacySyntax
  53827. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  53828. : genChildren(el, state) || 'undefined'
  53829. : genElement(el, state)) + "}";
  53830. // reverse proxy v-slot without scope on this.$slots
  53831. var reverseProxy = slotScope ? "" : ",proxy:true";
  53832. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  53833. }
  53834. function genChildren (
  53835. el,
  53836. state,
  53837. checkSkip,
  53838. altGenElement,
  53839. altGenNode
  53840. ) {
  53841. var children = el.children;
  53842. if (children.length) {
  53843. var el$1 = children[0];
  53844. // optimize single v-for
  53845. if (children.length === 1 &&
  53846. el$1.for &&
  53847. el$1.tag !== 'template' &&
  53848. el$1.tag !== 'slot'
  53849. ) {
  53850. var normalizationType = checkSkip
  53851. ? state.maybeComponent(el$1) ? ",1" : ",0"
  53852. : "";
  53853. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  53854. }
  53855. var normalizationType$1 = checkSkip
  53856. ? getNormalizationType(children, state.maybeComponent)
  53857. : 0;
  53858. var gen = altGenNode || genNode;
  53859. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  53860. }
  53861. }
  53862. // determine the normalization needed for the children array.
  53863. // 0: no normalization needed
  53864. // 1: simple normalization needed (possible 1-level deep nested array)
  53865. // 2: full normalization needed
  53866. function getNormalizationType (
  53867. children,
  53868. maybeComponent
  53869. ) {
  53870. var res = 0;
  53871. for (var i = 0; i < children.length; i++) {
  53872. var el = children[i];
  53873. if (el.type !== 1) {
  53874. continue
  53875. }
  53876. if (needsNormalization(el) ||
  53877. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  53878. res = 2;
  53879. break
  53880. }
  53881. if (maybeComponent(el) ||
  53882. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  53883. res = 1;
  53884. }
  53885. }
  53886. return res
  53887. }
  53888. function needsNormalization (el) {
  53889. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  53890. }
  53891. function genNode (node, state) {
  53892. if (node.type === 1) {
  53893. return genElement(node, state)
  53894. } else if (node.type === 3 && node.isComment) {
  53895. return genComment(node)
  53896. } else {
  53897. return genText(node)
  53898. }
  53899. }
  53900. function genText (text) {
  53901. return ("_v(" + (text.type === 2
  53902. ? text.expression // no need for () because already wrapped in _s()
  53903. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  53904. }
  53905. function genComment (comment) {
  53906. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  53907. }
  53908. function genSlot (el, state) {
  53909. var slotName = el.slotName || '"default"';
  53910. var children = genChildren(el, state);
  53911. var res = "_t(" + slotName + (children ? ("," + children) : '');
  53912. var attrs = el.attrs || el.dynamicAttrs
  53913. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  53914. // slot props are camelized
  53915. name: camelize(attr.name),
  53916. value: attr.value,
  53917. dynamic: attr.dynamic
  53918. }); }))
  53919. : null;
  53920. var bind$$1 = el.attrsMap['v-bind'];
  53921. if ((attrs || bind$$1) && !children) {
  53922. res += ",null";
  53923. }
  53924. if (attrs) {
  53925. res += "," + attrs;
  53926. }
  53927. if (bind$$1) {
  53928. res += (attrs ? '' : ',null') + "," + bind$$1;
  53929. }
  53930. return res + ')'
  53931. }
  53932. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  53933. function genComponent (
  53934. componentName,
  53935. el,
  53936. state
  53937. ) {
  53938. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53939. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  53940. }
  53941. function genProps (props) {
  53942. var staticProps = "";
  53943. var dynamicProps = "";
  53944. for (var i = 0; i < props.length; i++) {
  53945. var prop = props[i];
  53946. var value = transformSpecialNewlines(prop.value);
  53947. if (prop.dynamic) {
  53948. dynamicProps += (prop.name) + "," + value + ",";
  53949. } else {
  53950. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  53951. }
  53952. }
  53953. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  53954. if (dynamicProps) {
  53955. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  53956. } else {
  53957. return staticProps
  53958. }
  53959. }
  53960. // #3895, #4268
  53961. function transformSpecialNewlines (text) {
  53962. return text
  53963. .replace(/\u2028/g, '\\u2028')
  53964. .replace(/\u2029/g, '\\u2029')
  53965. }
  53966. /* */
  53967. // these keywords should not appear inside expressions, but operators like
  53968. // typeof, instanceof and in are allowed
  53969. var prohibitedKeywordRE = new RegExp('\\b' + (
  53970. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  53971. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  53972. 'extends,finally,continue,debugger,function,arguments'
  53973. ).split(',').join('\\b|\\b') + '\\b');
  53974. // these unary operators should not be used as property/method names
  53975. var unaryOperatorsRE = new RegExp('\\b' + (
  53976. 'delete,typeof,void'
  53977. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  53978. // strip strings in expressions
  53979. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  53980. // detect problematic expressions in a template
  53981. function detectErrors (ast, warn) {
  53982. if (ast) {
  53983. checkNode(ast, warn);
  53984. }
  53985. }
  53986. function checkNode (node, warn) {
  53987. if (node.type === 1) {
  53988. for (var name in node.attrsMap) {
  53989. if (dirRE.test(name)) {
  53990. var value = node.attrsMap[name];
  53991. if (value) {
  53992. var range = node.rawAttrsMap[name];
  53993. if (name === 'v-for') {
  53994. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  53995. } else if (name === 'v-slot' || name[0] === '#') {
  53996. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  53997. } else if (onRE.test(name)) {
  53998. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  53999. } else {
  54000. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54001. }
  54002. }
  54003. }
  54004. }
  54005. if (node.children) {
  54006. for (var i = 0; i < node.children.length; i++) {
  54007. checkNode(node.children[i], warn);
  54008. }
  54009. }
  54010. } else if (node.type === 2) {
  54011. checkExpression(node.expression, node.text, warn, node);
  54012. }
  54013. }
  54014. function checkEvent (exp, text, warn, range) {
  54015. var stripped = exp.replace(stripStringRE, '');
  54016. var keywordMatch = stripped.match(unaryOperatorsRE);
  54017. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54018. warn(
  54019. "avoid using JavaScript unary operator as property name: " +
  54020. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54021. range
  54022. );
  54023. }
  54024. checkExpression(exp, text, warn, range);
  54025. }
  54026. function checkFor (node, text, warn, range) {
  54027. checkExpression(node.for || '', text, warn, range);
  54028. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54029. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54030. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54031. }
  54032. function checkIdentifier (
  54033. ident,
  54034. type,
  54035. text,
  54036. warn,
  54037. range
  54038. ) {
  54039. if (typeof ident === 'string') {
  54040. try {
  54041. new Function(("var " + ident + "=_"));
  54042. } catch (e) {
  54043. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54044. }
  54045. }
  54046. }
  54047. function checkExpression (exp, text, warn, range) {
  54048. try {
  54049. new Function(("return " + exp));
  54050. } catch (e) {
  54051. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54052. if (keywordMatch) {
  54053. warn(
  54054. "avoid using JavaScript keyword as property name: " +
  54055. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54056. range
  54057. );
  54058. } else {
  54059. warn(
  54060. "invalid expression: " + (e.message) + " in\n\n" +
  54061. " " + exp + "\n\n" +
  54062. " Raw expression: " + (text.trim()) + "\n",
  54063. range
  54064. );
  54065. }
  54066. }
  54067. }
  54068. function checkFunctionParameterExpression (exp, text, warn, range) {
  54069. try {
  54070. new Function(exp, '');
  54071. } catch (e) {
  54072. warn(
  54073. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54074. " " + exp + "\n\n" +
  54075. " Raw expression: " + (text.trim()) + "\n",
  54076. range
  54077. );
  54078. }
  54079. }
  54080. /* */
  54081. var range = 2;
  54082. function generateCodeFrame (
  54083. source,
  54084. start,
  54085. end
  54086. ) {
  54087. if ( start === void 0 ) start = 0;
  54088. if ( end === void 0 ) end = source.length;
  54089. var lines = source.split(/\r?\n/);
  54090. var count = 0;
  54091. var res = [];
  54092. for (var i = 0; i < lines.length; i++) {
  54093. count += lines[i].length + 1;
  54094. if (count >= start) {
  54095. for (var j = i - range; j <= i + range || end > count; j++) {
  54096. if (j < 0 || j >= lines.length) { continue }
  54097. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54098. var lineLength = lines[j].length;
  54099. if (j === i) {
  54100. // push underline
  54101. var pad = start - (count - lineLength) + 1;
  54102. var length = end > count ? lineLength - pad : end - start;
  54103. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54104. } else if (j > i) {
  54105. if (end > count) {
  54106. var length$1 = Math.min(end - count, lineLength);
  54107. res.push(" | " + repeat$1("^", length$1));
  54108. }
  54109. count += lineLength + 1;
  54110. }
  54111. }
  54112. break
  54113. }
  54114. }
  54115. return res.join('\n')
  54116. }
  54117. function repeat$1 (str, n) {
  54118. var result = '';
  54119. if (n > 0) {
  54120. while (true) { // eslint-disable-line
  54121. if (n & 1) { result += str; }
  54122. n >>>= 1;
  54123. if (n <= 0) { break }
  54124. str += str;
  54125. }
  54126. }
  54127. return result
  54128. }
  54129. /* */
  54130. function createFunction (code, errors) {
  54131. try {
  54132. return new Function(code)
  54133. } catch (err) {
  54134. errors.push({ err: err, code: code });
  54135. return noop
  54136. }
  54137. }
  54138. function createCompileToFunctionFn (compile) {
  54139. var cache = Object.create(null);
  54140. return function compileToFunctions (
  54141. template,
  54142. options,
  54143. vm
  54144. ) {
  54145. options = extend({}, options);
  54146. var warn$$1 = options.warn || warn;
  54147. delete options.warn;
  54148. /* istanbul ignore if */
  54149. {
  54150. // detect possible CSP restriction
  54151. try {
  54152. new Function('return 1');
  54153. } catch (e) {
  54154. if (e.toString().match(/unsafe-eval|CSP/)) {
  54155. warn$$1(
  54156. 'It seems you are using the standalone build of Vue.js in an ' +
  54157. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54158. 'The template compiler cannot work in this environment. Consider ' +
  54159. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54160. 'templates into render functions.'
  54161. );
  54162. }
  54163. }
  54164. }
  54165. // check cache
  54166. var key = options.delimiters
  54167. ? String(options.delimiters) + template
  54168. : template;
  54169. if (cache[key]) {
  54170. return cache[key]
  54171. }
  54172. // compile
  54173. var compiled = compile(template, options);
  54174. // check compilation errors/tips
  54175. {
  54176. if (compiled.errors && compiled.errors.length) {
  54177. if (options.outputSourceRange) {
  54178. compiled.errors.forEach(function (e) {
  54179. warn$$1(
  54180. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54181. generateCodeFrame(template, e.start, e.end),
  54182. vm
  54183. );
  54184. });
  54185. } else {
  54186. warn$$1(
  54187. "Error compiling template:\n\n" + template + "\n\n" +
  54188. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54189. vm
  54190. );
  54191. }
  54192. }
  54193. if (compiled.tips && compiled.tips.length) {
  54194. if (options.outputSourceRange) {
  54195. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54196. } else {
  54197. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54198. }
  54199. }
  54200. }
  54201. // turn code into functions
  54202. var res = {};
  54203. var fnGenErrors = [];
  54204. res.render = createFunction(compiled.render, fnGenErrors);
  54205. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54206. return createFunction(code, fnGenErrors)
  54207. });
  54208. // check function generation errors.
  54209. // this should only happen if there is a bug in the compiler itself.
  54210. // mostly for codegen development use
  54211. /* istanbul ignore if */
  54212. {
  54213. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54214. warn$$1(
  54215. "Failed to generate render function:\n\n" +
  54216. fnGenErrors.map(function (ref) {
  54217. var err = ref.err;
  54218. var code = ref.code;
  54219. return ((err.toString()) + " in\n\n" + code + "\n");
  54220. }).join('\n'),
  54221. vm
  54222. );
  54223. }
  54224. }
  54225. return (cache[key] = res)
  54226. }
  54227. }
  54228. /* */
  54229. function createCompilerCreator (baseCompile) {
  54230. return function createCompiler (baseOptions) {
  54231. function compile (
  54232. template,
  54233. options
  54234. ) {
  54235. var finalOptions = Object.create(baseOptions);
  54236. var errors = [];
  54237. var tips = [];
  54238. var warn = function (msg, range, tip) {
  54239. (tip ? tips : errors).push(msg);
  54240. };
  54241. if (options) {
  54242. if (options.outputSourceRange) {
  54243. // $flow-disable-line
  54244. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54245. warn = function (msg, range, tip) {
  54246. var data = { msg: msg };
  54247. if (range) {
  54248. if (range.start != null) {
  54249. data.start = range.start + leadingSpaceLength;
  54250. }
  54251. if (range.end != null) {
  54252. data.end = range.end + leadingSpaceLength;
  54253. }
  54254. }
  54255. (tip ? tips : errors).push(data);
  54256. };
  54257. }
  54258. // merge custom modules
  54259. if (options.modules) {
  54260. finalOptions.modules =
  54261. (baseOptions.modules || []).concat(options.modules);
  54262. }
  54263. // merge custom directives
  54264. if (options.directives) {
  54265. finalOptions.directives = extend(
  54266. Object.create(baseOptions.directives || null),
  54267. options.directives
  54268. );
  54269. }
  54270. // copy other options
  54271. for (var key in options) {
  54272. if (key !== 'modules' && key !== 'directives') {
  54273. finalOptions[key] = options[key];
  54274. }
  54275. }
  54276. }
  54277. finalOptions.warn = warn;
  54278. var compiled = baseCompile(template.trim(), finalOptions);
  54279. {
  54280. detectErrors(compiled.ast, warn);
  54281. }
  54282. compiled.errors = errors;
  54283. compiled.tips = tips;
  54284. return compiled
  54285. }
  54286. return {
  54287. compile: compile,
  54288. compileToFunctions: createCompileToFunctionFn(compile)
  54289. }
  54290. }
  54291. }
  54292. /* */
  54293. // `createCompilerCreator` allows creating compilers that use alternative
  54294. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54295. // Here we just export a default compiler using the default parts.
  54296. var createCompiler = createCompilerCreator(function baseCompile (
  54297. template,
  54298. options
  54299. ) {
  54300. var ast = parse(template.trim(), options);
  54301. if (options.optimize !== false) {
  54302. optimize(ast, options);
  54303. }
  54304. var code = generate(ast, options);
  54305. return {
  54306. ast: ast,
  54307. render: code.render,
  54308. staticRenderFns: code.staticRenderFns
  54309. }
  54310. });
  54311. /* */
  54312. var ref$1 = createCompiler(baseOptions);
  54313. var compile = ref$1.compile;
  54314. var compileToFunctions = ref$1.compileToFunctions;
  54315. /* */
  54316. // check whether current browser encodes a char inside attribute values
  54317. var div;
  54318. function getShouldDecode (href) {
  54319. div = div || document.createElement('div');
  54320. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54321. return div.innerHTML.indexOf('&#10;') > 0
  54322. }
  54323. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54324. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54325. // #6828: chrome encodes content in a[href]
  54326. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54327. /* */
  54328. var idToTemplate = cached(function (id) {
  54329. var el = query(id);
  54330. return el && el.innerHTML
  54331. });
  54332. var mount = Vue.prototype.$mount;
  54333. Vue.prototype.$mount = function (
  54334. el,
  54335. hydrating
  54336. ) {
  54337. el = el && query(el);
  54338. /* istanbul ignore if */
  54339. if (el === document.body || el === document.documentElement) {
  54340. warn(
  54341. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54342. );
  54343. return this
  54344. }
  54345. var options = this.$options;
  54346. // resolve template/el and convert to render function
  54347. if (!options.render) {
  54348. var template = options.template;
  54349. if (template) {
  54350. if (typeof template === 'string') {
  54351. if (template.charAt(0) === '#') {
  54352. template = idToTemplate(template);
  54353. /* istanbul ignore if */
  54354. if (!template) {
  54355. warn(
  54356. ("Template element not found or is empty: " + (options.template)),
  54357. this
  54358. );
  54359. }
  54360. }
  54361. } else if (template.nodeType) {
  54362. template = template.innerHTML;
  54363. } else {
  54364. {
  54365. warn('invalid template option:' + template, this);
  54366. }
  54367. return this
  54368. }
  54369. } else if (el) {
  54370. template = getOuterHTML(el);
  54371. }
  54372. if (template) {
  54373. /* istanbul ignore if */
  54374. if (config.performance && mark) {
  54375. mark('compile');
  54376. }
  54377. var ref = compileToFunctions(template, {
  54378. outputSourceRange: "development" !== 'production',
  54379. shouldDecodeNewlines: shouldDecodeNewlines,
  54380. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54381. delimiters: options.delimiters,
  54382. comments: options.comments
  54383. }, this);
  54384. var render = ref.render;
  54385. var staticRenderFns = ref.staticRenderFns;
  54386. options.render = render;
  54387. options.staticRenderFns = staticRenderFns;
  54388. /* istanbul ignore if */
  54389. if (config.performance && mark) {
  54390. mark('compile end');
  54391. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54392. }
  54393. }
  54394. }
  54395. return mount.call(this, el, hydrating)
  54396. };
  54397. /**
  54398. * Get outerHTML of elements, taking care
  54399. * of SVG elements in IE as well.
  54400. */
  54401. function getOuterHTML (el) {
  54402. if (el.outerHTML) {
  54403. return el.outerHTML
  54404. } else {
  54405. var container = document.createElement('div');
  54406. container.appendChild(el.cloneNode(true));
  54407. return container.innerHTML
  54408. }
  54409. }
  54410. Vue.compile = compileToFunctions;
  54411. module.exports = Vue;
  54412. /* 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))
  54413. /***/ }),
  54414. /***/ "./node_modules/vue/dist/vue.common.js":
  54415. /*!*********************************************!*\
  54416. !*** ./node_modules/vue/dist/vue.common.js ***!
  54417. \*********************************************/
  54418. /*! no static exports found */
  54419. /***/ (function(module, exports, __webpack_require__) {
  54420. if (false) {} else {
  54421. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54422. }
  54423. /***/ }),
  54424. /***/ "./node_modules/webpack/buildin/global.js":
  54425. /*!***********************************!*\
  54426. !*** (webpack)/buildin/global.js ***!
  54427. \***********************************/
  54428. /*! no static exports found */
  54429. /***/ (function(module, exports) {
  54430. var g;
  54431. // This works in non-strict mode
  54432. g = (function() {
  54433. return this;
  54434. })();
  54435. try {
  54436. // This works if eval is allowed (see CSP)
  54437. g = g || new Function("return this")();
  54438. } catch (e) {
  54439. // This works if the window reference is available
  54440. if (typeof window === "object") g = window;
  54441. }
  54442. // g can still be undefined, but nothing to do about it...
  54443. // We return undefined, instead of nothing here, so it's
  54444. // easier to handle this case. if(!global) { ...}
  54445. module.exports = g;
  54446. /***/ }),
  54447. /***/ "./node_modules/webpack/buildin/module.js":
  54448. /*!***********************************!*\
  54449. !*** (webpack)/buildin/module.js ***!
  54450. \***********************************/
  54451. /*! no static exports found */
  54452. /***/ (function(module, exports) {
  54453. module.exports = function(module) {
  54454. if (!module.webpackPolyfill) {
  54455. module.deprecate = function() {};
  54456. module.paths = [];
  54457. // module.parent = undefined by default
  54458. if (!module.children) module.children = [];
  54459. Object.defineProperty(module, "loaded", {
  54460. enumerable: true,
  54461. get: function() {
  54462. return module.l;
  54463. }
  54464. });
  54465. Object.defineProperty(module, "id", {
  54466. enumerable: true,
  54467. get: function() {
  54468. return module.i;
  54469. }
  54470. });
  54471. module.webpackPolyfill = 1;
  54472. }
  54473. return module;
  54474. };
  54475. /***/ }),
  54476. /***/ "./resources/js/app.js":
  54477. /*!*****************************!*\
  54478. !*** ./resources/js/app.js ***!
  54479. \*****************************/
  54480. /*! no static exports found */
  54481. /***/ (function(module, exports, __webpack_require__) {
  54482. /**
  54483. * First we will load all of this project's JavaScript dependencies which
  54484. * includes Vue and other libraries. It is a great starting point when
  54485. * building robust, powerful web applications using Vue and Laravel.
  54486. */
  54487. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54488. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54489. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54490. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54491. /**
  54492. * The following block of code may be used to automatically register your
  54493. * Vue components. It will recursively scan this directory for the Vue
  54494. * components and automatically register them with their "basename".
  54495. *
  54496. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54497. */
  54498. // const files = require.context('./', true, /\.vue$/i)
  54499. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54500. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54501. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54502. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54503. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54504. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54505. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54506. /**
  54507. * Next, we will create a fresh Vue application instance and attach it to
  54508. * the page. Then, you may begin adding components to this application
  54509. * or customize the JavaScript scaffolding to fit your unique needs.
  54510. */
  54511. var app = new Vue({
  54512. el: '#app'
  54513. });
  54514. $(function () {
  54515. $('[data-toggle="tooltip"]').tooltip();
  54516. });
  54517. var clipboard = new Clipboard('.btn-clip');
  54518. clipboard.on('success', function (e) {
  54519. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54520. position: "right",
  54521. className: 'success'
  54522. });
  54523. e.clearSelection();
  54524. });
  54525. /***/ }),
  54526. /***/ "./resources/js/bootstrap.js":
  54527. /*!***********************************!*\
  54528. !*** ./resources/js/bootstrap.js ***!
  54529. \***********************************/
  54530. /*! no exports provided */
  54531. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54532. "use strict";
  54533. __webpack_require__.r(__webpack_exports__);
  54534. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54535. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54536. /**
  54537. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54538. * for JavaScript based Bootstrap features such as modals and tabs. This
  54539. * code may be modified to fit the specific needs of your application.
  54540. */
  54541. try {
  54542. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54543. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54544. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54545. } catch (e) {}
  54546. /**
  54547. * We'll load the axios HTTP library which allows us to easily issue requests
  54548. * to our Laravel back-end. This library automatically handles sending the
  54549. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54550. */
  54551. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54552. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54553. /**
  54554. * Echo exposes an expressive API for subscribing to channels and listening
  54555. * for events that are broadcast by Laravel. Echo and event broadcasting
  54556. * allows your team to easily build robust real-time web applications.
  54557. */
  54558. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54559. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54560. broadcaster: 'pusher',
  54561. key: "upccrt",
  54562. wsHost: window.location.hostname,
  54563. wsPort: 6001,
  54564. disableStats: true
  54565. });
  54566. /***/ }),
  54567. /***/ "./resources/js/components/ExampleComponent.vue":
  54568. /*!******************************************************!*\
  54569. !*** ./resources/js/components/ExampleComponent.vue ***!
  54570. \******************************************************/
  54571. /*! exports provided: default */
  54572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54573. "use strict";
  54574. __webpack_require__.r(__webpack_exports__);
  54575. /* 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&");
  54576. /* 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&");
  54577. /* 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");
  54578. /* normalize component */
  54579. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54580. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54581. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54582. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54583. false,
  54584. null,
  54585. null,
  54586. null
  54587. )
  54588. /* hot reload */
  54589. if (false) { var api; }
  54590. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54591. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54592. /***/ }),
  54593. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54594. /*!*******************************************************************************!*\
  54595. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  54596. \*******************************************************************************/
  54597. /*! exports provided: default */
  54598. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54599. "use strict";
  54600. __webpack_require__.r(__webpack_exports__);
  54601. /* 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&");
  54602. /* 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"]);
  54603. /***/ }),
  54604. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  54605. /*!*************************************************************************************!*\
  54606. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  54607. \*************************************************************************************/
  54608. /*! exports provided: render, staticRenderFns */
  54609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54610. "use strict";
  54611. __webpack_require__.r(__webpack_exports__);
  54612. /* 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&");
  54613. /* 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"]; });
  54614. /* 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"]; });
  54615. /***/ }),
  54616. /***/ "./resources/js/components/assetinfo.vue":
  54617. /*!***********************************************!*\
  54618. !*** ./resources/js/components/assetinfo.vue ***!
  54619. \***********************************************/
  54620. /*! exports provided: default */
  54621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54622. "use strict";
  54623. __webpack_require__.r(__webpack_exports__);
  54624. /* 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&");
  54625. /* 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&");
  54626. /* 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");
  54627. /* normalize component */
  54628. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54629. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54630. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  54631. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54632. false,
  54633. null,
  54634. null,
  54635. null
  54636. )
  54637. /* hot reload */
  54638. if (false) { var api; }
  54639. component.options.__file = "resources/js/components/assetinfo.vue"
  54640. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54641. /***/ }),
  54642. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  54643. /*!************************************************************************!*\
  54644. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  54645. \************************************************************************/
  54646. /*! exports provided: default */
  54647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54648. "use strict";
  54649. __webpack_require__.r(__webpack_exports__);
  54650. /* 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&");
  54651. /* 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"]);
  54652. /***/ }),
  54653. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  54654. /*!******************************************************************************!*\
  54655. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  54656. \******************************************************************************/
  54657. /*! exports provided: render, staticRenderFns */
  54658. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54659. "use strict";
  54660. __webpack_require__.r(__webpack_exports__);
  54661. /* 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&");
  54662. /* 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"]; });
  54663. /* 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"]; });
  54664. /***/ }),
  54665. /***/ "./resources/js/components/credential.vue":
  54666. /*!************************************************!*\
  54667. !*** ./resources/js/components/credential.vue ***!
  54668. \************************************************/
  54669. /*! exports provided: default */
  54670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54671. "use strict";
  54672. __webpack_require__.r(__webpack_exports__);
  54673. /* 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&");
  54674. /* 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&");
  54675. /* 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");
  54676. /* normalize component */
  54677. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54678. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54679. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  54680. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54681. false,
  54682. null,
  54683. null,
  54684. null
  54685. )
  54686. /* hot reload */
  54687. if (false) { var api; }
  54688. component.options.__file = "resources/js/components/credential.vue"
  54689. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54690. /***/ }),
  54691. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  54692. /*!*************************************************************************!*\
  54693. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  54694. \*************************************************************************/
  54695. /*! exports provided: default */
  54696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54697. "use strict";
  54698. __webpack_require__.r(__webpack_exports__);
  54699. /* 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&");
  54700. /* 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"]);
  54701. /***/ }),
  54702. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  54703. /*!*******************************************************************************!*\
  54704. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  54705. \*******************************************************************************/
  54706. /*! exports provided: render, staticRenderFns */
  54707. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54708. "use strict";
  54709. __webpack_require__.r(__webpack_exports__);
  54710. /* 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&");
  54711. /* 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"]; });
  54712. /* 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"]; });
  54713. /***/ }),
  54714. /***/ "./resources/js/components/modal.vue":
  54715. /*!*******************************************!*\
  54716. !*** ./resources/js/components/modal.vue ***!
  54717. \*******************************************/
  54718. /*! exports provided: default */
  54719. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54720. "use strict";
  54721. __webpack_require__.r(__webpack_exports__);
  54722. /* 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&");
  54723. /* 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");
  54724. var script = {}
  54725. /* normalize component */
  54726. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  54727. script,
  54728. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  54729. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54730. false,
  54731. null,
  54732. null,
  54733. null
  54734. )
  54735. /* hot reload */
  54736. if (false) { var api; }
  54737. component.options.__file = "resources/js/components/modal.vue"
  54738. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54739. /***/ }),
  54740. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  54741. /*!**************************************************************************!*\
  54742. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  54743. \**************************************************************************/
  54744. /*! exports provided: render, staticRenderFns */
  54745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54746. "use strict";
  54747. __webpack_require__.r(__webpack_exports__);
  54748. /* 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&");
  54749. /* 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"]; });
  54750. /* 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"]; });
  54751. /***/ }),
  54752. /***/ "./resources/js/components/notes.vue":
  54753. /*!*******************************************!*\
  54754. !*** ./resources/js/components/notes.vue ***!
  54755. \*******************************************/
  54756. /*! exports provided: default */
  54757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54758. "use strict";
  54759. __webpack_require__.r(__webpack_exports__);
  54760. /* 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&");
  54761. /* 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&");
  54762. /* 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");
  54763. /* normalize component */
  54764. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54765. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54766. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  54767. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54768. false,
  54769. null,
  54770. null,
  54771. null
  54772. )
  54773. /* hot reload */
  54774. if (false) { var api; }
  54775. component.options.__file = "resources/js/components/notes.vue"
  54776. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54777. /***/ }),
  54778. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  54779. /*!********************************************************************!*\
  54780. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  54781. \********************************************************************/
  54782. /*! exports provided: default */
  54783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54784. "use strict";
  54785. __webpack_require__.r(__webpack_exports__);
  54786. /* 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&");
  54787. /* 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"]);
  54788. /***/ }),
  54789. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  54790. /*!**************************************************************************!*\
  54791. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  54792. \**************************************************************************/
  54793. /*! exports provided: render, staticRenderFns */
  54794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54795. "use strict";
  54796. __webpack_require__.r(__webpack_exports__);
  54797. /* 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&");
  54798. /* 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"]; });
  54799. /* 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"]; });
  54800. /***/ }),
  54801. /***/ "./resources/js/components/woinfo.vue":
  54802. /*!********************************************!*\
  54803. !*** ./resources/js/components/woinfo.vue ***!
  54804. \********************************************/
  54805. /*! exports provided: default */
  54806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54807. "use strict";
  54808. __webpack_require__.r(__webpack_exports__);
  54809. /* 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&");
  54810. /* 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&");
  54811. /* 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");
  54812. /* normalize component */
  54813. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54814. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54815. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  54816. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54817. false,
  54818. null,
  54819. null,
  54820. null
  54821. )
  54822. /* hot reload */
  54823. if (false) { var api; }
  54824. component.options.__file = "resources/js/components/woinfo.vue"
  54825. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54826. /***/ }),
  54827. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  54828. /*!*********************************************************************!*\
  54829. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  54830. \*********************************************************************/
  54831. /*! exports provided: default */
  54832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54833. "use strict";
  54834. __webpack_require__.r(__webpack_exports__);
  54835. /* 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&");
  54836. /* 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"]);
  54837. /***/ }),
  54838. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  54839. /*!***************************************************************************!*\
  54840. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  54841. \***************************************************************************/
  54842. /*! exports provided: render, staticRenderFns */
  54843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54844. "use strict";
  54845. __webpack_require__.r(__webpack_exports__);
  54846. /* 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&");
  54847. /* 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"]; });
  54848. /* 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"]; });
  54849. /***/ }),
  54850. /***/ "./resources/js/mixins/dateMixin.js":
  54851. /*!******************************************!*\
  54852. !*** ./resources/js/mixins/dateMixin.js ***!
  54853. \******************************************/
  54854. /*! exports provided: default */
  54855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54856. "use strict";
  54857. __webpack_require__.r(__webpack_exports__);
  54858. /* harmony default export */ __webpack_exports__["default"] = ({
  54859. methods: {
  54860. treatAsUTC: function treatAsUTC(date) {
  54861. var result = new Date(date);
  54862. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  54863. return result;
  54864. },
  54865. daysSinceToday: function daysSinceToday(date) {
  54866. var currentDate = new Date();
  54867. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  54868. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  54869. },
  54870. getHRDate: function getHRDate(dateString) {
  54871. var date = new Date(dateString);
  54872. return date.toLocaleString('default', {
  54873. month: 'short',
  54874. day: 'numeric',
  54875. year: 'numeric',
  54876. hour: 'numeric',
  54877. minute: 'numeric'
  54878. });
  54879. },
  54880. isZero: function isZero(dateString) {
  54881. return dateString === '0000-00-00 00:00:00';
  54882. }
  54883. }
  54884. });
  54885. /***/ }),
  54886. /***/ "./resources/js/notify.min.js":
  54887. /*!************************************!*\
  54888. !*** ./resources/js/notify.min.js ***!
  54889. \************************************/
  54890. /*! no static exports found */
  54891. /***/ (function(module, exports, __webpack_require__) {
  54892. 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); }
  54893. (function (e) {
  54894. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  54895. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  54896. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  54897. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  54898. })(function (e) {
  54899. function A(t, n, i) {
  54900. typeof i == "string" && (i = {
  54901. className: i
  54902. }), 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);
  54903. }
  54904. var t = [].indexOf || function (e) {
  54905. for (var t = 0, n = this.length; t < n; t++) {
  54906. if (t in this && this[t] === e) return t;
  54907. }
  54908. return -1;
  54909. },
  54910. n = "notify",
  54911. r = n + "js",
  54912. i = n + "!blank",
  54913. s = {
  54914. t: "top",
  54915. m: "middle",
  54916. b: "bottom",
  54917. l: "left",
  54918. c: "center",
  54919. r: "right"
  54920. },
  54921. o = ["l", "c", "r"],
  54922. u = ["t", "m", "b"],
  54923. a = ["t", "b", "l", "r"],
  54924. f = {
  54925. t: "b",
  54926. m: null,
  54927. b: "t",
  54928. l: "r",
  54929. c: null,
  54930. r: "l"
  54931. },
  54932. l = function l(t) {
  54933. var n;
  54934. return n = [], e.each(t.split(/\W+/), function (e, t) {
  54935. var r;
  54936. r = t.toLowerCase().charAt(0);
  54937. if (s[r]) return n.push(r);
  54938. }), n;
  54939. },
  54940. c = {},
  54941. h = {
  54942. name: "core",
  54943. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  54944. 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}"
  54945. },
  54946. p = {
  54947. "border-radius": ["-webkit-", "-moz-"]
  54948. },
  54949. d = function d(e) {
  54950. return c[e];
  54951. },
  54952. v = function v(e) {
  54953. if (!e) throw "Missing Style name";
  54954. c[e] && delete c[e];
  54955. },
  54956. m = function m(t, i) {
  54957. if (!t) throw "Missing Style name";
  54958. if (!i) throw "Missing Style definition";
  54959. if (!i.html) throw "Missing Style HTML";
  54960. var s = c[t];
  54961. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  54962. var o = "";
  54963. i.classes && e.each(i.classes, function (t, n) {
  54964. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  54965. return p[t] && e.each(p[t], function (e, r) {
  54966. return o += " " + r + t + ": " + n + ";\n";
  54967. }), o += " " + t + ": " + n + ";\n";
  54968. }), o += "}\n";
  54969. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  54970. var u = {},
  54971. a = e(i.html);
  54972. y("html", a, u), y("text", a, u), i.fields = u;
  54973. },
  54974. g = function g(t) {
  54975. var n, r, i;
  54976. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  54977. try {
  54978. r.html(t);
  54979. } catch (s) {
  54980. r[0].styleSheet.cssText = t;
  54981. }
  54982. return r;
  54983. },
  54984. y = function y(t, n, r) {
  54985. var s;
  54986. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  54987. var n;
  54988. n = e(this).attr(s), n || (n = i), r[n] = t;
  54989. });
  54990. },
  54991. b = function b(e, t) {
  54992. return e.is(t) ? e : e.find(t);
  54993. },
  54994. w = {
  54995. clickToHide: !0,
  54996. autoHide: !0,
  54997. autoHideDelay: 5e3,
  54998. arrowShow: !0,
  54999. arrowSize: 5,
  55000. breakNewLines: !0,
  55001. elementPosition: "bottom",
  55002. globalPosition: "top right",
  55003. style: "bootstrap",
  55004. className: "error",
  55005. showAnimation: "slideDown",
  55006. showDuration: 400,
  55007. hideAnimation: "slideUp",
  55008. hideDuration: 200,
  55009. gap: 5
  55010. },
  55011. E = function E(t, n) {
  55012. var r;
  55013. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55014. },
  55015. S = function S(t) {
  55016. return e.extend(w, t);
  55017. },
  55018. x = function x(t) {
  55019. return e("<" + t + "></" + t + ">");
  55020. },
  55021. T = {},
  55022. N = function N(t) {
  55023. var n;
  55024. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55025. return e(r).attr("name") === t.attr("name");
  55026. }), t = n.first()), t;
  55027. },
  55028. C = function C(e, t, n) {
  55029. var r, i;
  55030. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55031. if (isNaN(n)) return;
  55032. 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;
  55033. },
  55034. k = function k(e, t, n) {
  55035. if (e === "l" || e === "t") return 0;
  55036. if (e === "c" || e === "m") return n / 2 - t / 2;
  55037. if (e === "r" || e === "b") return n - t;
  55038. throw "Invalid alignment";
  55039. },
  55040. L = function L(e) {
  55041. return L.e = L.e || x("div"), L.e.text(e).html();
  55042. };
  55043. A.prototype.loadHTML = function () {
  55044. var t;
  55045. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55046. }, A.prototype.show = function (e, t) {
  55047. var n, r, i, s, o;
  55048. r = function (n) {
  55049. return function () {
  55050. !e && !n.elem && n.destroy();
  55051. if (t) return t();
  55052. };
  55053. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55054. 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 {
  55055. if (!!o || !!e) return r();
  55056. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55057. }
  55058. return n.push(r), i[s].apply(i, n);
  55059. }, A.prototype.setGlobalPosition = function () {
  55060. var t = this.getPosition(),
  55061. n = t[0],
  55062. i = t[1],
  55063. o = s[n],
  55064. u = s[i],
  55065. a = n + "|" + i,
  55066. f = T[a];
  55067. if (!f || !document.body.contains(f[0])) {
  55068. f = T[a] = x("div");
  55069. var l = {};
  55070. 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);
  55071. }
  55072. return f.prepend(this.wrapper);
  55073. }, A.prototype.setElementPosition = function () {
  55074. 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;
  55075. 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"];
  55076. for (w = 0, S = B.length; w < S; w++) {
  55077. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55078. }
  55079. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55080. if (!this.options.arrowShow) this.arrow.hide();else {
  55081. 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";
  55082. for (E = 0, x = a.length; E < x; E++) {
  55083. D = a[E], P = s[D];
  55084. if (D === L) continue;
  55085. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55086. }
  55087. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55088. }
  55089. 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);
  55090. if (r) return this.arrow.removeAttr("style").css(r);
  55091. }, A.prototype.getPosition = function () {
  55092. var e, n, r, i, s, f, c, h;
  55093. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55094. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55095. 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";
  55096. return e.length === 2 && (e[2] = e[1]), e;
  55097. }, A.prototype.getStyle = function (e) {
  55098. var t;
  55099. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55100. if (!t) throw "Missing style: " + e;
  55101. return t;
  55102. }, A.prototype.updateClasses = function () {
  55103. var t, n;
  55104. 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) {
  55105. return r + "-" + n.name + "-" + e;
  55106. }).join(" "), this.userContainer.attr("class", t);
  55107. }, A.prototype.run = function (t, n) {
  55108. var r, s, o, u, a;
  55109. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55110. if (this.container && !t) {
  55111. this.show(!1);
  55112. return;
  55113. }
  55114. if (!this.container && !t) return;
  55115. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55116. for (o in s) {
  55117. r = s[o], u = this.userFields[o];
  55118. if (!u) continue;
  55119. 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);
  55120. }
  55121. 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));
  55122. }, A.prototype.destroy = function () {
  55123. this.wrapper.data(r, null), this.wrapper.remove();
  55124. }, e[n] = function (t, r, i) {
  55125. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55126. }, e.fn[n] = function (t, n) {
  55127. return e(this).each(function () {
  55128. var i = N(e(this)).data(r);
  55129. i && i.destroy();
  55130. var s = new A(e(this), t, n);
  55131. }), this;
  55132. }, e.extend(e[n], {
  55133. defaults: S,
  55134. addStyle: m,
  55135. removeStyle: v,
  55136. pluginOptions: w,
  55137. getStyle: d,
  55138. insertCSS: g
  55139. }), m("bootstrap", {
  55140. html: "<div>\n<span data-notify-text></span>\n</div>",
  55141. classes: {
  55142. base: {
  55143. "font-weight": "bold",
  55144. padding: "8px 15px 8px 14px",
  55145. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55146. "background-color": "#fcf8e3",
  55147. border: "1px solid #fbeed5",
  55148. "border-radius": "4px",
  55149. "white-space": "nowrap",
  55150. "padding-left": "25px",
  55151. "background-repeat": "no-repeat",
  55152. "background-position": "3px 7px"
  55153. },
  55154. error: {
  55155. color: "#B94A48",
  55156. "background-color": "#F2DEDE",
  55157. "border-color": "#EED3D7",
  55158. "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=)"
  55159. },
  55160. success: {
  55161. color: "#468847",
  55162. "background-color": "#DFF0D8",
  55163. "border-color": "#D6E9C6",
  55164. "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==)"
  55165. },
  55166. info: {
  55167. color: "#3A87AD",
  55168. "background-color": "#D9EDF7",
  55169. "border-color": "#BCE8F1",
  55170. "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=)"
  55171. },
  55172. warn: {
  55173. color: "#C09853",
  55174. "background-color": "#FCF8E3",
  55175. "border-color": "#FBEED5",
  55176. "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)"
  55177. }
  55178. }
  55179. }), e(function () {
  55180. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55181. e(this).trigger("notify-hide");
  55182. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55183. var n = e(this).data(r);
  55184. n && n.show(!1);
  55185. });
  55186. });
  55187. });
  55188. /***/ }),
  55189. /***/ "./resources/sass/app.scss":
  55190. /*!*********************************!*\
  55191. !*** ./resources/sass/app.scss ***!
  55192. \*********************************/
  55193. /*! no static exports found */
  55194. /***/ (function(module, exports) {
  55195. // removed by extract-text-webpack-plugin
  55196. /***/ }),
  55197. /***/ 0:
  55198. /*!*************************************************************!*\
  55199. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55200. \*************************************************************/
  55201. /*! no static exports found */
  55202. /***/ (function(module, exports, __webpack_require__) {
  55203. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55204. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55205. /***/ })
  55206. /******/ });