app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603
  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. //
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. //
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. props: ['credential'],
  1752. data: function data() {
  1753. return {
  1754. data: JSON.parse(this.credential)
  1755. };
  1756. },
  1757. mounted: function mounted() {
  1758. var _this = this;
  1759. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1760. _this.data = JSON.parse(e.data);
  1761. });
  1762. },
  1763. methods: {
  1764. rndStr: function rndStr(len) {
  1765. var text = "";
  1766. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1767. for (var i = 0; i < len; i++) {
  1768. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1769. }
  1770. return text;
  1771. },
  1772. getRandomPassword: function getRandomPassword() {
  1773. this.data.credpass = this.rndStr(16);
  1774. }
  1775. }
  1776. });
  1777. /***/ }),
  1778. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1779. /*!****************************************************************************************************************************************************************!*\
  1780. !*** ./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& ***!
  1781. \****************************************************************************************************************************************************************/
  1782. /*! exports provided: default */
  1783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1784. "use strict";
  1785. __webpack_require__.r(__webpack_exports__);
  1786. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1787. //
  1788. //
  1789. //
  1790. //
  1791. //
  1792. //
  1793. //
  1794. //
  1795. //
  1796. //
  1797. //
  1798. //
  1799. //
  1800. //
  1801. //
  1802. //
  1803. //
  1804. //
  1805. //
  1806. //
  1807. //
  1808. //
  1809. //
  1810. //
  1811. /* harmony default export */ __webpack_exports__["default"] = ({
  1812. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1813. props: ['initialnotes', 'authusername'],
  1814. data: function data() {
  1815. return {
  1816. notes: this.initialnotes
  1817. };
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1822. /*!*****************************************************************************************************************************************************************!*\
  1823. !*** ./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& ***!
  1824. \*****************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. //
  1856. //
  1857. //
  1858. //
  1859. //
  1860. //
  1861. //
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. /* harmony default export */ __webpack_exports__["default"] = ({
  1878. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1879. props: ['workOrder'],
  1880. data: function data() {
  1881. return {
  1882. data: JSON.parse(this.workOrder),
  1883. storeList: null
  1884. };
  1885. },
  1886. mounted: function mounted() {
  1887. var _this = this;
  1888. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1889. _this.data = JSON.parse(e.data);
  1890. });
  1891. axios.get('/api/stores').then(function (response) {
  1892. _this.storeList = new Map();
  1893. response.data.map(function (val) {
  1894. _this.storeList.set(val.storeid, val);
  1895. });
  1896. })["catch"](function (error) {
  1897. console.error(error);
  1898. });
  1899. },
  1900. methods: {
  1901. updateWorkOrder: function updateWorkOrder() {
  1902. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {})["catch"](function (error) {});
  1903. $('#workordereditModal').modal('hide');
  1904. }
  1905. }
  1906. });
  1907. /***/ }),
  1908. /***/ "./node_modules/base64-js/index.js":
  1909. /*!*****************************************!*\
  1910. !*** ./node_modules/base64-js/index.js ***!
  1911. \*****************************************/
  1912. /*! no static exports found */
  1913. /***/ (function(module, exports, __webpack_require__) {
  1914. "use strict";
  1915. exports.byteLength = byteLength
  1916. exports.toByteArray = toByteArray
  1917. exports.fromByteArray = fromByteArray
  1918. var lookup = []
  1919. var revLookup = []
  1920. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1921. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1922. for (var i = 0, len = code.length; i < len; ++i) {
  1923. lookup[i] = code[i]
  1924. revLookup[code.charCodeAt(i)] = i
  1925. }
  1926. // Support decoding URL-safe base64 strings, as Node.js does.
  1927. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1928. revLookup['-'.charCodeAt(0)] = 62
  1929. revLookup['_'.charCodeAt(0)] = 63
  1930. function getLens (b64) {
  1931. var len = b64.length
  1932. if (len % 4 > 0) {
  1933. throw new Error('Invalid string. Length must be a multiple of 4')
  1934. }
  1935. // Trim off extra bytes after placeholder bytes are found
  1936. // See: https://github.com/beatgammit/base64-js/issues/42
  1937. var validLen = b64.indexOf('=')
  1938. if (validLen === -1) validLen = len
  1939. var placeHoldersLen = validLen === len
  1940. ? 0
  1941. : 4 - (validLen % 4)
  1942. return [validLen, placeHoldersLen]
  1943. }
  1944. // base64 is 4/3 + up to two characters of the original data
  1945. function byteLength (b64) {
  1946. var lens = getLens(b64)
  1947. var validLen = lens[0]
  1948. var placeHoldersLen = lens[1]
  1949. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1950. }
  1951. function _byteLength (b64, validLen, placeHoldersLen) {
  1952. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1953. }
  1954. function toByteArray (b64) {
  1955. var tmp
  1956. var lens = getLens(b64)
  1957. var validLen = lens[0]
  1958. var placeHoldersLen = lens[1]
  1959. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1960. var curByte = 0
  1961. // if there are placeholders, only get up to the last complete 4 chars
  1962. var len = placeHoldersLen > 0
  1963. ? validLen - 4
  1964. : validLen
  1965. var i
  1966. for (i = 0; i < len; i += 4) {
  1967. tmp =
  1968. (revLookup[b64.charCodeAt(i)] << 18) |
  1969. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1970. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1971. revLookup[b64.charCodeAt(i + 3)]
  1972. arr[curByte++] = (tmp >> 16) & 0xFF
  1973. arr[curByte++] = (tmp >> 8) & 0xFF
  1974. arr[curByte++] = tmp & 0xFF
  1975. }
  1976. if (placeHoldersLen === 2) {
  1977. tmp =
  1978. (revLookup[b64.charCodeAt(i)] << 2) |
  1979. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1980. arr[curByte++] = tmp & 0xFF
  1981. }
  1982. if (placeHoldersLen === 1) {
  1983. tmp =
  1984. (revLookup[b64.charCodeAt(i)] << 10) |
  1985. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1986. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1987. arr[curByte++] = (tmp >> 8) & 0xFF
  1988. arr[curByte++] = tmp & 0xFF
  1989. }
  1990. return arr
  1991. }
  1992. function tripletToBase64 (num) {
  1993. return lookup[num >> 18 & 0x3F] +
  1994. lookup[num >> 12 & 0x3F] +
  1995. lookup[num >> 6 & 0x3F] +
  1996. lookup[num & 0x3F]
  1997. }
  1998. function encodeChunk (uint8, start, end) {
  1999. var tmp
  2000. var output = []
  2001. for (var i = start; i < end; i += 3) {
  2002. tmp =
  2003. ((uint8[i] << 16) & 0xFF0000) +
  2004. ((uint8[i + 1] << 8) & 0xFF00) +
  2005. (uint8[i + 2] & 0xFF)
  2006. output.push(tripletToBase64(tmp))
  2007. }
  2008. return output.join('')
  2009. }
  2010. function fromByteArray (uint8) {
  2011. var tmp
  2012. var len = uint8.length
  2013. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2014. var parts = []
  2015. var maxChunkLength = 16383 // must be multiple of 3
  2016. // go through the array every three bytes, we'll deal with trailing stuff later
  2017. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2018. parts.push(encodeChunk(
  2019. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2020. ))
  2021. }
  2022. // pad the end with zeros, but make sure to not forget the extra bytes
  2023. if (extraBytes === 1) {
  2024. tmp = uint8[len - 1]
  2025. parts.push(
  2026. lookup[tmp >> 2] +
  2027. lookup[(tmp << 4) & 0x3F] +
  2028. '=='
  2029. )
  2030. } else if (extraBytes === 2) {
  2031. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2032. parts.push(
  2033. lookup[tmp >> 10] +
  2034. lookup[(tmp >> 4) & 0x3F] +
  2035. lookup[(tmp << 2) & 0x3F] +
  2036. '='
  2037. )
  2038. }
  2039. return parts.join('')
  2040. }
  2041. /***/ }),
  2042. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2043. /*!*****************************************************!*\
  2044. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2045. \*****************************************************/
  2046. /*! no static exports found */
  2047. /***/ (function(module, exports, __webpack_require__) {
  2048. /*!
  2049. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2050. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2051. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2052. */
  2053. (function (global, factory) {
  2054. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2055. undefined;
  2056. }(this, (function (exports, $, Popper) { 'use strict';
  2057. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2058. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2059. function _defineProperties(target, props) {
  2060. for (var i = 0; i < props.length; i++) {
  2061. var descriptor = props[i];
  2062. descriptor.enumerable = descriptor.enumerable || false;
  2063. descriptor.configurable = true;
  2064. if ("value" in descriptor) descriptor.writable = true;
  2065. Object.defineProperty(target, descriptor.key, descriptor);
  2066. }
  2067. }
  2068. function _createClass(Constructor, protoProps, staticProps) {
  2069. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2070. if (staticProps) _defineProperties(Constructor, staticProps);
  2071. return Constructor;
  2072. }
  2073. function _defineProperty(obj, key, value) {
  2074. if (key in obj) {
  2075. Object.defineProperty(obj, key, {
  2076. value: value,
  2077. enumerable: true,
  2078. configurable: true,
  2079. writable: true
  2080. });
  2081. } else {
  2082. obj[key] = value;
  2083. }
  2084. return obj;
  2085. }
  2086. function ownKeys(object, enumerableOnly) {
  2087. var keys = Object.keys(object);
  2088. if (Object.getOwnPropertySymbols) {
  2089. var symbols = Object.getOwnPropertySymbols(object);
  2090. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2091. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2092. });
  2093. keys.push.apply(keys, symbols);
  2094. }
  2095. return keys;
  2096. }
  2097. function _objectSpread2(target) {
  2098. for (var i = 1; i < arguments.length; i++) {
  2099. var source = arguments[i] != null ? arguments[i] : {};
  2100. if (i % 2) {
  2101. ownKeys(Object(source), true).forEach(function (key) {
  2102. _defineProperty(target, key, source[key]);
  2103. });
  2104. } else if (Object.getOwnPropertyDescriptors) {
  2105. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2106. } else {
  2107. ownKeys(Object(source)).forEach(function (key) {
  2108. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2109. });
  2110. }
  2111. }
  2112. return target;
  2113. }
  2114. function _inheritsLoose(subClass, superClass) {
  2115. subClass.prototype = Object.create(superClass.prototype);
  2116. subClass.prototype.constructor = subClass;
  2117. subClass.__proto__ = superClass;
  2118. }
  2119. /**
  2120. * --------------------------------------------------------------------------
  2121. * Bootstrap (v4.4.1): util.js
  2122. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2123. * --------------------------------------------------------------------------
  2124. */
  2125. /**
  2126. * ------------------------------------------------------------------------
  2127. * Private TransitionEnd Helpers
  2128. * ------------------------------------------------------------------------
  2129. */
  2130. var TRANSITION_END = 'transitionend';
  2131. var MAX_UID = 1000000;
  2132. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2133. function toType(obj) {
  2134. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2135. }
  2136. function getSpecialTransitionEndEvent() {
  2137. return {
  2138. bindType: TRANSITION_END,
  2139. delegateType: TRANSITION_END,
  2140. handle: function handle(event) {
  2141. if ($(event.target).is(this)) {
  2142. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2143. }
  2144. return undefined; // eslint-disable-line no-undefined
  2145. }
  2146. };
  2147. }
  2148. function transitionEndEmulator(duration) {
  2149. var _this = this;
  2150. var called = false;
  2151. $(this).one(Util.TRANSITION_END, function () {
  2152. called = true;
  2153. });
  2154. setTimeout(function () {
  2155. if (!called) {
  2156. Util.triggerTransitionEnd(_this);
  2157. }
  2158. }, duration);
  2159. return this;
  2160. }
  2161. function setTransitionEndSupport() {
  2162. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2163. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2164. }
  2165. /**
  2166. * --------------------------------------------------------------------------
  2167. * Public Util Api
  2168. * --------------------------------------------------------------------------
  2169. */
  2170. var Util = {
  2171. TRANSITION_END: 'bsTransitionEnd',
  2172. getUID: function getUID(prefix) {
  2173. do {
  2174. // eslint-disable-next-line no-bitwise
  2175. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2176. } while (document.getElementById(prefix));
  2177. return prefix;
  2178. },
  2179. getSelectorFromElement: function getSelectorFromElement(element) {
  2180. var selector = element.getAttribute('data-target');
  2181. if (!selector || selector === '#') {
  2182. var hrefAttr = element.getAttribute('href');
  2183. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2184. }
  2185. try {
  2186. return document.querySelector(selector) ? selector : null;
  2187. } catch (err) {
  2188. return null;
  2189. }
  2190. },
  2191. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2192. if (!element) {
  2193. return 0;
  2194. } // Get transition-duration of the element
  2195. var transitionDuration = $(element).css('transition-duration');
  2196. var transitionDelay = $(element).css('transition-delay');
  2197. var floatTransitionDuration = parseFloat(transitionDuration);
  2198. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2199. if (!floatTransitionDuration && !floatTransitionDelay) {
  2200. return 0;
  2201. } // If multiple durations are defined, take the first
  2202. transitionDuration = transitionDuration.split(',')[0];
  2203. transitionDelay = transitionDelay.split(',')[0];
  2204. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2205. },
  2206. reflow: function reflow(element) {
  2207. return element.offsetHeight;
  2208. },
  2209. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2210. $(element).trigger(TRANSITION_END);
  2211. },
  2212. // TODO: Remove in v5
  2213. supportsTransitionEnd: function supportsTransitionEnd() {
  2214. return Boolean(TRANSITION_END);
  2215. },
  2216. isElement: function isElement(obj) {
  2217. return (obj[0] || obj).nodeType;
  2218. },
  2219. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2220. for (var property in configTypes) {
  2221. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2222. var expectedTypes = configTypes[property];
  2223. var value = config[property];
  2224. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2225. if (!new RegExp(expectedTypes).test(valueType)) {
  2226. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2227. }
  2228. }
  2229. }
  2230. },
  2231. findShadowRoot: function findShadowRoot(element) {
  2232. if (!document.documentElement.attachShadow) {
  2233. return null;
  2234. } // Can find the shadow root otherwise it'll return the document
  2235. if (typeof element.getRootNode === 'function') {
  2236. var root = element.getRootNode();
  2237. return root instanceof ShadowRoot ? root : null;
  2238. }
  2239. if (element instanceof ShadowRoot) {
  2240. return element;
  2241. } // when we don't find a shadow root
  2242. if (!element.parentNode) {
  2243. return null;
  2244. }
  2245. return Util.findShadowRoot(element.parentNode);
  2246. },
  2247. jQueryDetection: function jQueryDetection() {
  2248. if (typeof $ === 'undefined') {
  2249. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2250. }
  2251. var version = $.fn.jquery.split(' ')[0].split('.');
  2252. var minMajor = 1;
  2253. var ltMajor = 2;
  2254. var minMinor = 9;
  2255. var minPatch = 1;
  2256. var maxMajor = 4;
  2257. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2258. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2259. }
  2260. }
  2261. };
  2262. Util.jQueryDetection();
  2263. setTransitionEndSupport();
  2264. /**
  2265. * ------------------------------------------------------------------------
  2266. * Constants
  2267. * ------------------------------------------------------------------------
  2268. */
  2269. var NAME = 'alert';
  2270. var VERSION = '4.4.1';
  2271. var DATA_KEY = 'bs.alert';
  2272. var EVENT_KEY = "." + DATA_KEY;
  2273. var DATA_API_KEY = '.data-api';
  2274. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2275. var Selector = {
  2276. DISMISS: '[data-dismiss="alert"]'
  2277. };
  2278. var Event = {
  2279. CLOSE: "close" + EVENT_KEY,
  2280. CLOSED: "closed" + EVENT_KEY,
  2281. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2282. };
  2283. var ClassName = {
  2284. ALERT: 'alert',
  2285. FADE: 'fade',
  2286. SHOW: 'show'
  2287. };
  2288. /**
  2289. * ------------------------------------------------------------------------
  2290. * Class Definition
  2291. * ------------------------------------------------------------------------
  2292. */
  2293. var Alert =
  2294. /*#__PURE__*/
  2295. function () {
  2296. function Alert(element) {
  2297. this._element = element;
  2298. } // Getters
  2299. var _proto = Alert.prototype;
  2300. // Public
  2301. _proto.close = function close(element) {
  2302. var rootElement = this._element;
  2303. if (element) {
  2304. rootElement = this._getRootElement(element);
  2305. }
  2306. var customEvent = this._triggerCloseEvent(rootElement);
  2307. if (customEvent.isDefaultPrevented()) {
  2308. return;
  2309. }
  2310. this._removeElement(rootElement);
  2311. };
  2312. _proto.dispose = function dispose() {
  2313. $.removeData(this._element, DATA_KEY);
  2314. this._element = null;
  2315. } // Private
  2316. ;
  2317. _proto._getRootElement = function _getRootElement(element) {
  2318. var selector = Util.getSelectorFromElement(element);
  2319. var parent = false;
  2320. if (selector) {
  2321. parent = document.querySelector(selector);
  2322. }
  2323. if (!parent) {
  2324. parent = $(element).closest("." + ClassName.ALERT)[0];
  2325. }
  2326. return parent;
  2327. };
  2328. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2329. var closeEvent = $.Event(Event.CLOSE);
  2330. $(element).trigger(closeEvent);
  2331. return closeEvent;
  2332. };
  2333. _proto._removeElement = function _removeElement(element) {
  2334. var _this = this;
  2335. $(element).removeClass(ClassName.SHOW);
  2336. if (!$(element).hasClass(ClassName.FADE)) {
  2337. this._destroyElement(element);
  2338. return;
  2339. }
  2340. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2341. $(element).one(Util.TRANSITION_END, function (event) {
  2342. return _this._destroyElement(element, event);
  2343. }).emulateTransitionEnd(transitionDuration);
  2344. };
  2345. _proto._destroyElement = function _destroyElement(element) {
  2346. $(element).detach().trigger(Event.CLOSED).remove();
  2347. } // Static
  2348. ;
  2349. Alert._jQueryInterface = function _jQueryInterface(config) {
  2350. return this.each(function () {
  2351. var $element = $(this);
  2352. var data = $element.data(DATA_KEY);
  2353. if (!data) {
  2354. data = new Alert(this);
  2355. $element.data(DATA_KEY, data);
  2356. }
  2357. if (config === 'close') {
  2358. data[config](this);
  2359. }
  2360. });
  2361. };
  2362. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2363. return function (event) {
  2364. if (event) {
  2365. event.preventDefault();
  2366. }
  2367. alertInstance.close(this);
  2368. };
  2369. };
  2370. _createClass(Alert, null, [{
  2371. key: "VERSION",
  2372. get: function get() {
  2373. return VERSION;
  2374. }
  2375. }]);
  2376. return Alert;
  2377. }();
  2378. /**
  2379. * ------------------------------------------------------------------------
  2380. * Data Api implementation
  2381. * ------------------------------------------------------------------------
  2382. */
  2383. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2384. /**
  2385. * ------------------------------------------------------------------------
  2386. * jQuery
  2387. * ------------------------------------------------------------------------
  2388. */
  2389. $.fn[NAME] = Alert._jQueryInterface;
  2390. $.fn[NAME].Constructor = Alert;
  2391. $.fn[NAME].noConflict = function () {
  2392. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2393. return Alert._jQueryInterface;
  2394. };
  2395. /**
  2396. * ------------------------------------------------------------------------
  2397. * Constants
  2398. * ------------------------------------------------------------------------
  2399. */
  2400. var NAME$1 = 'button';
  2401. var VERSION$1 = '4.4.1';
  2402. var DATA_KEY$1 = 'bs.button';
  2403. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2404. var DATA_API_KEY$1 = '.data-api';
  2405. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2406. var ClassName$1 = {
  2407. ACTIVE: 'active',
  2408. BUTTON: 'btn',
  2409. FOCUS: 'focus'
  2410. };
  2411. var Selector$1 = {
  2412. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2413. DATA_TOGGLES: '[data-toggle="buttons"]',
  2414. DATA_TOGGLE: '[data-toggle="button"]',
  2415. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2416. INPUT: 'input:not([type="hidden"])',
  2417. ACTIVE: '.active',
  2418. BUTTON: '.btn'
  2419. };
  2420. var Event$1 = {
  2421. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2422. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2423. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2424. };
  2425. /**
  2426. * ------------------------------------------------------------------------
  2427. * Class Definition
  2428. * ------------------------------------------------------------------------
  2429. */
  2430. var Button =
  2431. /*#__PURE__*/
  2432. function () {
  2433. function Button(element) {
  2434. this._element = element;
  2435. } // Getters
  2436. var _proto = Button.prototype;
  2437. // Public
  2438. _proto.toggle = function toggle() {
  2439. var triggerChangeEvent = true;
  2440. var addAriaPressed = true;
  2441. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2442. if (rootElement) {
  2443. var input = this._element.querySelector(Selector$1.INPUT);
  2444. if (input) {
  2445. if (input.type === 'radio') {
  2446. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2447. triggerChangeEvent = false;
  2448. } else {
  2449. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2450. if (activeElement) {
  2451. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2452. }
  2453. }
  2454. } else if (input.type === 'checkbox') {
  2455. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2456. triggerChangeEvent = false;
  2457. }
  2458. } else {
  2459. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2460. triggerChangeEvent = false;
  2461. }
  2462. if (triggerChangeEvent) {
  2463. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2464. $(input).trigger('change');
  2465. }
  2466. input.focus();
  2467. addAriaPressed = false;
  2468. }
  2469. }
  2470. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2471. if (addAriaPressed) {
  2472. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2473. }
  2474. if (triggerChangeEvent) {
  2475. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2476. }
  2477. }
  2478. };
  2479. _proto.dispose = function dispose() {
  2480. $.removeData(this._element, DATA_KEY$1);
  2481. this._element = null;
  2482. } // Static
  2483. ;
  2484. Button._jQueryInterface = function _jQueryInterface(config) {
  2485. return this.each(function () {
  2486. var data = $(this).data(DATA_KEY$1);
  2487. if (!data) {
  2488. data = new Button(this);
  2489. $(this).data(DATA_KEY$1, data);
  2490. }
  2491. if (config === 'toggle') {
  2492. data[config]();
  2493. }
  2494. });
  2495. };
  2496. _createClass(Button, null, [{
  2497. key: "VERSION",
  2498. get: function get() {
  2499. return VERSION$1;
  2500. }
  2501. }]);
  2502. return Button;
  2503. }();
  2504. /**
  2505. * ------------------------------------------------------------------------
  2506. * Data Api implementation
  2507. * ------------------------------------------------------------------------
  2508. */
  2509. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2510. var button = event.target;
  2511. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2512. button = $(button).closest(Selector$1.BUTTON)[0];
  2513. }
  2514. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2515. event.preventDefault(); // work around Firefox bug #1540995
  2516. } else {
  2517. var inputBtn = button.querySelector(Selector$1.INPUT);
  2518. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2519. event.preventDefault(); // work around Firefox bug #1540995
  2520. return;
  2521. }
  2522. Button._jQueryInterface.call($(button), 'toggle');
  2523. }
  2524. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2525. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2526. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2527. });
  2528. $(window).on(Event$1.LOAD_DATA_API, function () {
  2529. // ensure correct active class is set to match the controls' actual values/states
  2530. // find all checkboxes/readio buttons inside data-toggle groups
  2531. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2532. for (var i = 0, len = buttons.length; i < len; i++) {
  2533. var button = buttons[i];
  2534. var input = button.querySelector(Selector$1.INPUT);
  2535. if (input.checked || input.hasAttribute('checked')) {
  2536. button.classList.add(ClassName$1.ACTIVE);
  2537. } else {
  2538. button.classList.remove(ClassName$1.ACTIVE);
  2539. }
  2540. } // find all button toggles
  2541. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2542. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2543. var _button = buttons[_i];
  2544. if (_button.getAttribute('aria-pressed') === 'true') {
  2545. _button.classList.add(ClassName$1.ACTIVE);
  2546. } else {
  2547. _button.classList.remove(ClassName$1.ACTIVE);
  2548. }
  2549. }
  2550. });
  2551. /**
  2552. * ------------------------------------------------------------------------
  2553. * jQuery
  2554. * ------------------------------------------------------------------------
  2555. */
  2556. $.fn[NAME$1] = Button._jQueryInterface;
  2557. $.fn[NAME$1].Constructor = Button;
  2558. $.fn[NAME$1].noConflict = function () {
  2559. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2560. return Button._jQueryInterface;
  2561. };
  2562. /**
  2563. * ------------------------------------------------------------------------
  2564. * Constants
  2565. * ------------------------------------------------------------------------
  2566. */
  2567. var NAME$2 = 'carousel';
  2568. var VERSION$2 = '4.4.1';
  2569. var DATA_KEY$2 = 'bs.carousel';
  2570. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2571. var DATA_API_KEY$2 = '.data-api';
  2572. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2573. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2574. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2575. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2576. var SWIPE_THRESHOLD = 40;
  2577. var Default = {
  2578. interval: 5000,
  2579. keyboard: true,
  2580. slide: false,
  2581. pause: 'hover',
  2582. wrap: true,
  2583. touch: true
  2584. };
  2585. var DefaultType = {
  2586. interval: '(number|boolean)',
  2587. keyboard: 'boolean',
  2588. slide: '(boolean|string)',
  2589. pause: '(string|boolean)',
  2590. wrap: 'boolean',
  2591. touch: 'boolean'
  2592. };
  2593. var Direction = {
  2594. NEXT: 'next',
  2595. PREV: 'prev',
  2596. LEFT: 'left',
  2597. RIGHT: 'right'
  2598. };
  2599. var Event$2 = {
  2600. SLIDE: "slide" + EVENT_KEY$2,
  2601. SLID: "slid" + EVENT_KEY$2,
  2602. KEYDOWN: "keydown" + EVENT_KEY$2,
  2603. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2604. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2605. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2606. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2607. TOUCHEND: "touchend" + EVENT_KEY$2,
  2608. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2609. POINTERUP: "pointerup" + EVENT_KEY$2,
  2610. DRAG_START: "dragstart" + EVENT_KEY$2,
  2611. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2612. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2613. };
  2614. var ClassName$2 = {
  2615. CAROUSEL: 'carousel',
  2616. ACTIVE: 'active',
  2617. SLIDE: 'slide',
  2618. RIGHT: 'carousel-item-right',
  2619. LEFT: 'carousel-item-left',
  2620. NEXT: 'carousel-item-next',
  2621. PREV: 'carousel-item-prev',
  2622. ITEM: 'carousel-item',
  2623. POINTER_EVENT: 'pointer-event'
  2624. };
  2625. var Selector$2 = {
  2626. ACTIVE: '.active',
  2627. ACTIVE_ITEM: '.active.carousel-item',
  2628. ITEM: '.carousel-item',
  2629. ITEM_IMG: '.carousel-item img',
  2630. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2631. INDICATORS: '.carousel-indicators',
  2632. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2633. DATA_RIDE: '[data-ride="carousel"]'
  2634. };
  2635. var PointerType = {
  2636. TOUCH: 'touch',
  2637. PEN: 'pen'
  2638. };
  2639. /**
  2640. * ------------------------------------------------------------------------
  2641. * Class Definition
  2642. * ------------------------------------------------------------------------
  2643. */
  2644. var Carousel =
  2645. /*#__PURE__*/
  2646. function () {
  2647. function Carousel(element, config) {
  2648. this._items = null;
  2649. this._interval = null;
  2650. this._activeElement = null;
  2651. this._isPaused = false;
  2652. this._isSliding = false;
  2653. this.touchTimeout = null;
  2654. this.touchStartX = 0;
  2655. this.touchDeltaX = 0;
  2656. this._config = this._getConfig(config);
  2657. this._element = element;
  2658. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2659. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2660. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2661. this._addEventListeners();
  2662. } // Getters
  2663. var _proto = Carousel.prototype;
  2664. // Public
  2665. _proto.next = function next() {
  2666. if (!this._isSliding) {
  2667. this._slide(Direction.NEXT);
  2668. }
  2669. };
  2670. _proto.nextWhenVisible = function nextWhenVisible() {
  2671. // Don't call next when the page isn't visible
  2672. // or the carousel or its parent isn't visible
  2673. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2674. this.next();
  2675. }
  2676. };
  2677. _proto.prev = function prev() {
  2678. if (!this._isSliding) {
  2679. this._slide(Direction.PREV);
  2680. }
  2681. };
  2682. _proto.pause = function pause(event) {
  2683. if (!event) {
  2684. this._isPaused = true;
  2685. }
  2686. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2687. Util.triggerTransitionEnd(this._element);
  2688. this.cycle(true);
  2689. }
  2690. clearInterval(this._interval);
  2691. this._interval = null;
  2692. };
  2693. _proto.cycle = function cycle(event) {
  2694. if (!event) {
  2695. this._isPaused = false;
  2696. }
  2697. if (this._interval) {
  2698. clearInterval(this._interval);
  2699. this._interval = null;
  2700. }
  2701. if (this._config.interval && !this._isPaused) {
  2702. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2703. }
  2704. };
  2705. _proto.to = function to(index) {
  2706. var _this = this;
  2707. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2708. var activeIndex = this._getItemIndex(this._activeElement);
  2709. if (index > this._items.length - 1 || index < 0) {
  2710. return;
  2711. }
  2712. if (this._isSliding) {
  2713. $(this._element).one(Event$2.SLID, function () {
  2714. return _this.to(index);
  2715. });
  2716. return;
  2717. }
  2718. if (activeIndex === index) {
  2719. this.pause();
  2720. this.cycle();
  2721. return;
  2722. }
  2723. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2724. this._slide(direction, this._items[index]);
  2725. };
  2726. _proto.dispose = function dispose() {
  2727. $(this._element).off(EVENT_KEY$2);
  2728. $.removeData(this._element, DATA_KEY$2);
  2729. this._items = null;
  2730. this._config = null;
  2731. this._element = null;
  2732. this._interval = null;
  2733. this._isPaused = null;
  2734. this._isSliding = null;
  2735. this._activeElement = null;
  2736. this._indicatorsElement = null;
  2737. } // Private
  2738. ;
  2739. _proto._getConfig = function _getConfig(config) {
  2740. config = _objectSpread2({}, Default, {}, config);
  2741. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2742. return config;
  2743. };
  2744. _proto._handleSwipe = function _handleSwipe() {
  2745. var absDeltax = Math.abs(this.touchDeltaX);
  2746. if (absDeltax <= SWIPE_THRESHOLD) {
  2747. return;
  2748. }
  2749. var direction = absDeltax / this.touchDeltaX;
  2750. this.touchDeltaX = 0; // swipe left
  2751. if (direction > 0) {
  2752. this.prev();
  2753. } // swipe right
  2754. if (direction < 0) {
  2755. this.next();
  2756. }
  2757. };
  2758. _proto._addEventListeners = function _addEventListeners() {
  2759. var _this2 = this;
  2760. if (this._config.keyboard) {
  2761. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2762. return _this2._keydown(event);
  2763. });
  2764. }
  2765. if (this._config.pause === 'hover') {
  2766. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2767. return _this2.pause(event);
  2768. }).on(Event$2.MOUSELEAVE, function (event) {
  2769. return _this2.cycle(event);
  2770. });
  2771. }
  2772. if (this._config.touch) {
  2773. this._addTouchEventListeners();
  2774. }
  2775. };
  2776. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2777. var _this3 = this;
  2778. if (!this._touchSupported) {
  2779. return;
  2780. }
  2781. var start = function start(event) {
  2782. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2783. _this3.touchStartX = event.originalEvent.clientX;
  2784. } else if (!_this3._pointerEvent) {
  2785. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2786. }
  2787. };
  2788. var move = function move(event) {
  2789. // ensure swiping with one touch and not pinching
  2790. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2791. _this3.touchDeltaX = 0;
  2792. } else {
  2793. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2794. }
  2795. };
  2796. var end = function end(event) {
  2797. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2798. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2799. }
  2800. _this3._handleSwipe();
  2801. if (_this3._config.pause === 'hover') {
  2802. // If it's a touch-enabled device, mouseenter/leave are fired as
  2803. // part of the mouse compatibility events on first tap - the carousel
  2804. // would stop cycling until user tapped out of it;
  2805. // here, we listen for touchend, explicitly pause the carousel
  2806. // (as if it's the second time we tap on it, mouseenter compat event
  2807. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2808. // events to fire) we explicitly restart cycling
  2809. _this3.pause();
  2810. if (_this3.touchTimeout) {
  2811. clearTimeout(_this3.touchTimeout);
  2812. }
  2813. _this3.touchTimeout = setTimeout(function (event) {
  2814. return _this3.cycle(event);
  2815. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2816. }
  2817. };
  2818. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2819. return e.preventDefault();
  2820. });
  2821. if (this._pointerEvent) {
  2822. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2823. return start(event);
  2824. });
  2825. $(this._element).on(Event$2.POINTERUP, function (event) {
  2826. return end(event);
  2827. });
  2828. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2829. } else {
  2830. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2831. return start(event);
  2832. });
  2833. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2834. return move(event);
  2835. });
  2836. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2837. return end(event);
  2838. });
  2839. }
  2840. };
  2841. _proto._keydown = function _keydown(event) {
  2842. if (/input|textarea/i.test(event.target.tagName)) {
  2843. return;
  2844. }
  2845. switch (event.which) {
  2846. case ARROW_LEFT_KEYCODE:
  2847. event.preventDefault();
  2848. this.prev();
  2849. break;
  2850. case ARROW_RIGHT_KEYCODE:
  2851. event.preventDefault();
  2852. this.next();
  2853. break;
  2854. }
  2855. };
  2856. _proto._getItemIndex = function _getItemIndex(element) {
  2857. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2858. return this._items.indexOf(element);
  2859. };
  2860. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2861. var isNextDirection = direction === Direction.NEXT;
  2862. var isPrevDirection = direction === Direction.PREV;
  2863. var activeIndex = this._getItemIndex(activeElement);
  2864. var lastItemIndex = this._items.length - 1;
  2865. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2866. if (isGoingToWrap && !this._config.wrap) {
  2867. return activeElement;
  2868. }
  2869. var delta = direction === Direction.PREV ? -1 : 1;
  2870. var itemIndex = (activeIndex + delta) % this._items.length;
  2871. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2872. };
  2873. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2874. var targetIndex = this._getItemIndex(relatedTarget);
  2875. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2876. var slideEvent = $.Event(Event$2.SLIDE, {
  2877. relatedTarget: relatedTarget,
  2878. direction: eventDirectionName,
  2879. from: fromIndex,
  2880. to: targetIndex
  2881. });
  2882. $(this._element).trigger(slideEvent);
  2883. return slideEvent;
  2884. };
  2885. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2886. if (this._indicatorsElement) {
  2887. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2888. $(indicators).removeClass(ClassName$2.ACTIVE);
  2889. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2890. if (nextIndicator) {
  2891. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2892. }
  2893. }
  2894. };
  2895. _proto._slide = function _slide(direction, element) {
  2896. var _this4 = this;
  2897. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2898. var activeElementIndex = this._getItemIndex(activeElement);
  2899. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2900. var nextElementIndex = this._getItemIndex(nextElement);
  2901. var isCycling = Boolean(this._interval);
  2902. var directionalClassName;
  2903. var orderClassName;
  2904. var eventDirectionName;
  2905. if (direction === Direction.NEXT) {
  2906. directionalClassName = ClassName$2.LEFT;
  2907. orderClassName = ClassName$2.NEXT;
  2908. eventDirectionName = Direction.LEFT;
  2909. } else {
  2910. directionalClassName = ClassName$2.RIGHT;
  2911. orderClassName = ClassName$2.PREV;
  2912. eventDirectionName = Direction.RIGHT;
  2913. }
  2914. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2915. this._isSliding = false;
  2916. return;
  2917. }
  2918. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2919. if (slideEvent.isDefaultPrevented()) {
  2920. return;
  2921. }
  2922. if (!activeElement || !nextElement) {
  2923. // Some weirdness is happening, so we bail
  2924. return;
  2925. }
  2926. this._isSliding = true;
  2927. if (isCycling) {
  2928. this.pause();
  2929. }
  2930. this._setActiveIndicatorElement(nextElement);
  2931. var slidEvent = $.Event(Event$2.SLID, {
  2932. relatedTarget: nextElement,
  2933. direction: eventDirectionName,
  2934. from: activeElementIndex,
  2935. to: nextElementIndex
  2936. });
  2937. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2938. $(nextElement).addClass(orderClassName);
  2939. Util.reflow(nextElement);
  2940. $(activeElement).addClass(directionalClassName);
  2941. $(nextElement).addClass(directionalClassName);
  2942. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2943. if (nextElementInterval) {
  2944. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2945. this._config.interval = nextElementInterval;
  2946. } else {
  2947. this._config.interval = this._config.defaultInterval || this._config.interval;
  2948. }
  2949. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2950. $(activeElement).one(Util.TRANSITION_END, function () {
  2951. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2952. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2953. _this4._isSliding = false;
  2954. setTimeout(function () {
  2955. return $(_this4._element).trigger(slidEvent);
  2956. }, 0);
  2957. }).emulateTransitionEnd(transitionDuration);
  2958. } else {
  2959. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2960. $(nextElement).addClass(ClassName$2.ACTIVE);
  2961. this._isSliding = false;
  2962. $(this._element).trigger(slidEvent);
  2963. }
  2964. if (isCycling) {
  2965. this.cycle();
  2966. }
  2967. } // Static
  2968. ;
  2969. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2970. return this.each(function () {
  2971. var data = $(this).data(DATA_KEY$2);
  2972. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2973. if (typeof config === 'object') {
  2974. _config = _objectSpread2({}, _config, {}, config);
  2975. }
  2976. var action = typeof config === 'string' ? config : _config.slide;
  2977. if (!data) {
  2978. data = new Carousel(this, _config);
  2979. $(this).data(DATA_KEY$2, data);
  2980. }
  2981. if (typeof config === 'number') {
  2982. data.to(config);
  2983. } else if (typeof action === 'string') {
  2984. if (typeof data[action] === 'undefined') {
  2985. throw new TypeError("No method named \"" + action + "\"");
  2986. }
  2987. data[action]();
  2988. } else if (_config.interval && _config.ride) {
  2989. data.pause();
  2990. data.cycle();
  2991. }
  2992. });
  2993. };
  2994. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2995. var selector = Util.getSelectorFromElement(this);
  2996. if (!selector) {
  2997. return;
  2998. }
  2999. var target = $(selector)[0];
  3000. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3001. return;
  3002. }
  3003. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3004. var slideIndex = this.getAttribute('data-slide-to');
  3005. if (slideIndex) {
  3006. config.interval = false;
  3007. }
  3008. Carousel._jQueryInterface.call($(target), config);
  3009. if (slideIndex) {
  3010. $(target).data(DATA_KEY$2).to(slideIndex);
  3011. }
  3012. event.preventDefault();
  3013. };
  3014. _createClass(Carousel, null, [{
  3015. key: "VERSION",
  3016. get: function get() {
  3017. return VERSION$2;
  3018. }
  3019. }, {
  3020. key: "Default",
  3021. get: function get() {
  3022. return Default;
  3023. }
  3024. }]);
  3025. return Carousel;
  3026. }();
  3027. /**
  3028. * ------------------------------------------------------------------------
  3029. * Data Api implementation
  3030. * ------------------------------------------------------------------------
  3031. */
  3032. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3033. $(window).on(Event$2.LOAD_DATA_API, function () {
  3034. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3035. for (var i = 0, len = carousels.length; i < len; i++) {
  3036. var $carousel = $(carousels[i]);
  3037. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3038. }
  3039. });
  3040. /**
  3041. * ------------------------------------------------------------------------
  3042. * jQuery
  3043. * ------------------------------------------------------------------------
  3044. */
  3045. $.fn[NAME$2] = Carousel._jQueryInterface;
  3046. $.fn[NAME$2].Constructor = Carousel;
  3047. $.fn[NAME$2].noConflict = function () {
  3048. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3049. return Carousel._jQueryInterface;
  3050. };
  3051. /**
  3052. * ------------------------------------------------------------------------
  3053. * Constants
  3054. * ------------------------------------------------------------------------
  3055. */
  3056. var NAME$3 = 'collapse';
  3057. var VERSION$3 = '4.4.1';
  3058. var DATA_KEY$3 = 'bs.collapse';
  3059. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3060. var DATA_API_KEY$3 = '.data-api';
  3061. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3062. var Default$1 = {
  3063. toggle: true,
  3064. parent: ''
  3065. };
  3066. var DefaultType$1 = {
  3067. toggle: 'boolean',
  3068. parent: '(string|element)'
  3069. };
  3070. var Event$3 = {
  3071. SHOW: "show" + EVENT_KEY$3,
  3072. SHOWN: "shown" + EVENT_KEY$3,
  3073. HIDE: "hide" + EVENT_KEY$3,
  3074. HIDDEN: "hidden" + EVENT_KEY$3,
  3075. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3076. };
  3077. var ClassName$3 = {
  3078. SHOW: 'show',
  3079. COLLAPSE: 'collapse',
  3080. COLLAPSING: 'collapsing',
  3081. COLLAPSED: 'collapsed'
  3082. };
  3083. var Dimension = {
  3084. WIDTH: 'width',
  3085. HEIGHT: 'height'
  3086. };
  3087. var Selector$3 = {
  3088. ACTIVES: '.show, .collapsing',
  3089. DATA_TOGGLE: '[data-toggle="collapse"]'
  3090. };
  3091. /**
  3092. * ------------------------------------------------------------------------
  3093. * Class Definition
  3094. * ------------------------------------------------------------------------
  3095. */
  3096. var Collapse =
  3097. /*#__PURE__*/
  3098. function () {
  3099. function Collapse(element, config) {
  3100. this._isTransitioning = false;
  3101. this._element = element;
  3102. this._config = this._getConfig(config);
  3103. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3104. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3105. for (var i = 0, len = toggleList.length; i < len; i++) {
  3106. var elem = toggleList[i];
  3107. var selector = Util.getSelectorFromElement(elem);
  3108. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3109. return foundElem === element;
  3110. });
  3111. if (selector !== null && filterElement.length > 0) {
  3112. this._selector = selector;
  3113. this._triggerArray.push(elem);
  3114. }
  3115. }
  3116. this._parent = this._config.parent ? this._getParent() : null;
  3117. if (!this._config.parent) {
  3118. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3119. }
  3120. if (this._config.toggle) {
  3121. this.toggle();
  3122. }
  3123. } // Getters
  3124. var _proto = Collapse.prototype;
  3125. // Public
  3126. _proto.toggle = function toggle() {
  3127. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3128. this.hide();
  3129. } else {
  3130. this.show();
  3131. }
  3132. };
  3133. _proto.show = function show() {
  3134. var _this = this;
  3135. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3136. return;
  3137. }
  3138. var actives;
  3139. var activesData;
  3140. if (this._parent) {
  3141. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3142. if (typeof _this._config.parent === 'string') {
  3143. return elem.getAttribute('data-parent') === _this._config.parent;
  3144. }
  3145. return elem.classList.contains(ClassName$3.COLLAPSE);
  3146. });
  3147. if (actives.length === 0) {
  3148. actives = null;
  3149. }
  3150. }
  3151. if (actives) {
  3152. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3153. if (activesData && activesData._isTransitioning) {
  3154. return;
  3155. }
  3156. }
  3157. var startEvent = $.Event(Event$3.SHOW);
  3158. $(this._element).trigger(startEvent);
  3159. if (startEvent.isDefaultPrevented()) {
  3160. return;
  3161. }
  3162. if (actives) {
  3163. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3164. if (!activesData) {
  3165. $(actives).data(DATA_KEY$3, null);
  3166. }
  3167. }
  3168. var dimension = this._getDimension();
  3169. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3170. this._element.style[dimension] = 0;
  3171. if (this._triggerArray.length) {
  3172. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3173. }
  3174. this.setTransitioning(true);
  3175. var complete = function complete() {
  3176. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3177. _this._element.style[dimension] = '';
  3178. _this.setTransitioning(false);
  3179. $(_this._element).trigger(Event$3.SHOWN);
  3180. };
  3181. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3182. var scrollSize = "scroll" + capitalizedDimension;
  3183. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3184. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3185. this._element.style[dimension] = this._element[scrollSize] + "px";
  3186. };
  3187. _proto.hide = function hide() {
  3188. var _this2 = this;
  3189. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3190. return;
  3191. }
  3192. var startEvent = $.Event(Event$3.HIDE);
  3193. $(this._element).trigger(startEvent);
  3194. if (startEvent.isDefaultPrevented()) {
  3195. return;
  3196. }
  3197. var dimension = this._getDimension();
  3198. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3199. Util.reflow(this._element);
  3200. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3201. var triggerArrayLength = this._triggerArray.length;
  3202. if (triggerArrayLength > 0) {
  3203. for (var i = 0; i < triggerArrayLength; i++) {
  3204. var trigger = this._triggerArray[i];
  3205. var selector = Util.getSelectorFromElement(trigger);
  3206. if (selector !== null) {
  3207. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3208. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3209. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3210. }
  3211. }
  3212. }
  3213. }
  3214. this.setTransitioning(true);
  3215. var complete = function complete() {
  3216. _this2.setTransitioning(false);
  3217. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3218. };
  3219. this._element.style[dimension] = '';
  3220. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3221. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3222. };
  3223. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3224. this._isTransitioning = isTransitioning;
  3225. };
  3226. _proto.dispose = function dispose() {
  3227. $.removeData(this._element, DATA_KEY$3);
  3228. this._config = null;
  3229. this._parent = null;
  3230. this._element = null;
  3231. this._triggerArray = null;
  3232. this._isTransitioning = null;
  3233. } // Private
  3234. ;
  3235. _proto._getConfig = function _getConfig(config) {
  3236. config = _objectSpread2({}, Default$1, {}, config);
  3237. config.toggle = Boolean(config.toggle); // Coerce string values
  3238. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3239. return config;
  3240. };
  3241. _proto._getDimension = function _getDimension() {
  3242. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3243. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3244. };
  3245. _proto._getParent = function _getParent() {
  3246. var _this3 = this;
  3247. var parent;
  3248. if (Util.isElement(this._config.parent)) {
  3249. parent = this._config.parent; // It's a jQuery object
  3250. if (typeof this._config.parent.jquery !== 'undefined') {
  3251. parent = this._config.parent[0];
  3252. }
  3253. } else {
  3254. parent = document.querySelector(this._config.parent);
  3255. }
  3256. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3257. var children = [].slice.call(parent.querySelectorAll(selector));
  3258. $(children).each(function (i, element) {
  3259. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3260. });
  3261. return parent;
  3262. };
  3263. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3264. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3265. if (triggerArray.length) {
  3266. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3267. }
  3268. } // Static
  3269. ;
  3270. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3271. var selector = Util.getSelectorFromElement(element);
  3272. return selector ? document.querySelector(selector) : null;
  3273. };
  3274. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3275. return this.each(function () {
  3276. var $this = $(this);
  3277. var data = $this.data(DATA_KEY$3);
  3278. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3279. if (!data && _config.toggle && /show|hide/.test(config)) {
  3280. _config.toggle = false;
  3281. }
  3282. if (!data) {
  3283. data = new Collapse(this, _config);
  3284. $this.data(DATA_KEY$3, data);
  3285. }
  3286. if (typeof config === 'string') {
  3287. if (typeof data[config] === 'undefined') {
  3288. throw new TypeError("No method named \"" + config + "\"");
  3289. }
  3290. data[config]();
  3291. }
  3292. });
  3293. };
  3294. _createClass(Collapse, null, [{
  3295. key: "VERSION",
  3296. get: function get() {
  3297. return VERSION$3;
  3298. }
  3299. }, {
  3300. key: "Default",
  3301. get: function get() {
  3302. return Default$1;
  3303. }
  3304. }]);
  3305. return Collapse;
  3306. }();
  3307. /**
  3308. * ------------------------------------------------------------------------
  3309. * Data Api implementation
  3310. * ------------------------------------------------------------------------
  3311. */
  3312. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3313. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3314. if (event.currentTarget.tagName === 'A') {
  3315. event.preventDefault();
  3316. }
  3317. var $trigger = $(this);
  3318. var selector = Util.getSelectorFromElement(this);
  3319. var selectors = [].slice.call(document.querySelectorAll(selector));
  3320. $(selectors).each(function () {
  3321. var $target = $(this);
  3322. var data = $target.data(DATA_KEY$3);
  3323. var config = data ? 'toggle' : $trigger.data();
  3324. Collapse._jQueryInterface.call($target, config);
  3325. });
  3326. });
  3327. /**
  3328. * ------------------------------------------------------------------------
  3329. * jQuery
  3330. * ------------------------------------------------------------------------
  3331. */
  3332. $.fn[NAME$3] = Collapse._jQueryInterface;
  3333. $.fn[NAME$3].Constructor = Collapse;
  3334. $.fn[NAME$3].noConflict = function () {
  3335. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3336. return Collapse._jQueryInterface;
  3337. };
  3338. /**
  3339. * ------------------------------------------------------------------------
  3340. * Constants
  3341. * ------------------------------------------------------------------------
  3342. */
  3343. var NAME$4 = 'dropdown';
  3344. var VERSION$4 = '4.4.1';
  3345. var DATA_KEY$4 = 'bs.dropdown';
  3346. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3347. var DATA_API_KEY$4 = '.data-api';
  3348. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3349. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3350. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3351. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3352. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3353. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3354. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3355. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3356. var Event$4 = {
  3357. HIDE: "hide" + EVENT_KEY$4,
  3358. HIDDEN: "hidden" + EVENT_KEY$4,
  3359. SHOW: "show" + EVENT_KEY$4,
  3360. SHOWN: "shown" + EVENT_KEY$4,
  3361. CLICK: "click" + EVENT_KEY$4,
  3362. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3363. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3364. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3365. };
  3366. var ClassName$4 = {
  3367. DISABLED: 'disabled',
  3368. SHOW: 'show',
  3369. DROPUP: 'dropup',
  3370. DROPRIGHT: 'dropright',
  3371. DROPLEFT: 'dropleft',
  3372. MENURIGHT: 'dropdown-menu-right',
  3373. MENULEFT: 'dropdown-menu-left',
  3374. POSITION_STATIC: 'position-static'
  3375. };
  3376. var Selector$4 = {
  3377. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3378. FORM_CHILD: '.dropdown form',
  3379. MENU: '.dropdown-menu',
  3380. NAVBAR_NAV: '.navbar-nav',
  3381. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3382. };
  3383. var AttachmentMap = {
  3384. TOP: 'top-start',
  3385. TOPEND: 'top-end',
  3386. BOTTOM: 'bottom-start',
  3387. BOTTOMEND: 'bottom-end',
  3388. RIGHT: 'right-start',
  3389. RIGHTEND: 'right-end',
  3390. LEFT: 'left-start',
  3391. LEFTEND: 'left-end'
  3392. };
  3393. var Default$2 = {
  3394. offset: 0,
  3395. flip: true,
  3396. boundary: 'scrollParent',
  3397. reference: 'toggle',
  3398. display: 'dynamic',
  3399. popperConfig: null
  3400. };
  3401. var DefaultType$2 = {
  3402. offset: '(number|string|function)',
  3403. flip: 'boolean',
  3404. boundary: '(string|element)',
  3405. reference: '(string|element)',
  3406. display: 'string',
  3407. popperConfig: '(null|object)'
  3408. };
  3409. /**
  3410. * ------------------------------------------------------------------------
  3411. * Class Definition
  3412. * ------------------------------------------------------------------------
  3413. */
  3414. var Dropdown =
  3415. /*#__PURE__*/
  3416. function () {
  3417. function Dropdown(element, config) {
  3418. this._element = element;
  3419. this._popper = null;
  3420. this._config = this._getConfig(config);
  3421. this._menu = this._getMenuElement();
  3422. this._inNavbar = this._detectNavbar();
  3423. this._addEventListeners();
  3424. } // Getters
  3425. var _proto = Dropdown.prototype;
  3426. // Public
  3427. _proto.toggle = function toggle() {
  3428. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3429. return;
  3430. }
  3431. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3432. Dropdown._clearMenus();
  3433. if (isActive) {
  3434. return;
  3435. }
  3436. this.show(true);
  3437. };
  3438. _proto.show = function show(usePopper) {
  3439. if (usePopper === void 0) {
  3440. usePopper = false;
  3441. }
  3442. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3443. return;
  3444. }
  3445. var relatedTarget = {
  3446. relatedTarget: this._element
  3447. };
  3448. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3449. var parent = Dropdown._getParentFromElement(this._element);
  3450. $(parent).trigger(showEvent);
  3451. if (showEvent.isDefaultPrevented()) {
  3452. return;
  3453. } // Disable totally Popper.js for Dropdown in Navbar
  3454. if (!this._inNavbar && usePopper) {
  3455. /**
  3456. * Check for Popper dependency
  3457. * Popper - https://popper.js.org
  3458. */
  3459. if (typeof Popper === 'undefined') {
  3460. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3461. }
  3462. var referenceElement = this._element;
  3463. if (this._config.reference === 'parent') {
  3464. referenceElement = parent;
  3465. } else if (Util.isElement(this._config.reference)) {
  3466. referenceElement = this._config.reference; // Check if it's jQuery element
  3467. if (typeof this._config.reference.jquery !== 'undefined') {
  3468. referenceElement = this._config.reference[0];
  3469. }
  3470. } // If boundary is not `scrollParent`, then set position to `static`
  3471. // to allow the menu to "escape" the scroll parent's boundaries
  3472. // https://github.com/twbs/bootstrap/issues/24251
  3473. if (this._config.boundary !== 'scrollParent') {
  3474. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3475. }
  3476. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3477. } // If this is a touch-enabled device we add extra
  3478. // empty mouseover listeners to the body's immediate children;
  3479. // only needed because of broken event delegation on iOS
  3480. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3481. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3482. $(document.body).children().on('mouseover', null, $.noop);
  3483. }
  3484. this._element.focus();
  3485. this._element.setAttribute('aria-expanded', true);
  3486. $(this._menu).toggleClass(ClassName$4.SHOW);
  3487. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3488. };
  3489. _proto.hide = function hide() {
  3490. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3491. return;
  3492. }
  3493. var relatedTarget = {
  3494. relatedTarget: this._element
  3495. };
  3496. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3497. var parent = Dropdown._getParentFromElement(this._element);
  3498. $(parent).trigger(hideEvent);
  3499. if (hideEvent.isDefaultPrevented()) {
  3500. return;
  3501. }
  3502. if (this._popper) {
  3503. this._popper.destroy();
  3504. }
  3505. $(this._menu).toggleClass(ClassName$4.SHOW);
  3506. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3507. };
  3508. _proto.dispose = function dispose() {
  3509. $.removeData(this._element, DATA_KEY$4);
  3510. $(this._element).off(EVENT_KEY$4);
  3511. this._element = null;
  3512. this._menu = null;
  3513. if (this._popper !== null) {
  3514. this._popper.destroy();
  3515. this._popper = null;
  3516. }
  3517. };
  3518. _proto.update = function update() {
  3519. this._inNavbar = this._detectNavbar();
  3520. if (this._popper !== null) {
  3521. this._popper.scheduleUpdate();
  3522. }
  3523. } // Private
  3524. ;
  3525. _proto._addEventListeners = function _addEventListeners() {
  3526. var _this = this;
  3527. $(this._element).on(Event$4.CLICK, function (event) {
  3528. event.preventDefault();
  3529. event.stopPropagation();
  3530. _this.toggle();
  3531. });
  3532. };
  3533. _proto._getConfig = function _getConfig(config) {
  3534. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3535. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3536. return config;
  3537. };
  3538. _proto._getMenuElement = function _getMenuElement() {
  3539. if (!this._menu) {
  3540. var parent = Dropdown._getParentFromElement(this._element);
  3541. if (parent) {
  3542. this._menu = parent.querySelector(Selector$4.MENU);
  3543. }
  3544. }
  3545. return this._menu;
  3546. };
  3547. _proto._getPlacement = function _getPlacement() {
  3548. var $parentDropdown = $(this._element.parentNode);
  3549. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3550. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3551. placement = AttachmentMap.TOP;
  3552. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3553. placement = AttachmentMap.TOPEND;
  3554. }
  3555. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3556. placement = AttachmentMap.RIGHT;
  3557. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3558. placement = AttachmentMap.LEFT;
  3559. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3560. placement = AttachmentMap.BOTTOMEND;
  3561. }
  3562. return placement;
  3563. };
  3564. _proto._detectNavbar = function _detectNavbar() {
  3565. return $(this._element).closest('.navbar').length > 0;
  3566. };
  3567. _proto._getOffset = function _getOffset() {
  3568. var _this2 = this;
  3569. var offset = {};
  3570. if (typeof this._config.offset === 'function') {
  3571. offset.fn = function (data) {
  3572. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3573. return data;
  3574. };
  3575. } else {
  3576. offset.offset = this._config.offset;
  3577. }
  3578. return offset;
  3579. };
  3580. _proto._getPopperConfig = function _getPopperConfig() {
  3581. var popperConfig = {
  3582. placement: this._getPlacement(),
  3583. modifiers: {
  3584. offset: this._getOffset(),
  3585. flip: {
  3586. enabled: this._config.flip
  3587. },
  3588. preventOverflow: {
  3589. boundariesElement: this._config.boundary
  3590. }
  3591. }
  3592. }; // Disable Popper.js if we have a static display
  3593. if (this._config.display === 'static') {
  3594. popperConfig.modifiers.applyStyle = {
  3595. enabled: false
  3596. };
  3597. }
  3598. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3599. } // Static
  3600. ;
  3601. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3602. return this.each(function () {
  3603. var data = $(this).data(DATA_KEY$4);
  3604. var _config = typeof config === 'object' ? config : null;
  3605. if (!data) {
  3606. data = new Dropdown(this, _config);
  3607. $(this).data(DATA_KEY$4, data);
  3608. }
  3609. if (typeof config === 'string') {
  3610. if (typeof data[config] === 'undefined') {
  3611. throw new TypeError("No method named \"" + config + "\"");
  3612. }
  3613. data[config]();
  3614. }
  3615. });
  3616. };
  3617. Dropdown._clearMenus = function _clearMenus(event) {
  3618. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3619. return;
  3620. }
  3621. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3622. for (var i = 0, len = toggles.length; i < len; i++) {
  3623. var parent = Dropdown._getParentFromElement(toggles[i]);
  3624. var context = $(toggles[i]).data(DATA_KEY$4);
  3625. var relatedTarget = {
  3626. relatedTarget: toggles[i]
  3627. };
  3628. if (event && event.type === 'click') {
  3629. relatedTarget.clickEvent = event;
  3630. }
  3631. if (!context) {
  3632. continue;
  3633. }
  3634. var dropdownMenu = context._menu;
  3635. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3636. continue;
  3637. }
  3638. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3639. continue;
  3640. }
  3641. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3642. $(parent).trigger(hideEvent);
  3643. if (hideEvent.isDefaultPrevented()) {
  3644. continue;
  3645. } // If this is a touch-enabled device we remove the extra
  3646. // empty mouseover listeners we added for iOS support
  3647. if ('ontouchstart' in document.documentElement) {
  3648. $(document.body).children().off('mouseover', null, $.noop);
  3649. }
  3650. toggles[i].setAttribute('aria-expanded', 'false');
  3651. if (context._popper) {
  3652. context._popper.destroy();
  3653. }
  3654. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3655. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3656. }
  3657. };
  3658. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3659. var parent;
  3660. var selector = Util.getSelectorFromElement(element);
  3661. if (selector) {
  3662. parent = document.querySelector(selector);
  3663. }
  3664. return parent || element.parentNode;
  3665. } // eslint-disable-next-line complexity
  3666. ;
  3667. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3668. // If not input/textarea:
  3669. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3670. // If input/textarea:
  3671. // - If space key => not a dropdown command
  3672. // - If key is other than escape
  3673. // - If key is not up or down => not a dropdown command
  3674. // - If trigger inside the menu => not a dropdown command
  3675. 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)) {
  3676. return;
  3677. }
  3678. event.preventDefault();
  3679. event.stopPropagation();
  3680. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3681. return;
  3682. }
  3683. var parent = Dropdown._getParentFromElement(this);
  3684. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3685. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3686. return;
  3687. }
  3688. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3689. if (event.which === ESCAPE_KEYCODE) {
  3690. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3691. $(toggle).trigger('focus');
  3692. }
  3693. $(this).trigger('click');
  3694. return;
  3695. }
  3696. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3697. return $(item).is(':visible');
  3698. });
  3699. if (items.length === 0) {
  3700. return;
  3701. }
  3702. var index = items.indexOf(event.target);
  3703. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3704. // Up
  3705. index--;
  3706. }
  3707. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3708. // Down
  3709. index++;
  3710. }
  3711. if (index < 0) {
  3712. index = 0;
  3713. }
  3714. items[index].focus();
  3715. };
  3716. _createClass(Dropdown, null, [{
  3717. key: "VERSION",
  3718. get: function get() {
  3719. return VERSION$4;
  3720. }
  3721. }, {
  3722. key: "Default",
  3723. get: function get() {
  3724. return Default$2;
  3725. }
  3726. }, {
  3727. key: "DefaultType",
  3728. get: function get() {
  3729. return DefaultType$2;
  3730. }
  3731. }]);
  3732. return Dropdown;
  3733. }();
  3734. /**
  3735. * ------------------------------------------------------------------------
  3736. * Data Api implementation
  3737. * ------------------------------------------------------------------------
  3738. */
  3739. $(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) {
  3740. event.preventDefault();
  3741. event.stopPropagation();
  3742. Dropdown._jQueryInterface.call($(this), 'toggle');
  3743. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3744. e.stopPropagation();
  3745. });
  3746. /**
  3747. * ------------------------------------------------------------------------
  3748. * jQuery
  3749. * ------------------------------------------------------------------------
  3750. */
  3751. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3752. $.fn[NAME$4].Constructor = Dropdown;
  3753. $.fn[NAME$4].noConflict = function () {
  3754. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3755. return Dropdown._jQueryInterface;
  3756. };
  3757. /**
  3758. * ------------------------------------------------------------------------
  3759. * Constants
  3760. * ------------------------------------------------------------------------
  3761. */
  3762. var NAME$5 = 'modal';
  3763. var VERSION$5 = '4.4.1';
  3764. var DATA_KEY$5 = 'bs.modal';
  3765. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3766. var DATA_API_KEY$5 = '.data-api';
  3767. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3768. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3769. var Default$3 = {
  3770. backdrop: true,
  3771. keyboard: true,
  3772. focus: true,
  3773. show: true
  3774. };
  3775. var DefaultType$3 = {
  3776. backdrop: '(boolean|string)',
  3777. keyboard: 'boolean',
  3778. focus: 'boolean',
  3779. show: 'boolean'
  3780. };
  3781. var Event$5 = {
  3782. HIDE: "hide" + EVENT_KEY$5,
  3783. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3784. HIDDEN: "hidden" + EVENT_KEY$5,
  3785. SHOW: "show" + EVENT_KEY$5,
  3786. SHOWN: "shown" + EVENT_KEY$5,
  3787. FOCUSIN: "focusin" + EVENT_KEY$5,
  3788. RESIZE: "resize" + EVENT_KEY$5,
  3789. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3790. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3791. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3792. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3793. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3794. };
  3795. var ClassName$5 = {
  3796. SCROLLABLE: 'modal-dialog-scrollable',
  3797. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3798. BACKDROP: 'modal-backdrop',
  3799. OPEN: 'modal-open',
  3800. FADE: 'fade',
  3801. SHOW: 'show',
  3802. STATIC: 'modal-static'
  3803. };
  3804. var Selector$5 = {
  3805. DIALOG: '.modal-dialog',
  3806. MODAL_BODY: '.modal-body',
  3807. DATA_TOGGLE: '[data-toggle="modal"]',
  3808. DATA_DISMISS: '[data-dismiss="modal"]',
  3809. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3810. STICKY_CONTENT: '.sticky-top'
  3811. };
  3812. /**
  3813. * ------------------------------------------------------------------------
  3814. * Class Definition
  3815. * ------------------------------------------------------------------------
  3816. */
  3817. var Modal =
  3818. /*#__PURE__*/
  3819. function () {
  3820. function Modal(element, config) {
  3821. this._config = this._getConfig(config);
  3822. this._element = element;
  3823. this._dialog = element.querySelector(Selector$5.DIALOG);
  3824. this._backdrop = null;
  3825. this._isShown = false;
  3826. this._isBodyOverflowing = false;
  3827. this._ignoreBackdropClick = false;
  3828. this._isTransitioning = false;
  3829. this._scrollbarWidth = 0;
  3830. } // Getters
  3831. var _proto = Modal.prototype;
  3832. // Public
  3833. _proto.toggle = function toggle(relatedTarget) {
  3834. return this._isShown ? this.hide() : this.show(relatedTarget);
  3835. };
  3836. _proto.show = function show(relatedTarget) {
  3837. var _this = this;
  3838. if (this._isShown || this._isTransitioning) {
  3839. return;
  3840. }
  3841. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3842. this._isTransitioning = true;
  3843. }
  3844. var showEvent = $.Event(Event$5.SHOW, {
  3845. relatedTarget: relatedTarget
  3846. });
  3847. $(this._element).trigger(showEvent);
  3848. if (this._isShown || showEvent.isDefaultPrevented()) {
  3849. return;
  3850. }
  3851. this._isShown = true;
  3852. this._checkScrollbar();
  3853. this._setScrollbar();
  3854. this._adjustDialog();
  3855. this._setEscapeEvent();
  3856. this._setResizeEvent();
  3857. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3858. return _this.hide(event);
  3859. });
  3860. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3861. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3862. if ($(event.target).is(_this._element)) {
  3863. _this._ignoreBackdropClick = true;
  3864. }
  3865. });
  3866. });
  3867. this._showBackdrop(function () {
  3868. return _this._showElement(relatedTarget);
  3869. });
  3870. };
  3871. _proto.hide = function hide(event) {
  3872. var _this2 = this;
  3873. if (event) {
  3874. event.preventDefault();
  3875. }
  3876. if (!this._isShown || this._isTransitioning) {
  3877. return;
  3878. }
  3879. var hideEvent = $.Event(Event$5.HIDE);
  3880. $(this._element).trigger(hideEvent);
  3881. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3882. return;
  3883. }
  3884. this._isShown = false;
  3885. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3886. if (transition) {
  3887. this._isTransitioning = true;
  3888. }
  3889. this._setEscapeEvent();
  3890. this._setResizeEvent();
  3891. $(document).off(Event$5.FOCUSIN);
  3892. $(this._element).removeClass(ClassName$5.SHOW);
  3893. $(this._element).off(Event$5.CLICK_DISMISS);
  3894. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3895. if (transition) {
  3896. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3897. $(this._element).one(Util.TRANSITION_END, function (event) {
  3898. return _this2._hideModal(event);
  3899. }).emulateTransitionEnd(transitionDuration);
  3900. } else {
  3901. this._hideModal();
  3902. }
  3903. };
  3904. _proto.dispose = function dispose() {
  3905. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3906. return $(htmlElement).off(EVENT_KEY$5);
  3907. });
  3908. /**
  3909. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3910. * Do not move `document` in `htmlElements` array
  3911. * It will remove `Event.CLICK_DATA_API` event that should remain
  3912. */
  3913. $(document).off(Event$5.FOCUSIN);
  3914. $.removeData(this._element, DATA_KEY$5);
  3915. this._config = null;
  3916. this._element = null;
  3917. this._dialog = null;
  3918. this._backdrop = null;
  3919. this._isShown = null;
  3920. this._isBodyOverflowing = null;
  3921. this._ignoreBackdropClick = null;
  3922. this._isTransitioning = null;
  3923. this._scrollbarWidth = null;
  3924. };
  3925. _proto.handleUpdate = function handleUpdate() {
  3926. this._adjustDialog();
  3927. } // Private
  3928. ;
  3929. _proto._getConfig = function _getConfig(config) {
  3930. config = _objectSpread2({}, Default$3, {}, config);
  3931. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3932. return config;
  3933. };
  3934. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3935. var _this3 = this;
  3936. if (this._config.backdrop === 'static') {
  3937. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3938. $(this._element).trigger(hideEventPrevented);
  3939. if (hideEventPrevented.defaultPrevented) {
  3940. return;
  3941. }
  3942. this._element.classList.add(ClassName$5.STATIC);
  3943. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3944. $(this._element).one(Util.TRANSITION_END, function () {
  3945. _this3._element.classList.remove(ClassName$5.STATIC);
  3946. }).emulateTransitionEnd(modalTransitionDuration);
  3947. this._element.focus();
  3948. } else {
  3949. this.hide();
  3950. }
  3951. };
  3952. _proto._showElement = function _showElement(relatedTarget) {
  3953. var _this4 = this;
  3954. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3955. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3956. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3957. // Don't move modal's DOM position
  3958. document.body.appendChild(this._element);
  3959. }
  3960. this._element.style.display = 'block';
  3961. this._element.removeAttribute('aria-hidden');
  3962. this._element.setAttribute('aria-modal', true);
  3963. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3964. modalBody.scrollTop = 0;
  3965. } else {
  3966. this._element.scrollTop = 0;
  3967. }
  3968. if (transition) {
  3969. Util.reflow(this._element);
  3970. }
  3971. $(this._element).addClass(ClassName$5.SHOW);
  3972. if (this._config.focus) {
  3973. this._enforceFocus();
  3974. }
  3975. var shownEvent = $.Event(Event$5.SHOWN, {
  3976. relatedTarget: relatedTarget
  3977. });
  3978. var transitionComplete = function transitionComplete() {
  3979. if (_this4._config.focus) {
  3980. _this4._element.focus();
  3981. }
  3982. _this4._isTransitioning = false;
  3983. $(_this4._element).trigger(shownEvent);
  3984. };
  3985. if (transition) {
  3986. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3987. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3988. } else {
  3989. transitionComplete();
  3990. }
  3991. };
  3992. _proto._enforceFocus = function _enforceFocus() {
  3993. var _this5 = this;
  3994. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3995. .on(Event$5.FOCUSIN, function (event) {
  3996. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3997. _this5._element.focus();
  3998. }
  3999. });
  4000. };
  4001. _proto._setEscapeEvent = function _setEscapeEvent() {
  4002. var _this6 = this;
  4003. if (this._isShown && this._config.keyboard) {
  4004. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4005. if (event.which === ESCAPE_KEYCODE$1) {
  4006. _this6._triggerBackdropTransition();
  4007. }
  4008. });
  4009. } else if (!this._isShown) {
  4010. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4011. }
  4012. };
  4013. _proto._setResizeEvent = function _setResizeEvent() {
  4014. var _this7 = this;
  4015. if (this._isShown) {
  4016. $(window).on(Event$5.RESIZE, function (event) {
  4017. return _this7.handleUpdate(event);
  4018. });
  4019. } else {
  4020. $(window).off(Event$5.RESIZE);
  4021. }
  4022. };
  4023. _proto._hideModal = function _hideModal() {
  4024. var _this8 = this;
  4025. this._element.style.display = 'none';
  4026. this._element.setAttribute('aria-hidden', true);
  4027. this._element.removeAttribute('aria-modal');
  4028. this._isTransitioning = false;
  4029. this._showBackdrop(function () {
  4030. $(document.body).removeClass(ClassName$5.OPEN);
  4031. _this8._resetAdjustments();
  4032. _this8._resetScrollbar();
  4033. $(_this8._element).trigger(Event$5.HIDDEN);
  4034. });
  4035. };
  4036. _proto._removeBackdrop = function _removeBackdrop() {
  4037. if (this._backdrop) {
  4038. $(this._backdrop).remove();
  4039. this._backdrop = null;
  4040. }
  4041. };
  4042. _proto._showBackdrop = function _showBackdrop(callback) {
  4043. var _this9 = this;
  4044. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4045. if (this._isShown && this._config.backdrop) {
  4046. this._backdrop = document.createElement('div');
  4047. this._backdrop.className = ClassName$5.BACKDROP;
  4048. if (animate) {
  4049. this._backdrop.classList.add(animate);
  4050. }
  4051. $(this._backdrop).appendTo(document.body);
  4052. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4053. if (_this9._ignoreBackdropClick) {
  4054. _this9._ignoreBackdropClick = false;
  4055. return;
  4056. }
  4057. if (event.target !== event.currentTarget) {
  4058. return;
  4059. }
  4060. _this9._triggerBackdropTransition();
  4061. });
  4062. if (animate) {
  4063. Util.reflow(this._backdrop);
  4064. }
  4065. $(this._backdrop).addClass(ClassName$5.SHOW);
  4066. if (!callback) {
  4067. return;
  4068. }
  4069. if (!animate) {
  4070. callback();
  4071. return;
  4072. }
  4073. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4074. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4075. } else if (!this._isShown && this._backdrop) {
  4076. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4077. var callbackRemove = function callbackRemove() {
  4078. _this9._removeBackdrop();
  4079. if (callback) {
  4080. callback();
  4081. }
  4082. };
  4083. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4084. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4085. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4086. } else {
  4087. callbackRemove();
  4088. }
  4089. } else if (callback) {
  4090. callback();
  4091. }
  4092. } // ----------------------------------------------------------------------
  4093. // the following methods are used to handle overflowing modals
  4094. // todo (fat): these should probably be refactored out of modal.js
  4095. // ----------------------------------------------------------------------
  4096. ;
  4097. _proto._adjustDialog = function _adjustDialog() {
  4098. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4099. if (!this._isBodyOverflowing && isModalOverflowing) {
  4100. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4101. }
  4102. if (this._isBodyOverflowing && !isModalOverflowing) {
  4103. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4104. }
  4105. };
  4106. _proto._resetAdjustments = function _resetAdjustments() {
  4107. this._element.style.paddingLeft = '';
  4108. this._element.style.paddingRight = '';
  4109. };
  4110. _proto._checkScrollbar = function _checkScrollbar() {
  4111. var rect = document.body.getBoundingClientRect();
  4112. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4113. this._scrollbarWidth = this._getScrollbarWidth();
  4114. };
  4115. _proto._setScrollbar = function _setScrollbar() {
  4116. var _this10 = this;
  4117. if (this._isBodyOverflowing) {
  4118. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4119. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4120. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4121. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4122. $(fixedContent).each(function (index, element) {
  4123. var actualPadding = element.style.paddingRight;
  4124. var calculatedPadding = $(element).css('padding-right');
  4125. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4126. }); // Adjust sticky content margin
  4127. $(stickyContent).each(function (index, element) {
  4128. var actualMargin = element.style.marginRight;
  4129. var calculatedMargin = $(element).css('margin-right');
  4130. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4131. }); // Adjust body padding
  4132. var actualPadding = document.body.style.paddingRight;
  4133. var calculatedPadding = $(document.body).css('padding-right');
  4134. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4135. }
  4136. $(document.body).addClass(ClassName$5.OPEN);
  4137. };
  4138. _proto._resetScrollbar = function _resetScrollbar() {
  4139. // Restore fixed content padding
  4140. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4141. $(fixedContent).each(function (index, element) {
  4142. var padding = $(element).data('padding-right');
  4143. $(element).removeData('padding-right');
  4144. element.style.paddingRight = padding ? padding : '';
  4145. }); // Restore sticky content
  4146. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4147. $(elements).each(function (index, element) {
  4148. var margin = $(element).data('margin-right');
  4149. if (typeof margin !== 'undefined') {
  4150. $(element).css('margin-right', margin).removeData('margin-right');
  4151. }
  4152. }); // Restore body padding
  4153. var padding = $(document.body).data('padding-right');
  4154. $(document.body).removeData('padding-right');
  4155. document.body.style.paddingRight = padding ? padding : '';
  4156. };
  4157. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4158. // thx d.walsh
  4159. var scrollDiv = document.createElement('div');
  4160. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4161. document.body.appendChild(scrollDiv);
  4162. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4163. document.body.removeChild(scrollDiv);
  4164. return scrollbarWidth;
  4165. } // Static
  4166. ;
  4167. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4168. return this.each(function () {
  4169. var data = $(this).data(DATA_KEY$5);
  4170. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4171. if (!data) {
  4172. data = new Modal(this, _config);
  4173. $(this).data(DATA_KEY$5, data);
  4174. }
  4175. if (typeof config === 'string') {
  4176. if (typeof data[config] === 'undefined') {
  4177. throw new TypeError("No method named \"" + config + "\"");
  4178. }
  4179. data[config](relatedTarget);
  4180. } else if (_config.show) {
  4181. data.show(relatedTarget);
  4182. }
  4183. });
  4184. };
  4185. _createClass(Modal, null, [{
  4186. key: "VERSION",
  4187. get: function get() {
  4188. return VERSION$5;
  4189. }
  4190. }, {
  4191. key: "Default",
  4192. get: function get() {
  4193. return Default$3;
  4194. }
  4195. }]);
  4196. return Modal;
  4197. }();
  4198. /**
  4199. * ------------------------------------------------------------------------
  4200. * Data Api implementation
  4201. * ------------------------------------------------------------------------
  4202. */
  4203. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4204. var _this11 = this;
  4205. var target;
  4206. var selector = Util.getSelectorFromElement(this);
  4207. if (selector) {
  4208. target = document.querySelector(selector);
  4209. }
  4210. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4211. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4212. event.preventDefault();
  4213. }
  4214. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4215. if (showEvent.isDefaultPrevented()) {
  4216. // Only register focus restorer if modal will actually get shown
  4217. return;
  4218. }
  4219. $target.one(Event$5.HIDDEN, function () {
  4220. if ($(_this11).is(':visible')) {
  4221. _this11.focus();
  4222. }
  4223. });
  4224. });
  4225. Modal._jQueryInterface.call($(target), config, this);
  4226. });
  4227. /**
  4228. * ------------------------------------------------------------------------
  4229. * jQuery
  4230. * ------------------------------------------------------------------------
  4231. */
  4232. $.fn[NAME$5] = Modal._jQueryInterface;
  4233. $.fn[NAME$5].Constructor = Modal;
  4234. $.fn[NAME$5].noConflict = function () {
  4235. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4236. return Modal._jQueryInterface;
  4237. };
  4238. /**
  4239. * --------------------------------------------------------------------------
  4240. * Bootstrap (v4.4.1): tools/sanitizer.js
  4241. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4242. * --------------------------------------------------------------------------
  4243. */
  4244. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4245. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4246. var DefaultWhitelist = {
  4247. // Global attributes allowed on any supplied element below.
  4248. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4249. a: ['target', 'href', 'title', 'rel'],
  4250. area: [],
  4251. b: [],
  4252. br: [],
  4253. col: [],
  4254. code: [],
  4255. div: [],
  4256. em: [],
  4257. hr: [],
  4258. h1: [],
  4259. h2: [],
  4260. h3: [],
  4261. h4: [],
  4262. h5: [],
  4263. h6: [],
  4264. i: [],
  4265. img: ['src', 'alt', 'title', 'width', 'height'],
  4266. li: [],
  4267. ol: [],
  4268. p: [],
  4269. pre: [],
  4270. s: [],
  4271. small: [],
  4272. span: [],
  4273. sub: [],
  4274. sup: [],
  4275. strong: [],
  4276. u: [],
  4277. ul: []
  4278. };
  4279. /**
  4280. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4281. *
  4282. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4283. */
  4284. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4285. /**
  4286. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4287. *
  4288. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4289. */
  4290. 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;
  4291. function allowedAttribute(attr, allowedAttributeList) {
  4292. var attrName = attr.nodeName.toLowerCase();
  4293. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4294. if (uriAttrs.indexOf(attrName) !== -1) {
  4295. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4296. }
  4297. return true;
  4298. }
  4299. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4300. return attrRegex instanceof RegExp;
  4301. }); // Check if a regular expression validates the attribute.
  4302. for (var i = 0, l = regExp.length; i < l; i++) {
  4303. if (attrName.match(regExp[i])) {
  4304. return true;
  4305. }
  4306. }
  4307. return false;
  4308. }
  4309. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4310. if (unsafeHtml.length === 0) {
  4311. return unsafeHtml;
  4312. }
  4313. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4314. return sanitizeFn(unsafeHtml);
  4315. }
  4316. var domParser = new window.DOMParser();
  4317. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4318. var whitelistKeys = Object.keys(whiteList);
  4319. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4320. var _loop = function _loop(i, len) {
  4321. var el = elements[i];
  4322. var elName = el.nodeName.toLowerCase();
  4323. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4324. el.parentNode.removeChild(el);
  4325. return "continue";
  4326. }
  4327. var attributeList = [].slice.call(el.attributes);
  4328. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4329. attributeList.forEach(function (attr) {
  4330. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4331. el.removeAttribute(attr.nodeName);
  4332. }
  4333. });
  4334. };
  4335. for (var i = 0, len = elements.length; i < len; i++) {
  4336. var _ret = _loop(i);
  4337. if (_ret === "continue") continue;
  4338. }
  4339. return createdDocument.body.innerHTML;
  4340. }
  4341. /**
  4342. * ------------------------------------------------------------------------
  4343. * Constants
  4344. * ------------------------------------------------------------------------
  4345. */
  4346. var NAME$6 = 'tooltip';
  4347. var VERSION$6 = '4.4.1';
  4348. var DATA_KEY$6 = 'bs.tooltip';
  4349. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4350. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4351. var CLASS_PREFIX = 'bs-tooltip';
  4352. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4353. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4354. var DefaultType$4 = {
  4355. animation: 'boolean',
  4356. template: 'string',
  4357. title: '(string|element|function)',
  4358. trigger: 'string',
  4359. delay: '(number|object)',
  4360. html: 'boolean',
  4361. selector: '(string|boolean)',
  4362. placement: '(string|function)',
  4363. offset: '(number|string|function)',
  4364. container: '(string|element|boolean)',
  4365. fallbackPlacement: '(string|array)',
  4366. boundary: '(string|element)',
  4367. sanitize: 'boolean',
  4368. sanitizeFn: '(null|function)',
  4369. whiteList: 'object',
  4370. popperConfig: '(null|object)'
  4371. };
  4372. var AttachmentMap$1 = {
  4373. AUTO: 'auto',
  4374. TOP: 'top',
  4375. RIGHT: 'right',
  4376. BOTTOM: 'bottom',
  4377. LEFT: 'left'
  4378. };
  4379. var Default$4 = {
  4380. animation: true,
  4381. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4382. trigger: 'hover focus',
  4383. title: '',
  4384. delay: 0,
  4385. html: false,
  4386. selector: false,
  4387. placement: 'top',
  4388. offset: 0,
  4389. container: false,
  4390. fallbackPlacement: 'flip',
  4391. boundary: 'scrollParent',
  4392. sanitize: true,
  4393. sanitizeFn: null,
  4394. whiteList: DefaultWhitelist,
  4395. popperConfig: null
  4396. };
  4397. var HoverState = {
  4398. SHOW: 'show',
  4399. OUT: 'out'
  4400. };
  4401. var Event$6 = {
  4402. HIDE: "hide" + EVENT_KEY$6,
  4403. HIDDEN: "hidden" + EVENT_KEY$6,
  4404. SHOW: "show" + EVENT_KEY$6,
  4405. SHOWN: "shown" + EVENT_KEY$6,
  4406. INSERTED: "inserted" + EVENT_KEY$6,
  4407. CLICK: "click" + EVENT_KEY$6,
  4408. FOCUSIN: "focusin" + EVENT_KEY$6,
  4409. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4410. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4411. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4412. };
  4413. var ClassName$6 = {
  4414. FADE: 'fade',
  4415. SHOW: 'show'
  4416. };
  4417. var Selector$6 = {
  4418. TOOLTIP: '.tooltip',
  4419. TOOLTIP_INNER: '.tooltip-inner',
  4420. ARROW: '.arrow'
  4421. };
  4422. var Trigger = {
  4423. HOVER: 'hover',
  4424. FOCUS: 'focus',
  4425. CLICK: 'click',
  4426. MANUAL: 'manual'
  4427. };
  4428. /**
  4429. * ------------------------------------------------------------------------
  4430. * Class Definition
  4431. * ------------------------------------------------------------------------
  4432. */
  4433. var Tooltip =
  4434. /*#__PURE__*/
  4435. function () {
  4436. function Tooltip(element, config) {
  4437. if (typeof Popper === 'undefined') {
  4438. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4439. } // private
  4440. this._isEnabled = true;
  4441. this._timeout = 0;
  4442. this._hoverState = '';
  4443. this._activeTrigger = {};
  4444. this._popper = null; // Protected
  4445. this.element = element;
  4446. this.config = this._getConfig(config);
  4447. this.tip = null;
  4448. this._setListeners();
  4449. } // Getters
  4450. var _proto = Tooltip.prototype;
  4451. // Public
  4452. _proto.enable = function enable() {
  4453. this._isEnabled = true;
  4454. };
  4455. _proto.disable = function disable() {
  4456. this._isEnabled = false;
  4457. };
  4458. _proto.toggleEnabled = function toggleEnabled() {
  4459. this._isEnabled = !this._isEnabled;
  4460. };
  4461. _proto.toggle = function toggle(event) {
  4462. if (!this._isEnabled) {
  4463. return;
  4464. }
  4465. if (event) {
  4466. var dataKey = this.constructor.DATA_KEY;
  4467. var context = $(event.currentTarget).data(dataKey);
  4468. if (!context) {
  4469. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4470. $(event.currentTarget).data(dataKey, context);
  4471. }
  4472. context._activeTrigger.click = !context._activeTrigger.click;
  4473. if (context._isWithActiveTrigger()) {
  4474. context._enter(null, context);
  4475. } else {
  4476. context._leave(null, context);
  4477. }
  4478. } else {
  4479. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4480. this._leave(null, this);
  4481. return;
  4482. }
  4483. this._enter(null, this);
  4484. }
  4485. };
  4486. _proto.dispose = function dispose() {
  4487. clearTimeout(this._timeout);
  4488. $.removeData(this.element, this.constructor.DATA_KEY);
  4489. $(this.element).off(this.constructor.EVENT_KEY);
  4490. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4491. if (this.tip) {
  4492. $(this.tip).remove();
  4493. }
  4494. this._isEnabled = null;
  4495. this._timeout = null;
  4496. this._hoverState = null;
  4497. this._activeTrigger = null;
  4498. if (this._popper) {
  4499. this._popper.destroy();
  4500. }
  4501. this._popper = null;
  4502. this.element = null;
  4503. this.config = null;
  4504. this.tip = null;
  4505. };
  4506. _proto.show = function show() {
  4507. var _this = this;
  4508. if ($(this.element).css('display') === 'none') {
  4509. throw new Error('Please use show on visible elements');
  4510. }
  4511. var showEvent = $.Event(this.constructor.Event.SHOW);
  4512. if (this.isWithContent() && this._isEnabled) {
  4513. $(this.element).trigger(showEvent);
  4514. var shadowRoot = Util.findShadowRoot(this.element);
  4515. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4516. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4517. return;
  4518. }
  4519. var tip = this.getTipElement();
  4520. var tipId = Util.getUID(this.constructor.NAME);
  4521. tip.setAttribute('id', tipId);
  4522. this.element.setAttribute('aria-describedby', tipId);
  4523. this.setContent();
  4524. if (this.config.animation) {
  4525. $(tip).addClass(ClassName$6.FADE);
  4526. }
  4527. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4528. var attachment = this._getAttachment(placement);
  4529. this.addAttachmentClass(attachment);
  4530. var container = this._getContainer();
  4531. $(tip).data(this.constructor.DATA_KEY, this);
  4532. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4533. $(tip).appendTo(container);
  4534. }
  4535. $(this.element).trigger(this.constructor.Event.INSERTED);
  4536. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4537. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4538. // empty mouseover listeners to the body's immediate children;
  4539. // only needed because of broken event delegation on iOS
  4540. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4541. if ('ontouchstart' in document.documentElement) {
  4542. $(document.body).children().on('mouseover', null, $.noop);
  4543. }
  4544. var complete = function complete() {
  4545. if (_this.config.animation) {
  4546. _this._fixTransition();
  4547. }
  4548. var prevHoverState = _this._hoverState;
  4549. _this._hoverState = null;
  4550. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4551. if (prevHoverState === HoverState.OUT) {
  4552. _this._leave(null, _this);
  4553. }
  4554. };
  4555. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4556. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4557. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4558. } else {
  4559. complete();
  4560. }
  4561. }
  4562. };
  4563. _proto.hide = function hide(callback) {
  4564. var _this2 = this;
  4565. var tip = this.getTipElement();
  4566. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4567. var complete = function complete() {
  4568. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4569. tip.parentNode.removeChild(tip);
  4570. }
  4571. _this2._cleanTipClass();
  4572. _this2.element.removeAttribute('aria-describedby');
  4573. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4574. if (_this2._popper !== null) {
  4575. _this2._popper.destroy();
  4576. }
  4577. if (callback) {
  4578. callback();
  4579. }
  4580. };
  4581. $(this.element).trigger(hideEvent);
  4582. if (hideEvent.isDefaultPrevented()) {
  4583. return;
  4584. }
  4585. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4586. // empty mouseover listeners we added for iOS support
  4587. if ('ontouchstart' in document.documentElement) {
  4588. $(document.body).children().off('mouseover', null, $.noop);
  4589. }
  4590. this._activeTrigger[Trigger.CLICK] = false;
  4591. this._activeTrigger[Trigger.FOCUS] = false;
  4592. this._activeTrigger[Trigger.HOVER] = false;
  4593. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4594. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4595. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4596. } else {
  4597. complete();
  4598. }
  4599. this._hoverState = '';
  4600. };
  4601. _proto.update = function update() {
  4602. if (this._popper !== null) {
  4603. this._popper.scheduleUpdate();
  4604. }
  4605. } // Protected
  4606. ;
  4607. _proto.isWithContent = function isWithContent() {
  4608. return Boolean(this.getTitle());
  4609. };
  4610. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4611. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4612. };
  4613. _proto.getTipElement = function getTipElement() {
  4614. this.tip = this.tip || $(this.config.template)[0];
  4615. return this.tip;
  4616. };
  4617. _proto.setContent = function setContent() {
  4618. var tip = this.getTipElement();
  4619. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4620. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4621. };
  4622. _proto.setElementContent = function setElementContent($element, content) {
  4623. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4624. // Content is a DOM node or a jQuery
  4625. if (this.config.html) {
  4626. if (!$(content).parent().is($element)) {
  4627. $element.empty().append(content);
  4628. }
  4629. } else {
  4630. $element.text($(content).text());
  4631. }
  4632. return;
  4633. }
  4634. if (this.config.html) {
  4635. if (this.config.sanitize) {
  4636. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4637. }
  4638. $element.html(content);
  4639. } else {
  4640. $element.text(content);
  4641. }
  4642. };
  4643. _proto.getTitle = function getTitle() {
  4644. var title = this.element.getAttribute('data-original-title');
  4645. if (!title) {
  4646. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4647. }
  4648. return title;
  4649. } // Private
  4650. ;
  4651. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4652. var _this3 = this;
  4653. var defaultBsConfig = {
  4654. placement: attachment,
  4655. modifiers: {
  4656. offset: this._getOffset(),
  4657. flip: {
  4658. behavior: this.config.fallbackPlacement
  4659. },
  4660. arrow: {
  4661. element: Selector$6.ARROW
  4662. },
  4663. preventOverflow: {
  4664. boundariesElement: this.config.boundary
  4665. }
  4666. },
  4667. onCreate: function onCreate(data) {
  4668. if (data.originalPlacement !== data.placement) {
  4669. _this3._handlePopperPlacementChange(data);
  4670. }
  4671. },
  4672. onUpdate: function onUpdate(data) {
  4673. return _this3._handlePopperPlacementChange(data);
  4674. }
  4675. };
  4676. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4677. };
  4678. _proto._getOffset = function _getOffset() {
  4679. var _this4 = this;
  4680. var offset = {};
  4681. if (typeof this.config.offset === 'function') {
  4682. offset.fn = function (data) {
  4683. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4684. return data;
  4685. };
  4686. } else {
  4687. offset.offset = this.config.offset;
  4688. }
  4689. return offset;
  4690. };
  4691. _proto._getContainer = function _getContainer() {
  4692. if (this.config.container === false) {
  4693. return document.body;
  4694. }
  4695. if (Util.isElement(this.config.container)) {
  4696. return $(this.config.container);
  4697. }
  4698. return $(document).find(this.config.container);
  4699. };
  4700. _proto._getAttachment = function _getAttachment(placement) {
  4701. return AttachmentMap$1[placement.toUpperCase()];
  4702. };
  4703. _proto._setListeners = function _setListeners() {
  4704. var _this5 = this;
  4705. var triggers = this.config.trigger.split(' ');
  4706. triggers.forEach(function (trigger) {
  4707. if (trigger === 'click') {
  4708. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4709. return _this5.toggle(event);
  4710. });
  4711. } else if (trigger !== Trigger.MANUAL) {
  4712. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4713. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4714. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4715. return _this5._enter(event);
  4716. }).on(eventOut, _this5.config.selector, function (event) {
  4717. return _this5._leave(event);
  4718. });
  4719. }
  4720. });
  4721. this._hideModalHandler = function () {
  4722. if (_this5.element) {
  4723. _this5.hide();
  4724. }
  4725. };
  4726. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4727. if (this.config.selector) {
  4728. this.config = _objectSpread2({}, this.config, {
  4729. trigger: 'manual',
  4730. selector: ''
  4731. });
  4732. } else {
  4733. this._fixTitle();
  4734. }
  4735. };
  4736. _proto._fixTitle = function _fixTitle() {
  4737. var titleType = typeof this.element.getAttribute('data-original-title');
  4738. if (this.element.getAttribute('title') || titleType !== 'string') {
  4739. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4740. this.element.setAttribute('title', '');
  4741. }
  4742. };
  4743. _proto._enter = function _enter(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 === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4752. }
  4753. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4754. context._hoverState = HoverState.SHOW;
  4755. return;
  4756. }
  4757. clearTimeout(context._timeout);
  4758. context._hoverState = HoverState.SHOW;
  4759. if (!context.config.delay || !context.config.delay.show) {
  4760. context.show();
  4761. return;
  4762. }
  4763. context._timeout = setTimeout(function () {
  4764. if (context._hoverState === HoverState.SHOW) {
  4765. context.show();
  4766. }
  4767. }, context.config.delay.show);
  4768. };
  4769. _proto._leave = function _leave(event, context) {
  4770. var dataKey = this.constructor.DATA_KEY;
  4771. context = context || $(event.currentTarget).data(dataKey);
  4772. if (!context) {
  4773. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4774. $(event.currentTarget).data(dataKey, context);
  4775. }
  4776. if (event) {
  4777. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4778. }
  4779. if (context._isWithActiveTrigger()) {
  4780. return;
  4781. }
  4782. clearTimeout(context._timeout);
  4783. context._hoverState = HoverState.OUT;
  4784. if (!context.config.delay || !context.config.delay.hide) {
  4785. context.hide();
  4786. return;
  4787. }
  4788. context._timeout = setTimeout(function () {
  4789. if (context._hoverState === HoverState.OUT) {
  4790. context.hide();
  4791. }
  4792. }, context.config.delay.hide);
  4793. };
  4794. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4795. for (var trigger in this._activeTrigger) {
  4796. if (this._activeTrigger[trigger]) {
  4797. return true;
  4798. }
  4799. }
  4800. return false;
  4801. };
  4802. _proto._getConfig = function _getConfig(config) {
  4803. var dataAttributes = $(this.element).data();
  4804. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4805. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4806. delete dataAttributes[dataAttr];
  4807. }
  4808. });
  4809. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4810. if (typeof config.delay === 'number') {
  4811. config.delay = {
  4812. show: config.delay,
  4813. hide: config.delay
  4814. };
  4815. }
  4816. if (typeof config.title === 'number') {
  4817. config.title = config.title.toString();
  4818. }
  4819. if (typeof config.content === 'number') {
  4820. config.content = config.content.toString();
  4821. }
  4822. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4823. if (config.sanitize) {
  4824. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4825. }
  4826. return config;
  4827. };
  4828. _proto._getDelegateConfig = function _getDelegateConfig() {
  4829. var config = {};
  4830. if (this.config) {
  4831. for (var key in this.config) {
  4832. if (this.constructor.Default[key] !== this.config[key]) {
  4833. config[key] = this.config[key];
  4834. }
  4835. }
  4836. }
  4837. return config;
  4838. };
  4839. _proto._cleanTipClass = function _cleanTipClass() {
  4840. var $tip = $(this.getTipElement());
  4841. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4842. if (tabClass !== null && tabClass.length) {
  4843. $tip.removeClass(tabClass.join(''));
  4844. }
  4845. };
  4846. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4847. var popperInstance = popperData.instance;
  4848. this.tip = popperInstance.popper;
  4849. this._cleanTipClass();
  4850. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4851. };
  4852. _proto._fixTransition = function _fixTransition() {
  4853. var tip = this.getTipElement();
  4854. var initConfigAnimation = this.config.animation;
  4855. if (tip.getAttribute('x-placement') !== null) {
  4856. return;
  4857. }
  4858. $(tip).removeClass(ClassName$6.FADE);
  4859. this.config.animation = false;
  4860. this.hide();
  4861. this.show();
  4862. this.config.animation = initConfigAnimation;
  4863. } // Static
  4864. ;
  4865. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4866. return this.each(function () {
  4867. var data = $(this).data(DATA_KEY$6);
  4868. var _config = typeof config === 'object' && config;
  4869. if (!data && /dispose|hide/.test(config)) {
  4870. return;
  4871. }
  4872. if (!data) {
  4873. data = new Tooltip(this, _config);
  4874. $(this).data(DATA_KEY$6, data);
  4875. }
  4876. if (typeof config === 'string') {
  4877. if (typeof data[config] === 'undefined') {
  4878. throw new TypeError("No method named \"" + config + "\"");
  4879. }
  4880. data[config]();
  4881. }
  4882. });
  4883. };
  4884. _createClass(Tooltip, null, [{
  4885. key: "VERSION",
  4886. get: function get() {
  4887. return VERSION$6;
  4888. }
  4889. }, {
  4890. key: "Default",
  4891. get: function get() {
  4892. return Default$4;
  4893. }
  4894. }, {
  4895. key: "NAME",
  4896. get: function get() {
  4897. return NAME$6;
  4898. }
  4899. }, {
  4900. key: "DATA_KEY",
  4901. get: function get() {
  4902. return DATA_KEY$6;
  4903. }
  4904. }, {
  4905. key: "Event",
  4906. get: function get() {
  4907. return Event$6;
  4908. }
  4909. }, {
  4910. key: "EVENT_KEY",
  4911. get: function get() {
  4912. return EVENT_KEY$6;
  4913. }
  4914. }, {
  4915. key: "DefaultType",
  4916. get: function get() {
  4917. return DefaultType$4;
  4918. }
  4919. }]);
  4920. return Tooltip;
  4921. }();
  4922. /**
  4923. * ------------------------------------------------------------------------
  4924. * jQuery
  4925. * ------------------------------------------------------------------------
  4926. */
  4927. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4928. $.fn[NAME$6].Constructor = Tooltip;
  4929. $.fn[NAME$6].noConflict = function () {
  4930. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4931. return Tooltip._jQueryInterface;
  4932. };
  4933. /**
  4934. * ------------------------------------------------------------------------
  4935. * Constants
  4936. * ------------------------------------------------------------------------
  4937. */
  4938. var NAME$7 = 'popover';
  4939. var VERSION$7 = '4.4.1';
  4940. var DATA_KEY$7 = 'bs.popover';
  4941. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4942. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4943. var CLASS_PREFIX$1 = 'bs-popover';
  4944. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4945. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4946. placement: 'right',
  4947. trigger: 'click',
  4948. content: '',
  4949. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4950. });
  4951. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4952. content: '(string|element|function)'
  4953. });
  4954. var ClassName$7 = {
  4955. FADE: 'fade',
  4956. SHOW: 'show'
  4957. };
  4958. var Selector$7 = {
  4959. TITLE: '.popover-header',
  4960. CONTENT: '.popover-body'
  4961. };
  4962. var Event$7 = {
  4963. HIDE: "hide" + EVENT_KEY$7,
  4964. HIDDEN: "hidden" + EVENT_KEY$7,
  4965. SHOW: "show" + EVENT_KEY$7,
  4966. SHOWN: "shown" + EVENT_KEY$7,
  4967. INSERTED: "inserted" + EVENT_KEY$7,
  4968. CLICK: "click" + EVENT_KEY$7,
  4969. FOCUSIN: "focusin" + EVENT_KEY$7,
  4970. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4971. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4972. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4973. };
  4974. /**
  4975. * ------------------------------------------------------------------------
  4976. * Class Definition
  4977. * ------------------------------------------------------------------------
  4978. */
  4979. var Popover =
  4980. /*#__PURE__*/
  4981. function (_Tooltip) {
  4982. _inheritsLoose(Popover, _Tooltip);
  4983. function Popover() {
  4984. return _Tooltip.apply(this, arguments) || this;
  4985. }
  4986. var _proto = Popover.prototype;
  4987. // Overrides
  4988. _proto.isWithContent = function isWithContent() {
  4989. return this.getTitle() || this._getContent();
  4990. };
  4991. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4992. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4993. };
  4994. _proto.getTipElement = function getTipElement() {
  4995. this.tip = this.tip || $(this.config.template)[0];
  4996. return this.tip;
  4997. };
  4998. _proto.setContent = function setContent() {
  4999. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5000. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5001. var content = this._getContent();
  5002. if (typeof content === 'function') {
  5003. content = content.call(this.element);
  5004. }
  5005. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5006. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5007. } // Private
  5008. ;
  5009. _proto._getContent = function _getContent() {
  5010. return this.element.getAttribute('data-content') || this.config.content;
  5011. };
  5012. _proto._cleanTipClass = function _cleanTipClass() {
  5013. var $tip = $(this.getTipElement());
  5014. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5015. if (tabClass !== null && tabClass.length > 0) {
  5016. $tip.removeClass(tabClass.join(''));
  5017. }
  5018. } // Static
  5019. ;
  5020. Popover._jQueryInterface = function _jQueryInterface(config) {
  5021. return this.each(function () {
  5022. var data = $(this).data(DATA_KEY$7);
  5023. var _config = typeof config === 'object' ? config : null;
  5024. if (!data && /dispose|hide/.test(config)) {
  5025. return;
  5026. }
  5027. if (!data) {
  5028. data = new Popover(this, _config);
  5029. $(this).data(DATA_KEY$7, data);
  5030. }
  5031. if (typeof config === 'string') {
  5032. if (typeof data[config] === 'undefined') {
  5033. throw new TypeError("No method named \"" + config + "\"");
  5034. }
  5035. data[config]();
  5036. }
  5037. });
  5038. };
  5039. _createClass(Popover, null, [{
  5040. key: "VERSION",
  5041. // Getters
  5042. get: function get() {
  5043. return VERSION$7;
  5044. }
  5045. }, {
  5046. key: "Default",
  5047. get: function get() {
  5048. return Default$5;
  5049. }
  5050. }, {
  5051. key: "NAME",
  5052. get: function get() {
  5053. return NAME$7;
  5054. }
  5055. }, {
  5056. key: "DATA_KEY",
  5057. get: function get() {
  5058. return DATA_KEY$7;
  5059. }
  5060. }, {
  5061. key: "Event",
  5062. get: function get() {
  5063. return Event$7;
  5064. }
  5065. }, {
  5066. key: "EVENT_KEY",
  5067. get: function get() {
  5068. return EVENT_KEY$7;
  5069. }
  5070. }, {
  5071. key: "DefaultType",
  5072. get: function get() {
  5073. return DefaultType$5;
  5074. }
  5075. }]);
  5076. return Popover;
  5077. }(Tooltip);
  5078. /**
  5079. * ------------------------------------------------------------------------
  5080. * jQuery
  5081. * ------------------------------------------------------------------------
  5082. */
  5083. $.fn[NAME$7] = Popover._jQueryInterface;
  5084. $.fn[NAME$7].Constructor = Popover;
  5085. $.fn[NAME$7].noConflict = function () {
  5086. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5087. return Popover._jQueryInterface;
  5088. };
  5089. /**
  5090. * ------------------------------------------------------------------------
  5091. * Constants
  5092. * ------------------------------------------------------------------------
  5093. */
  5094. var NAME$8 = 'scrollspy';
  5095. var VERSION$8 = '4.4.1';
  5096. var DATA_KEY$8 = 'bs.scrollspy';
  5097. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5098. var DATA_API_KEY$6 = '.data-api';
  5099. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5100. var Default$6 = {
  5101. offset: 10,
  5102. method: 'auto',
  5103. target: ''
  5104. };
  5105. var DefaultType$6 = {
  5106. offset: 'number',
  5107. method: 'string',
  5108. target: '(string|element)'
  5109. };
  5110. var Event$8 = {
  5111. ACTIVATE: "activate" + EVENT_KEY$8,
  5112. SCROLL: "scroll" + EVENT_KEY$8,
  5113. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5114. };
  5115. var ClassName$8 = {
  5116. DROPDOWN_ITEM: 'dropdown-item',
  5117. DROPDOWN_MENU: 'dropdown-menu',
  5118. ACTIVE: 'active'
  5119. };
  5120. var Selector$8 = {
  5121. DATA_SPY: '[data-spy="scroll"]',
  5122. ACTIVE: '.active',
  5123. NAV_LIST_GROUP: '.nav, .list-group',
  5124. NAV_LINKS: '.nav-link',
  5125. NAV_ITEMS: '.nav-item',
  5126. LIST_ITEMS: '.list-group-item',
  5127. DROPDOWN: '.dropdown',
  5128. DROPDOWN_ITEMS: '.dropdown-item',
  5129. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5130. };
  5131. var OffsetMethod = {
  5132. OFFSET: 'offset',
  5133. POSITION: 'position'
  5134. };
  5135. /**
  5136. * ------------------------------------------------------------------------
  5137. * Class Definition
  5138. * ------------------------------------------------------------------------
  5139. */
  5140. var ScrollSpy =
  5141. /*#__PURE__*/
  5142. function () {
  5143. function ScrollSpy(element, config) {
  5144. var _this = this;
  5145. this._element = element;
  5146. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5147. this._config = this._getConfig(config);
  5148. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5149. this._offsets = [];
  5150. this._targets = [];
  5151. this._activeTarget = null;
  5152. this._scrollHeight = 0;
  5153. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5154. return _this._process(event);
  5155. });
  5156. this.refresh();
  5157. this._process();
  5158. } // Getters
  5159. var _proto = ScrollSpy.prototype;
  5160. // Public
  5161. _proto.refresh = function refresh() {
  5162. var _this2 = this;
  5163. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5164. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5165. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5166. this._offsets = [];
  5167. this._targets = [];
  5168. this._scrollHeight = this._getScrollHeight();
  5169. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5170. targets.map(function (element) {
  5171. var target;
  5172. var targetSelector = Util.getSelectorFromElement(element);
  5173. if (targetSelector) {
  5174. target = document.querySelector(targetSelector);
  5175. }
  5176. if (target) {
  5177. var targetBCR = target.getBoundingClientRect();
  5178. if (targetBCR.width || targetBCR.height) {
  5179. // TODO (fat): remove sketch reliance on jQuery position/offset
  5180. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5181. }
  5182. }
  5183. return null;
  5184. }).filter(function (item) {
  5185. return item;
  5186. }).sort(function (a, b) {
  5187. return a[0] - b[0];
  5188. }).forEach(function (item) {
  5189. _this2._offsets.push(item[0]);
  5190. _this2._targets.push(item[1]);
  5191. });
  5192. };
  5193. _proto.dispose = function dispose() {
  5194. $.removeData(this._element, DATA_KEY$8);
  5195. $(this._scrollElement).off(EVENT_KEY$8);
  5196. this._element = null;
  5197. this._scrollElement = null;
  5198. this._config = null;
  5199. this._selector = null;
  5200. this._offsets = null;
  5201. this._targets = null;
  5202. this._activeTarget = null;
  5203. this._scrollHeight = null;
  5204. } // Private
  5205. ;
  5206. _proto._getConfig = function _getConfig(config) {
  5207. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5208. if (typeof config.target !== 'string') {
  5209. var id = $(config.target).attr('id');
  5210. if (!id) {
  5211. id = Util.getUID(NAME$8);
  5212. $(config.target).attr('id', id);
  5213. }
  5214. config.target = "#" + id;
  5215. }
  5216. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5217. return config;
  5218. };
  5219. _proto._getScrollTop = function _getScrollTop() {
  5220. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5221. };
  5222. _proto._getScrollHeight = function _getScrollHeight() {
  5223. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5224. };
  5225. _proto._getOffsetHeight = function _getOffsetHeight() {
  5226. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5227. };
  5228. _proto._process = function _process() {
  5229. var scrollTop = this._getScrollTop() + this._config.offset;
  5230. var scrollHeight = this._getScrollHeight();
  5231. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5232. if (this._scrollHeight !== scrollHeight) {
  5233. this.refresh();
  5234. }
  5235. if (scrollTop >= maxScroll) {
  5236. var target = this._targets[this._targets.length - 1];
  5237. if (this._activeTarget !== target) {
  5238. this._activate(target);
  5239. }
  5240. return;
  5241. }
  5242. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5243. this._activeTarget = null;
  5244. this._clear();
  5245. return;
  5246. }
  5247. var offsetLength = this._offsets.length;
  5248. for (var i = offsetLength; i--;) {
  5249. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5250. if (isActiveTarget) {
  5251. this._activate(this._targets[i]);
  5252. }
  5253. }
  5254. };
  5255. _proto._activate = function _activate(target) {
  5256. this._activeTarget = target;
  5257. this._clear();
  5258. var queries = this._selector.split(',').map(function (selector) {
  5259. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5260. });
  5261. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5262. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5263. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5264. $link.addClass(ClassName$8.ACTIVE);
  5265. } else {
  5266. // Set triggered link as active
  5267. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5268. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5269. $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
  5270. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5271. }
  5272. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5273. relatedTarget: target
  5274. });
  5275. };
  5276. _proto._clear = function _clear() {
  5277. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5278. return node.classList.contains(ClassName$8.ACTIVE);
  5279. }).forEach(function (node) {
  5280. return node.classList.remove(ClassName$8.ACTIVE);
  5281. });
  5282. } // Static
  5283. ;
  5284. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5285. return this.each(function () {
  5286. var data = $(this).data(DATA_KEY$8);
  5287. var _config = typeof config === 'object' && config;
  5288. if (!data) {
  5289. data = new ScrollSpy(this, _config);
  5290. $(this).data(DATA_KEY$8, data);
  5291. }
  5292. if (typeof config === 'string') {
  5293. if (typeof data[config] === 'undefined') {
  5294. throw new TypeError("No method named \"" + config + "\"");
  5295. }
  5296. data[config]();
  5297. }
  5298. });
  5299. };
  5300. _createClass(ScrollSpy, null, [{
  5301. key: "VERSION",
  5302. get: function get() {
  5303. return VERSION$8;
  5304. }
  5305. }, {
  5306. key: "Default",
  5307. get: function get() {
  5308. return Default$6;
  5309. }
  5310. }]);
  5311. return ScrollSpy;
  5312. }();
  5313. /**
  5314. * ------------------------------------------------------------------------
  5315. * Data Api implementation
  5316. * ------------------------------------------------------------------------
  5317. */
  5318. $(window).on(Event$8.LOAD_DATA_API, function () {
  5319. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5320. var scrollSpysLength = scrollSpys.length;
  5321. for (var i = scrollSpysLength; i--;) {
  5322. var $spy = $(scrollSpys[i]);
  5323. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5324. }
  5325. });
  5326. /**
  5327. * ------------------------------------------------------------------------
  5328. * jQuery
  5329. * ------------------------------------------------------------------------
  5330. */
  5331. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5332. $.fn[NAME$8].Constructor = ScrollSpy;
  5333. $.fn[NAME$8].noConflict = function () {
  5334. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5335. return ScrollSpy._jQueryInterface;
  5336. };
  5337. /**
  5338. * ------------------------------------------------------------------------
  5339. * Constants
  5340. * ------------------------------------------------------------------------
  5341. */
  5342. var NAME$9 = 'tab';
  5343. var VERSION$9 = '4.4.1';
  5344. var DATA_KEY$9 = 'bs.tab';
  5345. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5346. var DATA_API_KEY$7 = '.data-api';
  5347. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5348. var Event$9 = {
  5349. HIDE: "hide" + EVENT_KEY$9,
  5350. HIDDEN: "hidden" + EVENT_KEY$9,
  5351. SHOW: "show" + EVENT_KEY$9,
  5352. SHOWN: "shown" + EVENT_KEY$9,
  5353. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5354. };
  5355. var ClassName$9 = {
  5356. DROPDOWN_MENU: 'dropdown-menu',
  5357. ACTIVE: 'active',
  5358. DISABLED: 'disabled',
  5359. FADE: 'fade',
  5360. SHOW: 'show'
  5361. };
  5362. var Selector$9 = {
  5363. DROPDOWN: '.dropdown',
  5364. NAV_LIST_GROUP: '.nav, .list-group',
  5365. ACTIVE: '.active',
  5366. ACTIVE_UL: '> li > .active',
  5367. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5368. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5369. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5370. };
  5371. /**
  5372. * ------------------------------------------------------------------------
  5373. * Class Definition
  5374. * ------------------------------------------------------------------------
  5375. */
  5376. var Tab =
  5377. /*#__PURE__*/
  5378. function () {
  5379. function Tab(element) {
  5380. this._element = element;
  5381. } // Getters
  5382. var _proto = Tab.prototype;
  5383. // Public
  5384. _proto.show = function show() {
  5385. var _this = this;
  5386. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5387. return;
  5388. }
  5389. var target;
  5390. var previous;
  5391. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5392. var selector = Util.getSelectorFromElement(this._element);
  5393. if (listElement) {
  5394. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5395. previous = $.makeArray($(listElement).find(itemSelector));
  5396. previous = previous[previous.length - 1];
  5397. }
  5398. var hideEvent = $.Event(Event$9.HIDE, {
  5399. relatedTarget: this._element
  5400. });
  5401. var showEvent = $.Event(Event$9.SHOW, {
  5402. relatedTarget: previous
  5403. });
  5404. if (previous) {
  5405. $(previous).trigger(hideEvent);
  5406. }
  5407. $(this._element).trigger(showEvent);
  5408. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5409. return;
  5410. }
  5411. if (selector) {
  5412. target = document.querySelector(selector);
  5413. }
  5414. this._activate(this._element, listElement);
  5415. var complete = function complete() {
  5416. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5417. relatedTarget: _this._element
  5418. });
  5419. var shownEvent = $.Event(Event$9.SHOWN, {
  5420. relatedTarget: previous
  5421. });
  5422. $(previous).trigger(hiddenEvent);
  5423. $(_this._element).trigger(shownEvent);
  5424. };
  5425. if (target) {
  5426. this._activate(target, target.parentNode, complete);
  5427. } else {
  5428. complete();
  5429. }
  5430. };
  5431. _proto.dispose = function dispose() {
  5432. $.removeData(this._element, DATA_KEY$9);
  5433. this._element = null;
  5434. } // Private
  5435. ;
  5436. _proto._activate = function _activate(element, container, callback) {
  5437. var _this2 = this;
  5438. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5439. var active = activeElements[0];
  5440. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5441. var complete = function complete() {
  5442. return _this2._transitionComplete(element, active, callback);
  5443. };
  5444. if (active && isTransitioning) {
  5445. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5446. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5447. } else {
  5448. complete();
  5449. }
  5450. };
  5451. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5452. if (active) {
  5453. $(active).removeClass(ClassName$9.ACTIVE);
  5454. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5455. if (dropdownChild) {
  5456. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5457. }
  5458. if (active.getAttribute('role') === 'tab') {
  5459. active.setAttribute('aria-selected', false);
  5460. }
  5461. }
  5462. $(element).addClass(ClassName$9.ACTIVE);
  5463. if (element.getAttribute('role') === 'tab') {
  5464. element.setAttribute('aria-selected', true);
  5465. }
  5466. Util.reflow(element);
  5467. if (element.classList.contains(ClassName$9.FADE)) {
  5468. element.classList.add(ClassName$9.SHOW);
  5469. }
  5470. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5471. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5472. if (dropdownElement) {
  5473. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5474. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5475. }
  5476. element.setAttribute('aria-expanded', true);
  5477. }
  5478. if (callback) {
  5479. callback();
  5480. }
  5481. } // Static
  5482. ;
  5483. Tab._jQueryInterface = function _jQueryInterface(config) {
  5484. return this.each(function () {
  5485. var $this = $(this);
  5486. var data = $this.data(DATA_KEY$9);
  5487. if (!data) {
  5488. data = new Tab(this);
  5489. $this.data(DATA_KEY$9, data);
  5490. }
  5491. if (typeof config === 'string') {
  5492. if (typeof data[config] === 'undefined') {
  5493. throw new TypeError("No method named \"" + config + "\"");
  5494. }
  5495. data[config]();
  5496. }
  5497. });
  5498. };
  5499. _createClass(Tab, null, [{
  5500. key: "VERSION",
  5501. get: function get() {
  5502. return VERSION$9;
  5503. }
  5504. }]);
  5505. return Tab;
  5506. }();
  5507. /**
  5508. * ------------------------------------------------------------------------
  5509. * Data Api implementation
  5510. * ------------------------------------------------------------------------
  5511. */
  5512. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5513. event.preventDefault();
  5514. Tab._jQueryInterface.call($(this), 'show');
  5515. });
  5516. /**
  5517. * ------------------------------------------------------------------------
  5518. * jQuery
  5519. * ------------------------------------------------------------------------
  5520. */
  5521. $.fn[NAME$9] = Tab._jQueryInterface;
  5522. $.fn[NAME$9].Constructor = Tab;
  5523. $.fn[NAME$9].noConflict = function () {
  5524. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5525. return Tab._jQueryInterface;
  5526. };
  5527. /**
  5528. * ------------------------------------------------------------------------
  5529. * Constants
  5530. * ------------------------------------------------------------------------
  5531. */
  5532. var NAME$a = 'toast';
  5533. var VERSION$a = '4.4.1';
  5534. var DATA_KEY$a = 'bs.toast';
  5535. var EVENT_KEY$a = "." + DATA_KEY$a;
  5536. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5537. var Event$a = {
  5538. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5539. HIDE: "hide" + EVENT_KEY$a,
  5540. HIDDEN: "hidden" + EVENT_KEY$a,
  5541. SHOW: "show" + EVENT_KEY$a,
  5542. SHOWN: "shown" + EVENT_KEY$a
  5543. };
  5544. var ClassName$a = {
  5545. FADE: 'fade',
  5546. HIDE: 'hide',
  5547. SHOW: 'show',
  5548. SHOWING: 'showing'
  5549. };
  5550. var DefaultType$7 = {
  5551. animation: 'boolean',
  5552. autohide: 'boolean',
  5553. delay: 'number'
  5554. };
  5555. var Default$7 = {
  5556. animation: true,
  5557. autohide: true,
  5558. delay: 500
  5559. };
  5560. var Selector$a = {
  5561. DATA_DISMISS: '[data-dismiss="toast"]'
  5562. };
  5563. /**
  5564. * ------------------------------------------------------------------------
  5565. * Class Definition
  5566. * ------------------------------------------------------------------------
  5567. */
  5568. var Toast =
  5569. /*#__PURE__*/
  5570. function () {
  5571. function Toast(element, config) {
  5572. this._element = element;
  5573. this._config = this._getConfig(config);
  5574. this._timeout = null;
  5575. this._setListeners();
  5576. } // Getters
  5577. var _proto = Toast.prototype;
  5578. // Public
  5579. _proto.show = function show() {
  5580. var _this = this;
  5581. var showEvent = $.Event(Event$a.SHOW);
  5582. $(this._element).trigger(showEvent);
  5583. if (showEvent.isDefaultPrevented()) {
  5584. return;
  5585. }
  5586. if (this._config.animation) {
  5587. this._element.classList.add(ClassName$a.FADE);
  5588. }
  5589. var complete = function complete() {
  5590. _this._element.classList.remove(ClassName$a.SHOWING);
  5591. _this._element.classList.add(ClassName$a.SHOW);
  5592. $(_this._element).trigger(Event$a.SHOWN);
  5593. if (_this._config.autohide) {
  5594. _this._timeout = setTimeout(function () {
  5595. _this.hide();
  5596. }, _this._config.delay);
  5597. }
  5598. };
  5599. this._element.classList.remove(ClassName$a.HIDE);
  5600. Util.reflow(this._element);
  5601. this._element.classList.add(ClassName$a.SHOWING);
  5602. if (this._config.animation) {
  5603. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5604. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5605. } else {
  5606. complete();
  5607. }
  5608. };
  5609. _proto.hide = function hide() {
  5610. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5611. return;
  5612. }
  5613. var hideEvent = $.Event(Event$a.HIDE);
  5614. $(this._element).trigger(hideEvent);
  5615. if (hideEvent.isDefaultPrevented()) {
  5616. return;
  5617. }
  5618. this._close();
  5619. };
  5620. _proto.dispose = function dispose() {
  5621. clearTimeout(this._timeout);
  5622. this._timeout = null;
  5623. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5624. this._element.classList.remove(ClassName$a.SHOW);
  5625. }
  5626. $(this._element).off(Event$a.CLICK_DISMISS);
  5627. $.removeData(this._element, DATA_KEY$a);
  5628. this._element = null;
  5629. this._config = null;
  5630. } // Private
  5631. ;
  5632. _proto._getConfig = function _getConfig(config) {
  5633. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5634. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5635. return config;
  5636. };
  5637. _proto._setListeners = function _setListeners() {
  5638. var _this2 = this;
  5639. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5640. return _this2.hide();
  5641. });
  5642. };
  5643. _proto._close = function _close() {
  5644. var _this3 = this;
  5645. var complete = function complete() {
  5646. _this3._element.classList.add(ClassName$a.HIDE);
  5647. $(_this3._element).trigger(Event$a.HIDDEN);
  5648. };
  5649. this._element.classList.remove(ClassName$a.SHOW);
  5650. if (this._config.animation) {
  5651. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5652. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5653. } else {
  5654. complete();
  5655. }
  5656. } // Static
  5657. ;
  5658. Toast._jQueryInterface = function _jQueryInterface(config) {
  5659. return this.each(function () {
  5660. var $element = $(this);
  5661. var data = $element.data(DATA_KEY$a);
  5662. var _config = typeof config === 'object' && config;
  5663. if (!data) {
  5664. data = new Toast(this, _config);
  5665. $element.data(DATA_KEY$a, data);
  5666. }
  5667. if (typeof config === 'string') {
  5668. if (typeof data[config] === 'undefined') {
  5669. throw new TypeError("No method named \"" + config + "\"");
  5670. }
  5671. data[config](this);
  5672. }
  5673. });
  5674. };
  5675. _createClass(Toast, null, [{
  5676. key: "VERSION",
  5677. get: function get() {
  5678. return VERSION$a;
  5679. }
  5680. }, {
  5681. key: "DefaultType",
  5682. get: function get() {
  5683. return DefaultType$7;
  5684. }
  5685. }, {
  5686. key: "Default",
  5687. get: function get() {
  5688. return Default$7;
  5689. }
  5690. }]);
  5691. return Toast;
  5692. }();
  5693. /**
  5694. * ------------------------------------------------------------------------
  5695. * jQuery
  5696. * ------------------------------------------------------------------------
  5697. */
  5698. $.fn[NAME$a] = Toast._jQueryInterface;
  5699. $.fn[NAME$a].Constructor = Toast;
  5700. $.fn[NAME$a].noConflict = function () {
  5701. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5702. return Toast._jQueryInterface;
  5703. };
  5704. exports.Alert = Alert;
  5705. exports.Button = Button;
  5706. exports.Carousel = Carousel;
  5707. exports.Collapse = Collapse;
  5708. exports.Dropdown = Dropdown;
  5709. exports.Modal = Modal;
  5710. exports.Popover = Popover;
  5711. exports.Scrollspy = ScrollSpy;
  5712. exports.Tab = Tab;
  5713. exports.Toast = Toast;
  5714. exports.Tooltip = Tooltip;
  5715. exports.Util = Util;
  5716. Object.defineProperty(exports, '__esModule', { value: true });
  5717. })));
  5718. //# sourceMappingURL=bootstrap.js.map
  5719. /***/ }),
  5720. /***/ "./node_modules/buffer/index.js":
  5721. /*!**************************************!*\
  5722. !*** ./node_modules/buffer/index.js ***!
  5723. \**************************************/
  5724. /*! no static exports found */
  5725. /***/ (function(module, exports, __webpack_require__) {
  5726. "use strict";
  5727. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5728. * The buffer module from node.js, for the browser.
  5729. *
  5730. * @author Feross Aboukhadijeh <http://feross.org>
  5731. * @license MIT
  5732. */
  5733. /* eslint-disable no-proto */
  5734. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5735. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5736. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5737. exports.Buffer = Buffer
  5738. exports.SlowBuffer = SlowBuffer
  5739. exports.INSPECT_MAX_BYTES = 50
  5740. /**
  5741. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5742. * === true Use Uint8Array implementation (fastest)
  5743. * === false Use Object implementation (most compatible, even IE6)
  5744. *
  5745. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5746. * Opera 11.6+, iOS 4.2+.
  5747. *
  5748. * Due to various browser bugs, sometimes the Object implementation will be used even
  5749. * when the browser supports typed arrays.
  5750. *
  5751. * Note:
  5752. *
  5753. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5754. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5755. *
  5756. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5757. *
  5758. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5759. * incorrect length in some situations.
  5760. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5761. * get the Object implementation, which is slower but behaves correctly.
  5762. */
  5763. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5764. ? global.TYPED_ARRAY_SUPPORT
  5765. : typedArraySupport()
  5766. /*
  5767. * Export kMaxLength after typed array support is determined.
  5768. */
  5769. exports.kMaxLength = kMaxLength()
  5770. function typedArraySupport () {
  5771. try {
  5772. var arr = new Uint8Array(1)
  5773. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5774. return arr.foo() === 42 && // typed array instances can be augmented
  5775. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5776. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5777. } catch (e) {
  5778. return false
  5779. }
  5780. }
  5781. function kMaxLength () {
  5782. return Buffer.TYPED_ARRAY_SUPPORT
  5783. ? 0x7fffffff
  5784. : 0x3fffffff
  5785. }
  5786. function createBuffer (that, length) {
  5787. if (kMaxLength() < length) {
  5788. throw new RangeError('Invalid typed array length')
  5789. }
  5790. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5791. // Return an augmented `Uint8Array` instance, for best performance
  5792. that = new Uint8Array(length)
  5793. that.__proto__ = Buffer.prototype
  5794. } else {
  5795. // Fallback: Return an object instance of the Buffer class
  5796. if (that === null) {
  5797. that = new Buffer(length)
  5798. }
  5799. that.length = length
  5800. }
  5801. return that
  5802. }
  5803. /**
  5804. * The Buffer constructor returns instances of `Uint8Array` that have their
  5805. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5806. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5807. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5808. * returns a single octet.
  5809. *
  5810. * The `Uint8Array` prototype remains unmodified.
  5811. */
  5812. function Buffer (arg, encodingOrOffset, length) {
  5813. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5814. return new Buffer(arg, encodingOrOffset, length)
  5815. }
  5816. // Common case.
  5817. if (typeof arg === 'number') {
  5818. if (typeof encodingOrOffset === 'string') {
  5819. throw new Error(
  5820. 'If encoding is specified then the first argument must be a string'
  5821. )
  5822. }
  5823. return allocUnsafe(this, arg)
  5824. }
  5825. return from(this, arg, encodingOrOffset, length)
  5826. }
  5827. Buffer.poolSize = 8192 // not used by this implementation
  5828. // TODO: Legacy, not needed anymore. Remove in next major version.
  5829. Buffer._augment = function (arr) {
  5830. arr.__proto__ = Buffer.prototype
  5831. return arr
  5832. }
  5833. function from (that, value, encodingOrOffset, length) {
  5834. if (typeof value === 'number') {
  5835. throw new TypeError('"value" argument must not be a number')
  5836. }
  5837. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5838. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5839. }
  5840. if (typeof value === 'string') {
  5841. return fromString(that, value, encodingOrOffset)
  5842. }
  5843. return fromObject(that, value)
  5844. }
  5845. /**
  5846. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5847. * if value is a number.
  5848. * Buffer.from(str[, encoding])
  5849. * Buffer.from(array)
  5850. * Buffer.from(buffer)
  5851. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5852. **/
  5853. Buffer.from = function (value, encodingOrOffset, length) {
  5854. return from(null, value, encodingOrOffset, length)
  5855. }
  5856. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5857. Buffer.prototype.__proto__ = Uint8Array.prototype
  5858. Buffer.__proto__ = Uint8Array
  5859. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5860. Buffer[Symbol.species] === Buffer) {
  5861. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5862. Object.defineProperty(Buffer, Symbol.species, {
  5863. value: null,
  5864. configurable: true
  5865. })
  5866. }
  5867. }
  5868. function assertSize (size) {
  5869. if (typeof size !== 'number') {
  5870. throw new TypeError('"size" argument must be a number')
  5871. } else if (size < 0) {
  5872. throw new RangeError('"size" argument must not be negative')
  5873. }
  5874. }
  5875. function alloc (that, size, fill, encoding) {
  5876. assertSize(size)
  5877. if (size <= 0) {
  5878. return createBuffer(that, size)
  5879. }
  5880. if (fill !== undefined) {
  5881. // Only pay attention to encoding if it's a string. This
  5882. // prevents accidentally sending in a number that would
  5883. // be interpretted as a start offset.
  5884. return typeof encoding === 'string'
  5885. ? createBuffer(that, size).fill(fill, encoding)
  5886. : createBuffer(that, size).fill(fill)
  5887. }
  5888. return createBuffer(that, size)
  5889. }
  5890. /**
  5891. * Creates a new filled Buffer instance.
  5892. * alloc(size[, fill[, encoding]])
  5893. **/
  5894. Buffer.alloc = function (size, fill, encoding) {
  5895. return alloc(null, size, fill, encoding)
  5896. }
  5897. function allocUnsafe (that, size) {
  5898. assertSize(size)
  5899. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5900. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5901. for (var i = 0; i < size; ++i) {
  5902. that[i] = 0
  5903. }
  5904. }
  5905. return that
  5906. }
  5907. /**
  5908. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5909. * */
  5910. Buffer.allocUnsafe = function (size) {
  5911. return allocUnsafe(null, size)
  5912. }
  5913. /**
  5914. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5915. */
  5916. Buffer.allocUnsafeSlow = function (size) {
  5917. return allocUnsafe(null, size)
  5918. }
  5919. function fromString (that, string, encoding) {
  5920. if (typeof encoding !== 'string' || encoding === '') {
  5921. encoding = 'utf8'
  5922. }
  5923. if (!Buffer.isEncoding(encoding)) {
  5924. throw new TypeError('"encoding" must be a valid string encoding')
  5925. }
  5926. var length = byteLength(string, encoding) | 0
  5927. that = createBuffer(that, length)
  5928. var actual = that.write(string, encoding)
  5929. if (actual !== length) {
  5930. // Writing a hex string, for example, that contains invalid characters will
  5931. // cause everything after the first invalid character to be ignored. (e.g.
  5932. // 'abxxcd' will be treated as 'ab')
  5933. that = that.slice(0, actual)
  5934. }
  5935. return that
  5936. }
  5937. function fromArrayLike (that, array) {
  5938. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5939. that = createBuffer(that, length)
  5940. for (var i = 0; i < length; i += 1) {
  5941. that[i] = array[i] & 255
  5942. }
  5943. return that
  5944. }
  5945. function fromArrayBuffer (that, array, byteOffset, length) {
  5946. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5947. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5948. throw new RangeError('\'offset\' is out of bounds')
  5949. }
  5950. if (array.byteLength < byteOffset + (length || 0)) {
  5951. throw new RangeError('\'length\' is out of bounds')
  5952. }
  5953. if (byteOffset === undefined && length === undefined) {
  5954. array = new Uint8Array(array)
  5955. } else if (length === undefined) {
  5956. array = new Uint8Array(array, byteOffset)
  5957. } else {
  5958. array = new Uint8Array(array, byteOffset, length)
  5959. }
  5960. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5961. // Return an augmented `Uint8Array` instance, for best performance
  5962. that = array
  5963. that.__proto__ = Buffer.prototype
  5964. } else {
  5965. // Fallback: Return an object instance of the Buffer class
  5966. that = fromArrayLike(that, array)
  5967. }
  5968. return that
  5969. }
  5970. function fromObject (that, obj) {
  5971. if (Buffer.isBuffer(obj)) {
  5972. var len = checked(obj.length) | 0
  5973. that = createBuffer(that, len)
  5974. if (that.length === 0) {
  5975. return that
  5976. }
  5977. obj.copy(that, 0, 0, len)
  5978. return that
  5979. }
  5980. if (obj) {
  5981. if ((typeof ArrayBuffer !== 'undefined' &&
  5982. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5983. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5984. return createBuffer(that, 0)
  5985. }
  5986. return fromArrayLike(that, obj)
  5987. }
  5988. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5989. return fromArrayLike(that, obj.data)
  5990. }
  5991. }
  5992. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5993. }
  5994. function checked (length) {
  5995. // Note: cannot use `length < kMaxLength()` here because that fails when
  5996. // length is NaN (which is otherwise coerced to zero.)
  5997. if (length >= kMaxLength()) {
  5998. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5999. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6000. }
  6001. return length | 0
  6002. }
  6003. function SlowBuffer (length) {
  6004. if (+length != length) { // eslint-disable-line eqeqeq
  6005. length = 0
  6006. }
  6007. return Buffer.alloc(+length)
  6008. }
  6009. Buffer.isBuffer = function isBuffer (b) {
  6010. return !!(b != null && b._isBuffer)
  6011. }
  6012. Buffer.compare = function compare (a, b) {
  6013. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6014. throw new TypeError('Arguments must be Buffers')
  6015. }
  6016. if (a === b) return 0
  6017. var x = a.length
  6018. var y = b.length
  6019. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6020. if (a[i] !== b[i]) {
  6021. x = a[i]
  6022. y = b[i]
  6023. break
  6024. }
  6025. }
  6026. if (x < y) return -1
  6027. if (y < x) return 1
  6028. return 0
  6029. }
  6030. Buffer.isEncoding = function isEncoding (encoding) {
  6031. switch (String(encoding).toLowerCase()) {
  6032. case 'hex':
  6033. case 'utf8':
  6034. case 'utf-8':
  6035. case 'ascii':
  6036. case 'latin1':
  6037. case 'binary':
  6038. case 'base64':
  6039. case 'ucs2':
  6040. case 'ucs-2':
  6041. case 'utf16le':
  6042. case 'utf-16le':
  6043. return true
  6044. default:
  6045. return false
  6046. }
  6047. }
  6048. Buffer.concat = function concat (list, length) {
  6049. if (!isArray(list)) {
  6050. throw new TypeError('"list" argument must be an Array of Buffers')
  6051. }
  6052. if (list.length === 0) {
  6053. return Buffer.alloc(0)
  6054. }
  6055. var i
  6056. if (length === undefined) {
  6057. length = 0
  6058. for (i = 0; i < list.length; ++i) {
  6059. length += list[i].length
  6060. }
  6061. }
  6062. var buffer = Buffer.allocUnsafe(length)
  6063. var pos = 0
  6064. for (i = 0; i < list.length; ++i) {
  6065. var buf = list[i]
  6066. if (!Buffer.isBuffer(buf)) {
  6067. throw new TypeError('"list" argument must be an Array of Buffers')
  6068. }
  6069. buf.copy(buffer, pos)
  6070. pos += buf.length
  6071. }
  6072. return buffer
  6073. }
  6074. function byteLength (string, encoding) {
  6075. if (Buffer.isBuffer(string)) {
  6076. return string.length
  6077. }
  6078. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6079. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6080. return string.byteLength
  6081. }
  6082. if (typeof string !== 'string') {
  6083. string = '' + string
  6084. }
  6085. var len = string.length
  6086. if (len === 0) return 0
  6087. // Use a for loop to avoid recursion
  6088. var loweredCase = false
  6089. for (;;) {
  6090. switch (encoding) {
  6091. case 'ascii':
  6092. case 'latin1':
  6093. case 'binary':
  6094. return len
  6095. case 'utf8':
  6096. case 'utf-8':
  6097. case undefined:
  6098. return utf8ToBytes(string).length
  6099. case 'ucs2':
  6100. case 'ucs-2':
  6101. case 'utf16le':
  6102. case 'utf-16le':
  6103. return len * 2
  6104. case 'hex':
  6105. return len >>> 1
  6106. case 'base64':
  6107. return base64ToBytes(string).length
  6108. default:
  6109. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6110. encoding = ('' + encoding).toLowerCase()
  6111. loweredCase = true
  6112. }
  6113. }
  6114. }
  6115. Buffer.byteLength = byteLength
  6116. function slowToString (encoding, start, end) {
  6117. var loweredCase = false
  6118. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6119. // property of a typed array.
  6120. // This behaves neither like String nor Uint8Array in that we set start/end
  6121. // to their upper/lower bounds if the value passed is out of range.
  6122. // undefined is handled specially as per ECMA-262 6th Edition,
  6123. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6124. if (start === undefined || start < 0) {
  6125. start = 0
  6126. }
  6127. // Return early if start > this.length. Done here to prevent potential uint32
  6128. // coercion fail below.
  6129. if (start > this.length) {
  6130. return ''
  6131. }
  6132. if (end === undefined || end > this.length) {
  6133. end = this.length
  6134. }
  6135. if (end <= 0) {
  6136. return ''
  6137. }
  6138. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6139. end >>>= 0
  6140. start >>>= 0
  6141. if (end <= start) {
  6142. return ''
  6143. }
  6144. if (!encoding) encoding = 'utf8'
  6145. while (true) {
  6146. switch (encoding) {
  6147. case 'hex':
  6148. return hexSlice(this, start, end)
  6149. case 'utf8':
  6150. case 'utf-8':
  6151. return utf8Slice(this, start, end)
  6152. case 'ascii':
  6153. return asciiSlice(this, start, end)
  6154. case 'latin1':
  6155. case 'binary':
  6156. return latin1Slice(this, start, end)
  6157. case 'base64':
  6158. return base64Slice(this, start, end)
  6159. case 'ucs2':
  6160. case 'ucs-2':
  6161. case 'utf16le':
  6162. case 'utf-16le':
  6163. return utf16leSlice(this, start, end)
  6164. default:
  6165. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6166. encoding = (encoding + '').toLowerCase()
  6167. loweredCase = true
  6168. }
  6169. }
  6170. }
  6171. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6172. // Buffer instances.
  6173. Buffer.prototype._isBuffer = true
  6174. function swap (b, n, m) {
  6175. var i = b[n]
  6176. b[n] = b[m]
  6177. b[m] = i
  6178. }
  6179. Buffer.prototype.swap16 = function swap16 () {
  6180. var len = this.length
  6181. if (len % 2 !== 0) {
  6182. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6183. }
  6184. for (var i = 0; i < len; i += 2) {
  6185. swap(this, i, i + 1)
  6186. }
  6187. return this
  6188. }
  6189. Buffer.prototype.swap32 = function swap32 () {
  6190. var len = this.length
  6191. if (len % 4 !== 0) {
  6192. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6193. }
  6194. for (var i = 0; i < len; i += 4) {
  6195. swap(this, i, i + 3)
  6196. swap(this, i + 1, i + 2)
  6197. }
  6198. return this
  6199. }
  6200. Buffer.prototype.swap64 = function swap64 () {
  6201. var len = this.length
  6202. if (len % 8 !== 0) {
  6203. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6204. }
  6205. for (var i = 0; i < len; i += 8) {
  6206. swap(this, i, i + 7)
  6207. swap(this, i + 1, i + 6)
  6208. swap(this, i + 2, i + 5)
  6209. swap(this, i + 3, i + 4)
  6210. }
  6211. return this
  6212. }
  6213. Buffer.prototype.toString = function toString () {
  6214. var length = this.length | 0
  6215. if (length === 0) return ''
  6216. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6217. return slowToString.apply(this, arguments)
  6218. }
  6219. Buffer.prototype.equals = function equals (b) {
  6220. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6221. if (this === b) return true
  6222. return Buffer.compare(this, b) === 0
  6223. }
  6224. Buffer.prototype.inspect = function inspect () {
  6225. var str = ''
  6226. var max = exports.INSPECT_MAX_BYTES
  6227. if (this.length > 0) {
  6228. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6229. if (this.length > max) str += ' ... '
  6230. }
  6231. return '<Buffer ' + str + '>'
  6232. }
  6233. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6234. if (!Buffer.isBuffer(target)) {
  6235. throw new TypeError('Argument must be a Buffer')
  6236. }
  6237. if (start === undefined) {
  6238. start = 0
  6239. }
  6240. if (end === undefined) {
  6241. end = target ? target.length : 0
  6242. }
  6243. if (thisStart === undefined) {
  6244. thisStart = 0
  6245. }
  6246. if (thisEnd === undefined) {
  6247. thisEnd = this.length
  6248. }
  6249. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6250. throw new RangeError('out of range index')
  6251. }
  6252. if (thisStart >= thisEnd && start >= end) {
  6253. return 0
  6254. }
  6255. if (thisStart >= thisEnd) {
  6256. return -1
  6257. }
  6258. if (start >= end) {
  6259. return 1
  6260. }
  6261. start >>>= 0
  6262. end >>>= 0
  6263. thisStart >>>= 0
  6264. thisEnd >>>= 0
  6265. if (this === target) return 0
  6266. var x = thisEnd - thisStart
  6267. var y = end - start
  6268. var len = Math.min(x, y)
  6269. var thisCopy = this.slice(thisStart, thisEnd)
  6270. var targetCopy = target.slice(start, end)
  6271. for (var i = 0; i < len; ++i) {
  6272. if (thisCopy[i] !== targetCopy[i]) {
  6273. x = thisCopy[i]
  6274. y = targetCopy[i]
  6275. break
  6276. }
  6277. }
  6278. if (x < y) return -1
  6279. if (y < x) return 1
  6280. return 0
  6281. }
  6282. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6283. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6284. //
  6285. // Arguments:
  6286. // - buffer - a Buffer to search
  6287. // - val - a string, Buffer, or number
  6288. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6289. // - encoding - an optional encoding, relevant is val is a string
  6290. // - dir - true for indexOf, false for lastIndexOf
  6291. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6292. // Empty buffer means no match
  6293. if (buffer.length === 0) return -1
  6294. // Normalize byteOffset
  6295. if (typeof byteOffset === 'string') {
  6296. encoding = byteOffset
  6297. byteOffset = 0
  6298. } else if (byteOffset > 0x7fffffff) {
  6299. byteOffset = 0x7fffffff
  6300. } else if (byteOffset < -0x80000000) {
  6301. byteOffset = -0x80000000
  6302. }
  6303. byteOffset = +byteOffset // Coerce to Number.
  6304. if (isNaN(byteOffset)) {
  6305. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6306. byteOffset = dir ? 0 : (buffer.length - 1)
  6307. }
  6308. // Normalize byteOffset: negative offsets start from the end of the buffer
  6309. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6310. if (byteOffset >= buffer.length) {
  6311. if (dir) return -1
  6312. else byteOffset = buffer.length - 1
  6313. } else if (byteOffset < 0) {
  6314. if (dir) byteOffset = 0
  6315. else return -1
  6316. }
  6317. // Normalize val
  6318. if (typeof val === 'string') {
  6319. val = Buffer.from(val, encoding)
  6320. }
  6321. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6322. if (Buffer.isBuffer(val)) {
  6323. // Special case: looking for empty string/buffer always fails
  6324. if (val.length === 0) {
  6325. return -1
  6326. }
  6327. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6328. } else if (typeof val === 'number') {
  6329. val = val & 0xFF // Search for a byte value [0-255]
  6330. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6331. typeof Uint8Array.prototype.indexOf === 'function') {
  6332. if (dir) {
  6333. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6334. } else {
  6335. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6336. }
  6337. }
  6338. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6339. }
  6340. throw new TypeError('val must be string, number or Buffer')
  6341. }
  6342. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6343. var indexSize = 1
  6344. var arrLength = arr.length
  6345. var valLength = val.length
  6346. if (encoding !== undefined) {
  6347. encoding = String(encoding).toLowerCase()
  6348. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6349. encoding === 'utf16le' || encoding === 'utf-16le') {
  6350. if (arr.length < 2 || val.length < 2) {
  6351. return -1
  6352. }
  6353. indexSize = 2
  6354. arrLength /= 2
  6355. valLength /= 2
  6356. byteOffset /= 2
  6357. }
  6358. }
  6359. function read (buf, i) {
  6360. if (indexSize === 1) {
  6361. return buf[i]
  6362. } else {
  6363. return buf.readUInt16BE(i * indexSize)
  6364. }
  6365. }
  6366. var i
  6367. if (dir) {
  6368. var foundIndex = -1
  6369. for (i = byteOffset; i < arrLength; i++) {
  6370. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6371. if (foundIndex === -1) foundIndex = i
  6372. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6373. } else {
  6374. if (foundIndex !== -1) i -= i - foundIndex
  6375. foundIndex = -1
  6376. }
  6377. }
  6378. } else {
  6379. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6380. for (i = byteOffset; i >= 0; i--) {
  6381. var found = true
  6382. for (var j = 0; j < valLength; j++) {
  6383. if (read(arr, i + j) !== read(val, j)) {
  6384. found = false
  6385. break
  6386. }
  6387. }
  6388. if (found) return i
  6389. }
  6390. }
  6391. return -1
  6392. }
  6393. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6394. return this.indexOf(val, byteOffset, encoding) !== -1
  6395. }
  6396. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6397. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6398. }
  6399. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6400. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6401. }
  6402. function hexWrite (buf, string, offset, length) {
  6403. offset = Number(offset) || 0
  6404. var remaining = buf.length - offset
  6405. if (!length) {
  6406. length = remaining
  6407. } else {
  6408. length = Number(length)
  6409. if (length > remaining) {
  6410. length = remaining
  6411. }
  6412. }
  6413. // must be an even number of digits
  6414. var strLen = string.length
  6415. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6416. if (length > strLen / 2) {
  6417. length = strLen / 2
  6418. }
  6419. for (var i = 0; i < length; ++i) {
  6420. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6421. if (isNaN(parsed)) return i
  6422. buf[offset + i] = parsed
  6423. }
  6424. return i
  6425. }
  6426. function utf8Write (buf, string, offset, length) {
  6427. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6428. }
  6429. function asciiWrite (buf, string, offset, length) {
  6430. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6431. }
  6432. function latin1Write (buf, string, offset, length) {
  6433. return asciiWrite(buf, string, offset, length)
  6434. }
  6435. function base64Write (buf, string, offset, length) {
  6436. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6437. }
  6438. function ucs2Write (buf, string, offset, length) {
  6439. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6440. }
  6441. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6442. // Buffer#write(string)
  6443. if (offset === undefined) {
  6444. encoding = 'utf8'
  6445. length = this.length
  6446. offset = 0
  6447. // Buffer#write(string, encoding)
  6448. } else if (length === undefined && typeof offset === 'string') {
  6449. encoding = offset
  6450. length = this.length
  6451. offset = 0
  6452. // Buffer#write(string, offset[, length][, encoding])
  6453. } else if (isFinite(offset)) {
  6454. offset = offset | 0
  6455. if (isFinite(length)) {
  6456. length = length | 0
  6457. if (encoding === undefined) encoding = 'utf8'
  6458. } else {
  6459. encoding = length
  6460. length = undefined
  6461. }
  6462. // legacy write(string, encoding, offset, length) - remove in v0.13
  6463. } else {
  6464. throw new Error(
  6465. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6466. )
  6467. }
  6468. var remaining = this.length - offset
  6469. if (length === undefined || length > remaining) length = remaining
  6470. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6471. throw new RangeError('Attempt to write outside buffer bounds')
  6472. }
  6473. if (!encoding) encoding = 'utf8'
  6474. var loweredCase = false
  6475. for (;;) {
  6476. switch (encoding) {
  6477. case 'hex':
  6478. return hexWrite(this, string, offset, length)
  6479. case 'utf8':
  6480. case 'utf-8':
  6481. return utf8Write(this, string, offset, length)
  6482. case 'ascii':
  6483. return asciiWrite(this, string, offset, length)
  6484. case 'latin1':
  6485. case 'binary':
  6486. return latin1Write(this, string, offset, length)
  6487. case 'base64':
  6488. // Warning: maxLength not taken into account in base64Write
  6489. return base64Write(this, string, offset, length)
  6490. case 'ucs2':
  6491. case 'ucs-2':
  6492. case 'utf16le':
  6493. case 'utf-16le':
  6494. return ucs2Write(this, string, offset, length)
  6495. default:
  6496. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6497. encoding = ('' + encoding).toLowerCase()
  6498. loweredCase = true
  6499. }
  6500. }
  6501. }
  6502. Buffer.prototype.toJSON = function toJSON () {
  6503. return {
  6504. type: 'Buffer',
  6505. data: Array.prototype.slice.call(this._arr || this, 0)
  6506. }
  6507. }
  6508. function base64Slice (buf, start, end) {
  6509. if (start === 0 && end === buf.length) {
  6510. return base64.fromByteArray(buf)
  6511. } else {
  6512. return base64.fromByteArray(buf.slice(start, end))
  6513. }
  6514. }
  6515. function utf8Slice (buf, start, end) {
  6516. end = Math.min(buf.length, end)
  6517. var res = []
  6518. var i = start
  6519. while (i < end) {
  6520. var firstByte = buf[i]
  6521. var codePoint = null
  6522. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6523. : (firstByte > 0xDF) ? 3
  6524. : (firstByte > 0xBF) ? 2
  6525. : 1
  6526. if (i + bytesPerSequence <= end) {
  6527. var secondByte, thirdByte, fourthByte, tempCodePoint
  6528. switch (bytesPerSequence) {
  6529. case 1:
  6530. if (firstByte < 0x80) {
  6531. codePoint = firstByte
  6532. }
  6533. break
  6534. case 2:
  6535. secondByte = buf[i + 1]
  6536. if ((secondByte & 0xC0) === 0x80) {
  6537. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6538. if (tempCodePoint > 0x7F) {
  6539. codePoint = tempCodePoint
  6540. }
  6541. }
  6542. break
  6543. case 3:
  6544. secondByte = buf[i + 1]
  6545. thirdByte = buf[i + 2]
  6546. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6547. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6548. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6549. codePoint = tempCodePoint
  6550. }
  6551. }
  6552. break
  6553. case 4:
  6554. secondByte = buf[i + 1]
  6555. thirdByte = buf[i + 2]
  6556. fourthByte = buf[i + 3]
  6557. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6558. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6559. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6560. codePoint = tempCodePoint
  6561. }
  6562. }
  6563. }
  6564. }
  6565. if (codePoint === null) {
  6566. // we did not generate a valid codePoint so insert a
  6567. // replacement char (U+FFFD) and advance only 1 byte
  6568. codePoint = 0xFFFD
  6569. bytesPerSequence = 1
  6570. } else if (codePoint > 0xFFFF) {
  6571. // encode to utf16 (surrogate pair dance)
  6572. codePoint -= 0x10000
  6573. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6574. codePoint = 0xDC00 | codePoint & 0x3FF
  6575. }
  6576. res.push(codePoint)
  6577. i += bytesPerSequence
  6578. }
  6579. return decodeCodePointsArray(res)
  6580. }
  6581. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6582. // the lowest limit is Chrome, with 0x10000 args.
  6583. // We go 1 magnitude less, for safety
  6584. var MAX_ARGUMENTS_LENGTH = 0x1000
  6585. function decodeCodePointsArray (codePoints) {
  6586. var len = codePoints.length
  6587. if (len <= MAX_ARGUMENTS_LENGTH) {
  6588. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6589. }
  6590. // Decode in chunks to avoid "call stack size exceeded".
  6591. var res = ''
  6592. var i = 0
  6593. while (i < len) {
  6594. res += String.fromCharCode.apply(
  6595. String,
  6596. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6597. )
  6598. }
  6599. return res
  6600. }
  6601. function asciiSlice (buf, start, end) {
  6602. var ret = ''
  6603. end = Math.min(buf.length, end)
  6604. for (var i = start; i < end; ++i) {
  6605. ret += String.fromCharCode(buf[i] & 0x7F)
  6606. }
  6607. return ret
  6608. }
  6609. function latin1Slice (buf, start, end) {
  6610. var ret = ''
  6611. end = Math.min(buf.length, end)
  6612. for (var i = start; i < end; ++i) {
  6613. ret += String.fromCharCode(buf[i])
  6614. }
  6615. return ret
  6616. }
  6617. function hexSlice (buf, start, end) {
  6618. var len = buf.length
  6619. if (!start || start < 0) start = 0
  6620. if (!end || end < 0 || end > len) end = len
  6621. var out = ''
  6622. for (var i = start; i < end; ++i) {
  6623. out += toHex(buf[i])
  6624. }
  6625. return out
  6626. }
  6627. function utf16leSlice (buf, start, end) {
  6628. var bytes = buf.slice(start, end)
  6629. var res = ''
  6630. for (var i = 0; i < bytes.length; i += 2) {
  6631. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6632. }
  6633. return res
  6634. }
  6635. Buffer.prototype.slice = function slice (start, end) {
  6636. var len = this.length
  6637. start = ~~start
  6638. end = end === undefined ? len : ~~end
  6639. if (start < 0) {
  6640. start += len
  6641. if (start < 0) start = 0
  6642. } else if (start > len) {
  6643. start = len
  6644. }
  6645. if (end < 0) {
  6646. end += len
  6647. if (end < 0) end = 0
  6648. } else if (end > len) {
  6649. end = len
  6650. }
  6651. if (end < start) end = start
  6652. var newBuf
  6653. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6654. newBuf = this.subarray(start, end)
  6655. newBuf.__proto__ = Buffer.prototype
  6656. } else {
  6657. var sliceLen = end - start
  6658. newBuf = new Buffer(sliceLen, undefined)
  6659. for (var i = 0; i < sliceLen; ++i) {
  6660. newBuf[i] = this[i + start]
  6661. }
  6662. }
  6663. return newBuf
  6664. }
  6665. /*
  6666. * Need to make sure that buffer isn't trying to write out of bounds.
  6667. */
  6668. function checkOffset (offset, ext, length) {
  6669. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6670. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6671. }
  6672. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6673. offset = offset | 0
  6674. byteLength = byteLength | 0
  6675. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6676. var val = this[offset]
  6677. var mul = 1
  6678. var i = 0
  6679. while (++i < byteLength && (mul *= 0x100)) {
  6680. val += this[offset + i] * mul
  6681. }
  6682. return val
  6683. }
  6684. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6685. offset = offset | 0
  6686. byteLength = byteLength | 0
  6687. if (!noAssert) {
  6688. checkOffset(offset, byteLength, this.length)
  6689. }
  6690. var val = this[offset + --byteLength]
  6691. var mul = 1
  6692. while (byteLength > 0 && (mul *= 0x100)) {
  6693. val += this[offset + --byteLength] * mul
  6694. }
  6695. return val
  6696. }
  6697. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6698. if (!noAssert) checkOffset(offset, 1, this.length)
  6699. return this[offset]
  6700. }
  6701. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6702. if (!noAssert) checkOffset(offset, 2, this.length)
  6703. return this[offset] | (this[offset + 1] << 8)
  6704. }
  6705. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6706. if (!noAssert) checkOffset(offset, 2, this.length)
  6707. return (this[offset] << 8) | this[offset + 1]
  6708. }
  6709. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6710. if (!noAssert) checkOffset(offset, 4, this.length)
  6711. return ((this[offset]) |
  6712. (this[offset + 1] << 8) |
  6713. (this[offset + 2] << 16)) +
  6714. (this[offset + 3] * 0x1000000)
  6715. }
  6716. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6717. if (!noAssert) checkOffset(offset, 4, this.length)
  6718. return (this[offset] * 0x1000000) +
  6719. ((this[offset + 1] << 16) |
  6720. (this[offset + 2] << 8) |
  6721. this[offset + 3])
  6722. }
  6723. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6724. offset = offset | 0
  6725. byteLength = byteLength | 0
  6726. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6727. var val = this[offset]
  6728. var mul = 1
  6729. var i = 0
  6730. while (++i < byteLength && (mul *= 0x100)) {
  6731. val += this[offset + i] * mul
  6732. }
  6733. mul *= 0x80
  6734. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6735. return val
  6736. }
  6737. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6738. offset = offset | 0
  6739. byteLength = byteLength | 0
  6740. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6741. var i = byteLength
  6742. var mul = 1
  6743. var val = this[offset + --i]
  6744. while (i > 0 && (mul *= 0x100)) {
  6745. val += this[offset + --i] * mul
  6746. }
  6747. mul *= 0x80
  6748. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6749. return val
  6750. }
  6751. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6752. if (!noAssert) checkOffset(offset, 1, this.length)
  6753. if (!(this[offset] & 0x80)) return (this[offset])
  6754. return ((0xff - this[offset] + 1) * -1)
  6755. }
  6756. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6757. if (!noAssert) checkOffset(offset, 2, this.length)
  6758. var val = this[offset] | (this[offset + 1] << 8)
  6759. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6760. }
  6761. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6762. if (!noAssert) checkOffset(offset, 2, this.length)
  6763. var val = this[offset + 1] | (this[offset] << 8)
  6764. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6765. }
  6766. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6767. if (!noAssert) checkOffset(offset, 4, this.length)
  6768. return (this[offset]) |
  6769. (this[offset + 1] << 8) |
  6770. (this[offset + 2] << 16) |
  6771. (this[offset + 3] << 24)
  6772. }
  6773. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6774. if (!noAssert) checkOffset(offset, 4, this.length)
  6775. return (this[offset] << 24) |
  6776. (this[offset + 1] << 16) |
  6777. (this[offset + 2] << 8) |
  6778. (this[offset + 3])
  6779. }
  6780. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6781. if (!noAssert) checkOffset(offset, 4, this.length)
  6782. return ieee754.read(this, offset, true, 23, 4)
  6783. }
  6784. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6785. if (!noAssert) checkOffset(offset, 4, this.length)
  6786. return ieee754.read(this, offset, false, 23, 4)
  6787. }
  6788. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6789. if (!noAssert) checkOffset(offset, 8, this.length)
  6790. return ieee754.read(this, offset, true, 52, 8)
  6791. }
  6792. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6793. if (!noAssert) checkOffset(offset, 8, this.length)
  6794. return ieee754.read(this, offset, false, 52, 8)
  6795. }
  6796. function checkInt (buf, value, offset, ext, max, min) {
  6797. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6798. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6799. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6800. }
  6801. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6802. value = +value
  6803. offset = offset | 0
  6804. byteLength = byteLength | 0
  6805. if (!noAssert) {
  6806. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6807. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6808. }
  6809. var mul = 1
  6810. var i = 0
  6811. this[offset] = value & 0xFF
  6812. while (++i < byteLength && (mul *= 0x100)) {
  6813. this[offset + i] = (value / mul) & 0xFF
  6814. }
  6815. return offset + byteLength
  6816. }
  6817. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6818. value = +value
  6819. offset = offset | 0
  6820. byteLength = byteLength | 0
  6821. if (!noAssert) {
  6822. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6823. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6824. }
  6825. var i = byteLength - 1
  6826. var mul = 1
  6827. this[offset + i] = value & 0xFF
  6828. while (--i >= 0 && (mul *= 0x100)) {
  6829. this[offset + i] = (value / mul) & 0xFF
  6830. }
  6831. return offset + byteLength
  6832. }
  6833. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6834. value = +value
  6835. offset = offset | 0
  6836. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6837. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6838. this[offset] = (value & 0xff)
  6839. return offset + 1
  6840. }
  6841. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6842. if (value < 0) value = 0xffff + value + 1
  6843. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6844. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6845. (littleEndian ? i : 1 - i) * 8
  6846. }
  6847. }
  6848. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6849. value = +value
  6850. offset = offset | 0
  6851. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6852. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6853. this[offset] = (value & 0xff)
  6854. this[offset + 1] = (value >>> 8)
  6855. } else {
  6856. objectWriteUInt16(this, value, offset, true)
  6857. }
  6858. return offset + 2
  6859. }
  6860. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6861. value = +value
  6862. offset = offset | 0
  6863. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6864. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6865. this[offset] = (value >>> 8)
  6866. this[offset + 1] = (value & 0xff)
  6867. } else {
  6868. objectWriteUInt16(this, value, offset, false)
  6869. }
  6870. return offset + 2
  6871. }
  6872. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6873. if (value < 0) value = 0xffffffff + value + 1
  6874. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6875. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6876. }
  6877. }
  6878. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6879. value = +value
  6880. offset = offset | 0
  6881. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6882. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6883. this[offset + 3] = (value >>> 24)
  6884. this[offset + 2] = (value >>> 16)
  6885. this[offset + 1] = (value >>> 8)
  6886. this[offset] = (value & 0xff)
  6887. } else {
  6888. objectWriteUInt32(this, value, offset, true)
  6889. }
  6890. return offset + 4
  6891. }
  6892. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6893. value = +value
  6894. offset = offset | 0
  6895. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6896. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6897. this[offset] = (value >>> 24)
  6898. this[offset + 1] = (value >>> 16)
  6899. this[offset + 2] = (value >>> 8)
  6900. this[offset + 3] = (value & 0xff)
  6901. } else {
  6902. objectWriteUInt32(this, value, offset, false)
  6903. }
  6904. return offset + 4
  6905. }
  6906. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6907. value = +value
  6908. offset = offset | 0
  6909. if (!noAssert) {
  6910. var limit = Math.pow(2, 8 * byteLength - 1)
  6911. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6912. }
  6913. var i = 0
  6914. var mul = 1
  6915. var sub = 0
  6916. this[offset] = value & 0xFF
  6917. while (++i < byteLength && (mul *= 0x100)) {
  6918. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6919. sub = 1
  6920. }
  6921. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6922. }
  6923. return offset + byteLength
  6924. }
  6925. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6926. value = +value
  6927. offset = offset | 0
  6928. if (!noAssert) {
  6929. var limit = Math.pow(2, 8 * byteLength - 1)
  6930. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6931. }
  6932. var i = byteLength - 1
  6933. var mul = 1
  6934. var sub = 0
  6935. this[offset + i] = value & 0xFF
  6936. while (--i >= 0 && (mul *= 0x100)) {
  6937. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6938. sub = 1
  6939. }
  6940. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6941. }
  6942. return offset + byteLength
  6943. }
  6944. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6945. value = +value
  6946. offset = offset | 0
  6947. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6948. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6949. if (value < 0) value = 0xff + value + 1
  6950. this[offset] = (value & 0xff)
  6951. return offset + 1
  6952. }
  6953. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6954. value = +value
  6955. offset = offset | 0
  6956. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6957. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6958. this[offset] = (value & 0xff)
  6959. this[offset + 1] = (value >>> 8)
  6960. } else {
  6961. objectWriteUInt16(this, value, offset, true)
  6962. }
  6963. return offset + 2
  6964. }
  6965. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6966. value = +value
  6967. offset = offset | 0
  6968. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6969. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6970. this[offset] = (value >>> 8)
  6971. this[offset + 1] = (value & 0xff)
  6972. } else {
  6973. objectWriteUInt16(this, value, offset, false)
  6974. }
  6975. return offset + 2
  6976. }
  6977. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6978. value = +value
  6979. offset = offset | 0
  6980. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6981. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6982. this[offset] = (value & 0xff)
  6983. this[offset + 1] = (value >>> 8)
  6984. this[offset + 2] = (value >>> 16)
  6985. this[offset + 3] = (value >>> 24)
  6986. } else {
  6987. objectWriteUInt32(this, value, offset, true)
  6988. }
  6989. return offset + 4
  6990. }
  6991. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6992. value = +value
  6993. offset = offset | 0
  6994. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6995. if (value < 0) value = 0xffffffff + value + 1
  6996. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6997. this[offset] = (value >>> 24)
  6998. this[offset + 1] = (value >>> 16)
  6999. this[offset + 2] = (value >>> 8)
  7000. this[offset + 3] = (value & 0xff)
  7001. } else {
  7002. objectWriteUInt32(this, value, offset, false)
  7003. }
  7004. return offset + 4
  7005. }
  7006. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7007. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7008. if (offset < 0) throw new RangeError('Index out of range')
  7009. }
  7010. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7011. if (!noAssert) {
  7012. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7013. }
  7014. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7015. return offset + 4
  7016. }
  7017. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7018. return writeFloat(this, value, offset, true, noAssert)
  7019. }
  7020. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7021. return writeFloat(this, value, offset, false, noAssert)
  7022. }
  7023. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7024. if (!noAssert) {
  7025. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7026. }
  7027. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7028. return offset + 8
  7029. }
  7030. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7031. return writeDouble(this, value, offset, true, noAssert)
  7032. }
  7033. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7034. return writeDouble(this, value, offset, false, noAssert)
  7035. }
  7036. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7037. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7038. if (!start) start = 0
  7039. if (!end && end !== 0) end = this.length
  7040. if (targetStart >= target.length) targetStart = target.length
  7041. if (!targetStart) targetStart = 0
  7042. if (end > 0 && end < start) end = start
  7043. // Copy 0 bytes; we're done
  7044. if (end === start) return 0
  7045. if (target.length === 0 || this.length === 0) return 0
  7046. // Fatal error conditions
  7047. if (targetStart < 0) {
  7048. throw new RangeError('targetStart out of bounds')
  7049. }
  7050. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7051. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7052. // Are we oob?
  7053. if (end > this.length) end = this.length
  7054. if (target.length - targetStart < end - start) {
  7055. end = target.length - targetStart + start
  7056. }
  7057. var len = end - start
  7058. var i
  7059. if (this === target && start < targetStart && targetStart < end) {
  7060. // descending copy from end
  7061. for (i = len - 1; i >= 0; --i) {
  7062. target[i + targetStart] = this[i + start]
  7063. }
  7064. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7065. // ascending copy from start
  7066. for (i = 0; i < len; ++i) {
  7067. target[i + targetStart] = this[i + start]
  7068. }
  7069. } else {
  7070. Uint8Array.prototype.set.call(
  7071. target,
  7072. this.subarray(start, start + len),
  7073. targetStart
  7074. )
  7075. }
  7076. return len
  7077. }
  7078. // Usage:
  7079. // buffer.fill(number[, offset[, end]])
  7080. // buffer.fill(buffer[, offset[, end]])
  7081. // buffer.fill(string[, offset[, end]][, encoding])
  7082. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7083. // Handle string cases:
  7084. if (typeof val === 'string') {
  7085. if (typeof start === 'string') {
  7086. encoding = start
  7087. start = 0
  7088. end = this.length
  7089. } else if (typeof end === 'string') {
  7090. encoding = end
  7091. end = this.length
  7092. }
  7093. if (val.length === 1) {
  7094. var code = val.charCodeAt(0)
  7095. if (code < 256) {
  7096. val = code
  7097. }
  7098. }
  7099. if (encoding !== undefined && typeof encoding !== 'string') {
  7100. throw new TypeError('encoding must be a string')
  7101. }
  7102. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7103. throw new TypeError('Unknown encoding: ' + encoding)
  7104. }
  7105. } else if (typeof val === 'number') {
  7106. val = val & 255
  7107. }
  7108. // Invalid ranges are not set to a default, so can range check early.
  7109. if (start < 0 || this.length < start || this.length < end) {
  7110. throw new RangeError('Out of range index')
  7111. }
  7112. if (end <= start) {
  7113. return this
  7114. }
  7115. start = start >>> 0
  7116. end = end === undefined ? this.length : end >>> 0
  7117. if (!val) val = 0
  7118. var i
  7119. if (typeof val === 'number') {
  7120. for (i = start; i < end; ++i) {
  7121. this[i] = val
  7122. }
  7123. } else {
  7124. var bytes = Buffer.isBuffer(val)
  7125. ? val
  7126. : utf8ToBytes(new Buffer(val, encoding).toString())
  7127. var len = bytes.length
  7128. for (i = 0; i < end - start; ++i) {
  7129. this[i + start] = bytes[i % len]
  7130. }
  7131. }
  7132. return this
  7133. }
  7134. // HELPER FUNCTIONS
  7135. // ================
  7136. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7137. function base64clean (str) {
  7138. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7139. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7140. // Node converts strings with length < 2 to ''
  7141. if (str.length < 2) return ''
  7142. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7143. while (str.length % 4 !== 0) {
  7144. str = str + '='
  7145. }
  7146. return str
  7147. }
  7148. function stringtrim (str) {
  7149. if (str.trim) return str.trim()
  7150. return str.replace(/^\s+|\s+$/g, '')
  7151. }
  7152. function toHex (n) {
  7153. if (n < 16) return '0' + n.toString(16)
  7154. return n.toString(16)
  7155. }
  7156. function utf8ToBytes (string, units) {
  7157. units = units || Infinity
  7158. var codePoint
  7159. var length = string.length
  7160. var leadSurrogate = null
  7161. var bytes = []
  7162. for (var i = 0; i < length; ++i) {
  7163. codePoint = string.charCodeAt(i)
  7164. // is surrogate component
  7165. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7166. // last char was a lead
  7167. if (!leadSurrogate) {
  7168. // no lead yet
  7169. if (codePoint > 0xDBFF) {
  7170. // unexpected trail
  7171. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7172. continue
  7173. } else if (i + 1 === length) {
  7174. // unpaired lead
  7175. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7176. continue
  7177. }
  7178. // valid lead
  7179. leadSurrogate = codePoint
  7180. continue
  7181. }
  7182. // 2 leads in a row
  7183. if (codePoint < 0xDC00) {
  7184. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7185. leadSurrogate = codePoint
  7186. continue
  7187. }
  7188. // valid surrogate pair
  7189. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7190. } else if (leadSurrogate) {
  7191. // valid bmp char, but last char was a lead
  7192. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7193. }
  7194. leadSurrogate = null
  7195. // encode utf8
  7196. if (codePoint < 0x80) {
  7197. if ((units -= 1) < 0) break
  7198. bytes.push(codePoint)
  7199. } else if (codePoint < 0x800) {
  7200. if ((units -= 2) < 0) break
  7201. bytes.push(
  7202. codePoint >> 0x6 | 0xC0,
  7203. codePoint & 0x3F | 0x80
  7204. )
  7205. } else if (codePoint < 0x10000) {
  7206. if ((units -= 3) < 0) break
  7207. bytes.push(
  7208. codePoint >> 0xC | 0xE0,
  7209. codePoint >> 0x6 & 0x3F | 0x80,
  7210. codePoint & 0x3F | 0x80
  7211. )
  7212. } else if (codePoint < 0x110000) {
  7213. if ((units -= 4) < 0) break
  7214. bytes.push(
  7215. codePoint >> 0x12 | 0xF0,
  7216. codePoint >> 0xC & 0x3F | 0x80,
  7217. codePoint >> 0x6 & 0x3F | 0x80,
  7218. codePoint & 0x3F | 0x80
  7219. )
  7220. } else {
  7221. throw new Error('Invalid code point')
  7222. }
  7223. }
  7224. return bytes
  7225. }
  7226. function asciiToBytes (str) {
  7227. var byteArray = []
  7228. for (var i = 0; i < str.length; ++i) {
  7229. // Node's code seems to be doing this and not & 0x7F..
  7230. byteArray.push(str.charCodeAt(i) & 0xFF)
  7231. }
  7232. return byteArray
  7233. }
  7234. function utf16leToBytes (str, units) {
  7235. var c, hi, lo
  7236. var byteArray = []
  7237. for (var i = 0; i < str.length; ++i) {
  7238. if ((units -= 2) < 0) break
  7239. c = str.charCodeAt(i)
  7240. hi = c >> 8
  7241. lo = c % 256
  7242. byteArray.push(lo)
  7243. byteArray.push(hi)
  7244. }
  7245. return byteArray
  7246. }
  7247. function base64ToBytes (str) {
  7248. return base64.toByteArray(base64clean(str))
  7249. }
  7250. function blitBuffer (src, dst, offset, length) {
  7251. for (var i = 0; i < length; ++i) {
  7252. if ((i + offset >= dst.length) || (i >= src.length)) break
  7253. dst[i + offset] = src[i]
  7254. }
  7255. return i
  7256. }
  7257. function isnan (val) {
  7258. return val !== val // eslint-disable-line no-self-compare
  7259. }
  7260. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7261. /***/ }),
  7262. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7263. /*!**************************************************!*\
  7264. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7265. \**************************************************/
  7266. /*! no static exports found */
  7267. /***/ (function(module, exports, __webpack_require__) {
  7268. /*!
  7269. * clipboard.js v2.0.4
  7270. * https://zenorocha.github.io/clipboard.js
  7271. *
  7272. * Licensed MIT © Zeno Rocha
  7273. */
  7274. (function webpackUniversalModuleDefinition(root, factory) {
  7275. if(true)
  7276. module.exports = factory();
  7277. else {}
  7278. })(this, function() {
  7279. return /******/ (function(modules) { // webpackBootstrap
  7280. /******/ // The module cache
  7281. /******/ var installedModules = {};
  7282. /******/
  7283. /******/ // The require function
  7284. /******/ function __webpack_require__(moduleId) {
  7285. /******/
  7286. /******/ // Check if module is in cache
  7287. /******/ if(installedModules[moduleId]) {
  7288. /******/ return installedModules[moduleId].exports;
  7289. /******/ }
  7290. /******/ // Create a new module (and put it into the cache)
  7291. /******/ var module = installedModules[moduleId] = {
  7292. /******/ i: moduleId,
  7293. /******/ l: false,
  7294. /******/ exports: {}
  7295. /******/ };
  7296. /******/
  7297. /******/ // Execute the module function
  7298. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7299. /******/
  7300. /******/ // Flag the module as loaded
  7301. /******/ module.l = true;
  7302. /******/
  7303. /******/ // Return the exports of the module
  7304. /******/ return module.exports;
  7305. /******/ }
  7306. /******/
  7307. /******/
  7308. /******/ // expose the modules object (__webpack_modules__)
  7309. /******/ __webpack_require__.m = modules;
  7310. /******/
  7311. /******/ // expose the module cache
  7312. /******/ __webpack_require__.c = installedModules;
  7313. /******/
  7314. /******/ // define getter function for harmony exports
  7315. /******/ __webpack_require__.d = function(exports, name, getter) {
  7316. /******/ if(!__webpack_require__.o(exports, name)) {
  7317. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7318. /******/ }
  7319. /******/ };
  7320. /******/
  7321. /******/ // define __esModule on exports
  7322. /******/ __webpack_require__.r = function(exports) {
  7323. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7324. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7325. /******/ }
  7326. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7327. /******/ };
  7328. /******/
  7329. /******/ // create a fake namespace object
  7330. /******/ // mode & 1: value is a module id, require it
  7331. /******/ // mode & 2: merge all properties of value into the ns
  7332. /******/ // mode & 4: return value when already ns object
  7333. /******/ // mode & 8|1: behave like require
  7334. /******/ __webpack_require__.t = function(value, mode) {
  7335. /******/ if(mode & 1) value = __webpack_require__(value);
  7336. /******/ if(mode & 8) return value;
  7337. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7338. /******/ var ns = Object.create(null);
  7339. /******/ __webpack_require__.r(ns);
  7340. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7341. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7342. /******/ return ns;
  7343. /******/ };
  7344. /******/
  7345. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7346. /******/ __webpack_require__.n = function(module) {
  7347. /******/ var getter = module && module.__esModule ?
  7348. /******/ function getDefault() { return module['default']; } :
  7349. /******/ function getModuleExports() { return module; };
  7350. /******/ __webpack_require__.d(getter, 'a', getter);
  7351. /******/ return getter;
  7352. /******/ };
  7353. /******/
  7354. /******/ // Object.prototype.hasOwnProperty.call
  7355. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7356. /******/
  7357. /******/ // __webpack_public_path__
  7358. /******/ __webpack_require__.p = "";
  7359. /******/
  7360. /******/
  7361. /******/ // Load entry module and return exports
  7362. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7363. /******/ })
  7364. /************************************************************************/
  7365. /******/ ([
  7366. /* 0 */
  7367. /***/ (function(module, exports, __webpack_require__) {
  7368. "use strict";
  7369. 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; };
  7370. 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; }; }();
  7371. var _clipboardAction = __webpack_require__(1);
  7372. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7373. var _tinyEmitter = __webpack_require__(3);
  7374. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7375. var _goodListener = __webpack_require__(4);
  7376. var _goodListener2 = _interopRequireDefault(_goodListener);
  7377. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7378. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7379. 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; }
  7380. 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; }
  7381. /**
  7382. * Base class which takes one or more elements, adds event listeners to them,
  7383. * and instantiates a new `ClipboardAction` on each click.
  7384. */
  7385. var Clipboard = function (_Emitter) {
  7386. _inherits(Clipboard, _Emitter);
  7387. /**
  7388. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7389. * @param {Object} options
  7390. */
  7391. function Clipboard(trigger, options) {
  7392. _classCallCheck(this, Clipboard);
  7393. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7394. _this.resolveOptions(options);
  7395. _this.listenClick(trigger);
  7396. return _this;
  7397. }
  7398. /**
  7399. * Defines if attributes would be resolved using internal setter functions
  7400. * or custom functions that were passed in the constructor.
  7401. * @param {Object} options
  7402. */
  7403. _createClass(Clipboard, [{
  7404. key: 'resolveOptions',
  7405. value: function resolveOptions() {
  7406. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7407. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7408. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7409. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7410. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7411. }
  7412. /**
  7413. * Adds a click event listener to the passed trigger.
  7414. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7415. */
  7416. }, {
  7417. key: 'listenClick',
  7418. value: function listenClick(trigger) {
  7419. var _this2 = this;
  7420. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7421. return _this2.onClick(e);
  7422. });
  7423. }
  7424. /**
  7425. * Defines a new `ClipboardAction` on each click event.
  7426. * @param {Event} e
  7427. */
  7428. }, {
  7429. key: 'onClick',
  7430. value: function onClick(e) {
  7431. var trigger = e.delegateTarget || e.currentTarget;
  7432. if (this.clipboardAction) {
  7433. this.clipboardAction = null;
  7434. }
  7435. this.clipboardAction = new _clipboardAction2.default({
  7436. action: this.action(trigger),
  7437. target: this.target(trigger),
  7438. text: this.text(trigger),
  7439. container: this.container,
  7440. trigger: trigger,
  7441. emitter: this
  7442. });
  7443. }
  7444. /**
  7445. * Default `action` lookup function.
  7446. * @param {Element} trigger
  7447. */
  7448. }, {
  7449. key: 'defaultAction',
  7450. value: function defaultAction(trigger) {
  7451. return getAttributeValue('action', trigger);
  7452. }
  7453. /**
  7454. * Default `target` lookup function.
  7455. * @param {Element} trigger
  7456. */
  7457. }, {
  7458. key: 'defaultTarget',
  7459. value: function defaultTarget(trigger) {
  7460. var selector = getAttributeValue('target', trigger);
  7461. if (selector) {
  7462. return document.querySelector(selector);
  7463. }
  7464. }
  7465. /**
  7466. * Returns the support of the given action, or all actions if no action is
  7467. * given.
  7468. * @param {String} [action]
  7469. */
  7470. }, {
  7471. key: 'defaultText',
  7472. /**
  7473. * Default `text` lookup function.
  7474. * @param {Element} trigger
  7475. */
  7476. value: function defaultText(trigger) {
  7477. return getAttributeValue('text', trigger);
  7478. }
  7479. /**
  7480. * Destroy lifecycle.
  7481. */
  7482. }, {
  7483. key: 'destroy',
  7484. value: function destroy() {
  7485. this.listener.destroy();
  7486. if (this.clipboardAction) {
  7487. this.clipboardAction.destroy();
  7488. this.clipboardAction = null;
  7489. }
  7490. }
  7491. }], [{
  7492. key: 'isSupported',
  7493. value: function isSupported() {
  7494. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7495. var actions = typeof action === 'string' ? [action] : action;
  7496. var support = !!document.queryCommandSupported;
  7497. actions.forEach(function (action) {
  7498. support = support && !!document.queryCommandSupported(action);
  7499. });
  7500. return support;
  7501. }
  7502. }]);
  7503. return Clipboard;
  7504. }(_tinyEmitter2.default);
  7505. /**
  7506. * Helper function to retrieve attribute value.
  7507. * @param {String} suffix
  7508. * @param {Element} element
  7509. */
  7510. function getAttributeValue(suffix, element) {
  7511. var attribute = 'data-clipboard-' + suffix;
  7512. if (!element.hasAttribute(attribute)) {
  7513. return;
  7514. }
  7515. return element.getAttribute(attribute);
  7516. }
  7517. module.exports = Clipboard;
  7518. /***/ }),
  7519. /* 1 */
  7520. /***/ (function(module, exports, __webpack_require__) {
  7521. "use strict";
  7522. 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; };
  7523. 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; }; }();
  7524. var _select = __webpack_require__(2);
  7525. var _select2 = _interopRequireDefault(_select);
  7526. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7527. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7528. /**
  7529. * Inner class which performs selection from either `text` or `target`
  7530. * properties and then executes copy or cut operations.
  7531. */
  7532. var ClipboardAction = function () {
  7533. /**
  7534. * @param {Object} options
  7535. */
  7536. function ClipboardAction(options) {
  7537. _classCallCheck(this, ClipboardAction);
  7538. this.resolveOptions(options);
  7539. this.initSelection();
  7540. }
  7541. /**
  7542. * Defines base properties passed from constructor.
  7543. * @param {Object} options
  7544. */
  7545. _createClass(ClipboardAction, [{
  7546. key: 'resolveOptions',
  7547. value: function resolveOptions() {
  7548. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7549. this.action = options.action;
  7550. this.container = options.container;
  7551. this.emitter = options.emitter;
  7552. this.target = options.target;
  7553. this.text = options.text;
  7554. this.trigger = options.trigger;
  7555. this.selectedText = '';
  7556. }
  7557. /**
  7558. * Decides which selection strategy is going to be applied based
  7559. * on the existence of `text` and `target` properties.
  7560. */
  7561. }, {
  7562. key: 'initSelection',
  7563. value: function initSelection() {
  7564. if (this.text) {
  7565. this.selectFake();
  7566. } else if (this.target) {
  7567. this.selectTarget();
  7568. }
  7569. }
  7570. /**
  7571. * Creates a fake textarea element, sets its value from `text` property,
  7572. * and makes a selection on it.
  7573. */
  7574. }, {
  7575. key: 'selectFake',
  7576. value: function selectFake() {
  7577. var _this = this;
  7578. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7579. this.removeFake();
  7580. this.fakeHandlerCallback = function () {
  7581. return _this.removeFake();
  7582. };
  7583. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7584. this.fakeElem = document.createElement('textarea');
  7585. // Prevent zooming on iOS
  7586. this.fakeElem.style.fontSize = '12pt';
  7587. // Reset box model
  7588. this.fakeElem.style.border = '0';
  7589. this.fakeElem.style.padding = '0';
  7590. this.fakeElem.style.margin = '0';
  7591. // Move element out of screen horizontally
  7592. this.fakeElem.style.position = 'absolute';
  7593. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7594. // Move element to the same position vertically
  7595. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7596. this.fakeElem.style.top = yPosition + 'px';
  7597. this.fakeElem.setAttribute('readonly', '');
  7598. this.fakeElem.value = this.text;
  7599. this.container.appendChild(this.fakeElem);
  7600. this.selectedText = (0, _select2.default)(this.fakeElem);
  7601. this.copyText();
  7602. }
  7603. /**
  7604. * Only removes the fake element after another click event, that way
  7605. * a user can hit `Ctrl+C` to copy because selection still exists.
  7606. */
  7607. }, {
  7608. key: 'removeFake',
  7609. value: function removeFake() {
  7610. if (this.fakeHandler) {
  7611. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7612. this.fakeHandler = null;
  7613. this.fakeHandlerCallback = null;
  7614. }
  7615. if (this.fakeElem) {
  7616. this.container.removeChild(this.fakeElem);
  7617. this.fakeElem = null;
  7618. }
  7619. }
  7620. /**
  7621. * Selects the content from element passed on `target` property.
  7622. */
  7623. }, {
  7624. key: 'selectTarget',
  7625. value: function selectTarget() {
  7626. this.selectedText = (0, _select2.default)(this.target);
  7627. this.copyText();
  7628. }
  7629. /**
  7630. * Executes the copy operation based on the current selection.
  7631. */
  7632. }, {
  7633. key: 'copyText',
  7634. value: function copyText() {
  7635. var succeeded = void 0;
  7636. try {
  7637. succeeded = document.execCommand(this.action);
  7638. } catch (err) {
  7639. succeeded = false;
  7640. }
  7641. this.handleResult(succeeded);
  7642. }
  7643. /**
  7644. * Fires an event based on the copy operation result.
  7645. * @param {Boolean} succeeded
  7646. */
  7647. }, {
  7648. key: 'handleResult',
  7649. value: function handleResult(succeeded) {
  7650. this.emitter.emit(succeeded ? 'success' : 'error', {
  7651. action: this.action,
  7652. text: this.selectedText,
  7653. trigger: this.trigger,
  7654. clearSelection: this.clearSelection.bind(this)
  7655. });
  7656. }
  7657. /**
  7658. * Moves focus away from `target` and back to the trigger, removes current selection.
  7659. */
  7660. }, {
  7661. key: 'clearSelection',
  7662. value: function clearSelection() {
  7663. if (this.trigger) {
  7664. this.trigger.focus();
  7665. }
  7666. window.getSelection().removeAllRanges();
  7667. }
  7668. /**
  7669. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7670. * @param {String} action
  7671. */
  7672. }, {
  7673. key: 'destroy',
  7674. /**
  7675. * Destroy lifecycle.
  7676. */
  7677. value: function destroy() {
  7678. this.removeFake();
  7679. }
  7680. }, {
  7681. key: 'action',
  7682. set: function set() {
  7683. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7684. this._action = action;
  7685. if (this._action !== 'copy' && this._action !== 'cut') {
  7686. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7687. }
  7688. }
  7689. /**
  7690. * Gets the `action` property.
  7691. * @return {String}
  7692. */
  7693. ,
  7694. get: function get() {
  7695. return this._action;
  7696. }
  7697. /**
  7698. * Sets the `target` property using an element
  7699. * that will be have its content copied.
  7700. * @param {Element} target
  7701. */
  7702. }, {
  7703. key: 'target',
  7704. set: function set(target) {
  7705. if (target !== undefined) {
  7706. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7707. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7708. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7709. }
  7710. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7711. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7712. }
  7713. this._target = target;
  7714. } else {
  7715. throw new Error('Invalid "target" value, use a valid Element');
  7716. }
  7717. }
  7718. }
  7719. /**
  7720. * Gets the `target` property.
  7721. * @return {String|HTMLElement}
  7722. */
  7723. ,
  7724. get: function get() {
  7725. return this._target;
  7726. }
  7727. }]);
  7728. return ClipboardAction;
  7729. }();
  7730. module.exports = ClipboardAction;
  7731. /***/ }),
  7732. /* 2 */
  7733. /***/ (function(module, exports) {
  7734. function select(element) {
  7735. var selectedText;
  7736. if (element.nodeName === 'SELECT') {
  7737. element.focus();
  7738. selectedText = element.value;
  7739. }
  7740. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7741. var isReadOnly = element.hasAttribute('readonly');
  7742. if (!isReadOnly) {
  7743. element.setAttribute('readonly', '');
  7744. }
  7745. element.select();
  7746. element.setSelectionRange(0, element.value.length);
  7747. if (!isReadOnly) {
  7748. element.removeAttribute('readonly');
  7749. }
  7750. selectedText = element.value;
  7751. }
  7752. else {
  7753. if (element.hasAttribute('contenteditable')) {
  7754. element.focus();
  7755. }
  7756. var selection = window.getSelection();
  7757. var range = document.createRange();
  7758. range.selectNodeContents(element);
  7759. selection.removeAllRanges();
  7760. selection.addRange(range);
  7761. selectedText = selection.toString();
  7762. }
  7763. return selectedText;
  7764. }
  7765. module.exports = select;
  7766. /***/ }),
  7767. /* 3 */
  7768. /***/ (function(module, exports) {
  7769. function E () {
  7770. // Keep this empty so it's easier to inherit from
  7771. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7772. }
  7773. E.prototype = {
  7774. on: function (name, callback, ctx) {
  7775. var e = this.e || (this.e = {});
  7776. (e[name] || (e[name] = [])).push({
  7777. fn: callback,
  7778. ctx: ctx
  7779. });
  7780. return this;
  7781. },
  7782. once: function (name, callback, ctx) {
  7783. var self = this;
  7784. function listener () {
  7785. self.off(name, listener);
  7786. callback.apply(ctx, arguments);
  7787. };
  7788. listener._ = callback
  7789. return this.on(name, listener, ctx);
  7790. },
  7791. emit: function (name) {
  7792. var data = [].slice.call(arguments, 1);
  7793. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7794. var i = 0;
  7795. var len = evtArr.length;
  7796. for (i; i < len; i++) {
  7797. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7798. }
  7799. return this;
  7800. },
  7801. off: function (name, callback) {
  7802. var e = this.e || (this.e = {});
  7803. var evts = e[name];
  7804. var liveEvents = [];
  7805. if (evts && callback) {
  7806. for (var i = 0, len = evts.length; i < len; i++) {
  7807. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7808. liveEvents.push(evts[i]);
  7809. }
  7810. }
  7811. // Remove event from queue to prevent memory leak
  7812. // Suggested by https://github.com/lazd
  7813. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7814. (liveEvents.length)
  7815. ? e[name] = liveEvents
  7816. : delete e[name];
  7817. return this;
  7818. }
  7819. };
  7820. module.exports = E;
  7821. /***/ }),
  7822. /* 4 */
  7823. /***/ (function(module, exports, __webpack_require__) {
  7824. var is = __webpack_require__(5);
  7825. var delegate = __webpack_require__(6);
  7826. /**
  7827. * Validates all params and calls the right
  7828. * listener function based on its target type.
  7829. *
  7830. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7831. * @param {String} type
  7832. * @param {Function} callback
  7833. * @return {Object}
  7834. */
  7835. function listen(target, type, callback) {
  7836. if (!target && !type && !callback) {
  7837. throw new Error('Missing required arguments');
  7838. }
  7839. if (!is.string(type)) {
  7840. throw new TypeError('Second argument must be a String');
  7841. }
  7842. if (!is.fn(callback)) {
  7843. throw new TypeError('Third argument must be a Function');
  7844. }
  7845. if (is.node(target)) {
  7846. return listenNode(target, type, callback);
  7847. }
  7848. else if (is.nodeList(target)) {
  7849. return listenNodeList(target, type, callback);
  7850. }
  7851. else if (is.string(target)) {
  7852. return listenSelector(target, type, callback);
  7853. }
  7854. else {
  7855. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7856. }
  7857. }
  7858. /**
  7859. * Adds an event listener to a HTML element
  7860. * and returns a remove listener function.
  7861. *
  7862. * @param {HTMLElement} node
  7863. * @param {String} type
  7864. * @param {Function} callback
  7865. * @return {Object}
  7866. */
  7867. function listenNode(node, type, callback) {
  7868. node.addEventListener(type, callback);
  7869. return {
  7870. destroy: function() {
  7871. node.removeEventListener(type, callback);
  7872. }
  7873. }
  7874. }
  7875. /**
  7876. * Add an event listener to a list of HTML elements
  7877. * and returns a remove listener function.
  7878. *
  7879. * @param {NodeList|HTMLCollection} nodeList
  7880. * @param {String} type
  7881. * @param {Function} callback
  7882. * @return {Object}
  7883. */
  7884. function listenNodeList(nodeList, type, callback) {
  7885. Array.prototype.forEach.call(nodeList, function(node) {
  7886. node.addEventListener(type, callback);
  7887. });
  7888. return {
  7889. destroy: function() {
  7890. Array.prototype.forEach.call(nodeList, function(node) {
  7891. node.removeEventListener(type, callback);
  7892. });
  7893. }
  7894. }
  7895. }
  7896. /**
  7897. * Add an event listener to a selector
  7898. * and returns a remove listener function.
  7899. *
  7900. * @param {String} selector
  7901. * @param {String} type
  7902. * @param {Function} callback
  7903. * @return {Object}
  7904. */
  7905. function listenSelector(selector, type, callback) {
  7906. return delegate(document.body, selector, type, callback);
  7907. }
  7908. module.exports = listen;
  7909. /***/ }),
  7910. /* 5 */
  7911. /***/ (function(module, exports) {
  7912. /**
  7913. * Check if argument is a HTML element.
  7914. *
  7915. * @param {Object} value
  7916. * @return {Boolean}
  7917. */
  7918. exports.node = function(value) {
  7919. return value !== undefined
  7920. && value instanceof HTMLElement
  7921. && value.nodeType === 1;
  7922. };
  7923. /**
  7924. * Check if argument is a list of HTML elements.
  7925. *
  7926. * @param {Object} value
  7927. * @return {Boolean}
  7928. */
  7929. exports.nodeList = function(value) {
  7930. var type = Object.prototype.toString.call(value);
  7931. return value !== undefined
  7932. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7933. && ('length' in value)
  7934. && (value.length === 0 || exports.node(value[0]));
  7935. };
  7936. /**
  7937. * Check if argument is a string.
  7938. *
  7939. * @param {Object} value
  7940. * @return {Boolean}
  7941. */
  7942. exports.string = function(value) {
  7943. return typeof value === 'string'
  7944. || value instanceof String;
  7945. };
  7946. /**
  7947. * Check if argument is a function.
  7948. *
  7949. * @param {Object} value
  7950. * @return {Boolean}
  7951. */
  7952. exports.fn = function(value) {
  7953. var type = Object.prototype.toString.call(value);
  7954. return type === '[object Function]';
  7955. };
  7956. /***/ }),
  7957. /* 6 */
  7958. /***/ (function(module, exports, __webpack_require__) {
  7959. var closest = __webpack_require__(7);
  7960. /**
  7961. * Delegates event to a selector.
  7962. *
  7963. * @param {Element} element
  7964. * @param {String} selector
  7965. * @param {String} type
  7966. * @param {Function} callback
  7967. * @param {Boolean} useCapture
  7968. * @return {Object}
  7969. */
  7970. function _delegate(element, selector, type, callback, useCapture) {
  7971. var listenerFn = listener.apply(this, arguments);
  7972. element.addEventListener(type, listenerFn, useCapture);
  7973. return {
  7974. destroy: function() {
  7975. element.removeEventListener(type, listenerFn, useCapture);
  7976. }
  7977. }
  7978. }
  7979. /**
  7980. * Delegates event to a selector.
  7981. *
  7982. * @param {Element|String|Array} [elements]
  7983. * @param {String} selector
  7984. * @param {String} type
  7985. * @param {Function} callback
  7986. * @param {Boolean} useCapture
  7987. * @return {Object}
  7988. */
  7989. function delegate(elements, selector, type, callback, useCapture) {
  7990. // Handle the regular Element usage
  7991. if (typeof elements.addEventListener === 'function') {
  7992. return _delegate.apply(null, arguments);
  7993. }
  7994. // Handle Element-less usage, it defaults to global delegation
  7995. if (typeof type === 'function') {
  7996. // Use `document` as the first parameter, then apply arguments
  7997. // This is a short way to .unshift `arguments` without running into deoptimizations
  7998. return _delegate.bind(null, document).apply(null, arguments);
  7999. }
  8000. // Handle Selector-based usage
  8001. if (typeof elements === 'string') {
  8002. elements = document.querySelectorAll(elements);
  8003. }
  8004. // Handle Array-like based usage
  8005. return Array.prototype.map.call(elements, function (element) {
  8006. return _delegate(element, selector, type, callback, useCapture);
  8007. });
  8008. }
  8009. /**
  8010. * Finds closest match and invokes callback.
  8011. *
  8012. * @param {Element} element
  8013. * @param {String} selector
  8014. * @param {String} type
  8015. * @param {Function} callback
  8016. * @return {Function}
  8017. */
  8018. function listener(element, selector, type, callback) {
  8019. return function(e) {
  8020. e.delegateTarget = closest(e.target, selector);
  8021. if (e.delegateTarget) {
  8022. callback.call(element, e);
  8023. }
  8024. }
  8025. }
  8026. module.exports = delegate;
  8027. /***/ }),
  8028. /* 7 */
  8029. /***/ (function(module, exports) {
  8030. var DOCUMENT_NODE_TYPE = 9;
  8031. /**
  8032. * A polyfill for Element.matches()
  8033. */
  8034. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8035. var proto = Element.prototype;
  8036. proto.matches = proto.matchesSelector ||
  8037. proto.mozMatchesSelector ||
  8038. proto.msMatchesSelector ||
  8039. proto.oMatchesSelector ||
  8040. proto.webkitMatchesSelector;
  8041. }
  8042. /**
  8043. * Finds the closest parent that matches a selector.
  8044. *
  8045. * @param {Element} element
  8046. * @param {String} selector
  8047. * @return {Function}
  8048. */
  8049. function closest (element, selector) {
  8050. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8051. if (typeof element.matches === 'function' &&
  8052. element.matches(selector)) {
  8053. return element;
  8054. }
  8055. element = element.parentNode;
  8056. }
  8057. }
  8058. module.exports = closest;
  8059. /***/ })
  8060. /******/ ]);
  8061. });
  8062. /***/ }),
  8063. /***/ "./node_modules/ieee754/index.js":
  8064. /*!***************************************!*\
  8065. !*** ./node_modules/ieee754/index.js ***!
  8066. \***************************************/
  8067. /*! no static exports found */
  8068. /***/ (function(module, exports) {
  8069. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8070. var e, m
  8071. var eLen = (nBytes * 8) - mLen - 1
  8072. var eMax = (1 << eLen) - 1
  8073. var eBias = eMax >> 1
  8074. var nBits = -7
  8075. var i = isLE ? (nBytes - 1) : 0
  8076. var d = isLE ? -1 : 1
  8077. var s = buffer[offset + i]
  8078. i += d
  8079. e = s & ((1 << (-nBits)) - 1)
  8080. s >>= (-nBits)
  8081. nBits += eLen
  8082. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8083. m = e & ((1 << (-nBits)) - 1)
  8084. e >>= (-nBits)
  8085. nBits += mLen
  8086. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8087. if (e === 0) {
  8088. e = 1 - eBias
  8089. } else if (e === eMax) {
  8090. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8091. } else {
  8092. m = m + Math.pow(2, mLen)
  8093. e = e - eBias
  8094. }
  8095. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8096. }
  8097. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8098. var e, m, c
  8099. var eLen = (nBytes * 8) - mLen - 1
  8100. var eMax = (1 << eLen) - 1
  8101. var eBias = eMax >> 1
  8102. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8103. var i = isLE ? 0 : (nBytes - 1)
  8104. var d = isLE ? 1 : -1
  8105. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8106. value = Math.abs(value)
  8107. if (isNaN(value) || value === Infinity) {
  8108. m = isNaN(value) ? 1 : 0
  8109. e = eMax
  8110. } else {
  8111. e = Math.floor(Math.log(value) / Math.LN2)
  8112. if (value * (c = Math.pow(2, -e)) < 1) {
  8113. e--
  8114. c *= 2
  8115. }
  8116. if (e + eBias >= 1) {
  8117. value += rt / c
  8118. } else {
  8119. value += rt * Math.pow(2, 1 - eBias)
  8120. }
  8121. if (value * c >= 2) {
  8122. e++
  8123. c /= 2
  8124. }
  8125. if (e + eBias >= eMax) {
  8126. m = 0
  8127. e = eMax
  8128. } else if (e + eBias >= 1) {
  8129. m = ((value * c) - 1) * Math.pow(2, mLen)
  8130. e = e + eBias
  8131. } else {
  8132. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8133. e = 0
  8134. }
  8135. }
  8136. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8137. e = (e << mLen) | m
  8138. eLen += mLen
  8139. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8140. buffer[offset + i - d] |= s * 128
  8141. }
  8142. /***/ }),
  8143. /***/ "./node_modules/isarray/index.js":
  8144. /*!***************************************!*\
  8145. !*** ./node_modules/isarray/index.js ***!
  8146. \***************************************/
  8147. /*! no static exports found */
  8148. /***/ (function(module, exports) {
  8149. var toString = {}.toString;
  8150. module.exports = Array.isArray || function (arr) {
  8151. return toString.call(arr) == '[object Array]';
  8152. };
  8153. /***/ }),
  8154. /***/ "./node_modules/jquery/dist/jquery.js":
  8155. /*!********************************************!*\
  8156. !*** ./node_modules/jquery/dist/jquery.js ***!
  8157. \********************************************/
  8158. /*! no static exports found */
  8159. /***/ (function(module, exports, __webpack_require__) {
  8160. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8161. * jQuery JavaScript Library v3.4.1
  8162. * https://jquery.com/
  8163. *
  8164. * Includes Sizzle.js
  8165. * https://sizzlejs.com/
  8166. *
  8167. * Copyright JS Foundation and other contributors
  8168. * Released under the MIT license
  8169. * https://jquery.org/license
  8170. *
  8171. * Date: 2019-05-01T21:04Z
  8172. */
  8173. ( function( global, factory ) {
  8174. "use strict";
  8175. if ( true && typeof module.exports === "object" ) {
  8176. // For CommonJS and CommonJS-like environments where a proper `window`
  8177. // is present, execute the factory and get jQuery.
  8178. // For environments that do not have a `window` with a `document`
  8179. // (such as Node.js), expose a factory as module.exports.
  8180. // This accentuates the need for the creation of a real `window`.
  8181. // e.g. var jQuery = require("jquery")(window);
  8182. // See ticket #14549 for more info.
  8183. module.exports = global.document ?
  8184. factory( global, true ) :
  8185. function( w ) {
  8186. if ( !w.document ) {
  8187. throw new Error( "jQuery requires a window with a document" );
  8188. }
  8189. return factory( w );
  8190. };
  8191. } else {
  8192. factory( global );
  8193. }
  8194. // Pass this if window is not defined yet
  8195. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8196. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8197. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8198. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8199. // enough that all such attempts are guarded in a try block.
  8200. "use strict";
  8201. var arr = [];
  8202. var document = window.document;
  8203. var getProto = Object.getPrototypeOf;
  8204. var slice = arr.slice;
  8205. var concat = arr.concat;
  8206. var push = arr.push;
  8207. var indexOf = arr.indexOf;
  8208. var class2type = {};
  8209. var toString = class2type.toString;
  8210. var hasOwn = class2type.hasOwnProperty;
  8211. var fnToString = hasOwn.toString;
  8212. var ObjectFunctionString = fnToString.call( Object );
  8213. var support = {};
  8214. var isFunction = function isFunction( obj ) {
  8215. // Support: Chrome <=57, Firefox <=52
  8216. // In some browsers, typeof returns "function" for HTML <object> elements
  8217. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8218. // We don't want to classify *any* DOM node as a function.
  8219. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8220. };
  8221. var isWindow = function isWindow( obj ) {
  8222. return obj != null && obj === obj.window;
  8223. };
  8224. var preservedScriptAttributes = {
  8225. type: true,
  8226. src: true,
  8227. nonce: true,
  8228. noModule: true
  8229. };
  8230. function DOMEval( code, node, doc ) {
  8231. doc = doc || document;
  8232. var i, val,
  8233. script = doc.createElement( "script" );
  8234. script.text = code;
  8235. if ( node ) {
  8236. for ( i in preservedScriptAttributes ) {
  8237. // Support: Firefox 64+, Edge 18+
  8238. // Some browsers don't support the "nonce" property on scripts.
  8239. // On the other hand, just using `getAttribute` is not enough as
  8240. // the `nonce` attribute is reset to an empty string whenever it
  8241. // becomes browsing-context connected.
  8242. // See https://github.com/whatwg/html/issues/2369
  8243. // See https://html.spec.whatwg.org/#nonce-attributes
  8244. // The `node.getAttribute` check was added for the sake of
  8245. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8246. // via an object.
  8247. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8248. if ( val ) {
  8249. script.setAttribute( i, val );
  8250. }
  8251. }
  8252. }
  8253. doc.head.appendChild( script ).parentNode.removeChild( script );
  8254. }
  8255. function toType( obj ) {
  8256. if ( obj == null ) {
  8257. return obj + "";
  8258. }
  8259. // Support: Android <=2.3 only (functionish RegExp)
  8260. return typeof obj === "object" || typeof obj === "function" ?
  8261. class2type[ toString.call( obj ) ] || "object" :
  8262. typeof obj;
  8263. }
  8264. /* global Symbol */
  8265. // Defining this global in .eslintrc.json would create a danger of using the global
  8266. // unguarded in another place, it seems safer to define global only for this module
  8267. var
  8268. version = "3.4.1",
  8269. // Define a local copy of jQuery
  8270. jQuery = function( selector, context ) {
  8271. // The jQuery object is actually just the init constructor 'enhanced'
  8272. // Need init if jQuery is called (just allow error to be thrown if not included)
  8273. return new jQuery.fn.init( selector, context );
  8274. },
  8275. // Support: Android <=4.0 only
  8276. // Make sure we trim BOM and NBSP
  8277. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8278. jQuery.fn = jQuery.prototype = {
  8279. // The current version of jQuery being used
  8280. jquery: version,
  8281. constructor: jQuery,
  8282. // The default length of a jQuery object is 0
  8283. length: 0,
  8284. toArray: function() {
  8285. return slice.call( this );
  8286. },
  8287. // Get the Nth element in the matched element set OR
  8288. // Get the whole matched element set as a clean array
  8289. get: function( num ) {
  8290. // Return all the elements in a clean array
  8291. if ( num == null ) {
  8292. return slice.call( this );
  8293. }
  8294. // Return just the one element from the set
  8295. return num < 0 ? this[ num + this.length ] : this[ num ];
  8296. },
  8297. // Take an array of elements and push it onto the stack
  8298. // (returning the new matched element set)
  8299. pushStack: function( elems ) {
  8300. // Build a new jQuery matched element set
  8301. var ret = jQuery.merge( this.constructor(), elems );
  8302. // Add the old object onto the stack (as a reference)
  8303. ret.prevObject = this;
  8304. // Return the newly-formed element set
  8305. return ret;
  8306. },
  8307. // Execute a callback for every element in the matched set.
  8308. each: function( callback ) {
  8309. return jQuery.each( this, callback );
  8310. },
  8311. map: function( callback ) {
  8312. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8313. return callback.call( elem, i, elem );
  8314. } ) );
  8315. },
  8316. slice: function() {
  8317. return this.pushStack( slice.apply( this, arguments ) );
  8318. },
  8319. first: function() {
  8320. return this.eq( 0 );
  8321. },
  8322. last: function() {
  8323. return this.eq( -1 );
  8324. },
  8325. eq: function( i ) {
  8326. var len = this.length,
  8327. j = +i + ( i < 0 ? len : 0 );
  8328. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8329. },
  8330. end: function() {
  8331. return this.prevObject || this.constructor();
  8332. },
  8333. // For internal use only.
  8334. // Behaves like an Array's method, not like a jQuery method.
  8335. push: push,
  8336. sort: arr.sort,
  8337. splice: arr.splice
  8338. };
  8339. jQuery.extend = jQuery.fn.extend = function() {
  8340. var options, name, src, copy, copyIsArray, clone,
  8341. target = arguments[ 0 ] || {},
  8342. i = 1,
  8343. length = arguments.length,
  8344. deep = false;
  8345. // Handle a deep copy situation
  8346. if ( typeof target === "boolean" ) {
  8347. deep = target;
  8348. // Skip the boolean and the target
  8349. target = arguments[ i ] || {};
  8350. i++;
  8351. }
  8352. // Handle case when target is a string or something (possible in deep copy)
  8353. if ( typeof target !== "object" && !isFunction( target ) ) {
  8354. target = {};
  8355. }
  8356. // Extend jQuery itself if only one argument is passed
  8357. if ( i === length ) {
  8358. target = this;
  8359. i--;
  8360. }
  8361. for ( ; i < length; i++ ) {
  8362. // Only deal with non-null/undefined values
  8363. if ( ( options = arguments[ i ] ) != null ) {
  8364. // Extend the base object
  8365. for ( name in options ) {
  8366. copy = options[ name ];
  8367. // Prevent Object.prototype pollution
  8368. // Prevent never-ending loop
  8369. if ( name === "__proto__" || target === copy ) {
  8370. continue;
  8371. }
  8372. // Recurse if we're merging plain objects or arrays
  8373. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8374. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8375. src = target[ name ];
  8376. // Ensure proper type for the source value
  8377. if ( copyIsArray && !Array.isArray( src ) ) {
  8378. clone = [];
  8379. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8380. clone = {};
  8381. } else {
  8382. clone = src;
  8383. }
  8384. copyIsArray = false;
  8385. // Never move original objects, clone them
  8386. target[ name ] = jQuery.extend( deep, clone, copy );
  8387. // Don't bring in undefined values
  8388. } else if ( copy !== undefined ) {
  8389. target[ name ] = copy;
  8390. }
  8391. }
  8392. }
  8393. }
  8394. // Return the modified object
  8395. return target;
  8396. };
  8397. jQuery.extend( {
  8398. // Unique for each copy of jQuery on the page
  8399. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8400. // Assume jQuery is ready without the ready module
  8401. isReady: true,
  8402. error: function( msg ) {
  8403. throw new Error( msg );
  8404. },
  8405. noop: function() {},
  8406. isPlainObject: function( obj ) {
  8407. var proto, Ctor;
  8408. // Detect obvious negatives
  8409. // Use toString instead of jQuery.type to catch host objects
  8410. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8411. return false;
  8412. }
  8413. proto = getProto( obj );
  8414. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8415. if ( !proto ) {
  8416. return true;
  8417. }
  8418. // Objects with prototype are plain iff they were constructed by a global Object function
  8419. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8420. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8421. },
  8422. isEmptyObject: function( obj ) {
  8423. var name;
  8424. for ( name in obj ) {
  8425. return false;
  8426. }
  8427. return true;
  8428. },
  8429. // Evaluates a script in a global context
  8430. globalEval: function( code, options ) {
  8431. DOMEval( code, { nonce: options && options.nonce } );
  8432. },
  8433. each: function( obj, callback ) {
  8434. var length, i = 0;
  8435. if ( isArrayLike( obj ) ) {
  8436. length = obj.length;
  8437. for ( ; i < length; i++ ) {
  8438. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8439. break;
  8440. }
  8441. }
  8442. } else {
  8443. for ( i in obj ) {
  8444. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8445. break;
  8446. }
  8447. }
  8448. }
  8449. return obj;
  8450. },
  8451. // Support: Android <=4.0 only
  8452. trim: function( text ) {
  8453. return text == null ?
  8454. "" :
  8455. ( text + "" ).replace( rtrim, "" );
  8456. },
  8457. // results is for internal usage only
  8458. makeArray: function( arr, results ) {
  8459. var ret = results || [];
  8460. if ( arr != null ) {
  8461. if ( isArrayLike( Object( arr ) ) ) {
  8462. jQuery.merge( ret,
  8463. typeof arr === "string" ?
  8464. [ arr ] : arr
  8465. );
  8466. } else {
  8467. push.call( ret, arr );
  8468. }
  8469. }
  8470. return ret;
  8471. },
  8472. inArray: function( elem, arr, i ) {
  8473. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8474. },
  8475. // Support: Android <=4.0 only, PhantomJS 1 only
  8476. // push.apply(_, arraylike) throws on ancient WebKit
  8477. merge: function( first, second ) {
  8478. var len = +second.length,
  8479. j = 0,
  8480. i = first.length;
  8481. for ( ; j < len; j++ ) {
  8482. first[ i++ ] = second[ j ];
  8483. }
  8484. first.length = i;
  8485. return first;
  8486. },
  8487. grep: function( elems, callback, invert ) {
  8488. var callbackInverse,
  8489. matches = [],
  8490. i = 0,
  8491. length = elems.length,
  8492. callbackExpect = !invert;
  8493. // Go through the array, only saving the items
  8494. // that pass the validator function
  8495. for ( ; i < length; i++ ) {
  8496. callbackInverse = !callback( elems[ i ], i );
  8497. if ( callbackInverse !== callbackExpect ) {
  8498. matches.push( elems[ i ] );
  8499. }
  8500. }
  8501. return matches;
  8502. },
  8503. // arg is for internal usage only
  8504. map: function( elems, callback, arg ) {
  8505. var length, value,
  8506. i = 0,
  8507. ret = [];
  8508. // Go through the array, translating each of the items to their new values
  8509. if ( isArrayLike( elems ) ) {
  8510. length = elems.length;
  8511. for ( ; i < length; i++ ) {
  8512. value = callback( elems[ i ], i, arg );
  8513. if ( value != null ) {
  8514. ret.push( value );
  8515. }
  8516. }
  8517. // Go through every key on the object,
  8518. } else {
  8519. for ( i in elems ) {
  8520. value = callback( elems[ i ], i, arg );
  8521. if ( value != null ) {
  8522. ret.push( value );
  8523. }
  8524. }
  8525. }
  8526. // Flatten any nested arrays
  8527. return concat.apply( [], ret );
  8528. },
  8529. // A global GUID counter for objects
  8530. guid: 1,
  8531. // jQuery.support is not used in Core but other projects attach their
  8532. // properties to it so it needs to exist.
  8533. support: support
  8534. } );
  8535. if ( typeof Symbol === "function" ) {
  8536. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8537. }
  8538. // Populate the class2type map
  8539. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8540. function( i, name ) {
  8541. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8542. } );
  8543. function isArrayLike( obj ) {
  8544. // Support: real iOS 8.2 only (not reproducible in simulator)
  8545. // `in` check used to prevent JIT error (gh-2145)
  8546. // hasOwn isn't used here due to false negatives
  8547. // regarding Nodelist length in IE
  8548. var length = !!obj && "length" in obj && obj.length,
  8549. type = toType( obj );
  8550. if ( isFunction( obj ) || isWindow( obj ) ) {
  8551. return false;
  8552. }
  8553. return type === "array" || length === 0 ||
  8554. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8555. }
  8556. var Sizzle =
  8557. /*!
  8558. * Sizzle CSS Selector Engine v2.3.4
  8559. * https://sizzlejs.com/
  8560. *
  8561. * Copyright JS Foundation and other contributors
  8562. * Released under the MIT license
  8563. * https://js.foundation/
  8564. *
  8565. * Date: 2019-04-08
  8566. */
  8567. (function( window ) {
  8568. var i,
  8569. support,
  8570. Expr,
  8571. getText,
  8572. isXML,
  8573. tokenize,
  8574. compile,
  8575. select,
  8576. outermostContext,
  8577. sortInput,
  8578. hasDuplicate,
  8579. // Local document vars
  8580. setDocument,
  8581. document,
  8582. docElem,
  8583. documentIsHTML,
  8584. rbuggyQSA,
  8585. rbuggyMatches,
  8586. matches,
  8587. contains,
  8588. // Instance-specific data
  8589. expando = "sizzle" + 1 * new Date(),
  8590. preferredDoc = window.document,
  8591. dirruns = 0,
  8592. done = 0,
  8593. classCache = createCache(),
  8594. tokenCache = createCache(),
  8595. compilerCache = createCache(),
  8596. nonnativeSelectorCache = createCache(),
  8597. sortOrder = function( a, b ) {
  8598. if ( a === b ) {
  8599. hasDuplicate = true;
  8600. }
  8601. return 0;
  8602. },
  8603. // Instance methods
  8604. hasOwn = ({}).hasOwnProperty,
  8605. arr = [],
  8606. pop = arr.pop,
  8607. push_native = arr.push,
  8608. push = arr.push,
  8609. slice = arr.slice,
  8610. // Use a stripped-down indexOf as it's faster than native
  8611. // https://jsperf.com/thor-indexof-vs-for/5
  8612. indexOf = function( list, elem ) {
  8613. var i = 0,
  8614. len = list.length;
  8615. for ( ; i < len; i++ ) {
  8616. if ( list[i] === elem ) {
  8617. return i;
  8618. }
  8619. }
  8620. return -1;
  8621. },
  8622. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8623. // Regular expressions
  8624. // http://www.w3.org/TR/css3-selectors/#whitespace
  8625. whitespace = "[\\x20\\t\\r\\n\\f]",
  8626. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8627. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8628. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8629. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8630. // Operator (capture 2)
  8631. "*([*^$|!~]?=)" + whitespace +
  8632. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8633. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8634. "*\\]",
  8635. pseudos = ":(" + identifier + ")(?:\\((" +
  8636. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8637. // 1. quoted (capture 3; capture 4 or capture 5)
  8638. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8639. // 2. simple (capture 6)
  8640. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8641. // 3. anything else (capture 2)
  8642. ".*" +
  8643. ")\\)|)",
  8644. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8645. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8646. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8647. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8648. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8649. rdescend = new RegExp( whitespace + "|>" ),
  8650. rpseudo = new RegExp( pseudos ),
  8651. ridentifier = new RegExp( "^" + identifier + "$" ),
  8652. matchExpr = {
  8653. "ID": new RegExp( "^#(" + identifier + ")" ),
  8654. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8655. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8656. "ATTR": new RegExp( "^" + attributes ),
  8657. "PSEUDO": new RegExp( "^" + pseudos ),
  8658. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8659. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8660. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8661. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8662. // For use in libraries implementing .is()
  8663. // We use this for POS matching in `select`
  8664. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8665. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8666. },
  8667. rhtml = /HTML$/i,
  8668. rinputs = /^(?:input|select|textarea|button)$/i,
  8669. rheader = /^h\d$/i,
  8670. rnative = /^[^{]+\{\s*\[native \w/,
  8671. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8672. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8673. rsibling = /[+~]/,
  8674. // CSS escapes
  8675. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8676. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8677. funescape = function( _, escaped, escapedWhitespace ) {
  8678. var high = "0x" + escaped - 0x10000;
  8679. // NaN means non-codepoint
  8680. // Support: Firefox<24
  8681. // Workaround erroneous numeric interpretation of +"0x"
  8682. return high !== high || escapedWhitespace ?
  8683. escaped :
  8684. high < 0 ?
  8685. // BMP codepoint
  8686. String.fromCharCode( high + 0x10000 ) :
  8687. // Supplemental Plane codepoint (surrogate pair)
  8688. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8689. },
  8690. // CSS string/identifier serialization
  8691. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8692. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8693. fcssescape = function( ch, asCodePoint ) {
  8694. if ( asCodePoint ) {
  8695. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8696. if ( ch === "\0" ) {
  8697. return "\uFFFD";
  8698. }
  8699. // Control characters and (dependent upon position) numbers get escaped as code points
  8700. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8701. }
  8702. // Other potentially-special ASCII characters get backslash-escaped
  8703. return "\\" + ch;
  8704. },
  8705. // Used for iframes
  8706. // See setDocument()
  8707. // Removing the function wrapper causes a "Permission Denied"
  8708. // error in IE
  8709. unloadHandler = function() {
  8710. setDocument();
  8711. },
  8712. inDisabledFieldset = addCombinator(
  8713. function( elem ) {
  8714. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8715. },
  8716. { dir: "parentNode", next: "legend" }
  8717. );
  8718. // Optimize for push.apply( _, NodeList )
  8719. try {
  8720. push.apply(
  8721. (arr = slice.call( preferredDoc.childNodes )),
  8722. preferredDoc.childNodes
  8723. );
  8724. // Support: Android<4.0
  8725. // Detect silently failing push.apply
  8726. arr[ preferredDoc.childNodes.length ].nodeType;
  8727. } catch ( e ) {
  8728. push = { apply: arr.length ?
  8729. // Leverage slice if possible
  8730. function( target, els ) {
  8731. push_native.apply( target, slice.call(els) );
  8732. } :
  8733. // Support: IE<9
  8734. // Otherwise append directly
  8735. function( target, els ) {
  8736. var j = target.length,
  8737. i = 0;
  8738. // Can't trust NodeList.length
  8739. while ( (target[j++] = els[i++]) ) {}
  8740. target.length = j - 1;
  8741. }
  8742. };
  8743. }
  8744. function Sizzle( selector, context, results, seed ) {
  8745. var m, i, elem, nid, match, groups, newSelector,
  8746. newContext = context && context.ownerDocument,
  8747. // nodeType defaults to 9, since context defaults to document
  8748. nodeType = context ? context.nodeType : 9;
  8749. results = results || [];
  8750. // Return early from calls with invalid selector or context
  8751. if ( typeof selector !== "string" || !selector ||
  8752. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8753. return results;
  8754. }
  8755. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8756. if ( !seed ) {
  8757. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8758. setDocument( context );
  8759. }
  8760. context = context || document;
  8761. if ( documentIsHTML ) {
  8762. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8763. // (excepting DocumentFragment context, where the methods don't exist)
  8764. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8765. // ID selector
  8766. if ( (m = match[1]) ) {
  8767. // Document context
  8768. if ( nodeType === 9 ) {
  8769. if ( (elem = context.getElementById( m )) ) {
  8770. // Support: IE, Opera, Webkit
  8771. // TODO: identify versions
  8772. // getElementById can match elements by name instead of ID
  8773. if ( elem.id === m ) {
  8774. results.push( elem );
  8775. return results;
  8776. }
  8777. } else {
  8778. return results;
  8779. }
  8780. // Element context
  8781. } else {
  8782. // Support: IE, Opera, Webkit
  8783. // TODO: identify versions
  8784. // getElementById can match elements by name instead of ID
  8785. if ( newContext && (elem = newContext.getElementById( m )) &&
  8786. contains( context, elem ) &&
  8787. elem.id === m ) {
  8788. results.push( elem );
  8789. return results;
  8790. }
  8791. }
  8792. // Type selector
  8793. } else if ( match[2] ) {
  8794. push.apply( results, context.getElementsByTagName( selector ) );
  8795. return results;
  8796. // Class selector
  8797. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8798. context.getElementsByClassName ) {
  8799. push.apply( results, context.getElementsByClassName( m ) );
  8800. return results;
  8801. }
  8802. }
  8803. // Take advantage of querySelectorAll
  8804. if ( support.qsa &&
  8805. !nonnativeSelectorCache[ selector + " " ] &&
  8806. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8807. // Support: IE 8 only
  8808. // Exclude object elements
  8809. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8810. newSelector = selector;
  8811. newContext = context;
  8812. // qSA considers elements outside a scoping root when evaluating child or
  8813. // descendant combinators, which is not what we want.
  8814. // In such cases, we work around the behavior by prefixing every selector in the
  8815. // list with an ID selector referencing the scope context.
  8816. // Thanks to Andrew Dupont for this technique.
  8817. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8818. // Capture the context ID, setting it first if necessary
  8819. if ( (nid = context.getAttribute( "id" )) ) {
  8820. nid = nid.replace( rcssescape, fcssescape );
  8821. } else {
  8822. context.setAttribute( "id", (nid = expando) );
  8823. }
  8824. // Prefix every selector in the list
  8825. groups = tokenize( selector );
  8826. i = groups.length;
  8827. while ( i-- ) {
  8828. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8829. }
  8830. newSelector = groups.join( "," );
  8831. // Expand context for sibling selectors
  8832. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8833. context;
  8834. }
  8835. try {
  8836. push.apply( results,
  8837. newContext.querySelectorAll( newSelector )
  8838. );
  8839. return results;
  8840. } catch ( qsaError ) {
  8841. nonnativeSelectorCache( selector, true );
  8842. } finally {
  8843. if ( nid === expando ) {
  8844. context.removeAttribute( "id" );
  8845. }
  8846. }
  8847. }
  8848. }
  8849. }
  8850. // All others
  8851. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8852. }
  8853. /**
  8854. * Create key-value caches of limited size
  8855. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8856. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8857. * deleting the oldest entry
  8858. */
  8859. function createCache() {
  8860. var keys = [];
  8861. function cache( key, value ) {
  8862. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8863. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8864. // Only keep the most recent entries
  8865. delete cache[ keys.shift() ];
  8866. }
  8867. return (cache[ key + " " ] = value);
  8868. }
  8869. return cache;
  8870. }
  8871. /**
  8872. * Mark a function for special use by Sizzle
  8873. * @param {Function} fn The function to mark
  8874. */
  8875. function markFunction( fn ) {
  8876. fn[ expando ] = true;
  8877. return fn;
  8878. }
  8879. /**
  8880. * Support testing using an element
  8881. * @param {Function} fn Passed the created element and returns a boolean result
  8882. */
  8883. function assert( fn ) {
  8884. var el = document.createElement("fieldset");
  8885. try {
  8886. return !!fn( el );
  8887. } catch (e) {
  8888. return false;
  8889. } finally {
  8890. // Remove from its parent by default
  8891. if ( el.parentNode ) {
  8892. el.parentNode.removeChild( el );
  8893. }
  8894. // release memory in IE
  8895. el = null;
  8896. }
  8897. }
  8898. /**
  8899. * Adds the same handler for all of the specified attrs
  8900. * @param {String} attrs Pipe-separated list of attributes
  8901. * @param {Function} handler The method that will be applied
  8902. */
  8903. function addHandle( attrs, handler ) {
  8904. var arr = attrs.split("|"),
  8905. i = arr.length;
  8906. while ( i-- ) {
  8907. Expr.attrHandle[ arr[i] ] = handler;
  8908. }
  8909. }
  8910. /**
  8911. * Checks document order of two siblings
  8912. * @param {Element} a
  8913. * @param {Element} b
  8914. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8915. */
  8916. function siblingCheck( a, b ) {
  8917. var cur = b && a,
  8918. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8919. a.sourceIndex - b.sourceIndex;
  8920. // Use IE sourceIndex if available on both nodes
  8921. if ( diff ) {
  8922. return diff;
  8923. }
  8924. // Check if b follows a
  8925. if ( cur ) {
  8926. while ( (cur = cur.nextSibling) ) {
  8927. if ( cur === b ) {
  8928. return -1;
  8929. }
  8930. }
  8931. }
  8932. return a ? 1 : -1;
  8933. }
  8934. /**
  8935. * Returns a function to use in pseudos for input types
  8936. * @param {String} type
  8937. */
  8938. function createInputPseudo( type ) {
  8939. return function( elem ) {
  8940. var name = elem.nodeName.toLowerCase();
  8941. return name === "input" && elem.type === type;
  8942. };
  8943. }
  8944. /**
  8945. * Returns a function to use in pseudos for buttons
  8946. * @param {String} type
  8947. */
  8948. function createButtonPseudo( type ) {
  8949. return function( elem ) {
  8950. var name = elem.nodeName.toLowerCase();
  8951. return (name === "input" || name === "button") && elem.type === type;
  8952. };
  8953. }
  8954. /**
  8955. * Returns a function to use in pseudos for :enabled/:disabled
  8956. * @param {Boolean} disabled true for :disabled; false for :enabled
  8957. */
  8958. function createDisabledPseudo( disabled ) {
  8959. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8960. return function( elem ) {
  8961. // Only certain elements can match :enabled or :disabled
  8962. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8963. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8964. if ( "form" in elem ) {
  8965. // Check for inherited disabledness on relevant non-disabled elements:
  8966. // * listed form-associated elements in a disabled fieldset
  8967. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8968. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8969. // * option elements in a disabled optgroup
  8970. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8971. // All such elements have a "form" property.
  8972. if ( elem.parentNode && elem.disabled === false ) {
  8973. // Option elements defer to a parent optgroup if present
  8974. if ( "label" in elem ) {
  8975. if ( "label" in elem.parentNode ) {
  8976. return elem.parentNode.disabled === disabled;
  8977. } else {
  8978. return elem.disabled === disabled;
  8979. }
  8980. }
  8981. // Support: IE 6 - 11
  8982. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8983. return elem.isDisabled === disabled ||
  8984. // Where there is no isDisabled, check manually
  8985. /* jshint -W018 */
  8986. elem.isDisabled !== !disabled &&
  8987. inDisabledFieldset( elem ) === disabled;
  8988. }
  8989. return elem.disabled === disabled;
  8990. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8991. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8992. // even exist on them, let alone have a boolean value.
  8993. } else if ( "label" in elem ) {
  8994. return elem.disabled === disabled;
  8995. }
  8996. // Remaining elements are neither :enabled nor :disabled
  8997. return false;
  8998. };
  8999. }
  9000. /**
  9001. * Returns a function to use in pseudos for positionals
  9002. * @param {Function} fn
  9003. */
  9004. function createPositionalPseudo( fn ) {
  9005. return markFunction(function( argument ) {
  9006. argument = +argument;
  9007. return markFunction(function( seed, matches ) {
  9008. var j,
  9009. matchIndexes = fn( [], seed.length, argument ),
  9010. i = matchIndexes.length;
  9011. // Match elements found at the specified indexes
  9012. while ( i-- ) {
  9013. if ( seed[ (j = matchIndexes[i]) ] ) {
  9014. seed[j] = !(matches[j] = seed[j]);
  9015. }
  9016. }
  9017. });
  9018. });
  9019. }
  9020. /**
  9021. * Checks a node for validity as a Sizzle context
  9022. * @param {Element|Object=} context
  9023. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9024. */
  9025. function testContext( context ) {
  9026. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9027. }
  9028. // Expose support vars for convenience
  9029. support = Sizzle.support = {};
  9030. /**
  9031. * Detects XML nodes
  9032. * @param {Element|Object} elem An element or a document
  9033. * @returns {Boolean} True iff elem is a non-HTML XML node
  9034. */
  9035. isXML = Sizzle.isXML = function( elem ) {
  9036. var namespace = elem.namespaceURI,
  9037. docElem = (elem.ownerDocument || elem).documentElement;
  9038. // Support: IE <=8
  9039. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9040. // https://bugs.jquery.com/ticket/4833
  9041. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9042. };
  9043. /**
  9044. * Sets document-related variables once based on the current document
  9045. * @param {Element|Object} [doc] An element or document object to use to set the document
  9046. * @returns {Object} Returns the current document
  9047. */
  9048. setDocument = Sizzle.setDocument = function( node ) {
  9049. var hasCompare, subWindow,
  9050. doc = node ? node.ownerDocument || node : preferredDoc;
  9051. // Return early if doc is invalid or already selected
  9052. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9053. return document;
  9054. }
  9055. // Update global variables
  9056. document = doc;
  9057. docElem = document.documentElement;
  9058. documentIsHTML = !isXML( document );
  9059. // Support: IE 9-11, Edge
  9060. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9061. if ( preferredDoc !== document &&
  9062. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9063. // Support: IE 11, Edge
  9064. if ( subWindow.addEventListener ) {
  9065. subWindow.addEventListener( "unload", unloadHandler, false );
  9066. // Support: IE 9 - 10 only
  9067. } else if ( subWindow.attachEvent ) {
  9068. subWindow.attachEvent( "onunload", unloadHandler );
  9069. }
  9070. }
  9071. /* Attributes
  9072. ---------------------------------------------------------------------- */
  9073. // Support: IE<8
  9074. // Verify that getAttribute really returns attributes and not properties
  9075. // (excepting IE8 booleans)
  9076. support.attributes = assert(function( el ) {
  9077. el.className = "i";
  9078. return !el.getAttribute("className");
  9079. });
  9080. /* getElement(s)By*
  9081. ---------------------------------------------------------------------- */
  9082. // Check if getElementsByTagName("*") returns only elements
  9083. support.getElementsByTagName = assert(function( el ) {
  9084. el.appendChild( document.createComment("") );
  9085. return !el.getElementsByTagName("*").length;
  9086. });
  9087. // Support: IE<9
  9088. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9089. // Support: IE<10
  9090. // Check if getElementById returns elements by name
  9091. // The broken getElementById methods don't pick up programmatically-set names,
  9092. // so use a roundabout getElementsByName test
  9093. support.getById = assert(function( el ) {
  9094. docElem.appendChild( el ).id = expando;
  9095. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9096. });
  9097. // ID filter and find
  9098. if ( support.getById ) {
  9099. Expr.filter["ID"] = function( id ) {
  9100. var attrId = id.replace( runescape, funescape );
  9101. return function( elem ) {
  9102. return elem.getAttribute("id") === attrId;
  9103. };
  9104. };
  9105. Expr.find["ID"] = function( id, context ) {
  9106. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9107. var elem = context.getElementById( id );
  9108. return elem ? [ elem ] : [];
  9109. }
  9110. };
  9111. } else {
  9112. Expr.filter["ID"] = function( id ) {
  9113. var attrId = id.replace( runescape, funescape );
  9114. return function( elem ) {
  9115. var node = typeof elem.getAttributeNode !== "undefined" &&
  9116. elem.getAttributeNode("id");
  9117. return node && node.value === attrId;
  9118. };
  9119. };
  9120. // Support: IE 6 - 7 only
  9121. // getElementById is not reliable as a find shortcut
  9122. Expr.find["ID"] = function( id, context ) {
  9123. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9124. var node, i, elems,
  9125. elem = context.getElementById( id );
  9126. if ( elem ) {
  9127. // Verify the id attribute
  9128. node = elem.getAttributeNode("id");
  9129. if ( node && node.value === id ) {
  9130. return [ elem ];
  9131. }
  9132. // Fall back on getElementsByName
  9133. elems = context.getElementsByName( id );
  9134. i = 0;
  9135. while ( (elem = elems[i++]) ) {
  9136. node = elem.getAttributeNode("id");
  9137. if ( node && node.value === id ) {
  9138. return [ elem ];
  9139. }
  9140. }
  9141. }
  9142. return [];
  9143. }
  9144. };
  9145. }
  9146. // Tag
  9147. Expr.find["TAG"] = support.getElementsByTagName ?
  9148. function( tag, context ) {
  9149. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9150. return context.getElementsByTagName( tag );
  9151. // DocumentFragment nodes don't have gEBTN
  9152. } else if ( support.qsa ) {
  9153. return context.querySelectorAll( tag );
  9154. }
  9155. } :
  9156. function( tag, context ) {
  9157. var elem,
  9158. tmp = [],
  9159. i = 0,
  9160. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9161. results = context.getElementsByTagName( tag );
  9162. // Filter out possible comments
  9163. if ( tag === "*" ) {
  9164. while ( (elem = results[i++]) ) {
  9165. if ( elem.nodeType === 1 ) {
  9166. tmp.push( elem );
  9167. }
  9168. }
  9169. return tmp;
  9170. }
  9171. return results;
  9172. };
  9173. // Class
  9174. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9175. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9176. return context.getElementsByClassName( className );
  9177. }
  9178. };
  9179. /* QSA/matchesSelector
  9180. ---------------------------------------------------------------------- */
  9181. // QSA and matchesSelector support
  9182. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9183. rbuggyMatches = [];
  9184. // qSa(:focus) reports false when true (Chrome 21)
  9185. // We allow this because of a bug in IE8/9 that throws an error
  9186. // whenever `document.activeElement` is accessed on an iframe
  9187. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9188. // See https://bugs.jquery.com/ticket/13378
  9189. rbuggyQSA = [];
  9190. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9191. // Build QSA regex
  9192. // Regex strategy adopted from Diego Perini
  9193. assert(function( el ) {
  9194. // Select is set to empty string on purpose
  9195. // This is to test IE's treatment of not explicitly
  9196. // setting a boolean content attribute,
  9197. // since its presence should be enough
  9198. // https://bugs.jquery.com/ticket/12359
  9199. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9200. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9201. "<option selected=''></option></select>";
  9202. // Support: IE8, Opera 11-12.16
  9203. // Nothing should be selected when empty strings follow ^= or $= or *=
  9204. // The test attribute must be unknown in Opera but "safe" for WinRT
  9205. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9206. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9207. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9208. }
  9209. // Support: IE8
  9210. // Boolean attributes and "value" are not treated correctly
  9211. if ( !el.querySelectorAll("[selected]").length ) {
  9212. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9213. }
  9214. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9215. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9216. rbuggyQSA.push("~=");
  9217. }
  9218. // Webkit/Opera - :checked should return selected option elements
  9219. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9220. // IE8 throws error here and will not see later tests
  9221. if ( !el.querySelectorAll(":checked").length ) {
  9222. rbuggyQSA.push(":checked");
  9223. }
  9224. // Support: Safari 8+, iOS 8+
  9225. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9226. // In-page `selector#id sibling-combinator selector` fails
  9227. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9228. rbuggyQSA.push(".#.+[+~]");
  9229. }
  9230. });
  9231. assert(function( el ) {
  9232. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9233. "<select disabled='disabled'><option/></select>";
  9234. // Support: Windows 8 Native Apps
  9235. // The type and name attributes are restricted during .innerHTML assignment
  9236. var input = document.createElement("input");
  9237. input.setAttribute( "type", "hidden" );
  9238. el.appendChild( input ).setAttribute( "name", "D" );
  9239. // Support: IE8
  9240. // Enforce case-sensitivity of name attribute
  9241. if ( el.querySelectorAll("[name=d]").length ) {
  9242. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9243. }
  9244. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9245. // IE8 throws error here and will not see later tests
  9246. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9247. rbuggyQSA.push( ":enabled", ":disabled" );
  9248. }
  9249. // Support: IE9-11+
  9250. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9251. docElem.appendChild( el ).disabled = true;
  9252. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9253. rbuggyQSA.push( ":enabled", ":disabled" );
  9254. }
  9255. // Opera 10-11 does not throw on post-comma invalid pseudos
  9256. el.querySelectorAll("*,:x");
  9257. rbuggyQSA.push(",.*:");
  9258. });
  9259. }
  9260. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9261. docElem.webkitMatchesSelector ||
  9262. docElem.mozMatchesSelector ||
  9263. docElem.oMatchesSelector ||
  9264. docElem.msMatchesSelector) )) ) {
  9265. assert(function( el ) {
  9266. // Check to see if it's possible to do matchesSelector
  9267. // on a disconnected node (IE 9)
  9268. support.disconnectedMatch = matches.call( el, "*" );
  9269. // This should fail with an exception
  9270. // Gecko does not error, returns false instead
  9271. matches.call( el, "[s!='']:x" );
  9272. rbuggyMatches.push( "!=", pseudos );
  9273. });
  9274. }
  9275. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9276. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9277. /* Contains
  9278. ---------------------------------------------------------------------- */
  9279. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9280. // Element contains another
  9281. // Purposefully self-exclusive
  9282. // As in, an element does not contain itself
  9283. contains = hasCompare || rnative.test( docElem.contains ) ?
  9284. function( a, b ) {
  9285. var adown = a.nodeType === 9 ? a.documentElement : a,
  9286. bup = b && b.parentNode;
  9287. return a === bup || !!( bup && bup.nodeType === 1 && (
  9288. adown.contains ?
  9289. adown.contains( bup ) :
  9290. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9291. ));
  9292. } :
  9293. function( a, b ) {
  9294. if ( b ) {
  9295. while ( (b = b.parentNode) ) {
  9296. if ( b === a ) {
  9297. return true;
  9298. }
  9299. }
  9300. }
  9301. return false;
  9302. };
  9303. /* Sorting
  9304. ---------------------------------------------------------------------- */
  9305. // Document order sorting
  9306. sortOrder = hasCompare ?
  9307. function( a, b ) {
  9308. // Flag for duplicate removal
  9309. if ( a === b ) {
  9310. hasDuplicate = true;
  9311. return 0;
  9312. }
  9313. // Sort on method existence if only one input has compareDocumentPosition
  9314. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9315. if ( compare ) {
  9316. return compare;
  9317. }
  9318. // Calculate position if both inputs belong to the same document
  9319. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9320. a.compareDocumentPosition( b ) :
  9321. // Otherwise we know they are disconnected
  9322. 1;
  9323. // Disconnected nodes
  9324. if ( compare & 1 ||
  9325. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9326. // Choose the first element that is related to our preferred document
  9327. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9328. return -1;
  9329. }
  9330. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9331. return 1;
  9332. }
  9333. // Maintain original order
  9334. return sortInput ?
  9335. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9336. 0;
  9337. }
  9338. return compare & 4 ? -1 : 1;
  9339. } :
  9340. function( a, b ) {
  9341. // Exit early if the nodes are identical
  9342. if ( a === b ) {
  9343. hasDuplicate = true;
  9344. return 0;
  9345. }
  9346. var cur,
  9347. i = 0,
  9348. aup = a.parentNode,
  9349. bup = b.parentNode,
  9350. ap = [ a ],
  9351. bp = [ b ];
  9352. // Parentless nodes are either documents or disconnected
  9353. if ( !aup || !bup ) {
  9354. return a === document ? -1 :
  9355. b === document ? 1 :
  9356. aup ? -1 :
  9357. bup ? 1 :
  9358. sortInput ?
  9359. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9360. 0;
  9361. // If the nodes are siblings, we can do a quick check
  9362. } else if ( aup === bup ) {
  9363. return siblingCheck( a, b );
  9364. }
  9365. // Otherwise we need full lists of their ancestors for comparison
  9366. cur = a;
  9367. while ( (cur = cur.parentNode) ) {
  9368. ap.unshift( cur );
  9369. }
  9370. cur = b;
  9371. while ( (cur = cur.parentNode) ) {
  9372. bp.unshift( cur );
  9373. }
  9374. // Walk down the tree looking for a discrepancy
  9375. while ( ap[i] === bp[i] ) {
  9376. i++;
  9377. }
  9378. return i ?
  9379. // Do a sibling check if the nodes have a common ancestor
  9380. siblingCheck( ap[i], bp[i] ) :
  9381. // Otherwise nodes in our document sort first
  9382. ap[i] === preferredDoc ? -1 :
  9383. bp[i] === preferredDoc ? 1 :
  9384. 0;
  9385. };
  9386. return document;
  9387. };
  9388. Sizzle.matches = function( expr, elements ) {
  9389. return Sizzle( expr, null, null, elements );
  9390. };
  9391. Sizzle.matchesSelector = function( elem, expr ) {
  9392. // Set document vars if needed
  9393. if ( ( elem.ownerDocument || elem ) !== document ) {
  9394. setDocument( elem );
  9395. }
  9396. if ( support.matchesSelector && documentIsHTML &&
  9397. !nonnativeSelectorCache[ expr + " " ] &&
  9398. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9399. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9400. try {
  9401. var ret = matches.call( elem, expr );
  9402. // IE 9's matchesSelector returns false on disconnected nodes
  9403. if ( ret || support.disconnectedMatch ||
  9404. // As well, disconnected nodes are said to be in a document
  9405. // fragment in IE 9
  9406. elem.document && elem.document.nodeType !== 11 ) {
  9407. return ret;
  9408. }
  9409. } catch (e) {
  9410. nonnativeSelectorCache( expr, true );
  9411. }
  9412. }
  9413. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9414. };
  9415. Sizzle.contains = function( context, elem ) {
  9416. // Set document vars if needed
  9417. if ( ( context.ownerDocument || context ) !== document ) {
  9418. setDocument( context );
  9419. }
  9420. return contains( context, elem );
  9421. };
  9422. Sizzle.attr = function( elem, name ) {
  9423. // Set document vars if needed
  9424. if ( ( elem.ownerDocument || elem ) !== document ) {
  9425. setDocument( elem );
  9426. }
  9427. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9428. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9429. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9430. fn( elem, name, !documentIsHTML ) :
  9431. undefined;
  9432. return val !== undefined ?
  9433. val :
  9434. support.attributes || !documentIsHTML ?
  9435. elem.getAttribute( name ) :
  9436. (val = elem.getAttributeNode(name)) && val.specified ?
  9437. val.value :
  9438. null;
  9439. };
  9440. Sizzle.escape = function( sel ) {
  9441. return (sel + "").replace( rcssescape, fcssescape );
  9442. };
  9443. Sizzle.error = function( msg ) {
  9444. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9445. };
  9446. /**
  9447. * Document sorting and removing duplicates
  9448. * @param {ArrayLike} results
  9449. */
  9450. Sizzle.uniqueSort = function( results ) {
  9451. var elem,
  9452. duplicates = [],
  9453. j = 0,
  9454. i = 0;
  9455. // Unless we *know* we can detect duplicates, assume their presence
  9456. hasDuplicate = !support.detectDuplicates;
  9457. sortInput = !support.sortStable && results.slice( 0 );
  9458. results.sort( sortOrder );
  9459. if ( hasDuplicate ) {
  9460. while ( (elem = results[i++]) ) {
  9461. if ( elem === results[ i ] ) {
  9462. j = duplicates.push( i );
  9463. }
  9464. }
  9465. while ( j-- ) {
  9466. results.splice( duplicates[ j ], 1 );
  9467. }
  9468. }
  9469. // Clear input after sorting to release objects
  9470. // See https://github.com/jquery/sizzle/pull/225
  9471. sortInput = null;
  9472. return results;
  9473. };
  9474. /**
  9475. * Utility function for retrieving the text value of an array of DOM nodes
  9476. * @param {Array|Element} elem
  9477. */
  9478. getText = Sizzle.getText = function( elem ) {
  9479. var node,
  9480. ret = "",
  9481. i = 0,
  9482. nodeType = elem.nodeType;
  9483. if ( !nodeType ) {
  9484. // If no nodeType, this is expected to be an array
  9485. while ( (node = elem[i++]) ) {
  9486. // Do not traverse comment nodes
  9487. ret += getText( node );
  9488. }
  9489. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9490. // Use textContent for elements
  9491. // innerText usage removed for consistency of new lines (jQuery #11153)
  9492. if ( typeof elem.textContent === "string" ) {
  9493. return elem.textContent;
  9494. } else {
  9495. // Traverse its children
  9496. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9497. ret += getText( elem );
  9498. }
  9499. }
  9500. } else if ( nodeType === 3 || nodeType === 4 ) {
  9501. return elem.nodeValue;
  9502. }
  9503. // Do not include comment or processing instruction nodes
  9504. return ret;
  9505. };
  9506. Expr = Sizzle.selectors = {
  9507. // Can be adjusted by the user
  9508. cacheLength: 50,
  9509. createPseudo: markFunction,
  9510. match: matchExpr,
  9511. attrHandle: {},
  9512. find: {},
  9513. relative: {
  9514. ">": { dir: "parentNode", first: true },
  9515. " ": { dir: "parentNode" },
  9516. "+": { dir: "previousSibling", first: true },
  9517. "~": { dir: "previousSibling" }
  9518. },
  9519. preFilter: {
  9520. "ATTR": function( match ) {
  9521. match[1] = match[1].replace( runescape, funescape );
  9522. // Move the given value to match[3] whether quoted or unquoted
  9523. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9524. if ( match[2] === "~=" ) {
  9525. match[3] = " " + match[3] + " ";
  9526. }
  9527. return match.slice( 0, 4 );
  9528. },
  9529. "CHILD": function( match ) {
  9530. /* matches from matchExpr["CHILD"]
  9531. 1 type (only|nth|...)
  9532. 2 what (child|of-type)
  9533. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9534. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9535. 5 sign of xn-component
  9536. 6 x of xn-component
  9537. 7 sign of y-component
  9538. 8 y of y-component
  9539. */
  9540. match[1] = match[1].toLowerCase();
  9541. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9542. // nth-* requires argument
  9543. if ( !match[3] ) {
  9544. Sizzle.error( match[0] );
  9545. }
  9546. // numeric x and y parameters for Expr.filter.CHILD
  9547. // remember that false/true cast respectively to 0/1
  9548. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9549. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9550. // other types prohibit arguments
  9551. } else if ( match[3] ) {
  9552. Sizzle.error( match[0] );
  9553. }
  9554. return match;
  9555. },
  9556. "PSEUDO": function( match ) {
  9557. var excess,
  9558. unquoted = !match[6] && match[2];
  9559. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9560. return null;
  9561. }
  9562. // Accept quoted arguments as-is
  9563. if ( match[3] ) {
  9564. match[2] = match[4] || match[5] || "";
  9565. // Strip excess characters from unquoted arguments
  9566. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9567. // Get excess from tokenize (recursively)
  9568. (excess = tokenize( unquoted, true )) &&
  9569. // advance to the next closing parenthesis
  9570. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9571. // excess is a negative index
  9572. match[0] = match[0].slice( 0, excess );
  9573. match[2] = unquoted.slice( 0, excess );
  9574. }
  9575. // Return only captures needed by the pseudo filter method (type and argument)
  9576. return match.slice( 0, 3 );
  9577. }
  9578. },
  9579. filter: {
  9580. "TAG": function( nodeNameSelector ) {
  9581. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9582. return nodeNameSelector === "*" ?
  9583. function() { return true; } :
  9584. function( elem ) {
  9585. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9586. };
  9587. },
  9588. "CLASS": function( className ) {
  9589. var pattern = classCache[ className + " " ];
  9590. return pattern ||
  9591. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9592. classCache( className, function( elem ) {
  9593. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9594. });
  9595. },
  9596. "ATTR": function( name, operator, check ) {
  9597. return function( elem ) {
  9598. var result = Sizzle.attr( elem, name );
  9599. if ( result == null ) {
  9600. return operator === "!=";
  9601. }
  9602. if ( !operator ) {
  9603. return true;
  9604. }
  9605. result += "";
  9606. return operator === "=" ? result === check :
  9607. operator === "!=" ? result !== check :
  9608. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9609. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9610. operator === "$=" ? check && result.slice( -check.length ) === check :
  9611. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9612. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9613. false;
  9614. };
  9615. },
  9616. "CHILD": function( type, what, argument, first, last ) {
  9617. var simple = type.slice( 0, 3 ) !== "nth",
  9618. forward = type.slice( -4 ) !== "last",
  9619. ofType = what === "of-type";
  9620. return first === 1 && last === 0 ?
  9621. // Shortcut for :nth-*(n)
  9622. function( elem ) {
  9623. return !!elem.parentNode;
  9624. } :
  9625. function( elem, context, xml ) {
  9626. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9627. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9628. parent = elem.parentNode,
  9629. name = ofType && elem.nodeName.toLowerCase(),
  9630. useCache = !xml && !ofType,
  9631. diff = false;
  9632. if ( parent ) {
  9633. // :(first|last|only)-(child|of-type)
  9634. if ( simple ) {
  9635. while ( dir ) {
  9636. node = elem;
  9637. while ( (node = node[ dir ]) ) {
  9638. if ( ofType ?
  9639. node.nodeName.toLowerCase() === name :
  9640. node.nodeType === 1 ) {
  9641. return false;
  9642. }
  9643. }
  9644. // Reverse direction for :only-* (if we haven't yet done so)
  9645. start = dir = type === "only" && !start && "nextSibling";
  9646. }
  9647. return true;
  9648. }
  9649. start = [ forward ? parent.firstChild : parent.lastChild ];
  9650. // non-xml :nth-child(...) stores cache data on `parent`
  9651. if ( forward && useCache ) {
  9652. // Seek `elem` from a previously-cached index
  9653. // ...in a gzip-friendly way
  9654. node = parent;
  9655. outerCache = node[ expando ] || (node[ expando ] = {});
  9656. // Support: IE <9 only
  9657. // Defend against cloned attroperties (jQuery gh-1709)
  9658. uniqueCache = outerCache[ node.uniqueID ] ||
  9659. (outerCache[ node.uniqueID ] = {});
  9660. cache = uniqueCache[ type ] || [];
  9661. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9662. diff = nodeIndex && cache[ 2 ];
  9663. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9664. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9665. // Fallback to seeking `elem` from the start
  9666. (diff = nodeIndex = 0) || start.pop()) ) {
  9667. // When found, cache indexes on `parent` and break
  9668. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9669. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9670. break;
  9671. }
  9672. }
  9673. } else {
  9674. // Use previously-cached element index if available
  9675. if ( useCache ) {
  9676. // ...in a gzip-friendly way
  9677. node = elem;
  9678. outerCache = node[ expando ] || (node[ expando ] = {});
  9679. // Support: IE <9 only
  9680. // Defend against cloned attroperties (jQuery gh-1709)
  9681. uniqueCache = outerCache[ node.uniqueID ] ||
  9682. (outerCache[ node.uniqueID ] = {});
  9683. cache = uniqueCache[ type ] || [];
  9684. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9685. diff = nodeIndex;
  9686. }
  9687. // xml :nth-child(...)
  9688. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9689. if ( diff === false ) {
  9690. // Use the same loop as above to seek `elem` from the start
  9691. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9692. (diff = nodeIndex = 0) || start.pop()) ) {
  9693. if ( ( ofType ?
  9694. node.nodeName.toLowerCase() === name :
  9695. node.nodeType === 1 ) &&
  9696. ++diff ) {
  9697. // Cache the index of each encountered element
  9698. if ( useCache ) {
  9699. outerCache = node[ expando ] || (node[ expando ] = {});
  9700. // Support: IE <9 only
  9701. // Defend against cloned attroperties (jQuery gh-1709)
  9702. uniqueCache = outerCache[ node.uniqueID ] ||
  9703. (outerCache[ node.uniqueID ] = {});
  9704. uniqueCache[ type ] = [ dirruns, diff ];
  9705. }
  9706. if ( node === elem ) {
  9707. break;
  9708. }
  9709. }
  9710. }
  9711. }
  9712. }
  9713. // Incorporate the offset, then check against cycle size
  9714. diff -= last;
  9715. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9716. }
  9717. };
  9718. },
  9719. "PSEUDO": function( pseudo, argument ) {
  9720. // pseudo-class names are case-insensitive
  9721. // http://www.w3.org/TR/selectors/#pseudo-classes
  9722. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9723. // Remember that setFilters inherits from pseudos
  9724. var args,
  9725. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9726. Sizzle.error( "unsupported pseudo: " + pseudo );
  9727. // The user may use createPseudo to indicate that
  9728. // arguments are needed to create the filter function
  9729. // just as Sizzle does
  9730. if ( fn[ expando ] ) {
  9731. return fn( argument );
  9732. }
  9733. // But maintain support for old signatures
  9734. if ( fn.length > 1 ) {
  9735. args = [ pseudo, pseudo, "", argument ];
  9736. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9737. markFunction(function( seed, matches ) {
  9738. var idx,
  9739. matched = fn( seed, argument ),
  9740. i = matched.length;
  9741. while ( i-- ) {
  9742. idx = indexOf( seed, matched[i] );
  9743. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9744. }
  9745. }) :
  9746. function( elem ) {
  9747. return fn( elem, 0, args );
  9748. };
  9749. }
  9750. return fn;
  9751. }
  9752. },
  9753. pseudos: {
  9754. // Potentially complex pseudos
  9755. "not": markFunction(function( selector ) {
  9756. // Trim the selector passed to compile
  9757. // to avoid treating leading and trailing
  9758. // spaces as combinators
  9759. var input = [],
  9760. results = [],
  9761. matcher = compile( selector.replace( rtrim, "$1" ) );
  9762. return matcher[ expando ] ?
  9763. markFunction(function( seed, matches, context, xml ) {
  9764. var elem,
  9765. unmatched = matcher( seed, null, xml, [] ),
  9766. i = seed.length;
  9767. // Match elements unmatched by `matcher`
  9768. while ( i-- ) {
  9769. if ( (elem = unmatched[i]) ) {
  9770. seed[i] = !(matches[i] = elem);
  9771. }
  9772. }
  9773. }) :
  9774. function( elem, context, xml ) {
  9775. input[0] = elem;
  9776. matcher( input, null, xml, results );
  9777. // Don't keep the element (issue #299)
  9778. input[0] = null;
  9779. return !results.pop();
  9780. };
  9781. }),
  9782. "has": markFunction(function( selector ) {
  9783. return function( elem ) {
  9784. return Sizzle( selector, elem ).length > 0;
  9785. };
  9786. }),
  9787. "contains": markFunction(function( text ) {
  9788. text = text.replace( runescape, funescape );
  9789. return function( elem ) {
  9790. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9791. };
  9792. }),
  9793. // "Whether an element is represented by a :lang() selector
  9794. // is based solely on the element's language value
  9795. // being equal to the identifier C,
  9796. // or beginning with the identifier C immediately followed by "-".
  9797. // The matching of C against the element's language value is performed case-insensitively.
  9798. // The identifier C does not have to be a valid language name."
  9799. // http://www.w3.org/TR/selectors/#lang-pseudo
  9800. "lang": markFunction( function( lang ) {
  9801. // lang value must be a valid identifier
  9802. if ( !ridentifier.test(lang || "") ) {
  9803. Sizzle.error( "unsupported lang: " + lang );
  9804. }
  9805. lang = lang.replace( runescape, funescape ).toLowerCase();
  9806. return function( elem ) {
  9807. var elemLang;
  9808. do {
  9809. if ( (elemLang = documentIsHTML ?
  9810. elem.lang :
  9811. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9812. elemLang = elemLang.toLowerCase();
  9813. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9814. }
  9815. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9816. return false;
  9817. };
  9818. }),
  9819. // Miscellaneous
  9820. "target": function( elem ) {
  9821. var hash = window.location && window.location.hash;
  9822. return hash && hash.slice( 1 ) === elem.id;
  9823. },
  9824. "root": function( elem ) {
  9825. return elem === docElem;
  9826. },
  9827. "focus": function( elem ) {
  9828. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9829. },
  9830. // Boolean properties
  9831. "enabled": createDisabledPseudo( false ),
  9832. "disabled": createDisabledPseudo( true ),
  9833. "checked": function( elem ) {
  9834. // In CSS3, :checked should return both checked and selected elements
  9835. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9836. var nodeName = elem.nodeName.toLowerCase();
  9837. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9838. },
  9839. "selected": function( elem ) {
  9840. // Accessing this property makes selected-by-default
  9841. // options in Safari work properly
  9842. if ( elem.parentNode ) {
  9843. elem.parentNode.selectedIndex;
  9844. }
  9845. return elem.selected === true;
  9846. },
  9847. // Contents
  9848. "empty": function( elem ) {
  9849. // http://www.w3.org/TR/selectors/#empty-pseudo
  9850. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9851. // but not by others (comment: 8; processing instruction: 7; etc.)
  9852. // nodeType < 6 works because attributes (2) do not appear as children
  9853. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9854. if ( elem.nodeType < 6 ) {
  9855. return false;
  9856. }
  9857. }
  9858. return true;
  9859. },
  9860. "parent": function( elem ) {
  9861. return !Expr.pseudos["empty"]( elem );
  9862. },
  9863. // Element/input types
  9864. "header": function( elem ) {
  9865. return rheader.test( elem.nodeName );
  9866. },
  9867. "input": function( elem ) {
  9868. return rinputs.test( elem.nodeName );
  9869. },
  9870. "button": function( elem ) {
  9871. var name = elem.nodeName.toLowerCase();
  9872. return name === "input" && elem.type === "button" || name === "button";
  9873. },
  9874. "text": function( elem ) {
  9875. var attr;
  9876. return elem.nodeName.toLowerCase() === "input" &&
  9877. elem.type === "text" &&
  9878. // Support: IE<8
  9879. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9880. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9881. },
  9882. // Position-in-collection
  9883. "first": createPositionalPseudo(function() {
  9884. return [ 0 ];
  9885. }),
  9886. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9887. return [ length - 1 ];
  9888. }),
  9889. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9890. return [ argument < 0 ? argument + length : argument ];
  9891. }),
  9892. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9893. var i = 0;
  9894. for ( ; i < length; i += 2 ) {
  9895. matchIndexes.push( i );
  9896. }
  9897. return matchIndexes;
  9898. }),
  9899. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9900. var i = 1;
  9901. for ( ; i < length; i += 2 ) {
  9902. matchIndexes.push( i );
  9903. }
  9904. return matchIndexes;
  9905. }),
  9906. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9907. var i = argument < 0 ?
  9908. argument + length :
  9909. argument > length ?
  9910. length :
  9911. argument;
  9912. for ( ; --i >= 0; ) {
  9913. matchIndexes.push( i );
  9914. }
  9915. return matchIndexes;
  9916. }),
  9917. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9918. var i = argument < 0 ? argument + length : argument;
  9919. for ( ; ++i < length; ) {
  9920. matchIndexes.push( i );
  9921. }
  9922. return matchIndexes;
  9923. })
  9924. }
  9925. };
  9926. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9927. // Add button/input type pseudos
  9928. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9929. Expr.pseudos[ i ] = createInputPseudo( i );
  9930. }
  9931. for ( i in { submit: true, reset: true } ) {
  9932. Expr.pseudos[ i ] = createButtonPseudo( i );
  9933. }
  9934. // Easy API for creating new setFilters
  9935. function setFilters() {}
  9936. setFilters.prototype = Expr.filters = Expr.pseudos;
  9937. Expr.setFilters = new setFilters();
  9938. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9939. var matched, match, tokens, type,
  9940. soFar, groups, preFilters,
  9941. cached = tokenCache[ selector + " " ];
  9942. if ( cached ) {
  9943. return parseOnly ? 0 : cached.slice( 0 );
  9944. }
  9945. soFar = selector;
  9946. groups = [];
  9947. preFilters = Expr.preFilter;
  9948. while ( soFar ) {
  9949. // Comma and first run
  9950. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9951. if ( match ) {
  9952. // Don't consume trailing commas as valid
  9953. soFar = soFar.slice( match[0].length ) || soFar;
  9954. }
  9955. groups.push( (tokens = []) );
  9956. }
  9957. matched = false;
  9958. // Combinators
  9959. if ( (match = rcombinators.exec( soFar )) ) {
  9960. matched = match.shift();
  9961. tokens.push({
  9962. value: matched,
  9963. // Cast descendant combinators to space
  9964. type: match[0].replace( rtrim, " " )
  9965. });
  9966. soFar = soFar.slice( matched.length );
  9967. }
  9968. // Filters
  9969. for ( type in Expr.filter ) {
  9970. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9971. (match = preFilters[ type ]( match ))) ) {
  9972. matched = match.shift();
  9973. tokens.push({
  9974. value: matched,
  9975. type: type,
  9976. matches: match
  9977. });
  9978. soFar = soFar.slice( matched.length );
  9979. }
  9980. }
  9981. if ( !matched ) {
  9982. break;
  9983. }
  9984. }
  9985. // Return the length of the invalid excess
  9986. // if we're just parsing
  9987. // Otherwise, throw an error or return tokens
  9988. return parseOnly ?
  9989. soFar.length :
  9990. soFar ?
  9991. Sizzle.error( selector ) :
  9992. // Cache the tokens
  9993. tokenCache( selector, groups ).slice( 0 );
  9994. };
  9995. function toSelector( tokens ) {
  9996. var i = 0,
  9997. len = tokens.length,
  9998. selector = "";
  9999. for ( ; i < len; i++ ) {
  10000. selector += tokens[i].value;
  10001. }
  10002. return selector;
  10003. }
  10004. function addCombinator( matcher, combinator, base ) {
  10005. var dir = combinator.dir,
  10006. skip = combinator.next,
  10007. key = skip || dir,
  10008. checkNonElements = base && key === "parentNode",
  10009. doneName = done++;
  10010. return combinator.first ?
  10011. // Check against closest ancestor/preceding element
  10012. function( elem, context, xml ) {
  10013. while ( (elem = elem[ dir ]) ) {
  10014. if ( elem.nodeType === 1 || checkNonElements ) {
  10015. return matcher( elem, context, xml );
  10016. }
  10017. }
  10018. return false;
  10019. } :
  10020. // Check against all ancestor/preceding elements
  10021. function( elem, context, xml ) {
  10022. var oldCache, uniqueCache, outerCache,
  10023. newCache = [ dirruns, doneName ];
  10024. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10025. if ( xml ) {
  10026. while ( (elem = elem[ dir ]) ) {
  10027. if ( elem.nodeType === 1 || checkNonElements ) {
  10028. if ( matcher( elem, context, xml ) ) {
  10029. return true;
  10030. }
  10031. }
  10032. }
  10033. } else {
  10034. while ( (elem = elem[ dir ]) ) {
  10035. if ( elem.nodeType === 1 || checkNonElements ) {
  10036. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10037. // Support: IE <9 only
  10038. // Defend against cloned attroperties (jQuery gh-1709)
  10039. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10040. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10041. elem = elem[ dir ] || elem;
  10042. } else if ( (oldCache = uniqueCache[ key ]) &&
  10043. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10044. // Assign to newCache so results back-propagate to previous elements
  10045. return (newCache[ 2 ] = oldCache[ 2 ]);
  10046. } else {
  10047. // Reuse newcache so results back-propagate to previous elements
  10048. uniqueCache[ key ] = newCache;
  10049. // A match means we're done; a fail means we have to keep checking
  10050. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10051. return true;
  10052. }
  10053. }
  10054. }
  10055. }
  10056. }
  10057. return false;
  10058. };
  10059. }
  10060. function elementMatcher( matchers ) {
  10061. return matchers.length > 1 ?
  10062. function( elem, context, xml ) {
  10063. var i = matchers.length;
  10064. while ( i-- ) {
  10065. if ( !matchers[i]( elem, context, xml ) ) {
  10066. return false;
  10067. }
  10068. }
  10069. return true;
  10070. } :
  10071. matchers[0];
  10072. }
  10073. function multipleContexts( selector, contexts, results ) {
  10074. var i = 0,
  10075. len = contexts.length;
  10076. for ( ; i < len; i++ ) {
  10077. Sizzle( selector, contexts[i], results );
  10078. }
  10079. return results;
  10080. }
  10081. function condense( unmatched, map, filter, context, xml ) {
  10082. var elem,
  10083. newUnmatched = [],
  10084. i = 0,
  10085. len = unmatched.length,
  10086. mapped = map != null;
  10087. for ( ; i < len; i++ ) {
  10088. if ( (elem = unmatched[i]) ) {
  10089. if ( !filter || filter( elem, context, xml ) ) {
  10090. newUnmatched.push( elem );
  10091. if ( mapped ) {
  10092. map.push( i );
  10093. }
  10094. }
  10095. }
  10096. }
  10097. return newUnmatched;
  10098. }
  10099. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10100. if ( postFilter && !postFilter[ expando ] ) {
  10101. postFilter = setMatcher( postFilter );
  10102. }
  10103. if ( postFinder && !postFinder[ expando ] ) {
  10104. postFinder = setMatcher( postFinder, postSelector );
  10105. }
  10106. return markFunction(function( seed, results, context, xml ) {
  10107. var temp, i, elem,
  10108. preMap = [],
  10109. postMap = [],
  10110. preexisting = results.length,
  10111. // Get initial elements from seed or context
  10112. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10113. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10114. matcherIn = preFilter && ( seed || !selector ) ?
  10115. condense( elems, preMap, preFilter, context, xml ) :
  10116. elems,
  10117. matcherOut = matcher ?
  10118. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10119. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10120. // ...intermediate processing is necessary
  10121. [] :
  10122. // ...otherwise use results directly
  10123. results :
  10124. matcherIn;
  10125. // Find primary matches
  10126. if ( matcher ) {
  10127. matcher( matcherIn, matcherOut, context, xml );
  10128. }
  10129. // Apply postFilter
  10130. if ( postFilter ) {
  10131. temp = condense( matcherOut, postMap );
  10132. postFilter( temp, [], context, xml );
  10133. // Un-match failing elements by moving them back to matcherIn
  10134. i = temp.length;
  10135. while ( i-- ) {
  10136. if ( (elem = temp[i]) ) {
  10137. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10138. }
  10139. }
  10140. }
  10141. if ( seed ) {
  10142. if ( postFinder || preFilter ) {
  10143. if ( postFinder ) {
  10144. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10145. temp = [];
  10146. i = matcherOut.length;
  10147. while ( i-- ) {
  10148. if ( (elem = matcherOut[i]) ) {
  10149. // Restore matcherIn since elem is not yet a final match
  10150. temp.push( (matcherIn[i] = elem) );
  10151. }
  10152. }
  10153. postFinder( null, (matcherOut = []), temp, xml );
  10154. }
  10155. // Move matched elements from seed to results to keep them synchronized
  10156. i = matcherOut.length;
  10157. while ( i-- ) {
  10158. if ( (elem = matcherOut[i]) &&
  10159. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10160. seed[temp] = !(results[temp] = elem);
  10161. }
  10162. }
  10163. }
  10164. // Add elements to results, through postFinder if defined
  10165. } else {
  10166. matcherOut = condense(
  10167. matcherOut === results ?
  10168. matcherOut.splice( preexisting, matcherOut.length ) :
  10169. matcherOut
  10170. );
  10171. if ( postFinder ) {
  10172. postFinder( null, results, matcherOut, xml );
  10173. } else {
  10174. push.apply( results, matcherOut );
  10175. }
  10176. }
  10177. });
  10178. }
  10179. function matcherFromTokens( tokens ) {
  10180. var checkContext, matcher, j,
  10181. len = tokens.length,
  10182. leadingRelative = Expr.relative[ tokens[0].type ],
  10183. implicitRelative = leadingRelative || Expr.relative[" "],
  10184. i = leadingRelative ? 1 : 0,
  10185. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10186. matchContext = addCombinator( function( elem ) {
  10187. return elem === checkContext;
  10188. }, implicitRelative, true ),
  10189. matchAnyContext = addCombinator( function( elem ) {
  10190. return indexOf( checkContext, elem ) > -1;
  10191. }, implicitRelative, true ),
  10192. matchers = [ function( elem, context, xml ) {
  10193. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10194. (checkContext = context).nodeType ?
  10195. matchContext( elem, context, xml ) :
  10196. matchAnyContext( elem, context, xml ) );
  10197. // Avoid hanging onto element (issue #299)
  10198. checkContext = null;
  10199. return ret;
  10200. } ];
  10201. for ( ; i < len; i++ ) {
  10202. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10203. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10204. } else {
  10205. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10206. // Return special upon seeing a positional matcher
  10207. if ( matcher[ expando ] ) {
  10208. // Find the next relative operator (if any) for proper handling
  10209. j = ++i;
  10210. for ( ; j < len; j++ ) {
  10211. if ( Expr.relative[ tokens[j].type ] ) {
  10212. break;
  10213. }
  10214. }
  10215. return setMatcher(
  10216. i > 1 && elementMatcher( matchers ),
  10217. i > 1 && toSelector(
  10218. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10219. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10220. ).replace( rtrim, "$1" ),
  10221. matcher,
  10222. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10223. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10224. j < len && toSelector( tokens )
  10225. );
  10226. }
  10227. matchers.push( matcher );
  10228. }
  10229. }
  10230. return elementMatcher( matchers );
  10231. }
  10232. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10233. var bySet = setMatchers.length > 0,
  10234. byElement = elementMatchers.length > 0,
  10235. superMatcher = function( seed, context, xml, results, outermost ) {
  10236. var elem, j, matcher,
  10237. matchedCount = 0,
  10238. i = "0",
  10239. unmatched = seed && [],
  10240. setMatched = [],
  10241. contextBackup = outermostContext,
  10242. // We must always have either seed elements or outermost context
  10243. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10244. // Use integer dirruns iff this is the outermost matcher
  10245. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10246. len = elems.length;
  10247. if ( outermost ) {
  10248. outermostContext = context === document || context || outermost;
  10249. }
  10250. // Add elements passing elementMatchers directly to results
  10251. // Support: IE<9, Safari
  10252. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10253. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10254. if ( byElement && elem ) {
  10255. j = 0;
  10256. if ( !context && elem.ownerDocument !== document ) {
  10257. setDocument( elem );
  10258. xml = !documentIsHTML;
  10259. }
  10260. while ( (matcher = elementMatchers[j++]) ) {
  10261. if ( matcher( elem, context || document, xml) ) {
  10262. results.push( elem );
  10263. break;
  10264. }
  10265. }
  10266. if ( outermost ) {
  10267. dirruns = dirrunsUnique;
  10268. }
  10269. }
  10270. // Track unmatched elements for set filters
  10271. if ( bySet ) {
  10272. // They will have gone through all possible matchers
  10273. if ( (elem = !matcher && elem) ) {
  10274. matchedCount--;
  10275. }
  10276. // Lengthen the array for every element, matched or not
  10277. if ( seed ) {
  10278. unmatched.push( elem );
  10279. }
  10280. }
  10281. }
  10282. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10283. // makes the latter nonnegative.
  10284. matchedCount += i;
  10285. // Apply set filters to unmatched elements
  10286. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10287. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10288. // no element matchers and no seed.
  10289. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10290. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10291. // numerically zero.
  10292. if ( bySet && i !== matchedCount ) {
  10293. j = 0;
  10294. while ( (matcher = setMatchers[j++]) ) {
  10295. matcher( unmatched, setMatched, context, xml );
  10296. }
  10297. if ( seed ) {
  10298. // Reintegrate element matches to eliminate the need for sorting
  10299. if ( matchedCount > 0 ) {
  10300. while ( i-- ) {
  10301. if ( !(unmatched[i] || setMatched[i]) ) {
  10302. setMatched[i] = pop.call( results );
  10303. }
  10304. }
  10305. }
  10306. // Discard index placeholder values to get only actual matches
  10307. setMatched = condense( setMatched );
  10308. }
  10309. // Add matches to results
  10310. push.apply( results, setMatched );
  10311. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10312. if ( outermost && !seed && setMatched.length > 0 &&
  10313. ( matchedCount + setMatchers.length ) > 1 ) {
  10314. Sizzle.uniqueSort( results );
  10315. }
  10316. }
  10317. // Override manipulation of globals by nested matchers
  10318. if ( outermost ) {
  10319. dirruns = dirrunsUnique;
  10320. outermostContext = contextBackup;
  10321. }
  10322. return unmatched;
  10323. };
  10324. return bySet ?
  10325. markFunction( superMatcher ) :
  10326. superMatcher;
  10327. }
  10328. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10329. var i,
  10330. setMatchers = [],
  10331. elementMatchers = [],
  10332. cached = compilerCache[ selector + " " ];
  10333. if ( !cached ) {
  10334. // Generate a function of recursive functions that can be used to check each element
  10335. if ( !match ) {
  10336. match = tokenize( selector );
  10337. }
  10338. i = match.length;
  10339. while ( i-- ) {
  10340. cached = matcherFromTokens( match[i] );
  10341. if ( cached[ expando ] ) {
  10342. setMatchers.push( cached );
  10343. } else {
  10344. elementMatchers.push( cached );
  10345. }
  10346. }
  10347. // Cache the compiled function
  10348. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10349. // Save selector and tokenization
  10350. cached.selector = selector;
  10351. }
  10352. return cached;
  10353. };
  10354. /**
  10355. * A low-level selection function that works with Sizzle's compiled
  10356. * selector functions
  10357. * @param {String|Function} selector A selector or a pre-compiled
  10358. * selector function built with Sizzle.compile
  10359. * @param {Element} context
  10360. * @param {Array} [results]
  10361. * @param {Array} [seed] A set of elements to match against
  10362. */
  10363. select = Sizzle.select = function( selector, context, results, seed ) {
  10364. var i, tokens, token, type, find,
  10365. compiled = typeof selector === "function" && selector,
  10366. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10367. results = results || [];
  10368. // Try to minimize operations if there is only one selector in the list and no seed
  10369. // (the latter of which guarantees us context)
  10370. if ( match.length === 1 ) {
  10371. // Reduce context if the leading compound selector is an ID
  10372. tokens = match[0] = match[0].slice( 0 );
  10373. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10374. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10375. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10376. if ( !context ) {
  10377. return results;
  10378. // Precompiled matchers will still verify ancestry, so step up a level
  10379. } else if ( compiled ) {
  10380. context = context.parentNode;
  10381. }
  10382. selector = selector.slice( tokens.shift().value.length );
  10383. }
  10384. // Fetch a seed set for right-to-left matching
  10385. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10386. while ( i-- ) {
  10387. token = tokens[i];
  10388. // Abort if we hit a combinator
  10389. if ( Expr.relative[ (type = token.type) ] ) {
  10390. break;
  10391. }
  10392. if ( (find = Expr.find[ type ]) ) {
  10393. // Search, expanding context for leading sibling combinators
  10394. if ( (seed = find(
  10395. token.matches[0].replace( runescape, funescape ),
  10396. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10397. )) ) {
  10398. // If seed is empty or no tokens remain, we can return early
  10399. tokens.splice( i, 1 );
  10400. selector = seed.length && toSelector( tokens );
  10401. if ( !selector ) {
  10402. push.apply( results, seed );
  10403. return results;
  10404. }
  10405. break;
  10406. }
  10407. }
  10408. }
  10409. }
  10410. // Compile and execute a filtering function if one is not provided
  10411. // Provide `match` to avoid retokenization if we modified the selector above
  10412. ( compiled || compile( selector, match ) )(
  10413. seed,
  10414. context,
  10415. !documentIsHTML,
  10416. results,
  10417. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10418. );
  10419. return results;
  10420. };
  10421. // One-time assignments
  10422. // Sort stability
  10423. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10424. // Support: Chrome 14-35+
  10425. // Always assume duplicates if they aren't passed to the comparison function
  10426. support.detectDuplicates = !!hasDuplicate;
  10427. // Initialize against the default document
  10428. setDocument();
  10429. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10430. // Detached nodes confoundingly follow *each other*
  10431. support.sortDetached = assert(function( el ) {
  10432. // Should return 1, but returns 4 (following)
  10433. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10434. });
  10435. // Support: IE<8
  10436. // Prevent attribute/property "interpolation"
  10437. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10438. if ( !assert(function( el ) {
  10439. el.innerHTML = "<a href='#'></a>";
  10440. return el.firstChild.getAttribute("href") === "#" ;
  10441. }) ) {
  10442. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10443. if ( !isXML ) {
  10444. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10445. }
  10446. });
  10447. }
  10448. // Support: IE<9
  10449. // Use defaultValue in place of getAttribute("value")
  10450. if ( !support.attributes || !assert(function( el ) {
  10451. el.innerHTML = "<input/>";
  10452. el.firstChild.setAttribute( "value", "" );
  10453. return el.firstChild.getAttribute( "value" ) === "";
  10454. }) ) {
  10455. addHandle( "value", function( elem, name, isXML ) {
  10456. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10457. return elem.defaultValue;
  10458. }
  10459. });
  10460. }
  10461. // Support: IE<9
  10462. // Use getAttributeNode to fetch booleans when getAttribute lies
  10463. if ( !assert(function( el ) {
  10464. return el.getAttribute("disabled") == null;
  10465. }) ) {
  10466. addHandle( booleans, function( elem, name, isXML ) {
  10467. var val;
  10468. if ( !isXML ) {
  10469. return elem[ name ] === true ? name.toLowerCase() :
  10470. (val = elem.getAttributeNode( name )) && val.specified ?
  10471. val.value :
  10472. null;
  10473. }
  10474. });
  10475. }
  10476. return Sizzle;
  10477. })( window );
  10478. jQuery.find = Sizzle;
  10479. jQuery.expr = Sizzle.selectors;
  10480. // Deprecated
  10481. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10482. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10483. jQuery.text = Sizzle.getText;
  10484. jQuery.isXMLDoc = Sizzle.isXML;
  10485. jQuery.contains = Sizzle.contains;
  10486. jQuery.escapeSelector = Sizzle.escape;
  10487. var dir = function( elem, dir, until ) {
  10488. var matched = [],
  10489. truncate = until !== undefined;
  10490. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10491. if ( elem.nodeType === 1 ) {
  10492. if ( truncate && jQuery( elem ).is( until ) ) {
  10493. break;
  10494. }
  10495. matched.push( elem );
  10496. }
  10497. }
  10498. return matched;
  10499. };
  10500. var siblings = function( n, elem ) {
  10501. var matched = [];
  10502. for ( ; n; n = n.nextSibling ) {
  10503. if ( n.nodeType === 1 && n !== elem ) {
  10504. matched.push( n );
  10505. }
  10506. }
  10507. return matched;
  10508. };
  10509. var rneedsContext = jQuery.expr.match.needsContext;
  10510. function nodeName( elem, name ) {
  10511. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10512. };
  10513. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10514. // Implement the identical functionality for filter and not
  10515. function winnow( elements, qualifier, not ) {
  10516. if ( isFunction( qualifier ) ) {
  10517. return jQuery.grep( elements, function( elem, i ) {
  10518. return !!qualifier.call( elem, i, elem ) !== not;
  10519. } );
  10520. }
  10521. // Single element
  10522. if ( qualifier.nodeType ) {
  10523. return jQuery.grep( elements, function( elem ) {
  10524. return ( elem === qualifier ) !== not;
  10525. } );
  10526. }
  10527. // Arraylike of elements (jQuery, arguments, Array)
  10528. if ( typeof qualifier !== "string" ) {
  10529. return jQuery.grep( elements, function( elem ) {
  10530. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10531. } );
  10532. }
  10533. // Filtered directly for both simple and complex selectors
  10534. return jQuery.filter( qualifier, elements, not );
  10535. }
  10536. jQuery.filter = function( expr, elems, not ) {
  10537. var elem = elems[ 0 ];
  10538. if ( not ) {
  10539. expr = ":not(" + expr + ")";
  10540. }
  10541. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10542. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10543. }
  10544. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10545. return elem.nodeType === 1;
  10546. } ) );
  10547. };
  10548. jQuery.fn.extend( {
  10549. find: function( selector ) {
  10550. var i, ret,
  10551. len = this.length,
  10552. self = this;
  10553. if ( typeof selector !== "string" ) {
  10554. return this.pushStack( jQuery( selector ).filter( function() {
  10555. for ( i = 0; i < len; i++ ) {
  10556. if ( jQuery.contains( self[ i ], this ) ) {
  10557. return true;
  10558. }
  10559. }
  10560. } ) );
  10561. }
  10562. ret = this.pushStack( [] );
  10563. for ( i = 0; i < len; i++ ) {
  10564. jQuery.find( selector, self[ i ], ret );
  10565. }
  10566. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10567. },
  10568. filter: function( selector ) {
  10569. return this.pushStack( winnow( this, selector || [], false ) );
  10570. },
  10571. not: function( selector ) {
  10572. return this.pushStack( winnow( this, selector || [], true ) );
  10573. },
  10574. is: function( selector ) {
  10575. return !!winnow(
  10576. this,
  10577. // If this is a positional/relative selector, check membership in the returned set
  10578. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10579. typeof selector === "string" && rneedsContext.test( selector ) ?
  10580. jQuery( selector ) :
  10581. selector || [],
  10582. false
  10583. ).length;
  10584. }
  10585. } );
  10586. // Initialize a jQuery object
  10587. // A central reference to the root jQuery(document)
  10588. var rootjQuery,
  10589. // A simple way to check for HTML strings
  10590. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10591. // Strict HTML recognition (#11290: must start with <)
  10592. // Shortcut simple #id case for speed
  10593. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10594. init = jQuery.fn.init = function( selector, context, root ) {
  10595. var match, elem;
  10596. // HANDLE: $(""), $(null), $(undefined), $(false)
  10597. if ( !selector ) {
  10598. return this;
  10599. }
  10600. // Method init() accepts an alternate rootjQuery
  10601. // so migrate can support jQuery.sub (gh-2101)
  10602. root = root || rootjQuery;
  10603. // Handle HTML strings
  10604. if ( typeof selector === "string" ) {
  10605. if ( selector[ 0 ] === "<" &&
  10606. selector[ selector.length - 1 ] === ">" &&
  10607. selector.length >= 3 ) {
  10608. // Assume that strings that start and end with <> are HTML and skip the regex check
  10609. match = [ null, selector, null ];
  10610. } else {
  10611. match = rquickExpr.exec( selector );
  10612. }
  10613. // Match html or make sure no context is specified for #id
  10614. if ( match && ( match[ 1 ] || !context ) ) {
  10615. // HANDLE: $(html) -> $(array)
  10616. if ( match[ 1 ] ) {
  10617. context = context instanceof jQuery ? context[ 0 ] : context;
  10618. // Option to run scripts is true for back-compat
  10619. // Intentionally let the error be thrown if parseHTML is not present
  10620. jQuery.merge( this, jQuery.parseHTML(
  10621. match[ 1 ],
  10622. context && context.nodeType ? context.ownerDocument || context : document,
  10623. true
  10624. ) );
  10625. // HANDLE: $(html, props)
  10626. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10627. for ( match in context ) {
  10628. // Properties of context are called as methods if possible
  10629. if ( isFunction( this[ match ] ) ) {
  10630. this[ match ]( context[ match ] );
  10631. // ...and otherwise set as attributes
  10632. } else {
  10633. this.attr( match, context[ match ] );
  10634. }
  10635. }
  10636. }
  10637. return this;
  10638. // HANDLE: $(#id)
  10639. } else {
  10640. elem = document.getElementById( match[ 2 ] );
  10641. if ( elem ) {
  10642. // Inject the element directly into the jQuery object
  10643. this[ 0 ] = elem;
  10644. this.length = 1;
  10645. }
  10646. return this;
  10647. }
  10648. // HANDLE: $(expr, $(...))
  10649. } else if ( !context || context.jquery ) {
  10650. return ( context || root ).find( selector );
  10651. // HANDLE: $(expr, context)
  10652. // (which is just equivalent to: $(context).find(expr)
  10653. } else {
  10654. return this.constructor( context ).find( selector );
  10655. }
  10656. // HANDLE: $(DOMElement)
  10657. } else if ( selector.nodeType ) {
  10658. this[ 0 ] = selector;
  10659. this.length = 1;
  10660. return this;
  10661. // HANDLE: $(function)
  10662. // Shortcut for document ready
  10663. } else if ( isFunction( selector ) ) {
  10664. return root.ready !== undefined ?
  10665. root.ready( selector ) :
  10666. // Execute immediately if ready is not present
  10667. selector( jQuery );
  10668. }
  10669. return jQuery.makeArray( selector, this );
  10670. };
  10671. // Give the init function the jQuery prototype for later instantiation
  10672. init.prototype = jQuery.fn;
  10673. // Initialize central reference
  10674. rootjQuery = jQuery( document );
  10675. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10676. // Methods guaranteed to produce a unique set when starting from a unique set
  10677. guaranteedUnique = {
  10678. children: true,
  10679. contents: true,
  10680. next: true,
  10681. prev: true
  10682. };
  10683. jQuery.fn.extend( {
  10684. has: function( target ) {
  10685. var targets = jQuery( target, this ),
  10686. l = targets.length;
  10687. return this.filter( function() {
  10688. var i = 0;
  10689. for ( ; i < l; i++ ) {
  10690. if ( jQuery.contains( this, targets[ i ] ) ) {
  10691. return true;
  10692. }
  10693. }
  10694. } );
  10695. },
  10696. closest: function( selectors, context ) {
  10697. var cur,
  10698. i = 0,
  10699. l = this.length,
  10700. matched = [],
  10701. targets = typeof selectors !== "string" && jQuery( selectors );
  10702. // Positional selectors never match, since there's no _selection_ context
  10703. if ( !rneedsContext.test( selectors ) ) {
  10704. for ( ; i < l; i++ ) {
  10705. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10706. // Always skip document fragments
  10707. if ( cur.nodeType < 11 && ( targets ?
  10708. targets.index( cur ) > -1 :
  10709. // Don't pass non-elements to Sizzle
  10710. cur.nodeType === 1 &&
  10711. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10712. matched.push( cur );
  10713. break;
  10714. }
  10715. }
  10716. }
  10717. }
  10718. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10719. },
  10720. // Determine the position of an element within the set
  10721. index: function( elem ) {
  10722. // No argument, return index in parent
  10723. if ( !elem ) {
  10724. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10725. }
  10726. // Index in selector
  10727. if ( typeof elem === "string" ) {
  10728. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10729. }
  10730. // Locate the position of the desired element
  10731. return indexOf.call( this,
  10732. // If it receives a jQuery object, the first element is used
  10733. elem.jquery ? elem[ 0 ] : elem
  10734. );
  10735. },
  10736. add: function( selector, context ) {
  10737. return this.pushStack(
  10738. jQuery.uniqueSort(
  10739. jQuery.merge( this.get(), jQuery( selector, context ) )
  10740. )
  10741. );
  10742. },
  10743. addBack: function( selector ) {
  10744. return this.add( selector == null ?
  10745. this.prevObject : this.prevObject.filter( selector )
  10746. );
  10747. }
  10748. } );
  10749. function sibling( cur, dir ) {
  10750. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10751. return cur;
  10752. }
  10753. jQuery.each( {
  10754. parent: function( elem ) {
  10755. var parent = elem.parentNode;
  10756. return parent && parent.nodeType !== 11 ? parent : null;
  10757. },
  10758. parents: function( elem ) {
  10759. return dir( elem, "parentNode" );
  10760. },
  10761. parentsUntil: function( elem, i, until ) {
  10762. return dir( elem, "parentNode", until );
  10763. },
  10764. next: function( elem ) {
  10765. return sibling( elem, "nextSibling" );
  10766. },
  10767. prev: function( elem ) {
  10768. return sibling( elem, "previousSibling" );
  10769. },
  10770. nextAll: function( elem ) {
  10771. return dir( elem, "nextSibling" );
  10772. },
  10773. prevAll: function( elem ) {
  10774. return dir( elem, "previousSibling" );
  10775. },
  10776. nextUntil: function( elem, i, until ) {
  10777. return dir( elem, "nextSibling", until );
  10778. },
  10779. prevUntil: function( elem, i, until ) {
  10780. return dir( elem, "previousSibling", until );
  10781. },
  10782. siblings: function( elem ) {
  10783. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10784. },
  10785. children: function( elem ) {
  10786. return siblings( elem.firstChild );
  10787. },
  10788. contents: function( elem ) {
  10789. if ( typeof elem.contentDocument !== "undefined" ) {
  10790. return elem.contentDocument;
  10791. }
  10792. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10793. // Treat the template element as a regular one in browsers that
  10794. // don't support it.
  10795. if ( nodeName( elem, "template" ) ) {
  10796. elem = elem.content || elem;
  10797. }
  10798. return jQuery.merge( [], elem.childNodes );
  10799. }
  10800. }, function( name, fn ) {
  10801. jQuery.fn[ name ] = function( until, selector ) {
  10802. var matched = jQuery.map( this, fn, until );
  10803. if ( name.slice( -5 ) !== "Until" ) {
  10804. selector = until;
  10805. }
  10806. if ( selector && typeof selector === "string" ) {
  10807. matched = jQuery.filter( selector, matched );
  10808. }
  10809. if ( this.length > 1 ) {
  10810. // Remove duplicates
  10811. if ( !guaranteedUnique[ name ] ) {
  10812. jQuery.uniqueSort( matched );
  10813. }
  10814. // Reverse order for parents* and prev-derivatives
  10815. if ( rparentsprev.test( name ) ) {
  10816. matched.reverse();
  10817. }
  10818. }
  10819. return this.pushStack( matched );
  10820. };
  10821. } );
  10822. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10823. // Convert String-formatted options into Object-formatted ones
  10824. function createOptions( options ) {
  10825. var object = {};
  10826. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10827. object[ flag ] = true;
  10828. } );
  10829. return object;
  10830. }
  10831. /*
  10832. * Create a callback list using the following parameters:
  10833. *
  10834. * options: an optional list of space-separated options that will change how
  10835. * the callback list behaves or a more traditional option object
  10836. *
  10837. * By default a callback list will act like an event callback list and can be
  10838. * "fired" multiple times.
  10839. *
  10840. * Possible options:
  10841. *
  10842. * once: will ensure the callback list can only be fired once (like a Deferred)
  10843. *
  10844. * memory: will keep track of previous values and will call any callback added
  10845. * after the list has been fired right away with the latest "memorized"
  10846. * values (like a Deferred)
  10847. *
  10848. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10849. *
  10850. * stopOnFalse: interrupt callings when a callback returns false
  10851. *
  10852. */
  10853. jQuery.Callbacks = function( options ) {
  10854. // Convert options from String-formatted to Object-formatted if needed
  10855. // (we check in cache first)
  10856. options = typeof options === "string" ?
  10857. createOptions( options ) :
  10858. jQuery.extend( {}, options );
  10859. var // Flag to know if list is currently firing
  10860. firing,
  10861. // Last fire value for non-forgettable lists
  10862. memory,
  10863. // Flag to know if list was already fired
  10864. fired,
  10865. // Flag to prevent firing
  10866. locked,
  10867. // Actual callback list
  10868. list = [],
  10869. // Queue of execution data for repeatable lists
  10870. queue = [],
  10871. // Index of currently firing callback (modified by add/remove as needed)
  10872. firingIndex = -1,
  10873. // Fire callbacks
  10874. fire = function() {
  10875. // Enforce single-firing
  10876. locked = locked || options.once;
  10877. // Execute callbacks for all pending executions,
  10878. // respecting firingIndex overrides and runtime changes
  10879. fired = firing = true;
  10880. for ( ; queue.length; firingIndex = -1 ) {
  10881. memory = queue.shift();
  10882. while ( ++firingIndex < list.length ) {
  10883. // Run callback and check for early termination
  10884. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10885. options.stopOnFalse ) {
  10886. // Jump to end and forget the data so .add doesn't re-fire
  10887. firingIndex = list.length;
  10888. memory = false;
  10889. }
  10890. }
  10891. }
  10892. // Forget the data if we're done with it
  10893. if ( !options.memory ) {
  10894. memory = false;
  10895. }
  10896. firing = false;
  10897. // Clean up if we're done firing for good
  10898. if ( locked ) {
  10899. // Keep an empty list if we have data for future add calls
  10900. if ( memory ) {
  10901. list = [];
  10902. // Otherwise, this object is spent
  10903. } else {
  10904. list = "";
  10905. }
  10906. }
  10907. },
  10908. // Actual Callbacks object
  10909. self = {
  10910. // Add a callback or a collection of callbacks to the list
  10911. add: function() {
  10912. if ( list ) {
  10913. // If we have memory from a past run, we should fire after adding
  10914. if ( memory && !firing ) {
  10915. firingIndex = list.length - 1;
  10916. queue.push( memory );
  10917. }
  10918. ( function add( args ) {
  10919. jQuery.each( args, function( _, arg ) {
  10920. if ( isFunction( arg ) ) {
  10921. if ( !options.unique || !self.has( arg ) ) {
  10922. list.push( arg );
  10923. }
  10924. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10925. // Inspect recursively
  10926. add( arg );
  10927. }
  10928. } );
  10929. } )( arguments );
  10930. if ( memory && !firing ) {
  10931. fire();
  10932. }
  10933. }
  10934. return this;
  10935. },
  10936. // Remove a callback from the list
  10937. remove: function() {
  10938. jQuery.each( arguments, function( _, arg ) {
  10939. var index;
  10940. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10941. list.splice( index, 1 );
  10942. // Handle firing indexes
  10943. if ( index <= firingIndex ) {
  10944. firingIndex--;
  10945. }
  10946. }
  10947. } );
  10948. return this;
  10949. },
  10950. // Check if a given callback is in the list.
  10951. // If no argument is given, return whether or not list has callbacks attached.
  10952. has: function( fn ) {
  10953. return fn ?
  10954. jQuery.inArray( fn, list ) > -1 :
  10955. list.length > 0;
  10956. },
  10957. // Remove all callbacks from the list
  10958. empty: function() {
  10959. if ( list ) {
  10960. list = [];
  10961. }
  10962. return this;
  10963. },
  10964. // Disable .fire and .add
  10965. // Abort any current/pending executions
  10966. // Clear all callbacks and values
  10967. disable: function() {
  10968. locked = queue = [];
  10969. list = memory = "";
  10970. return this;
  10971. },
  10972. disabled: function() {
  10973. return !list;
  10974. },
  10975. // Disable .fire
  10976. // Also disable .add unless we have memory (since it would have no effect)
  10977. // Abort any pending executions
  10978. lock: function() {
  10979. locked = queue = [];
  10980. if ( !memory && !firing ) {
  10981. list = memory = "";
  10982. }
  10983. return this;
  10984. },
  10985. locked: function() {
  10986. return !!locked;
  10987. },
  10988. // Call all callbacks with the given context and arguments
  10989. fireWith: function( context, args ) {
  10990. if ( !locked ) {
  10991. args = args || [];
  10992. args = [ context, args.slice ? args.slice() : args ];
  10993. queue.push( args );
  10994. if ( !firing ) {
  10995. fire();
  10996. }
  10997. }
  10998. return this;
  10999. },
  11000. // Call all the callbacks with the given arguments
  11001. fire: function() {
  11002. self.fireWith( this, arguments );
  11003. return this;
  11004. },
  11005. // To know if the callbacks have already been called at least once
  11006. fired: function() {
  11007. return !!fired;
  11008. }
  11009. };
  11010. return self;
  11011. };
  11012. function Identity( v ) {
  11013. return v;
  11014. }
  11015. function Thrower( ex ) {
  11016. throw ex;
  11017. }
  11018. function adoptValue( value, resolve, reject, noValue ) {
  11019. var method;
  11020. try {
  11021. // Check for promise aspect first to privilege synchronous behavior
  11022. if ( value && isFunction( ( method = value.promise ) ) ) {
  11023. method.call( value ).done( resolve ).fail( reject );
  11024. // Other thenables
  11025. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11026. method.call( value, resolve, reject );
  11027. // Other non-thenables
  11028. } else {
  11029. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11030. // * false: [ value ].slice( 0 ) => resolve( value )
  11031. // * true: [ value ].slice( 1 ) => resolve()
  11032. resolve.apply( undefined, [ value ].slice( noValue ) );
  11033. }
  11034. // For Promises/A+, convert exceptions into rejections
  11035. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11036. // Deferred#then to conditionally suppress rejection.
  11037. } catch ( value ) {
  11038. // Support: Android 4.0 only
  11039. // Strict mode functions invoked without .call/.apply get global-object context
  11040. reject.apply( undefined, [ value ] );
  11041. }
  11042. }
  11043. jQuery.extend( {
  11044. Deferred: function( func ) {
  11045. var tuples = [
  11046. // action, add listener, callbacks,
  11047. // ... .then handlers, argument index, [final state]
  11048. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11049. jQuery.Callbacks( "memory" ), 2 ],
  11050. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11051. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11052. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11053. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11054. ],
  11055. state = "pending",
  11056. promise = {
  11057. state: function() {
  11058. return state;
  11059. },
  11060. always: function() {
  11061. deferred.done( arguments ).fail( arguments );
  11062. return this;
  11063. },
  11064. "catch": function( fn ) {
  11065. return promise.then( null, fn );
  11066. },
  11067. // Keep pipe for back-compat
  11068. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11069. var fns = arguments;
  11070. return jQuery.Deferred( function( newDefer ) {
  11071. jQuery.each( tuples, function( i, tuple ) {
  11072. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11073. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11074. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11075. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11076. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11077. deferred[ tuple[ 1 ] ]( function() {
  11078. var returned = fn && fn.apply( this, arguments );
  11079. if ( returned && isFunction( returned.promise ) ) {
  11080. returned.promise()
  11081. .progress( newDefer.notify )
  11082. .done( newDefer.resolve )
  11083. .fail( newDefer.reject );
  11084. } else {
  11085. newDefer[ tuple[ 0 ] + "With" ](
  11086. this,
  11087. fn ? [ returned ] : arguments
  11088. );
  11089. }
  11090. } );
  11091. } );
  11092. fns = null;
  11093. } ).promise();
  11094. },
  11095. then: function( onFulfilled, onRejected, onProgress ) {
  11096. var maxDepth = 0;
  11097. function resolve( depth, deferred, handler, special ) {
  11098. return function() {
  11099. var that = this,
  11100. args = arguments,
  11101. mightThrow = function() {
  11102. var returned, then;
  11103. // Support: Promises/A+ section 2.3.3.3.3
  11104. // https://promisesaplus.com/#point-59
  11105. // Ignore double-resolution attempts
  11106. if ( depth < maxDepth ) {
  11107. return;
  11108. }
  11109. returned = handler.apply( that, args );
  11110. // Support: Promises/A+ section 2.3.1
  11111. // https://promisesaplus.com/#point-48
  11112. if ( returned === deferred.promise() ) {
  11113. throw new TypeError( "Thenable self-resolution" );
  11114. }
  11115. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11116. // https://promisesaplus.com/#point-54
  11117. // https://promisesaplus.com/#point-75
  11118. // Retrieve `then` only once
  11119. then = returned &&
  11120. // Support: Promises/A+ section 2.3.4
  11121. // https://promisesaplus.com/#point-64
  11122. // Only check objects and functions for thenability
  11123. ( typeof returned === "object" ||
  11124. typeof returned === "function" ) &&
  11125. returned.then;
  11126. // Handle a returned thenable
  11127. if ( isFunction( then ) ) {
  11128. // Special processors (notify) just wait for resolution
  11129. if ( special ) {
  11130. then.call(
  11131. returned,
  11132. resolve( maxDepth, deferred, Identity, special ),
  11133. resolve( maxDepth, deferred, Thrower, special )
  11134. );
  11135. // Normal processors (resolve) also hook into progress
  11136. } else {
  11137. // ...and disregard older resolution values
  11138. maxDepth++;
  11139. then.call(
  11140. returned,
  11141. resolve( maxDepth, deferred, Identity, special ),
  11142. resolve( maxDepth, deferred, Thrower, special ),
  11143. resolve( maxDepth, deferred, Identity,
  11144. deferred.notifyWith )
  11145. );
  11146. }
  11147. // Handle all other returned values
  11148. } else {
  11149. // Only substitute handlers pass on context
  11150. // and multiple values (non-spec behavior)
  11151. if ( handler !== Identity ) {
  11152. that = undefined;
  11153. args = [ returned ];
  11154. }
  11155. // Process the value(s)
  11156. // Default process is resolve
  11157. ( special || deferred.resolveWith )( that, args );
  11158. }
  11159. },
  11160. // Only normal processors (resolve) catch and reject exceptions
  11161. process = special ?
  11162. mightThrow :
  11163. function() {
  11164. try {
  11165. mightThrow();
  11166. } catch ( e ) {
  11167. if ( jQuery.Deferred.exceptionHook ) {
  11168. jQuery.Deferred.exceptionHook( e,
  11169. process.stackTrace );
  11170. }
  11171. // Support: Promises/A+ section 2.3.3.3.4.1
  11172. // https://promisesaplus.com/#point-61
  11173. // Ignore post-resolution exceptions
  11174. if ( depth + 1 >= maxDepth ) {
  11175. // Only substitute handlers pass on context
  11176. // and multiple values (non-spec behavior)
  11177. if ( handler !== Thrower ) {
  11178. that = undefined;
  11179. args = [ e ];
  11180. }
  11181. deferred.rejectWith( that, args );
  11182. }
  11183. }
  11184. };
  11185. // Support: Promises/A+ section 2.3.3.3.1
  11186. // https://promisesaplus.com/#point-57
  11187. // Re-resolve promises immediately to dodge false rejection from
  11188. // subsequent errors
  11189. if ( depth ) {
  11190. process();
  11191. } else {
  11192. // Call an optional hook to record the stack, in case of exception
  11193. // since it's otherwise lost when execution goes async
  11194. if ( jQuery.Deferred.getStackHook ) {
  11195. process.stackTrace = jQuery.Deferred.getStackHook();
  11196. }
  11197. window.setTimeout( process );
  11198. }
  11199. };
  11200. }
  11201. return jQuery.Deferred( function( newDefer ) {
  11202. // progress_handlers.add( ... )
  11203. tuples[ 0 ][ 3 ].add(
  11204. resolve(
  11205. 0,
  11206. newDefer,
  11207. isFunction( onProgress ) ?
  11208. onProgress :
  11209. Identity,
  11210. newDefer.notifyWith
  11211. )
  11212. );
  11213. // fulfilled_handlers.add( ... )
  11214. tuples[ 1 ][ 3 ].add(
  11215. resolve(
  11216. 0,
  11217. newDefer,
  11218. isFunction( onFulfilled ) ?
  11219. onFulfilled :
  11220. Identity
  11221. )
  11222. );
  11223. // rejected_handlers.add( ... )
  11224. tuples[ 2 ][ 3 ].add(
  11225. resolve(
  11226. 0,
  11227. newDefer,
  11228. isFunction( onRejected ) ?
  11229. onRejected :
  11230. Thrower
  11231. )
  11232. );
  11233. } ).promise();
  11234. },
  11235. // Get a promise for this deferred
  11236. // If obj is provided, the promise aspect is added to the object
  11237. promise: function( obj ) {
  11238. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11239. }
  11240. },
  11241. deferred = {};
  11242. // Add list-specific methods
  11243. jQuery.each( tuples, function( i, tuple ) {
  11244. var list = tuple[ 2 ],
  11245. stateString = tuple[ 5 ];
  11246. // promise.progress = list.add
  11247. // promise.done = list.add
  11248. // promise.fail = list.add
  11249. promise[ tuple[ 1 ] ] = list.add;
  11250. // Handle state
  11251. if ( stateString ) {
  11252. list.add(
  11253. function() {
  11254. // state = "resolved" (i.e., fulfilled)
  11255. // state = "rejected"
  11256. state = stateString;
  11257. },
  11258. // rejected_callbacks.disable
  11259. // fulfilled_callbacks.disable
  11260. tuples[ 3 - i ][ 2 ].disable,
  11261. // rejected_handlers.disable
  11262. // fulfilled_handlers.disable
  11263. tuples[ 3 - i ][ 3 ].disable,
  11264. // progress_callbacks.lock
  11265. tuples[ 0 ][ 2 ].lock,
  11266. // progress_handlers.lock
  11267. tuples[ 0 ][ 3 ].lock
  11268. );
  11269. }
  11270. // progress_handlers.fire
  11271. // fulfilled_handlers.fire
  11272. // rejected_handlers.fire
  11273. list.add( tuple[ 3 ].fire );
  11274. // deferred.notify = function() { deferred.notifyWith(...) }
  11275. // deferred.resolve = function() { deferred.resolveWith(...) }
  11276. // deferred.reject = function() { deferred.rejectWith(...) }
  11277. deferred[ tuple[ 0 ] ] = function() {
  11278. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11279. return this;
  11280. };
  11281. // deferred.notifyWith = list.fireWith
  11282. // deferred.resolveWith = list.fireWith
  11283. // deferred.rejectWith = list.fireWith
  11284. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11285. } );
  11286. // Make the deferred a promise
  11287. promise.promise( deferred );
  11288. // Call given func if any
  11289. if ( func ) {
  11290. func.call( deferred, deferred );
  11291. }
  11292. // All done!
  11293. return deferred;
  11294. },
  11295. // Deferred helper
  11296. when: function( singleValue ) {
  11297. var
  11298. // count of uncompleted subordinates
  11299. remaining = arguments.length,
  11300. // count of unprocessed arguments
  11301. i = remaining,
  11302. // subordinate fulfillment data
  11303. resolveContexts = Array( i ),
  11304. resolveValues = slice.call( arguments ),
  11305. // the master Deferred
  11306. master = jQuery.Deferred(),
  11307. // subordinate callback factory
  11308. updateFunc = function( i ) {
  11309. return function( value ) {
  11310. resolveContexts[ i ] = this;
  11311. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11312. if ( !( --remaining ) ) {
  11313. master.resolveWith( resolveContexts, resolveValues );
  11314. }
  11315. };
  11316. };
  11317. // Single- and empty arguments are adopted like Promise.resolve
  11318. if ( remaining <= 1 ) {
  11319. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11320. !remaining );
  11321. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11322. if ( master.state() === "pending" ||
  11323. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11324. return master.then();
  11325. }
  11326. }
  11327. // Multiple arguments are aggregated like Promise.all array elements
  11328. while ( i-- ) {
  11329. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11330. }
  11331. return master.promise();
  11332. }
  11333. } );
  11334. // These usually indicate a programmer mistake during development,
  11335. // warn about them ASAP rather than swallowing them by default.
  11336. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11337. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11338. // Support: IE 8 - 9 only
  11339. // Console exists when dev tools are open, which can happen at any time
  11340. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11341. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11342. }
  11343. };
  11344. jQuery.readyException = function( error ) {
  11345. window.setTimeout( function() {
  11346. throw error;
  11347. } );
  11348. };
  11349. // The deferred used on DOM ready
  11350. var readyList = jQuery.Deferred();
  11351. jQuery.fn.ready = function( fn ) {
  11352. readyList
  11353. .then( fn )
  11354. // Wrap jQuery.readyException in a function so that the lookup
  11355. // happens at the time of error handling instead of callback
  11356. // registration.
  11357. .catch( function( error ) {
  11358. jQuery.readyException( error );
  11359. } );
  11360. return this;
  11361. };
  11362. jQuery.extend( {
  11363. // Is the DOM ready to be used? Set to true once it occurs.
  11364. isReady: false,
  11365. // A counter to track how many items to wait for before
  11366. // the ready event fires. See #6781
  11367. readyWait: 1,
  11368. // Handle when the DOM is ready
  11369. ready: function( wait ) {
  11370. // Abort if there are pending holds or we're already ready
  11371. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11372. return;
  11373. }
  11374. // Remember that the DOM is ready
  11375. jQuery.isReady = true;
  11376. // If a normal DOM Ready event fired, decrement, and wait if need be
  11377. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11378. return;
  11379. }
  11380. // If there are functions bound, to execute
  11381. readyList.resolveWith( document, [ jQuery ] );
  11382. }
  11383. } );
  11384. jQuery.ready.then = readyList.then;
  11385. // The ready event handler and self cleanup method
  11386. function completed() {
  11387. document.removeEventListener( "DOMContentLoaded", completed );
  11388. window.removeEventListener( "load", completed );
  11389. jQuery.ready();
  11390. }
  11391. // Catch cases where $(document).ready() is called
  11392. // after the browser event has already occurred.
  11393. // Support: IE <=9 - 10 only
  11394. // Older IE sometimes signals "interactive" too soon
  11395. if ( document.readyState === "complete" ||
  11396. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11397. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11398. window.setTimeout( jQuery.ready );
  11399. } else {
  11400. // Use the handy event callback
  11401. document.addEventListener( "DOMContentLoaded", completed );
  11402. // A fallback to window.onload, that will always work
  11403. window.addEventListener( "load", completed );
  11404. }
  11405. // Multifunctional method to get and set values of a collection
  11406. // The value/s can optionally be executed if it's a function
  11407. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11408. var i = 0,
  11409. len = elems.length,
  11410. bulk = key == null;
  11411. // Sets many values
  11412. if ( toType( key ) === "object" ) {
  11413. chainable = true;
  11414. for ( i in key ) {
  11415. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11416. }
  11417. // Sets one value
  11418. } else if ( value !== undefined ) {
  11419. chainable = true;
  11420. if ( !isFunction( value ) ) {
  11421. raw = true;
  11422. }
  11423. if ( bulk ) {
  11424. // Bulk operations run against the entire set
  11425. if ( raw ) {
  11426. fn.call( elems, value );
  11427. fn = null;
  11428. // ...except when executing function values
  11429. } else {
  11430. bulk = fn;
  11431. fn = function( elem, key, value ) {
  11432. return bulk.call( jQuery( elem ), value );
  11433. };
  11434. }
  11435. }
  11436. if ( fn ) {
  11437. for ( ; i < len; i++ ) {
  11438. fn(
  11439. elems[ i ], key, raw ?
  11440. value :
  11441. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11442. );
  11443. }
  11444. }
  11445. }
  11446. if ( chainable ) {
  11447. return elems;
  11448. }
  11449. // Gets
  11450. if ( bulk ) {
  11451. return fn.call( elems );
  11452. }
  11453. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11454. };
  11455. // Matches dashed string for camelizing
  11456. var rmsPrefix = /^-ms-/,
  11457. rdashAlpha = /-([a-z])/g;
  11458. // Used by camelCase as callback to replace()
  11459. function fcamelCase( all, letter ) {
  11460. return letter.toUpperCase();
  11461. }
  11462. // Convert dashed to camelCase; used by the css and data modules
  11463. // Support: IE <=9 - 11, Edge 12 - 15
  11464. // Microsoft forgot to hump their vendor prefix (#9572)
  11465. function camelCase( string ) {
  11466. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11467. }
  11468. var acceptData = function( owner ) {
  11469. // Accepts only:
  11470. // - Node
  11471. // - Node.ELEMENT_NODE
  11472. // - Node.DOCUMENT_NODE
  11473. // - Object
  11474. // - Any
  11475. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11476. };
  11477. function Data() {
  11478. this.expando = jQuery.expando + Data.uid++;
  11479. }
  11480. Data.uid = 1;
  11481. Data.prototype = {
  11482. cache: function( owner ) {
  11483. // Check if the owner object already has a cache
  11484. var value = owner[ this.expando ];
  11485. // If not, create one
  11486. if ( !value ) {
  11487. value = {};
  11488. // We can accept data for non-element nodes in modern browsers,
  11489. // but we should not, see #8335.
  11490. // Always return an empty object.
  11491. if ( acceptData( owner ) ) {
  11492. // If it is a node unlikely to be stringify-ed or looped over
  11493. // use plain assignment
  11494. if ( owner.nodeType ) {
  11495. owner[ this.expando ] = value;
  11496. // Otherwise secure it in a non-enumerable property
  11497. // configurable must be true to allow the property to be
  11498. // deleted when data is removed
  11499. } else {
  11500. Object.defineProperty( owner, this.expando, {
  11501. value: value,
  11502. configurable: true
  11503. } );
  11504. }
  11505. }
  11506. }
  11507. return value;
  11508. },
  11509. set: function( owner, data, value ) {
  11510. var prop,
  11511. cache = this.cache( owner );
  11512. // Handle: [ owner, key, value ] args
  11513. // Always use camelCase key (gh-2257)
  11514. if ( typeof data === "string" ) {
  11515. cache[ camelCase( data ) ] = value;
  11516. // Handle: [ owner, { properties } ] args
  11517. } else {
  11518. // Copy the properties one-by-one to the cache object
  11519. for ( prop in data ) {
  11520. cache[ camelCase( prop ) ] = data[ prop ];
  11521. }
  11522. }
  11523. return cache;
  11524. },
  11525. get: function( owner, key ) {
  11526. return key === undefined ?
  11527. this.cache( owner ) :
  11528. // Always use camelCase key (gh-2257)
  11529. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11530. },
  11531. access: function( owner, key, value ) {
  11532. // In cases where either:
  11533. //
  11534. // 1. No key was specified
  11535. // 2. A string key was specified, but no value provided
  11536. //
  11537. // Take the "read" path and allow the get method to determine
  11538. // which value to return, respectively either:
  11539. //
  11540. // 1. The entire cache object
  11541. // 2. The data stored at the key
  11542. //
  11543. if ( key === undefined ||
  11544. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11545. return this.get( owner, key );
  11546. }
  11547. // When the key is not a string, or both a key and value
  11548. // are specified, set or extend (existing objects) with either:
  11549. //
  11550. // 1. An object of properties
  11551. // 2. A key and value
  11552. //
  11553. this.set( owner, key, value );
  11554. // Since the "set" path can have two possible entry points
  11555. // return the expected data based on which path was taken[*]
  11556. return value !== undefined ? value : key;
  11557. },
  11558. remove: function( owner, key ) {
  11559. var i,
  11560. cache = owner[ this.expando ];
  11561. if ( cache === undefined ) {
  11562. return;
  11563. }
  11564. if ( key !== undefined ) {
  11565. // Support array or space separated string of keys
  11566. if ( Array.isArray( key ) ) {
  11567. // If key is an array of keys...
  11568. // We always set camelCase keys, so remove that.
  11569. key = key.map( camelCase );
  11570. } else {
  11571. key = camelCase( key );
  11572. // If a key with the spaces exists, use it.
  11573. // Otherwise, create an array by matching non-whitespace
  11574. key = key in cache ?
  11575. [ key ] :
  11576. ( key.match( rnothtmlwhite ) || [] );
  11577. }
  11578. i = key.length;
  11579. while ( i-- ) {
  11580. delete cache[ key[ i ] ];
  11581. }
  11582. }
  11583. // Remove the expando if there's no more data
  11584. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11585. // Support: Chrome <=35 - 45
  11586. // Webkit & Blink performance suffers when deleting properties
  11587. // from DOM nodes, so set to undefined instead
  11588. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11589. if ( owner.nodeType ) {
  11590. owner[ this.expando ] = undefined;
  11591. } else {
  11592. delete owner[ this.expando ];
  11593. }
  11594. }
  11595. },
  11596. hasData: function( owner ) {
  11597. var cache = owner[ this.expando ];
  11598. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11599. }
  11600. };
  11601. var dataPriv = new Data();
  11602. var dataUser = new Data();
  11603. // Implementation Summary
  11604. //
  11605. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11606. // 2. Improve the module's maintainability by reducing the storage
  11607. // paths to a single mechanism.
  11608. // 3. Use the same single mechanism to support "private" and "user" data.
  11609. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11610. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11611. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11612. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11613. rmultiDash = /[A-Z]/g;
  11614. function getData( data ) {
  11615. if ( data === "true" ) {
  11616. return true;
  11617. }
  11618. if ( data === "false" ) {
  11619. return false;
  11620. }
  11621. if ( data === "null" ) {
  11622. return null;
  11623. }
  11624. // Only convert to a number if it doesn't change the string
  11625. if ( data === +data + "" ) {
  11626. return +data;
  11627. }
  11628. if ( rbrace.test( data ) ) {
  11629. return JSON.parse( data );
  11630. }
  11631. return data;
  11632. }
  11633. function dataAttr( elem, key, data ) {
  11634. var name;
  11635. // If nothing was found internally, try to fetch any
  11636. // data from the HTML5 data-* attribute
  11637. if ( data === undefined && elem.nodeType === 1 ) {
  11638. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11639. data = elem.getAttribute( name );
  11640. if ( typeof data === "string" ) {
  11641. try {
  11642. data = getData( data );
  11643. } catch ( e ) {}
  11644. // Make sure we set the data so it isn't changed later
  11645. dataUser.set( elem, key, data );
  11646. } else {
  11647. data = undefined;
  11648. }
  11649. }
  11650. return data;
  11651. }
  11652. jQuery.extend( {
  11653. hasData: function( elem ) {
  11654. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11655. },
  11656. data: function( elem, name, data ) {
  11657. return dataUser.access( elem, name, data );
  11658. },
  11659. removeData: function( elem, name ) {
  11660. dataUser.remove( elem, name );
  11661. },
  11662. // TODO: Now that all calls to _data and _removeData have been replaced
  11663. // with direct calls to dataPriv methods, these can be deprecated.
  11664. _data: function( elem, name, data ) {
  11665. return dataPriv.access( elem, name, data );
  11666. },
  11667. _removeData: function( elem, name ) {
  11668. dataPriv.remove( elem, name );
  11669. }
  11670. } );
  11671. jQuery.fn.extend( {
  11672. data: function( key, value ) {
  11673. var i, name, data,
  11674. elem = this[ 0 ],
  11675. attrs = elem && elem.attributes;
  11676. // Gets all values
  11677. if ( key === undefined ) {
  11678. if ( this.length ) {
  11679. data = dataUser.get( elem );
  11680. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11681. i = attrs.length;
  11682. while ( i-- ) {
  11683. // Support: IE 11 only
  11684. // The attrs elements can be null (#14894)
  11685. if ( attrs[ i ] ) {
  11686. name = attrs[ i ].name;
  11687. if ( name.indexOf( "data-" ) === 0 ) {
  11688. name = camelCase( name.slice( 5 ) );
  11689. dataAttr( elem, name, data[ name ] );
  11690. }
  11691. }
  11692. }
  11693. dataPriv.set( elem, "hasDataAttrs", true );
  11694. }
  11695. }
  11696. return data;
  11697. }
  11698. // Sets multiple values
  11699. if ( typeof key === "object" ) {
  11700. return this.each( function() {
  11701. dataUser.set( this, key );
  11702. } );
  11703. }
  11704. return access( this, function( value ) {
  11705. var data;
  11706. // The calling jQuery object (element matches) is not empty
  11707. // (and therefore has an element appears at this[ 0 ]) and the
  11708. // `value` parameter was not undefined. An empty jQuery object
  11709. // will result in `undefined` for elem = this[ 0 ] which will
  11710. // throw an exception if an attempt to read a data cache is made.
  11711. if ( elem && value === undefined ) {
  11712. // Attempt to get data from the cache
  11713. // The key will always be camelCased in Data
  11714. data = dataUser.get( elem, key );
  11715. if ( data !== undefined ) {
  11716. return data;
  11717. }
  11718. // Attempt to "discover" the data in
  11719. // HTML5 custom data-* attrs
  11720. data = dataAttr( elem, key );
  11721. if ( data !== undefined ) {
  11722. return data;
  11723. }
  11724. // We tried really hard, but the data doesn't exist.
  11725. return;
  11726. }
  11727. // Set the data...
  11728. this.each( function() {
  11729. // We always store the camelCased key
  11730. dataUser.set( this, key, value );
  11731. } );
  11732. }, null, value, arguments.length > 1, null, true );
  11733. },
  11734. removeData: function( key ) {
  11735. return this.each( function() {
  11736. dataUser.remove( this, key );
  11737. } );
  11738. }
  11739. } );
  11740. jQuery.extend( {
  11741. queue: function( elem, type, data ) {
  11742. var queue;
  11743. if ( elem ) {
  11744. type = ( type || "fx" ) + "queue";
  11745. queue = dataPriv.get( elem, type );
  11746. // Speed up dequeue by getting out quickly if this is just a lookup
  11747. if ( data ) {
  11748. if ( !queue || Array.isArray( data ) ) {
  11749. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11750. } else {
  11751. queue.push( data );
  11752. }
  11753. }
  11754. return queue || [];
  11755. }
  11756. },
  11757. dequeue: function( elem, type ) {
  11758. type = type || "fx";
  11759. var queue = jQuery.queue( elem, type ),
  11760. startLength = queue.length,
  11761. fn = queue.shift(),
  11762. hooks = jQuery._queueHooks( elem, type ),
  11763. next = function() {
  11764. jQuery.dequeue( elem, type );
  11765. };
  11766. // If the fx queue is dequeued, always remove the progress sentinel
  11767. if ( fn === "inprogress" ) {
  11768. fn = queue.shift();
  11769. startLength--;
  11770. }
  11771. if ( fn ) {
  11772. // Add a progress sentinel to prevent the fx queue from being
  11773. // automatically dequeued
  11774. if ( type === "fx" ) {
  11775. queue.unshift( "inprogress" );
  11776. }
  11777. // Clear up the last queue stop function
  11778. delete hooks.stop;
  11779. fn.call( elem, next, hooks );
  11780. }
  11781. if ( !startLength && hooks ) {
  11782. hooks.empty.fire();
  11783. }
  11784. },
  11785. // Not public - generate a queueHooks object, or return the current one
  11786. _queueHooks: function( elem, type ) {
  11787. var key = type + "queueHooks";
  11788. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11789. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11790. dataPriv.remove( elem, [ type + "queue", key ] );
  11791. } )
  11792. } );
  11793. }
  11794. } );
  11795. jQuery.fn.extend( {
  11796. queue: function( type, data ) {
  11797. var setter = 2;
  11798. if ( typeof type !== "string" ) {
  11799. data = type;
  11800. type = "fx";
  11801. setter--;
  11802. }
  11803. if ( arguments.length < setter ) {
  11804. return jQuery.queue( this[ 0 ], type );
  11805. }
  11806. return data === undefined ?
  11807. this :
  11808. this.each( function() {
  11809. var queue = jQuery.queue( this, type, data );
  11810. // Ensure a hooks for this queue
  11811. jQuery._queueHooks( this, type );
  11812. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11813. jQuery.dequeue( this, type );
  11814. }
  11815. } );
  11816. },
  11817. dequeue: function( type ) {
  11818. return this.each( function() {
  11819. jQuery.dequeue( this, type );
  11820. } );
  11821. },
  11822. clearQueue: function( type ) {
  11823. return this.queue( type || "fx", [] );
  11824. },
  11825. // Get a promise resolved when queues of a certain type
  11826. // are emptied (fx is the type by default)
  11827. promise: function( type, obj ) {
  11828. var tmp,
  11829. count = 1,
  11830. defer = jQuery.Deferred(),
  11831. elements = this,
  11832. i = this.length,
  11833. resolve = function() {
  11834. if ( !( --count ) ) {
  11835. defer.resolveWith( elements, [ elements ] );
  11836. }
  11837. };
  11838. if ( typeof type !== "string" ) {
  11839. obj = type;
  11840. type = undefined;
  11841. }
  11842. type = type || "fx";
  11843. while ( i-- ) {
  11844. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11845. if ( tmp && tmp.empty ) {
  11846. count++;
  11847. tmp.empty.add( resolve );
  11848. }
  11849. }
  11850. resolve();
  11851. return defer.promise( obj );
  11852. }
  11853. } );
  11854. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11855. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11856. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11857. var documentElement = document.documentElement;
  11858. var isAttached = function( elem ) {
  11859. return jQuery.contains( elem.ownerDocument, elem );
  11860. },
  11861. composed = { composed: true };
  11862. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11863. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11864. // Support: iOS 10.0-10.2 only
  11865. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11866. // leading to errors. We need to check for `getRootNode`.
  11867. if ( documentElement.getRootNode ) {
  11868. isAttached = function( elem ) {
  11869. return jQuery.contains( elem.ownerDocument, elem ) ||
  11870. elem.getRootNode( composed ) === elem.ownerDocument;
  11871. };
  11872. }
  11873. var isHiddenWithinTree = function( elem, el ) {
  11874. // isHiddenWithinTree might be called from jQuery#filter function;
  11875. // in that case, element will be second argument
  11876. elem = el || elem;
  11877. // Inline style trumps all
  11878. return elem.style.display === "none" ||
  11879. elem.style.display === "" &&
  11880. // Otherwise, check computed style
  11881. // Support: Firefox <=43 - 45
  11882. // Disconnected elements can have computed display: none, so first confirm that elem is
  11883. // in the document.
  11884. isAttached( elem ) &&
  11885. jQuery.css( elem, "display" ) === "none";
  11886. };
  11887. var swap = function( elem, options, callback, args ) {
  11888. var ret, name,
  11889. old = {};
  11890. // Remember the old values, and insert the new ones
  11891. for ( name in options ) {
  11892. old[ name ] = elem.style[ name ];
  11893. elem.style[ name ] = options[ name ];
  11894. }
  11895. ret = callback.apply( elem, args || [] );
  11896. // Revert the old values
  11897. for ( name in options ) {
  11898. elem.style[ name ] = old[ name ];
  11899. }
  11900. return ret;
  11901. };
  11902. function adjustCSS( elem, prop, valueParts, tween ) {
  11903. var adjusted, scale,
  11904. maxIterations = 20,
  11905. currentValue = tween ?
  11906. function() {
  11907. return tween.cur();
  11908. } :
  11909. function() {
  11910. return jQuery.css( elem, prop, "" );
  11911. },
  11912. initial = currentValue(),
  11913. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11914. // Starting value computation is required for potential unit mismatches
  11915. initialInUnit = elem.nodeType &&
  11916. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11917. rcssNum.exec( jQuery.css( elem, prop ) );
  11918. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11919. // Support: Firefox <=54
  11920. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11921. initial = initial / 2;
  11922. // Trust units reported by jQuery.css
  11923. unit = unit || initialInUnit[ 3 ];
  11924. // Iteratively approximate from a nonzero starting point
  11925. initialInUnit = +initial || 1;
  11926. while ( maxIterations-- ) {
  11927. // Evaluate and update our best guess (doubling guesses that zero out).
  11928. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11929. jQuery.style( elem, prop, initialInUnit + unit );
  11930. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11931. maxIterations = 0;
  11932. }
  11933. initialInUnit = initialInUnit / scale;
  11934. }
  11935. initialInUnit = initialInUnit * 2;
  11936. jQuery.style( elem, prop, initialInUnit + unit );
  11937. // Make sure we update the tween properties later on
  11938. valueParts = valueParts || [];
  11939. }
  11940. if ( valueParts ) {
  11941. initialInUnit = +initialInUnit || +initial || 0;
  11942. // Apply relative offset (+=/-=) if specified
  11943. adjusted = valueParts[ 1 ] ?
  11944. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11945. +valueParts[ 2 ];
  11946. if ( tween ) {
  11947. tween.unit = unit;
  11948. tween.start = initialInUnit;
  11949. tween.end = adjusted;
  11950. }
  11951. }
  11952. return adjusted;
  11953. }
  11954. var defaultDisplayMap = {};
  11955. function getDefaultDisplay( elem ) {
  11956. var temp,
  11957. doc = elem.ownerDocument,
  11958. nodeName = elem.nodeName,
  11959. display = defaultDisplayMap[ nodeName ];
  11960. if ( display ) {
  11961. return display;
  11962. }
  11963. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11964. display = jQuery.css( temp, "display" );
  11965. temp.parentNode.removeChild( temp );
  11966. if ( display === "none" ) {
  11967. display = "block";
  11968. }
  11969. defaultDisplayMap[ nodeName ] = display;
  11970. return display;
  11971. }
  11972. function showHide( elements, show ) {
  11973. var display, elem,
  11974. values = [],
  11975. index = 0,
  11976. length = elements.length;
  11977. // Determine new display value for elements that need to change
  11978. for ( ; index < length; index++ ) {
  11979. elem = elements[ index ];
  11980. if ( !elem.style ) {
  11981. continue;
  11982. }
  11983. display = elem.style.display;
  11984. if ( show ) {
  11985. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11986. // check is required in this first loop unless we have a nonempty display value (either
  11987. // inline or about-to-be-restored)
  11988. if ( display === "none" ) {
  11989. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11990. if ( !values[ index ] ) {
  11991. elem.style.display = "";
  11992. }
  11993. }
  11994. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  11995. values[ index ] = getDefaultDisplay( elem );
  11996. }
  11997. } else {
  11998. if ( display !== "none" ) {
  11999. values[ index ] = "none";
  12000. // Remember what we're overwriting
  12001. dataPriv.set( elem, "display", display );
  12002. }
  12003. }
  12004. }
  12005. // Set the display of the elements in a second loop to avoid constant reflow
  12006. for ( index = 0; index < length; index++ ) {
  12007. if ( values[ index ] != null ) {
  12008. elements[ index ].style.display = values[ index ];
  12009. }
  12010. }
  12011. return elements;
  12012. }
  12013. jQuery.fn.extend( {
  12014. show: function() {
  12015. return showHide( this, true );
  12016. },
  12017. hide: function() {
  12018. return showHide( this );
  12019. },
  12020. toggle: function( state ) {
  12021. if ( typeof state === "boolean" ) {
  12022. return state ? this.show() : this.hide();
  12023. }
  12024. return this.each( function() {
  12025. if ( isHiddenWithinTree( this ) ) {
  12026. jQuery( this ).show();
  12027. } else {
  12028. jQuery( this ).hide();
  12029. }
  12030. } );
  12031. }
  12032. } );
  12033. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12034. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12035. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12036. // We have to close these tags to support XHTML (#13200)
  12037. var wrapMap = {
  12038. // Support: IE <=9 only
  12039. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12040. // XHTML parsers do not magically insert elements in the
  12041. // same way that tag soup parsers do. So we cannot shorten
  12042. // this by omitting <tbody> or other required elements.
  12043. thead: [ 1, "<table>", "</table>" ],
  12044. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12045. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12046. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12047. _default: [ 0, "", "" ]
  12048. };
  12049. // Support: IE <=9 only
  12050. wrapMap.optgroup = wrapMap.option;
  12051. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12052. wrapMap.th = wrapMap.td;
  12053. function getAll( context, tag ) {
  12054. // Support: IE <=9 - 11 only
  12055. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12056. var ret;
  12057. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12058. ret = context.getElementsByTagName( tag || "*" );
  12059. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12060. ret = context.querySelectorAll( tag || "*" );
  12061. } else {
  12062. ret = [];
  12063. }
  12064. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12065. return jQuery.merge( [ context ], ret );
  12066. }
  12067. return ret;
  12068. }
  12069. // Mark scripts as having already been evaluated
  12070. function setGlobalEval( elems, refElements ) {
  12071. var i = 0,
  12072. l = elems.length;
  12073. for ( ; i < l; i++ ) {
  12074. dataPriv.set(
  12075. elems[ i ],
  12076. "globalEval",
  12077. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12078. );
  12079. }
  12080. }
  12081. var rhtml = /<|&#?\w+;/;
  12082. function buildFragment( elems, context, scripts, selection, ignored ) {
  12083. var elem, tmp, tag, wrap, attached, j,
  12084. fragment = context.createDocumentFragment(),
  12085. nodes = [],
  12086. i = 0,
  12087. l = elems.length;
  12088. for ( ; i < l; i++ ) {
  12089. elem = elems[ i ];
  12090. if ( elem || elem === 0 ) {
  12091. // Add nodes directly
  12092. if ( toType( elem ) === "object" ) {
  12093. // Support: Android <=4.0 only, PhantomJS 1 only
  12094. // push.apply(_, arraylike) throws on ancient WebKit
  12095. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12096. // Convert non-html into a text node
  12097. } else if ( !rhtml.test( elem ) ) {
  12098. nodes.push( context.createTextNode( elem ) );
  12099. // Convert html into DOM nodes
  12100. } else {
  12101. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12102. // Deserialize a standard representation
  12103. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12104. wrap = wrapMap[ tag ] || wrapMap._default;
  12105. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12106. // Descend through wrappers to the right content
  12107. j = wrap[ 0 ];
  12108. while ( j-- ) {
  12109. tmp = tmp.lastChild;
  12110. }
  12111. // Support: Android <=4.0 only, PhantomJS 1 only
  12112. // push.apply(_, arraylike) throws on ancient WebKit
  12113. jQuery.merge( nodes, tmp.childNodes );
  12114. // Remember the top-level container
  12115. tmp = fragment.firstChild;
  12116. // Ensure the created nodes are orphaned (#12392)
  12117. tmp.textContent = "";
  12118. }
  12119. }
  12120. }
  12121. // Remove wrapper from fragment
  12122. fragment.textContent = "";
  12123. i = 0;
  12124. while ( ( elem = nodes[ i++ ] ) ) {
  12125. // Skip elements already in the context collection (trac-4087)
  12126. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12127. if ( ignored ) {
  12128. ignored.push( elem );
  12129. }
  12130. continue;
  12131. }
  12132. attached = isAttached( elem );
  12133. // Append to fragment
  12134. tmp = getAll( fragment.appendChild( elem ), "script" );
  12135. // Preserve script evaluation history
  12136. if ( attached ) {
  12137. setGlobalEval( tmp );
  12138. }
  12139. // Capture executables
  12140. if ( scripts ) {
  12141. j = 0;
  12142. while ( ( elem = tmp[ j++ ] ) ) {
  12143. if ( rscriptType.test( elem.type || "" ) ) {
  12144. scripts.push( elem );
  12145. }
  12146. }
  12147. }
  12148. }
  12149. return fragment;
  12150. }
  12151. ( function() {
  12152. var fragment = document.createDocumentFragment(),
  12153. div = fragment.appendChild( document.createElement( "div" ) ),
  12154. input = document.createElement( "input" );
  12155. // Support: Android 4.0 - 4.3 only
  12156. // Check state lost if the name is set (#11217)
  12157. // Support: Windows Web Apps (WWA)
  12158. // `name` and `type` must use .setAttribute for WWA (#14901)
  12159. input.setAttribute( "type", "radio" );
  12160. input.setAttribute( "checked", "checked" );
  12161. input.setAttribute( "name", "t" );
  12162. div.appendChild( input );
  12163. // Support: Android <=4.1 only
  12164. // Older WebKit doesn't clone checked state correctly in fragments
  12165. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12166. // Support: IE <=11 only
  12167. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12168. div.innerHTML = "<textarea>x</textarea>";
  12169. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12170. } )();
  12171. var
  12172. rkeyEvent = /^key/,
  12173. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12174. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12175. function returnTrue() {
  12176. return true;
  12177. }
  12178. function returnFalse() {
  12179. return false;
  12180. }
  12181. // Support: IE <=9 - 11+
  12182. // focus() and blur() are asynchronous, except when they are no-op.
  12183. // So expect focus to be synchronous when the element is already active,
  12184. // and blur to be synchronous when the element is not already active.
  12185. // (focus and blur are always synchronous in other supported browsers,
  12186. // this just defines when we can count on it).
  12187. function expectSync( elem, type ) {
  12188. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12189. }
  12190. // Support: IE <=9 only
  12191. // Accessing document.activeElement can throw unexpectedly
  12192. // https://bugs.jquery.com/ticket/13393
  12193. function safeActiveElement() {
  12194. try {
  12195. return document.activeElement;
  12196. } catch ( err ) { }
  12197. }
  12198. function on( elem, types, selector, data, fn, one ) {
  12199. var origFn, type;
  12200. // Types can be a map of types/handlers
  12201. if ( typeof types === "object" ) {
  12202. // ( types-Object, selector, data )
  12203. if ( typeof selector !== "string" ) {
  12204. // ( types-Object, data )
  12205. data = data || selector;
  12206. selector = undefined;
  12207. }
  12208. for ( type in types ) {
  12209. on( elem, type, selector, data, types[ type ], one );
  12210. }
  12211. return elem;
  12212. }
  12213. if ( data == null && fn == null ) {
  12214. // ( types, fn )
  12215. fn = selector;
  12216. data = selector = undefined;
  12217. } else if ( fn == null ) {
  12218. if ( typeof selector === "string" ) {
  12219. // ( types, selector, fn )
  12220. fn = data;
  12221. data = undefined;
  12222. } else {
  12223. // ( types, data, fn )
  12224. fn = data;
  12225. data = selector;
  12226. selector = undefined;
  12227. }
  12228. }
  12229. if ( fn === false ) {
  12230. fn = returnFalse;
  12231. } else if ( !fn ) {
  12232. return elem;
  12233. }
  12234. if ( one === 1 ) {
  12235. origFn = fn;
  12236. fn = function( event ) {
  12237. // Can use an empty set, since event contains the info
  12238. jQuery().off( event );
  12239. return origFn.apply( this, arguments );
  12240. };
  12241. // Use same guid so caller can remove using origFn
  12242. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12243. }
  12244. return elem.each( function() {
  12245. jQuery.event.add( this, types, fn, data, selector );
  12246. } );
  12247. }
  12248. /*
  12249. * Helper functions for managing events -- not part of the public interface.
  12250. * Props to Dean Edwards' addEvent library for many of the ideas.
  12251. */
  12252. jQuery.event = {
  12253. global: {},
  12254. add: function( elem, types, handler, data, selector ) {
  12255. var handleObjIn, eventHandle, tmp,
  12256. events, t, handleObj,
  12257. special, handlers, type, namespaces, origType,
  12258. elemData = dataPriv.get( elem );
  12259. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12260. if ( !elemData ) {
  12261. return;
  12262. }
  12263. // Caller can pass in an object of custom data in lieu of the handler
  12264. if ( handler.handler ) {
  12265. handleObjIn = handler;
  12266. handler = handleObjIn.handler;
  12267. selector = handleObjIn.selector;
  12268. }
  12269. // Ensure that invalid selectors throw exceptions at attach time
  12270. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12271. if ( selector ) {
  12272. jQuery.find.matchesSelector( documentElement, selector );
  12273. }
  12274. // Make sure that the handler has a unique ID, used to find/remove it later
  12275. if ( !handler.guid ) {
  12276. handler.guid = jQuery.guid++;
  12277. }
  12278. // Init the element's event structure and main handler, if this is the first
  12279. if ( !( events = elemData.events ) ) {
  12280. events = elemData.events = {};
  12281. }
  12282. if ( !( eventHandle = elemData.handle ) ) {
  12283. eventHandle = elemData.handle = function( e ) {
  12284. // Discard the second event of a jQuery.event.trigger() and
  12285. // when an event is called after a page has unloaded
  12286. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12287. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12288. };
  12289. }
  12290. // Handle multiple events separated by a space
  12291. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12292. t = types.length;
  12293. while ( t-- ) {
  12294. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12295. type = origType = tmp[ 1 ];
  12296. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12297. // There *must* be a type, no attaching namespace-only handlers
  12298. if ( !type ) {
  12299. continue;
  12300. }
  12301. // If event changes its type, use the special event handlers for the changed type
  12302. special = jQuery.event.special[ type ] || {};
  12303. // If selector defined, determine special event api type, otherwise given type
  12304. type = ( selector ? special.delegateType : special.bindType ) || type;
  12305. // Update special based on newly reset type
  12306. special = jQuery.event.special[ type ] || {};
  12307. // handleObj is passed to all event handlers
  12308. handleObj = jQuery.extend( {
  12309. type: type,
  12310. origType: origType,
  12311. data: data,
  12312. handler: handler,
  12313. guid: handler.guid,
  12314. selector: selector,
  12315. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12316. namespace: namespaces.join( "." )
  12317. }, handleObjIn );
  12318. // Init the event handler queue if we're the first
  12319. if ( !( handlers = events[ type ] ) ) {
  12320. handlers = events[ type ] = [];
  12321. handlers.delegateCount = 0;
  12322. // Only use addEventListener if the special events handler returns false
  12323. if ( !special.setup ||
  12324. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12325. if ( elem.addEventListener ) {
  12326. elem.addEventListener( type, eventHandle );
  12327. }
  12328. }
  12329. }
  12330. if ( special.add ) {
  12331. special.add.call( elem, handleObj );
  12332. if ( !handleObj.handler.guid ) {
  12333. handleObj.handler.guid = handler.guid;
  12334. }
  12335. }
  12336. // Add to the element's handler list, delegates in front
  12337. if ( selector ) {
  12338. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12339. } else {
  12340. handlers.push( handleObj );
  12341. }
  12342. // Keep track of which events have ever been used, for event optimization
  12343. jQuery.event.global[ type ] = true;
  12344. }
  12345. },
  12346. // Detach an event or set of events from an element
  12347. remove: function( elem, types, handler, selector, mappedTypes ) {
  12348. var j, origCount, tmp,
  12349. events, t, handleObj,
  12350. special, handlers, type, namespaces, origType,
  12351. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12352. if ( !elemData || !( events = elemData.events ) ) {
  12353. return;
  12354. }
  12355. // Once for each type.namespace in types; type may be omitted
  12356. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12357. t = types.length;
  12358. while ( t-- ) {
  12359. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12360. type = origType = tmp[ 1 ];
  12361. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12362. // Unbind all events (on this namespace, if provided) for the element
  12363. if ( !type ) {
  12364. for ( type in events ) {
  12365. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12366. }
  12367. continue;
  12368. }
  12369. special = jQuery.event.special[ type ] || {};
  12370. type = ( selector ? special.delegateType : special.bindType ) || type;
  12371. handlers = events[ type ] || [];
  12372. tmp = tmp[ 2 ] &&
  12373. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12374. // Remove matching events
  12375. origCount = j = handlers.length;
  12376. while ( j-- ) {
  12377. handleObj = handlers[ j ];
  12378. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12379. ( !handler || handler.guid === handleObj.guid ) &&
  12380. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12381. ( !selector || selector === handleObj.selector ||
  12382. selector === "**" && handleObj.selector ) ) {
  12383. handlers.splice( j, 1 );
  12384. if ( handleObj.selector ) {
  12385. handlers.delegateCount--;
  12386. }
  12387. if ( special.remove ) {
  12388. special.remove.call( elem, handleObj );
  12389. }
  12390. }
  12391. }
  12392. // Remove generic event handler if we removed something and no more handlers exist
  12393. // (avoids potential for endless recursion during removal of special event handlers)
  12394. if ( origCount && !handlers.length ) {
  12395. if ( !special.teardown ||
  12396. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12397. jQuery.removeEvent( elem, type, elemData.handle );
  12398. }
  12399. delete events[ type ];
  12400. }
  12401. }
  12402. // Remove data and the expando if it's no longer used
  12403. if ( jQuery.isEmptyObject( events ) ) {
  12404. dataPriv.remove( elem, "handle events" );
  12405. }
  12406. },
  12407. dispatch: function( nativeEvent ) {
  12408. // Make a writable jQuery.Event from the native event object
  12409. var event = jQuery.event.fix( nativeEvent );
  12410. var i, j, ret, matched, handleObj, handlerQueue,
  12411. args = new Array( arguments.length ),
  12412. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12413. special = jQuery.event.special[ event.type ] || {};
  12414. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12415. args[ 0 ] = event;
  12416. for ( i = 1; i < arguments.length; i++ ) {
  12417. args[ i ] = arguments[ i ];
  12418. }
  12419. event.delegateTarget = this;
  12420. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12421. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12422. return;
  12423. }
  12424. // Determine handlers
  12425. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12426. // Run delegates first; they may want to stop propagation beneath us
  12427. i = 0;
  12428. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12429. event.currentTarget = matched.elem;
  12430. j = 0;
  12431. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12432. !event.isImmediatePropagationStopped() ) {
  12433. // If the event is namespaced, then each handler is only invoked if it is
  12434. // specially universal or its namespaces are a superset of the event's.
  12435. if ( !event.rnamespace || handleObj.namespace === false ||
  12436. event.rnamespace.test( handleObj.namespace ) ) {
  12437. event.handleObj = handleObj;
  12438. event.data = handleObj.data;
  12439. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12440. handleObj.handler ).apply( matched.elem, args );
  12441. if ( ret !== undefined ) {
  12442. if ( ( event.result = ret ) === false ) {
  12443. event.preventDefault();
  12444. event.stopPropagation();
  12445. }
  12446. }
  12447. }
  12448. }
  12449. }
  12450. // Call the postDispatch hook for the mapped type
  12451. if ( special.postDispatch ) {
  12452. special.postDispatch.call( this, event );
  12453. }
  12454. return event.result;
  12455. },
  12456. handlers: function( event, handlers ) {
  12457. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12458. handlerQueue = [],
  12459. delegateCount = handlers.delegateCount,
  12460. cur = event.target;
  12461. // Find delegate handlers
  12462. if ( delegateCount &&
  12463. // Support: IE <=9
  12464. // Black-hole SVG <use> instance trees (trac-13180)
  12465. cur.nodeType &&
  12466. // Support: Firefox <=42
  12467. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12468. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12469. // Support: IE 11 only
  12470. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12471. !( event.type === "click" && event.button >= 1 ) ) {
  12472. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12473. // Don't check non-elements (#13208)
  12474. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12475. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12476. matchedHandlers = [];
  12477. matchedSelectors = {};
  12478. for ( i = 0; i < delegateCount; i++ ) {
  12479. handleObj = handlers[ i ];
  12480. // Don't conflict with Object.prototype properties (#13203)
  12481. sel = handleObj.selector + " ";
  12482. if ( matchedSelectors[ sel ] === undefined ) {
  12483. matchedSelectors[ sel ] = handleObj.needsContext ?
  12484. jQuery( sel, this ).index( cur ) > -1 :
  12485. jQuery.find( sel, this, null, [ cur ] ).length;
  12486. }
  12487. if ( matchedSelectors[ sel ] ) {
  12488. matchedHandlers.push( handleObj );
  12489. }
  12490. }
  12491. if ( matchedHandlers.length ) {
  12492. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12493. }
  12494. }
  12495. }
  12496. }
  12497. // Add the remaining (directly-bound) handlers
  12498. cur = this;
  12499. if ( delegateCount < handlers.length ) {
  12500. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12501. }
  12502. return handlerQueue;
  12503. },
  12504. addProp: function( name, hook ) {
  12505. Object.defineProperty( jQuery.Event.prototype, name, {
  12506. enumerable: true,
  12507. configurable: true,
  12508. get: isFunction( hook ) ?
  12509. function() {
  12510. if ( this.originalEvent ) {
  12511. return hook( this.originalEvent );
  12512. }
  12513. } :
  12514. function() {
  12515. if ( this.originalEvent ) {
  12516. return this.originalEvent[ name ];
  12517. }
  12518. },
  12519. set: function( value ) {
  12520. Object.defineProperty( this, name, {
  12521. enumerable: true,
  12522. configurable: true,
  12523. writable: true,
  12524. value: value
  12525. } );
  12526. }
  12527. } );
  12528. },
  12529. fix: function( originalEvent ) {
  12530. return originalEvent[ jQuery.expando ] ?
  12531. originalEvent :
  12532. new jQuery.Event( originalEvent );
  12533. },
  12534. special: {
  12535. load: {
  12536. // Prevent triggered image.load events from bubbling to window.load
  12537. noBubble: true
  12538. },
  12539. click: {
  12540. // Utilize native event to ensure correct state for checkable inputs
  12541. setup: function( data ) {
  12542. // For mutual compressibility with _default, replace `this` access with a local var.
  12543. // `|| data` is dead code meant only to preserve the variable through minification.
  12544. var el = this || data;
  12545. // Claim the first handler
  12546. if ( rcheckableType.test( el.type ) &&
  12547. el.click && nodeName( el, "input" ) ) {
  12548. // dataPriv.set( el, "click", ... )
  12549. leverageNative( el, "click", returnTrue );
  12550. }
  12551. // Return false to allow normal processing in the caller
  12552. return false;
  12553. },
  12554. trigger: function( data ) {
  12555. // For mutual compressibility with _default, replace `this` access with a local var.
  12556. // `|| data` is dead code meant only to preserve the variable through minification.
  12557. var el = this || data;
  12558. // Force setup before triggering a click
  12559. if ( rcheckableType.test( el.type ) &&
  12560. el.click && nodeName( el, "input" ) ) {
  12561. leverageNative( el, "click" );
  12562. }
  12563. // Return non-false to allow normal event-path propagation
  12564. return true;
  12565. },
  12566. // For cross-browser consistency, suppress native .click() on links
  12567. // Also prevent it if we're currently inside a leveraged native-event stack
  12568. _default: function( event ) {
  12569. var target = event.target;
  12570. return rcheckableType.test( target.type ) &&
  12571. target.click && nodeName( target, "input" ) &&
  12572. dataPriv.get( target, "click" ) ||
  12573. nodeName( target, "a" );
  12574. }
  12575. },
  12576. beforeunload: {
  12577. postDispatch: function( event ) {
  12578. // Support: Firefox 20+
  12579. // Firefox doesn't alert if the returnValue field is not set.
  12580. if ( event.result !== undefined && event.originalEvent ) {
  12581. event.originalEvent.returnValue = event.result;
  12582. }
  12583. }
  12584. }
  12585. }
  12586. };
  12587. // Ensure the presence of an event listener that handles manually-triggered
  12588. // synthetic events by interrupting progress until reinvoked in response to
  12589. // *native* events that it fires directly, ensuring that state changes have
  12590. // already occurred before other listeners are invoked.
  12591. function leverageNative( el, type, expectSync ) {
  12592. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12593. if ( !expectSync ) {
  12594. if ( dataPriv.get( el, type ) === undefined ) {
  12595. jQuery.event.add( el, type, returnTrue );
  12596. }
  12597. return;
  12598. }
  12599. // Register the controller as a special universal handler for all event namespaces
  12600. dataPriv.set( el, type, false );
  12601. jQuery.event.add( el, type, {
  12602. namespace: false,
  12603. handler: function( event ) {
  12604. var notAsync, result,
  12605. saved = dataPriv.get( this, type );
  12606. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12607. // Interrupt processing of the outer synthetic .trigger()ed event
  12608. // Saved data should be false in such cases, but might be a leftover capture object
  12609. // from an async native handler (gh-4350)
  12610. if ( !saved.length ) {
  12611. // Store arguments for use when handling the inner native event
  12612. // There will always be at least one argument (an event object), so this array
  12613. // will not be confused with a leftover capture object.
  12614. saved = slice.call( arguments );
  12615. dataPriv.set( this, type, saved );
  12616. // Trigger the native event and capture its result
  12617. // Support: IE <=9 - 11+
  12618. // focus() and blur() are asynchronous
  12619. notAsync = expectSync( this, type );
  12620. this[ type ]();
  12621. result = dataPriv.get( this, type );
  12622. if ( saved !== result || notAsync ) {
  12623. dataPriv.set( this, type, false );
  12624. } else {
  12625. result = {};
  12626. }
  12627. if ( saved !== result ) {
  12628. // Cancel the outer synthetic event
  12629. event.stopImmediatePropagation();
  12630. event.preventDefault();
  12631. return result.value;
  12632. }
  12633. // If this is an inner synthetic event for an event with a bubbling surrogate
  12634. // (focus or blur), assume that the surrogate already propagated from triggering the
  12635. // native event and prevent that from happening again here.
  12636. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12637. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12638. // less bad than duplication.
  12639. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12640. event.stopPropagation();
  12641. }
  12642. // If this is a native event triggered above, everything is now in order
  12643. // Fire an inner synthetic event with the original arguments
  12644. } else if ( saved.length ) {
  12645. // ...and capture the result
  12646. dataPriv.set( this, type, {
  12647. value: jQuery.event.trigger(
  12648. // Support: IE <=9 - 11+
  12649. // Extend with the prototype to reset the above stopImmediatePropagation()
  12650. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12651. saved.slice( 1 ),
  12652. this
  12653. )
  12654. } );
  12655. // Abort handling of the native event
  12656. event.stopImmediatePropagation();
  12657. }
  12658. }
  12659. } );
  12660. }
  12661. jQuery.removeEvent = function( elem, type, handle ) {
  12662. // This "if" is needed for plain objects
  12663. if ( elem.removeEventListener ) {
  12664. elem.removeEventListener( type, handle );
  12665. }
  12666. };
  12667. jQuery.Event = function( src, props ) {
  12668. // Allow instantiation without the 'new' keyword
  12669. if ( !( this instanceof jQuery.Event ) ) {
  12670. return new jQuery.Event( src, props );
  12671. }
  12672. // Event object
  12673. if ( src && src.type ) {
  12674. this.originalEvent = src;
  12675. this.type = src.type;
  12676. // Events bubbling up the document may have been marked as prevented
  12677. // by a handler lower down the tree; reflect the correct value.
  12678. this.isDefaultPrevented = src.defaultPrevented ||
  12679. src.defaultPrevented === undefined &&
  12680. // Support: Android <=2.3 only
  12681. src.returnValue === false ?
  12682. returnTrue :
  12683. returnFalse;
  12684. // Create target properties
  12685. // Support: Safari <=6 - 7 only
  12686. // Target should not be a text node (#504, #13143)
  12687. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12688. src.target.parentNode :
  12689. src.target;
  12690. this.currentTarget = src.currentTarget;
  12691. this.relatedTarget = src.relatedTarget;
  12692. // Event type
  12693. } else {
  12694. this.type = src;
  12695. }
  12696. // Put explicitly provided properties onto the event object
  12697. if ( props ) {
  12698. jQuery.extend( this, props );
  12699. }
  12700. // Create a timestamp if incoming event doesn't have one
  12701. this.timeStamp = src && src.timeStamp || Date.now();
  12702. // Mark it as fixed
  12703. this[ jQuery.expando ] = true;
  12704. };
  12705. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12706. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12707. jQuery.Event.prototype = {
  12708. constructor: jQuery.Event,
  12709. isDefaultPrevented: returnFalse,
  12710. isPropagationStopped: returnFalse,
  12711. isImmediatePropagationStopped: returnFalse,
  12712. isSimulated: false,
  12713. preventDefault: function() {
  12714. var e = this.originalEvent;
  12715. this.isDefaultPrevented = returnTrue;
  12716. if ( e && !this.isSimulated ) {
  12717. e.preventDefault();
  12718. }
  12719. },
  12720. stopPropagation: function() {
  12721. var e = this.originalEvent;
  12722. this.isPropagationStopped = returnTrue;
  12723. if ( e && !this.isSimulated ) {
  12724. e.stopPropagation();
  12725. }
  12726. },
  12727. stopImmediatePropagation: function() {
  12728. var e = this.originalEvent;
  12729. this.isImmediatePropagationStopped = returnTrue;
  12730. if ( e && !this.isSimulated ) {
  12731. e.stopImmediatePropagation();
  12732. }
  12733. this.stopPropagation();
  12734. }
  12735. };
  12736. // Includes all common event props including KeyEvent and MouseEvent specific props
  12737. jQuery.each( {
  12738. altKey: true,
  12739. bubbles: true,
  12740. cancelable: true,
  12741. changedTouches: true,
  12742. ctrlKey: true,
  12743. detail: true,
  12744. eventPhase: true,
  12745. metaKey: true,
  12746. pageX: true,
  12747. pageY: true,
  12748. shiftKey: true,
  12749. view: true,
  12750. "char": true,
  12751. code: true,
  12752. charCode: true,
  12753. key: true,
  12754. keyCode: true,
  12755. button: true,
  12756. buttons: true,
  12757. clientX: true,
  12758. clientY: true,
  12759. offsetX: true,
  12760. offsetY: true,
  12761. pointerId: true,
  12762. pointerType: true,
  12763. screenX: true,
  12764. screenY: true,
  12765. targetTouches: true,
  12766. toElement: true,
  12767. touches: true,
  12768. which: function( event ) {
  12769. var button = event.button;
  12770. // Add which for key events
  12771. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12772. return event.charCode != null ? event.charCode : event.keyCode;
  12773. }
  12774. // Add which for click: 1 === left; 2 === middle; 3 === right
  12775. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12776. if ( button & 1 ) {
  12777. return 1;
  12778. }
  12779. if ( button & 2 ) {
  12780. return 3;
  12781. }
  12782. if ( button & 4 ) {
  12783. return 2;
  12784. }
  12785. return 0;
  12786. }
  12787. return event.which;
  12788. }
  12789. }, jQuery.event.addProp );
  12790. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12791. jQuery.event.special[ type ] = {
  12792. // Utilize native event if possible so blur/focus sequence is correct
  12793. setup: function() {
  12794. // Claim the first handler
  12795. // dataPriv.set( this, "focus", ... )
  12796. // dataPriv.set( this, "blur", ... )
  12797. leverageNative( this, type, expectSync );
  12798. // Return false to allow normal processing in the caller
  12799. return false;
  12800. },
  12801. trigger: function() {
  12802. // Force setup before trigger
  12803. leverageNative( this, type );
  12804. // Return non-false to allow normal event-path propagation
  12805. return true;
  12806. },
  12807. delegateType: delegateType
  12808. };
  12809. } );
  12810. // Create mouseenter/leave events using mouseover/out and event-time checks
  12811. // so that event delegation works in jQuery.
  12812. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12813. //
  12814. // Support: Safari 7 only
  12815. // Safari sends mouseenter too often; see:
  12816. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12817. // for the description of the bug (it existed in older Chrome versions as well).
  12818. jQuery.each( {
  12819. mouseenter: "mouseover",
  12820. mouseleave: "mouseout",
  12821. pointerenter: "pointerover",
  12822. pointerleave: "pointerout"
  12823. }, function( orig, fix ) {
  12824. jQuery.event.special[ orig ] = {
  12825. delegateType: fix,
  12826. bindType: fix,
  12827. handle: function( event ) {
  12828. var ret,
  12829. target = this,
  12830. related = event.relatedTarget,
  12831. handleObj = event.handleObj;
  12832. // For mouseenter/leave call the handler if related is outside the target.
  12833. // NB: No relatedTarget if the mouse left/entered the browser window
  12834. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12835. event.type = handleObj.origType;
  12836. ret = handleObj.handler.apply( this, arguments );
  12837. event.type = fix;
  12838. }
  12839. return ret;
  12840. }
  12841. };
  12842. } );
  12843. jQuery.fn.extend( {
  12844. on: function( types, selector, data, fn ) {
  12845. return on( this, types, selector, data, fn );
  12846. },
  12847. one: function( types, selector, data, fn ) {
  12848. return on( this, types, selector, data, fn, 1 );
  12849. },
  12850. off: function( types, selector, fn ) {
  12851. var handleObj, type;
  12852. if ( types && types.preventDefault && types.handleObj ) {
  12853. // ( event ) dispatched jQuery.Event
  12854. handleObj = types.handleObj;
  12855. jQuery( types.delegateTarget ).off(
  12856. handleObj.namespace ?
  12857. handleObj.origType + "." + handleObj.namespace :
  12858. handleObj.origType,
  12859. handleObj.selector,
  12860. handleObj.handler
  12861. );
  12862. return this;
  12863. }
  12864. if ( typeof types === "object" ) {
  12865. // ( types-object [, selector] )
  12866. for ( type in types ) {
  12867. this.off( type, selector, types[ type ] );
  12868. }
  12869. return this;
  12870. }
  12871. if ( selector === false || typeof selector === "function" ) {
  12872. // ( types [, fn] )
  12873. fn = selector;
  12874. selector = undefined;
  12875. }
  12876. if ( fn === false ) {
  12877. fn = returnFalse;
  12878. }
  12879. return this.each( function() {
  12880. jQuery.event.remove( this, types, fn, selector );
  12881. } );
  12882. }
  12883. } );
  12884. var
  12885. /* eslint-disable max-len */
  12886. // See https://github.com/eslint/eslint/issues/3229
  12887. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12888. /* eslint-enable */
  12889. // Support: IE <=10 - 11, Edge 12 - 13 only
  12890. // In IE/Edge using regex groups here causes severe slowdowns.
  12891. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12892. rnoInnerhtml = /<script|<style|<link/i,
  12893. // checked="checked" or checked
  12894. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12895. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12896. // Prefer a tbody over its parent table for containing new rows
  12897. function manipulationTarget( elem, content ) {
  12898. if ( nodeName( elem, "table" ) &&
  12899. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12900. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12901. }
  12902. return elem;
  12903. }
  12904. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12905. function disableScript( elem ) {
  12906. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12907. return elem;
  12908. }
  12909. function restoreScript( elem ) {
  12910. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12911. elem.type = elem.type.slice( 5 );
  12912. } else {
  12913. elem.removeAttribute( "type" );
  12914. }
  12915. return elem;
  12916. }
  12917. function cloneCopyEvent( src, dest ) {
  12918. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12919. if ( dest.nodeType !== 1 ) {
  12920. return;
  12921. }
  12922. // 1. Copy private data: events, handlers, etc.
  12923. if ( dataPriv.hasData( src ) ) {
  12924. pdataOld = dataPriv.access( src );
  12925. pdataCur = dataPriv.set( dest, pdataOld );
  12926. events = pdataOld.events;
  12927. if ( events ) {
  12928. delete pdataCur.handle;
  12929. pdataCur.events = {};
  12930. for ( type in events ) {
  12931. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12932. jQuery.event.add( dest, type, events[ type ][ i ] );
  12933. }
  12934. }
  12935. }
  12936. }
  12937. // 2. Copy user data
  12938. if ( dataUser.hasData( src ) ) {
  12939. udataOld = dataUser.access( src );
  12940. udataCur = jQuery.extend( {}, udataOld );
  12941. dataUser.set( dest, udataCur );
  12942. }
  12943. }
  12944. // Fix IE bugs, see support tests
  12945. function fixInput( src, dest ) {
  12946. var nodeName = dest.nodeName.toLowerCase();
  12947. // Fails to persist the checked state of a cloned checkbox or radio button.
  12948. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12949. dest.checked = src.checked;
  12950. // Fails to return the selected option to the default selected state when cloning options
  12951. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12952. dest.defaultValue = src.defaultValue;
  12953. }
  12954. }
  12955. function domManip( collection, args, callback, ignored ) {
  12956. // Flatten any nested arrays
  12957. args = concat.apply( [], args );
  12958. var fragment, first, scripts, hasScripts, node, doc,
  12959. i = 0,
  12960. l = collection.length,
  12961. iNoClone = l - 1,
  12962. value = args[ 0 ],
  12963. valueIsFunction = isFunction( value );
  12964. // We can't cloneNode fragments that contain checked, in WebKit
  12965. if ( valueIsFunction ||
  12966. ( l > 1 && typeof value === "string" &&
  12967. !support.checkClone && rchecked.test( value ) ) ) {
  12968. return collection.each( function( index ) {
  12969. var self = collection.eq( index );
  12970. if ( valueIsFunction ) {
  12971. args[ 0 ] = value.call( this, index, self.html() );
  12972. }
  12973. domManip( self, args, callback, ignored );
  12974. } );
  12975. }
  12976. if ( l ) {
  12977. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12978. first = fragment.firstChild;
  12979. if ( fragment.childNodes.length === 1 ) {
  12980. fragment = first;
  12981. }
  12982. // Require either new content or an interest in ignored elements to invoke the callback
  12983. if ( first || ignored ) {
  12984. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12985. hasScripts = scripts.length;
  12986. // Use the original fragment for the last item
  12987. // instead of the first because it can end up
  12988. // being emptied incorrectly in certain situations (#8070).
  12989. for ( ; i < l; i++ ) {
  12990. node = fragment;
  12991. if ( i !== iNoClone ) {
  12992. node = jQuery.clone( node, true, true );
  12993. // Keep references to cloned scripts for later restoration
  12994. if ( hasScripts ) {
  12995. // Support: Android <=4.0 only, PhantomJS 1 only
  12996. // push.apply(_, arraylike) throws on ancient WebKit
  12997. jQuery.merge( scripts, getAll( node, "script" ) );
  12998. }
  12999. }
  13000. callback.call( collection[ i ], node, i );
  13001. }
  13002. if ( hasScripts ) {
  13003. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13004. // Reenable scripts
  13005. jQuery.map( scripts, restoreScript );
  13006. // Evaluate executable scripts on first document insertion
  13007. for ( i = 0; i < hasScripts; i++ ) {
  13008. node = scripts[ i ];
  13009. if ( rscriptType.test( node.type || "" ) &&
  13010. !dataPriv.access( node, "globalEval" ) &&
  13011. jQuery.contains( doc, node ) ) {
  13012. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13013. // Optional AJAX dependency, but won't run scripts if not present
  13014. if ( jQuery._evalUrl && !node.noModule ) {
  13015. jQuery._evalUrl( node.src, {
  13016. nonce: node.nonce || node.getAttribute( "nonce" )
  13017. } );
  13018. }
  13019. } else {
  13020. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13021. }
  13022. }
  13023. }
  13024. }
  13025. }
  13026. }
  13027. return collection;
  13028. }
  13029. function remove( elem, selector, keepData ) {
  13030. var node,
  13031. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13032. i = 0;
  13033. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13034. if ( !keepData && node.nodeType === 1 ) {
  13035. jQuery.cleanData( getAll( node ) );
  13036. }
  13037. if ( node.parentNode ) {
  13038. if ( keepData && isAttached( node ) ) {
  13039. setGlobalEval( getAll( node, "script" ) );
  13040. }
  13041. node.parentNode.removeChild( node );
  13042. }
  13043. }
  13044. return elem;
  13045. }
  13046. jQuery.extend( {
  13047. htmlPrefilter: function( html ) {
  13048. return html.replace( rxhtmlTag, "<$1></$2>" );
  13049. },
  13050. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13051. var i, l, srcElements, destElements,
  13052. clone = elem.cloneNode( true ),
  13053. inPage = isAttached( elem );
  13054. // Fix IE cloning issues
  13055. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13056. !jQuery.isXMLDoc( elem ) ) {
  13057. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13058. destElements = getAll( clone );
  13059. srcElements = getAll( elem );
  13060. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13061. fixInput( srcElements[ i ], destElements[ i ] );
  13062. }
  13063. }
  13064. // Copy the events from the original to the clone
  13065. if ( dataAndEvents ) {
  13066. if ( deepDataAndEvents ) {
  13067. srcElements = srcElements || getAll( elem );
  13068. destElements = destElements || getAll( clone );
  13069. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13070. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13071. }
  13072. } else {
  13073. cloneCopyEvent( elem, clone );
  13074. }
  13075. }
  13076. // Preserve script evaluation history
  13077. destElements = getAll( clone, "script" );
  13078. if ( destElements.length > 0 ) {
  13079. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13080. }
  13081. // Return the cloned set
  13082. return clone;
  13083. },
  13084. cleanData: function( elems ) {
  13085. var data, elem, type,
  13086. special = jQuery.event.special,
  13087. i = 0;
  13088. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13089. if ( acceptData( elem ) ) {
  13090. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13091. if ( data.events ) {
  13092. for ( type in data.events ) {
  13093. if ( special[ type ] ) {
  13094. jQuery.event.remove( elem, type );
  13095. // This is a shortcut to avoid jQuery.event.remove's overhead
  13096. } else {
  13097. jQuery.removeEvent( elem, type, data.handle );
  13098. }
  13099. }
  13100. }
  13101. // Support: Chrome <=35 - 45+
  13102. // Assign undefined instead of using delete, see Data#remove
  13103. elem[ dataPriv.expando ] = undefined;
  13104. }
  13105. if ( elem[ dataUser.expando ] ) {
  13106. // Support: Chrome <=35 - 45+
  13107. // Assign undefined instead of using delete, see Data#remove
  13108. elem[ dataUser.expando ] = undefined;
  13109. }
  13110. }
  13111. }
  13112. }
  13113. } );
  13114. jQuery.fn.extend( {
  13115. detach: function( selector ) {
  13116. return remove( this, selector, true );
  13117. },
  13118. remove: function( selector ) {
  13119. return remove( this, selector );
  13120. },
  13121. text: function( value ) {
  13122. return access( this, function( value ) {
  13123. return value === undefined ?
  13124. jQuery.text( this ) :
  13125. this.empty().each( function() {
  13126. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13127. this.textContent = value;
  13128. }
  13129. } );
  13130. }, null, value, arguments.length );
  13131. },
  13132. append: function() {
  13133. return domManip( this, arguments, function( elem ) {
  13134. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13135. var target = manipulationTarget( this, elem );
  13136. target.appendChild( elem );
  13137. }
  13138. } );
  13139. },
  13140. prepend: function() {
  13141. return domManip( this, arguments, function( elem ) {
  13142. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13143. var target = manipulationTarget( this, elem );
  13144. target.insertBefore( elem, target.firstChild );
  13145. }
  13146. } );
  13147. },
  13148. before: function() {
  13149. return domManip( this, arguments, function( elem ) {
  13150. if ( this.parentNode ) {
  13151. this.parentNode.insertBefore( elem, this );
  13152. }
  13153. } );
  13154. },
  13155. after: function() {
  13156. return domManip( this, arguments, function( elem ) {
  13157. if ( this.parentNode ) {
  13158. this.parentNode.insertBefore( elem, this.nextSibling );
  13159. }
  13160. } );
  13161. },
  13162. empty: function() {
  13163. var elem,
  13164. i = 0;
  13165. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13166. if ( elem.nodeType === 1 ) {
  13167. // Prevent memory leaks
  13168. jQuery.cleanData( getAll( elem, false ) );
  13169. // Remove any remaining nodes
  13170. elem.textContent = "";
  13171. }
  13172. }
  13173. return this;
  13174. },
  13175. clone: function( dataAndEvents, deepDataAndEvents ) {
  13176. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13177. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13178. return this.map( function() {
  13179. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13180. } );
  13181. },
  13182. html: function( value ) {
  13183. return access( this, function( value ) {
  13184. var elem = this[ 0 ] || {},
  13185. i = 0,
  13186. l = this.length;
  13187. if ( value === undefined && elem.nodeType === 1 ) {
  13188. return elem.innerHTML;
  13189. }
  13190. // See if we can take a shortcut and just use innerHTML
  13191. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13192. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13193. value = jQuery.htmlPrefilter( value );
  13194. try {
  13195. for ( ; i < l; i++ ) {
  13196. elem = this[ i ] || {};
  13197. // Remove element nodes and prevent memory leaks
  13198. if ( elem.nodeType === 1 ) {
  13199. jQuery.cleanData( getAll( elem, false ) );
  13200. elem.innerHTML = value;
  13201. }
  13202. }
  13203. elem = 0;
  13204. // If using innerHTML throws an exception, use the fallback method
  13205. } catch ( e ) {}
  13206. }
  13207. if ( elem ) {
  13208. this.empty().append( value );
  13209. }
  13210. }, null, value, arguments.length );
  13211. },
  13212. replaceWith: function() {
  13213. var ignored = [];
  13214. // Make the changes, replacing each non-ignored context element with the new content
  13215. return domManip( this, arguments, function( elem ) {
  13216. var parent = this.parentNode;
  13217. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13218. jQuery.cleanData( getAll( this ) );
  13219. if ( parent ) {
  13220. parent.replaceChild( elem, this );
  13221. }
  13222. }
  13223. // Force callback invocation
  13224. }, ignored );
  13225. }
  13226. } );
  13227. jQuery.each( {
  13228. appendTo: "append",
  13229. prependTo: "prepend",
  13230. insertBefore: "before",
  13231. insertAfter: "after",
  13232. replaceAll: "replaceWith"
  13233. }, function( name, original ) {
  13234. jQuery.fn[ name ] = function( selector ) {
  13235. var elems,
  13236. ret = [],
  13237. insert = jQuery( selector ),
  13238. last = insert.length - 1,
  13239. i = 0;
  13240. for ( ; i <= last; i++ ) {
  13241. elems = i === last ? this : this.clone( true );
  13242. jQuery( insert[ i ] )[ original ]( elems );
  13243. // Support: Android <=4.0 only, PhantomJS 1 only
  13244. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13245. push.apply( ret, elems.get() );
  13246. }
  13247. return this.pushStack( ret );
  13248. };
  13249. } );
  13250. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13251. var getStyles = function( elem ) {
  13252. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13253. // IE throws on elements created in popups
  13254. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13255. var view = elem.ownerDocument.defaultView;
  13256. if ( !view || !view.opener ) {
  13257. view = window;
  13258. }
  13259. return view.getComputedStyle( elem );
  13260. };
  13261. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13262. ( function() {
  13263. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13264. // so they're executed at the same time to save the second computation.
  13265. function computeStyleTests() {
  13266. // This is a singleton, we need to execute it only once
  13267. if ( !div ) {
  13268. return;
  13269. }
  13270. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13271. "margin-top:1px;padding:0;border:0";
  13272. div.style.cssText =
  13273. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13274. "margin:auto;border:1px;padding:1px;" +
  13275. "width:60%;top:1%";
  13276. documentElement.appendChild( container ).appendChild( div );
  13277. var divStyle = window.getComputedStyle( div );
  13278. pixelPositionVal = divStyle.top !== "1%";
  13279. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13280. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13281. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13282. // Some styles come back with percentage values, even though they shouldn't
  13283. div.style.right = "60%";
  13284. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13285. // Support: IE 9 - 11 only
  13286. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13287. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13288. // Support: IE 9 only
  13289. // Detect overflow:scroll screwiness (gh-3699)
  13290. // Support: Chrome <=64
  13291. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13292. div.style.position = "absolute";
  13293. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13294. documentElement.removeChild( container );
  13295. // Nullify the div so it wouldn't be stored in the memory and
  13296. // it will also be a sign that checks already performed
  13297. div = null;
  13298. }
  13299. function roundPixelMeasures( measure ) {
  13300. return Math.round( parseFloat( measure ) );
  13301. }
  13302. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13303. reliableMarginLeftVal,
  13304. container = document.createElement( "div" ),
  13305. div = document.createElement( "div" );
  13306. // Finish early in limited (non-browser) environments
  13307. if ( !div.style ) {
  13308. return;
  13309. }
  13310. // Support: IE <=9 - 11 only
  13311. // Style of cloned element affects source element cloned (#8908)
  13312. div.style.backgroundClip = "content-box";
  13313. div.cloneNode( true ).style.backgroundClip = "";
  13314. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13315. jQuery.extend( support, {
  13316. boxSizingReliable: function() {
  13317. computeStyleTests();
  13318. return boxSizingReliableVal;
  13319. },
  13320. pixelBoxStyles: function() {
  13321. computeStyleTests();
  13322. return pixelBoxStylesVal;
  13323. },
  13324. pixelPosition: function() {
  13325. computeStyleTests();
  13326. return pixelPositionVal;
  13327. },
  13328. reliableMarginLeft: function() {
  13329. computeStyleTests();
  13330. return reliableMarginLeftVal;
  13331. },
  13332. scrollboxSize: function() {
  13333. computeStyleTests();
  13334. return scrollboxSizeVal;
  13335. }
  13336. } );
  13337. } )();
  13338. function curCSS( elem, name, computed ) {
  13339. var width, minWidth, maxWidth, ret,
  13340. // Support: Firefox 51+
  13341. // Retrieving style before computed somehow
  13342. // fixes an issue with getting wrong values
  13343. // on detached elements
  13344. style = elem.style;
  13345. computed = computed || getStyles( elem );
  13346. // getPropertyValue is needed for:
  13347. // .css('filter') (IE 9 only, #12537)
  13348. // .css('--customProperty) (#3144)
  13349. if ( computed ) {
  13350. ret = computed.getPropertyValue( name ) || computed[ name ];
  13351. if ( ret === "" && !isAttached( elem ) ) {
  13352. ret = jQuery.style( elem, name );
  13353. }
  13354. // A tribute to the "awesome hack by Dean Edwards"
  13355. // Android Browser returns percentage for some values,
  13356. // but width seems to be reliably pixels.
  13357. // This is against the CSSOM draft spec:
  13358. // https://drafts.csswg.org/cssom/#resolved-values
  13359. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13360. // Remember the original values
  13361. width = style.width;
  13362. minWidth = style.minWidth;
  13363. maxWidth = style.maxWidth;
  13364. // Put in the new values to get a computed value out
  13365. style.minWidth = style.maxWidth = style.width = ret;
  13366. ret = computed.width;
  13367. // Revert the changed values
  13368. style.width = width;
  13369. style.minWidth = minWidth;
  13370. style.maxWidth = maxWidth;
  13371. }
  13372. }
  13373. return ret !== undefined ?
  13374. // Support: IE <=9 - 11 only
  13375. // IE returns zIndex value as an integer.
  13376. ret + "" :
  13377. ret;
  13378. }
  13379. function addGetHookIf( conditionFn, hookFn ) {
  13380. // Define the hook, we'll check on the first run if it's really needed.
  13381. return {
  13382. get: function() {
  13383. if ( conditionFn() ) {
  13384. // Hook not needed (or it's not possible to use it due
  13385. // to missing dependency), remove it.
  13386. delete this.get;
  13387. return;
  13388. }
  13389. // Hook needed; redefine it so that the support test is not executed again.
  13390. return ( this.get = hookFn ).apply( this, arguments );
  13391. }
  13392. };
  13393. }
  13394. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13395. emptyStyle = document.createElement( "div" ).style,
  13396. vendorProps = {};
  13397. // Return a vendor-prefixed property or undefined
  13398. function vendorPropName( name ) {
  13399. // Check for vendor prefixed names
  13400. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13401. i = cssPrefixes.length;
  13402. while ( i-- ) {
  13403. name = cssPrefixes[ i ] + capName;
  13404. if ( name in emptyStyle ) {
  13405. return name;
  13406. }
  13407. }
  13408. }
  13409. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13410. function finalPropName( name ) {
  13411. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13412. if ( final ) {
  13413. return final;
  13414. }
  13415. if ( name in emptyStyle ) {
  13416. return name;
  13417. }
  13418. return vendorProps[ name ] = vendorPropName( name ) || name;
  13419. }
  13420. var
  13421. // Swappable if display is none or starts with table
  13422. // except "table", "table-cell", or "table-caption"
  13423. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13424. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13425. rcustomProp = /^--/,
  13426. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13427. cssNormalTransform = {
  13428. letterSpacing: "0",
  13429. fontWeight: "400"
  13430. };
  13431. function setPositiveNumber( elem, value, subtract ) {
  13432. // Any relative (+/-) values have already been
  13433. // normalized at this point
  13434. var matches = rcssNum.exec( value );
  13435. return matches ?
  13436. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13437. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13438. value;
  13439. }
  13440. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13441. var i = dimension === "width" ? 1 : 0,
  13442. extra = 0,
  13443. delta = 0;
  13444. // Adjustment may not be necessary
  13445. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13446. return 0;
  13447. }
  13448. for ( ; i < 4; i += 2 ) {
  13449. // Both box models exclude margin
  13450. if ( box === "margin" ) {
  13451. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13452. }
  13453. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13454. if ( !isBorderBox ) {
  13455. // Add padding
  13456. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13457. // For "border" or "margin", add border
  13458. if ( box !== "padding" ) {
  13459. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13460. // But still keep track of it otherwise
  13461. } else {
  13462. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13463. }
  13464. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13465. // "padding" or "margin"
  13466. } else {
  13467. // For "content", subtract padding
  13468. if ( box === "content" ) {
  13469. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13470. }
  13471. // For "content" or "padding", subtract border
  13472. if ( box !== "margin" ) {
  13473. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13474. }
  13475. }
  13476. }
  13477. // Account for positive content-box scroll gutter when requested by providing computedVal
  13478. if ( !isBorderBox && computedVal >= 0 ) {
  13479. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13480. // Assuming integer scroll gutter, subtract the rest and round down
  13481. delta += Math.max( 0, Math.ceil(
  13482. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13483. computedVal -
  13484. delta -
  13485. extra -
  13486. 0.5
  13487. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13488. // Use an explicit zero to avoid NaN (gh-3964)
  13489. ) ) || 0;
  13490. }
  13491. return delta;
  13492. }
  13493. function getWidthOrHeight( elem, dimension, extra ) {
  13494. // Start with computed style
  13495. var styles = getStyles( elem ),
  13496. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13497. // Fake content-box until we know it's needed to know the true value.
  13498. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13499. isBorderBox = boxSizingNeeded &&
  13500. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13501. valueIsBorderBox = isBorderBox,
  13502. val = curCSS( elem, dimension, styles ),
  13503. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13504. // Support: Firefox <=54
  13505. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13506. if ( rnumnonpx.test( val ) ) {
  13507. if ( !extra ) {
  13508. return val;
  13509. }
  13510. val = "auto";
  13511. }
  13512. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13513. // This happens for inline elements with no explicit setting (gh-3571)
  13514. // Support: Android <=4.1 - 4.3 only
  13515. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13516. // Support: IE 9-11 only
  13517. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13518. // We use getClientRects() to check for hidden/disconnected.
  13519. // In those cases, the computed value can be trusted to be border-box
  13520. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13521. val === "auto" ||
  13522. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13523. elem.getClientRects().length ) {
  13524. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13525. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13526. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13527. // retrieved value as a content box dimension.
  13528. valueIsBorderBox = offsetProp in elem;
  13529. if ( valueIsBorderBox ) {
  13530. val = elem[ offsetProp ];
  13531. }
  13532. }
  13533. // Normalize "" and auto
  13534. val = parseFloat( val ) || 0;
  13535. // Adjust for the element's box model
  13536. return ( val +
  13537. boxModelAdjustment(
  13538. elem,
  13539. dimension,
  13540. extra || ( isBorderBox ? "border" : "content" ),
  13541. valueIsBorderBox,
  13542. styles,
  13543. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13544. val
  13545. )
  13546. ) + "px";
  13547. }
  13548. jQuery.extend( {
  13549. // Add in style property hooks for overriding the default
  13550. // behavior of getting and setting a style property
  13551. cssHooks: {
  13552. opacity: {
  13553. get: function( elem, computed ) {
  13554. if ( computed ) {
  13555. // We should always get a number back from opacity
  13556. var ret = curCSS( elem, "opacity" );
  13557. return ret === "" ? "1" : ret;
  13558. }
  13559. }
  13560. }
  13561. },
  13562. // Don't automatically add "px" to these possibly-unitless properties
  13563. cssNumber: {
  13564. "animationIterationCount": true,
  13565. "columnCount": true,
  13566. "fillOpacity": true,
  13567. "flexGrow": true,
  13568. "flexShrink": true,
  13569. "fontWeight": true,
  13570. "gridArea": true,
  13571. "gridColumn": true,
  13572. "gridColumnEnd": true,
  13573. "gridColumnStart": true,
  13574. "gridRow": true,
  13575. "gridRowEnd": true,
  13576. "gridRowStart": true,
  13577. "lineHeight": true,
  13578. "opacity": true,
  13579. "order": true,
  13580. "orphans": true,
  13581. "widows": true,
  13582. "zIndex": true,
  13583. "zoom": true
  13584. },
  13585. // Add in properties whose names you wish to fix before
  13586. // setting or getting the value
  13587. cssProps: {},
  13588. // Get and set the style property on a DOM Node
  13589. style: function( elem, name, value, extra ) {
  13590. // Don't set styles on text and comment nodes
  13591. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13592. return;
  13593. }
  13594. // Make sure that we're working with the right name
  13595. var ret, type, hooks,
  13596. origName = camelCase( name ),
  13597. isCustomProp = rcustomProp.test( name ),
  13598. style = elem.style;
  13599. // Make sure that we're working with the right name. We don't
  13600. // want to query the value if it is a CSS custom property
  13601. // since they are user-defined.
  13602. if ( !isCustomProp ) {
  13603. name = finalPropName( origName );
  13604. }
  13605. // Gets hook for the prefixed version, then unprefixed version
  13606. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13607. // Check if we're setting a value
  13608. if ( value !== undefined ) {
  13609. type = typeof value;
  13610. // Convert "+=" or "-=" to relative numbers (#7345)
  13611. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13612. value = adjustCSS( elem, name, ret );
  13613. // Fixes bug #9237
  13614. type = "number";
  13615. }
  13616. // Make sure that null and NaN values aren't set (#7116)
  13617. if ( value == null || value !== value ) {
  13618. return;
  13619. }
  13620. // If a number was passed in, add the unit (except for certain CSS properties)
  13621. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13622. // "px" to a few hardcoded values.
  13623. if ( type === "number" && !isCustomProp ) {
  13624. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13625. }
  13626. // background-* props affect original clone's values
  13627. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13628. style[ name ] = "inherit";
  13629. }
  13630. // If a hook was provided, use that value, otherwise just set the specified value
  13631. if ( !hooks || !( "set" in hooks ) ||
  13632. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13633. if ( isCustomProp ) {
  13634. style.setProperty( name, value );
  13635. } else {
  13636. style[ name ] = value;
  13637. }
  13638. }
  13639. } else {
  13640. // If a hook was provided get the non-computed value from there
  13641. if ( hooks && "get" in hooks &&
  13642. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13643. return ret;
  13644. }
  13645. // Otherwise just get the value from the style object
  13646. return style[ name ];
  13647. }
  13648. },
  13649. css: function( elem, name, extra, styles ) {
  13650. var val, num, hooks,
  13651. origName = camelCase( name ),
  13652. isCustomProp = rcustomProp.test( name );
  13653. // Make sure that we're working with the right name. We don't
  13654. // want to modify the value if it is a CSS custom property
  13655. // since they are user-defined.
  13656. if ( !isCustomProp ) {
  13657. name = finalPropName( origName );
  13658. }
  13659. // Try prefixed name followed by the unprefixed name
  13660. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13661. // If a hook was provided get the computed value from there
  13662. if ( hooks && "get" in hooks ) {
  13663. val = hooks.get( elem, true, extra );
  13664. }
  13665. // Otherwise, if a way to get the computed value exists, use that
  13666. if ( val === undefined ) {
  13667. val = curCSS( elem, name, styles );
  13668. }
  13669. // Convert "normal" to computed value
  13670. if ( val === "normal" && name in cssNormalTransform ) {
  13671. val = cssNormalTransform[ name ];
  13672. }
  13673. // Make numeric if forced or a qualifier was provided and val looks numeric
  13674. if ( extra === "" || extra ) {
  13675. num = parseFloat( val );
  13676. return extra === true || isFinite( num ) ? num || 0 : val;
  13677. }
  13678. return val;
  13679. }
  13680. } );
  13681. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13682. jQuery.cssHooks[ dimension ] = {
  13683. get: function( elem, computed, extra ) {
  13684. if ( computed ) {
  13685. // Certain elements can have dimension info if we invisibly show them
  13686. // but it must have a current display style that would benefit
  13687. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13688. // Support: Safari 8+
  13689. // Table columns in Safari have non-zero offsetWidth & zero
  13690. // getBoundingClientRect().width unless display is changed.
  13691. // Support: IE <=11 only
  13692. // Running getBoundingClientRect on a disconnected node
  13693. // in IE throws an error.
  13694. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13695. swap( elem, cssShow, function() {
  13696. return getWidthOrHeight( elem, dimension, extra );
  13697. } ) :
  13698. getWidthOrHeight( elem, dimension, extra );
  13699. }
  13700. },
  13701. set: function( elem, value, extra ) {
  13702. var matches,
  13703. styles = getStyles( elem ),
  13704. // Only read styles.position if the test has a chance to fail
  13705. // to avoid forcing a reflow.
  13706. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13707. styles.position === "absolute",
  13708. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13709. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13710. isBorderBox = boxSizingNeeded &&
  13711. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13712. subtract = extra ?
  13713. boxModelAdjustment(
  13714. elem,
  13715. dimension,
  13716. extra,
  13717. isBorderBox,
  13718. styles
  13719. ) :
  13720. 0;
  13721. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13722. // faking a content-box to get border and padding (gh-3699)
  13723. if ( isBorderBox && scrollboxSizeBuggy ) {
  13724. subtract -= Math.ceil(
  13725. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13726. parseFloat( styles[ dimension ] ) -
  13727. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13728. 0.5
  13729. );
  13730. }
  13731. // Convert to pixels if value adjustment is needed
  13732. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13733. ( matches[ 3 ] || "px" ) !== "px" ) {
  13734. elem.style[ dimension ] = value;
  13735. value = jQuery.css( elem, dimension );
  13736. }
  13737. return setPositiveNumber( elem, value, subtract );
  13738. }
  13739. };
  13740. } );
  13741. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13742. function( elem, computed ) {
  13743. if ( computed ) {
  13744. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13745. elem.getBoundingClientRect().left -
  13746. swap( elem, { marginLeft: 0 }, function() {
  13747. return elem.getBoundingClientRect().left;
  13748. } )
  13749. ) + "px";
  13750. }
  13751. }
  13752. );
  13753. // These hooks are used by animate to expand properties
  13754. jQuery.each( {
  13755. margin: "",
  13756. padding: "",
  13757. border: "Width"
  13758. }, function( prefix, suffix ) {
  13759. jQuery.cssHooks[ prefix + suffix ] = {
  13760. expand: function( value ) {
  13761. var i = 0,
  13762. expanded = {},
  13763. // Assumes a single number if not a string
  13764. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13765. for ( ; i < 4; i++ ) {
  13766. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13767. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13768. }
  13769. return expanded;
  13770. }
  13771. };
  13772. if ( prefix !== "margin" ) {
  13773. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13774. }
  13775. } );
  13776. jQuery.fn.extend( {
  13777. css: function( name, value ) {
  13778. return access( this, function( elem, name, value ) {
  13779. var styles, len,
  13780. map = {},
  13781. i = 0;
  13782. if ( Array.isArray( name ) ) {
  13783. styles = getStyles( elem );
  13784. len = name.length;
  13785. for ( ; i < len; i++ ) {
  13786. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13787. }
  13788. return map;
  13789. }
  13790. return value !== undefined ?
  13791. jQuery.style( elem, name, value ) :
  13792. jQuery.css( elem, name );
  13793. }, name, value, arguments.length > 1 );
  13794. }
  13795. } );
  13796. function Tween( elem, options, prop, end, easing ) {
  13797. return new Tween.prototype.init( elem, options, prop, end, easing );
  13798. }
  13799. jQuery.Tween = Tween;
  13800. Tween.prototype = {
  13801. constructor: Tween,
  13802. init: function( elem, options, prop, end, easing, unit ) {
  13803. this.elem = elem;
  13804. this.prop = prop;
  13805. this.easing = easing || jQuery.easing._default;
  13806. this.options = options;
  13807. this.start = this.now = this.cur();
  13808. this.end = end;
  13809. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13810. },
  13811. cur: function() {
  13812. var hooks = Tween.propHooks[ this.prop ];
  13813. return hooks && hooks.get ?
  13814. hooks.get( this ) :
  13815. Tween.propHooks._default.get( this );
  13816. },
  13817. run: function( percent ) {
  13818. var eased,
  13819. hooks = Tween.propHooks[ this.prop ];
  13820. if ( this.options.duration ) {
  13821. this.pos = eased = jQuery.easing[ this.easing ](
  13822. percent, this.options.duration * percent, 0, 1, this.options.duration
  13823. );
  13824. } else {
  13825. this.pos = eased = percent;
  13826. }
  13827. this.now = ( this.end - this.start ) * eased + this.start;
  13828. if ( this.options.step ) {
  13829. this.options.step.call( this.elem, this.now, this );
  13830. }
  13831. if ( hooks && hooks.set ) {
  13832. hooks.set( this );
  13833. } else {
  13834. Tween.propHooks._default.set( this );
  13835. }
  13836. return this;
  13837. }
  13838. };
  13839. Tween.prototype.init.prototype = Tween.prototype;
  13840. Tween.propHooks = {
  13841. _default: {
  13842. get: function( tween ) {
  13843. var result;
  13844. // Use a property on the element directly when it is not a DOM element,
  13845. // or when there is no matching style property that exists.
  13846. if ( tween.elem.nodeType !== 1 ||
  13847. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13848. return tween.elem[ tween.prop ];
  13849. }
  13850. // Passing an empty string as a 3rd parameter to .css will automatically
  13851. // attempt a parseFloat and fallback to a string if the parse fails.
  13852. // Simple values such as "10px" are parsed to Float;
  13853. // complex values such as "rotate(1rad)" are returned as-is.
  13854. result = jQuery.css( tween.elem, tween.prop, "" );
  13855. // Empty strings, null, undefined and "auto" are converted to 0.
  13856. return !result || result === "auto" ? 0 : result;
  13857. },
  13858. set: function( tween ) {
  13859. // Use step hook for back compat.
  13860. // Use cssHook if its there.
  13861. // Use .style if available and use plain properties where available.
  13862. if ( jQuery.fx.step[ tween.prop ] ) {
  13863. jQuery.fx.step[ tween.prop ]( tween );
  13864. } else if ( tween.elem.nodeType === 1 && (
  13865. jQuery.cssHooks[ tween.prop ] ||
  13866. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13867. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13868. } else {
  13869. tween.elem[ tween.prop ] = tween.now;
  13870. }
  13871. }
  13872. }
  13873. };
  13874. // Support: IE <=9 only
  13875. // Panic based approach to setting things on disconnected nodes
  13876. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13877. set: function( tween ) {
  13878. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13879. tween.elem[ tween.prop ] = tween.now;
  13880. }
  13881. }
  13882. };
  13883. jQuery.easing = {
  13884. linear: function( p ) {
  13885. return p;
  13886. },
  13887. swing: function( p ) {
  13888. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13889. },
  13890. _default: "swing"
  13891. };
  13892. jQuery.fx = Tween.prototype.init;
  13893. // Back compat <1.8 extension point
  13894. jQuery.fx.step = {};
  13895. var
  13896. fxNow, inProgress,
  13897. rfxtypes = /^(?:toggle|show|hide)$/,
  13898. rrun = /queueHooks$/;
  13899. function schedule() {
  13900. if ( inProgress ) {
  13901. if ( document.hidden === false && window.requestAnimationFrame ) {
  13902. window.requestAnimationFrame( schedule );
  13903. } else {
  13904. window.setTimeout( schedule, jQuery.fx.interval );
  13905. }
  13906. jQuery.fx.tick();
  13907. }
  13908. }
  13909. // Animations created synchronously will run synchronously
  13910. function createFxNow() {
  13911. window.setTimeout( function() {
  13912. fxNow = undefined;
  13913. } );
  13914. return ( fxNow = Date.now() );
  13915. }
  13916. // Generate parameters to create a standard animation
  13917. function genFx( type, includeWidth ) {
  13918. var which,
  13919. i = 0,
  13920. attrs = { height: type };
  13921. // If we include width, step value is 1 to do all cssExpand values,
  13922. // otherwise step value is 2 to skip over Left and Right
  13923. includeWidth = includeWidth ? 1 : 0;
  13924. for ( ; i < 4; i += 2 - includeWidth ) {
  13925. which = cssExpand[ i ];
  13926. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13927. }
  13928. if ( includeWidth ) {
  13929. attrs.opacity = attrs.width = type;
  13930. }
  13931. return attrs;
  13932. }
  13933. function createTween( value, prop, animation ) {
  13934. var tween,
  13935. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13936. index = 0,
  13937. length = collection.length;
  13938. for ( ; index < length; index++ ) {
  13939. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13940. // We're done with this property
  13941. return tween;
  13942. }
  13943. }
  13944. }
  13945. function defaultPrefilter( elem, props, opts ) {
  13946. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13947. isBox = "width" in props || "height" in props,
  13948. anim = this,
  13949. orig = {},
  13950. style = elem.style,
  13951. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13952. dataShow = dataPriv.get( elem, "fxshow" );
  13953. // Queue-skipping animations hijack the fx hooks
  13954. if ( !opts.queue ) {
  13955. hooks = jQuery._queueHooks( elem, "fx" );
  13956. if ( hooks.unqueued == null ) {
  13957. hooks.unqueued = 0;
  13958. oldfire = hooks.empty.fire;
  13959. hooks.empty.fire = function() {
  13960. if ( !hooks.unqueued ) {
  13961. oldfire();
  13962. }
  13963. };
  13964. }
  13965. hooks.unqueued++;
  13966. anim.always( function() {
  13967. // Ensure the complete handler is called before this completes
  13968. anim.always( function() {
  13969. hooks.unqueued--;
  13970. if ( !jQuery.queue( elem, "fx" ).length ) {
  13971. hooks.empty.fire();
  13972. }
  13973. } );
  13974. } );
  13975. }
  13976. // Detect show/hide animations
  13977. for ( prop in props ) {
  13978. value = props[ prop ];
  13979. if ( rfxtypes.test( value ) ) {
  13980. delete props[ prop ];
  13981. toggle = toggle || value === "toggle";
  13982. if ( value === ( hidden ? "hide" : "show" ) ) {
  13983. // Pretend to be hidden if this is a "show" and
  13984. // there is still data from a stopped show/hide
  13985. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13986. hidden = true;
  13987. // Ignore all other no-op show/hide data
  13988. } else {
  13989. continue;
  13990. }
  13991. }
  13992. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13993. }
  13994. }
  13995. // Bail out if this is a no-op like .hide().hide()
  13996. propTween = !jQuery.isEmptyObject( props );
  13997. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  13998. return;
  13999. }
  14000. // Restrict "overflow" and "display" styles during box animations
  14001. if ( isBox && elem.nodeType === 1 ) {
  14002. // Support: IE <=9 - 11, Edge 12 - 15
  14003. // Record all 3 overflow attributes because IE does not infer the shorthand
  14004. // from identically-valued overflowX and overflowY and Edge just mirrors
  14005. // the overflowX value there.
  14006. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14007. // Identify a display type, preferring old show/hide data over the CSS cascade
  14008. restoreDisplay = dataShow && dataShow.display;
  14009. if ( restoreDisplay == null ) {
  14010. restoreDisplay = dataPriv.get( elem, "display" );
  14011. }
  14012. display = jQuery.css( elem, "display" );
  14013. if ( display === "none" ) {
  14014. if ( restoreDisplay ) {
  14015. display = restoreDisplay;
  14016. } else {
  14017. // Get nonempty value(s) by temporarily forcing visibility
  14018. showHide( [ elem ], true );
  14019. restoreDisplay = elem.style.display || restoreDisplay;
  14020. display = jQuery.css( elem, "display" );
  14021. showHide( [ elem ] );
  14022. }
  14023. }
  14024. // Animate inline elements as inline-block
  14025. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14026. if ( jQuery.css( elem, "float" ) === "none" ) {
  14027. // Restore the original display value at the end of pure show/hide animations
  14028. if ( !propTween ) {
  14029. anim.done( function() {
  14030. style.display = restoreDisplay;
  14031. } );
  14032. if ( restoreDisplay == null ) {
  14033. display = style.display;
  14034. restoreDisplay = display === "none" ? "" : display;
  14035. }
  14036. }
  14037. style.display = "inline-block";
  14038. }
  14039. }
  14040. }
  14041. if ( opts.overflow ) {
  14042. style.overflow = "hidden";
  14043. anim.always( function() {
  14044. style.overflow = opts.overflow[ 0 ];
  14045. style.overflowX = opts.overflow[ 1 ];
  14046. style.overflowY = opts.overflow[ 2 ];
  14047. } );
  14048. }
  14049. // Implement show/hide animations
  14050. propTween = false;
  14051. for ( prop in orig ) {
  14052. // General show/hide setup for this element animation
  14053. if ( !propTween ) {
  14054. if ( dataShow ) {
  14055. if ( "hidden" in dataShow ) {
  14056. hidden = dataShow.hidden;
  14057. }
  14058. } else {
  14059. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14060. }
  14061. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14062. if ( toggle ) {
  14063. dataShow.hidden = !hidden;
  14064. }
  14065. // Show elements before animating them
  14066. if ( hidden ) {
  14067. showHide( [ elem ], true );
  14068. }
  14069. /* eslint-disable no-loop-func */
  14070. anim.done( function() {
  14071. /* eslint-enable no-loop-func */
  14072. // The final step of a "hide" animation is actually hiding the element
  14073. if ( !hidden ) {
  14074. showHide( [ elem ] );
  14075. }
  14076. dataPriv.remove( elem, "fxshow" );
  14077. for ( prop in orig ) {
  14078. jQuery.style( elem, prop, orig[ prop ] );
  14079. }
  14080. } );
  14081. }
  14082. // Per-property setup
  14083. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14084. if ( !( prop in dataShow ) ) {
  14085. dataShow[ prop ] = propTween.start;
  14086. if ( hidden ) {
  14087. propTween.end = propTween.start;
  14088. propTween.start = 0;
  14089. }
  14090. }
  14091. }
  14092. }
  14093. function propFilter( props, specialEasing ) {
  14094. var index, name, easing, value, hooks;
  14095. // camelCase, specialEasing and expand cssHook pass
  14096. for ( index in props ) {
  14097. name = camelCase( index );
  14098. easing = specialEasing[ name ];
  14099. value = props[ index ];
  14100. if ( Array.isArray( value ) ) {
  14101. easing = value[ 1 ];
  14102. value = props[ index ] = value[ 0 ];
  14103. }
  14104. if ( index !== name ) {
  14105. props[ name ] = value;
  14106. delete props[ index ];
  14107. }
  14108. hooks = jQuery.cssHooks[ name ];
  14109. if ( hooks && "expand" in hooks ) {
  14110. value = hooks.expand( value );
  14111. delete props[ name ];
  14112. // Not quite $.extend, this won't overwrite existing keys.
  14113. // Reusing 'index' because we have the correct "name"
  14114. for ( index in value ) {
  14115. if ( !( index in props ) ) {
  14116. props[ index ] = value[ index ];
  14117. specialEasing[ index ] = easing;
  14118. }
  14119. }
  14120. } else {
  14121. specialEasing[ name ] = easing;
  14122. }
  14123. }
  14124. }
  14125. function Animation( elem, properties, options ) {
  14126. var result,
  14127. stopped,
  14128. index = 0,
  14129. length = Animation.prefilters.length,
  14130. deferred = jQuery.Deferred().always( function() {
  14131. // Don't match elem in the :animated selector
  14132. delete tick.elem;
  14133. } ),
  14134. tick = function() {
  14135. if ( stopped ) {
  14136. return false;
  14137. }
  14138. var currentTime = fxNow || createFxNow(),
  14139. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14140. // Support: Android 2.3 only
  14141. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14142. temp = remaining / animation.duration || 0,
  14143. percent = 1 - temp,
  14144. index = 0,
  14145. length = animation.tweens.length;
  14146. for ( ; index < length; index++ ) {
  14147. animation.tweens[ index ].run( percent );
  14148. }
  14149. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14150. // If there's more to do, yield
  14151. if ( percent < 1 && length ) {
  14152. return remaining;
  14153. }
  14154. // If this was an empty animation, synthesize a final progress notification
  14155. if ( !length ) {
  14156. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14157. }
  14158. // Resolve the animation and report its conclusion
  14159. deferred.resolveWith( elem, [ animation ] );
  14160. return false;
  14161. },
  14162. animation = deferred.promise( {
  14163. elem: elem,
  14164. props: jQuery.extend( {}, properties ),
  14165. opts: jQuery.extend( true, {
  14166. specialEasing: {},
  14167. easing: jQuery.easing._default
  14168. }, options ),
  14169. originalProperties: properties,
  14170. originalOptions: options,
  14171. startTime: fxNow || createFxNow(),
  14172. duration: options.duration,
  14173. tweens: [],
  14174. createTween: function( prop, end ) {
  14175. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14176. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14177. animation.tweens.push( tween );
  14178. return tween;
  14179. },
  14180. stop: function( gotoEnd ) {
  14181. var index = 0,
  14182. // If we are going to the end, we want to run all the tweens
  14183. // otherwise we skip this part
  14184. length = gotoEnd ? animation.tweens.length : 0;
  14185. if ( stopped ) {
  14186. return this;
  14187. }
  14188. stopped = true;
  14189. for ( ; index < length; index++ ) {
  14190. animation.tweens[ index ].run( 1 );
  14191. }
  14192. // Resolve when we played the last frame; otherwise, reject
  14193. if ( gotoEnd ) {
  14194. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14195. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14196. } else {
  14197. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14198. }
  14199. return this;
  14200. }
  14201. } ),
  14202. props = animation.props;
  14203. propFilter( props, animation.opts.specialEasing );
  14204. for ( ; index < length; index++ ) {
  14205. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14206. if ( result ) {
  14207. if ( isFunction( result.stop ) ) {
  14208. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14209. result.stop.bind( result );
  14210. }
  14211. return result;
  14212. }
  14213. }
  14214. jQuery.map( props, createTween, animation );
  14215. if ( isFunction( animation.opts.start ) ) {
  14216. animation.opts.start.call( elem, animation );
  14217. }
  14218. // Attach callbacks from options
  14219. animation
  14220. .progress( animation.opts.progress )
  14221. .done( animation.opts.done, animation.opts.complete )
  14222. .fail( animation.opts.fail )
  14223. .always( animation.opts.always );
  14224. jQuery.fx.timer(
  14225. jQuery.extend( tick, {
  14226. elem: elem,
  14227. anim: animation,
  14228. queue: animation.opts.queue
  14229. } )
  14230. );
  14231. return animation;
  14232. }
  14233. jQuery.Animation = jQuery.extend( Animation, {
  14234. tweeners: {
  14235. "*": [ function( prop, value ) {
  14236. var tween = this.createTween( prop, value );
  14237. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14238. return tween;
  14239. } ]
  14240. },
  14241. tweener: function( props, callback ) {
  14242. if ( isFunction( props ) ) {
  14243. callback = props;
  14244. props = [ "*" ];
  14245. } else {
  14246. props = props.match( rnothtmlwhite );
  14247. }
  14248. var prop,
  14249. index = 0,
  14250. length = props.length;
  14251. for ( ; index < length; index++ ) {
  14252. prop = props[ index ];
  14253. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14254. Animation.tweeners[ prop ].unshift( callback );
  14255. }
  14256. },
  14257. prefilters: [ defaultPrefilter ],
  14258. prefilter: function( callback, prepend ) {
  14259. if ( prepend ) {
  14260. Animation.prefilters.unshift( callback );
  14261. } else {
  14262. Animation.prefilters.push( callback );
  14263. }
  14264. }
  14265. } );
  14266. jQuery.speed = function( speed, easing, fn ) {
  14267. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14268. complete: fn || !fn && easing ||
  14269. isFunction( speed ) && speed,
  14270. duration: speed,
  14271. easing: fn && easing || easing && !isFunction( easing ) && easing
  14272. };
  14273. // Go to the end state if fx are off
  14274. if ( jQuery.fx.off ) {
  14275. opt.duration = 0;
  14276. } else {
  14277. if ( typeof opt.duration !== "number" ) {
  14278. if ( opt.duration in jQuery.fx.speeds ) {
  14279. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14280. } else {
  14281. opt.duration = jQuery.fx.speeds._default;
  14282. }
  14283. }
  14284. }
  14285. // Normalize opt.queue - true/undefined/null -> "fx"
  14286. if ( opt.queue == null || opt.queue === true ) {
  14287. opt.queue = "fx";
  14288. }
  14289. // Queueing
  14290. opt.old = opt.complete;
  14291. opt.complete = function() {
  14292. if ( isFunction( opt.old ) ) {
  14293. opt.old.call( this );
  14294. }
  14295. if ( opt.queue ) {
  14296. jQuery.dequeue( this, opt.queue );
  14297. }
  14298. };
  14299. return opt;
  14300. };
  14301. jQuery.fn.extend( {
  14302. fadeTo: function( speed, to, easing, callback ) {
  14303. // Show any hidden elements after setting opacity to 0
  14304. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14305. // Animate to the value specified
  14306. .end().animate( { opacity: to }, speed, easing, callback );
  14307. },
  14308. animate: function( prop, speed, easing, callback ) {
  14309. var empty = jQuery.isEmptyObject( prop ),
  14310. optall = jQuery.speed( speed, easing, callback ),
  14311. doAnimation = function() {
  14312. // Operate on a copy of prop so per-property easing won't be lost
  14313. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14314. // Empty animations, or finishing resolves immediately
  14315. if ( empty || dataPriv.get( this, "finish" ) ) {
  14316. anim.stop( true );
  14317. }
  14318. };
  14319. doAnimation.finish = doAnimation;
  14320. return empty || optall.queue === false ?
  14321. this.each( doAnimation ) :
  14322. this.queue( optall.queue, doAnimation );
  14323. },
  14324. stop: function( type, clearQueue, gotoEnd ) {
  14325. var stopQueue = function( hooks ) {
  14326. var stop = hooks.stop;
  14327. delete hooks.stop;
  14328. stop( gotoEnd );
  14329. };
  14330. if ( typeof type !== "string" ) {
  14331. gotoEnd = clearQueue;
  14332. clearQueue = type;
  14333. type = undefined;
  14334. }
  14335. if ( clearQueue && type !== false ) {
  14336. this.queue( type || "fx", [] );
  14337. }
  14338. return this.each( function() {
  14339. var dequeue = true,
  14340. index = type != null && type + "queueHooks",
  14341. timers = jQuery.timers,
  14342. data = dataPriv.get( this );
  14343. if ( index ) {
  14344. if ( data[ index ] && data[ index ].stop ) {
  14345. stopQueue( data[ index ] );
  14346. }
  14347. } else {
  14348. for ( index in data ) {
  14349. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14350. stopQueue( data[ index ] );
  14351. }
  14352. }
  14353. }
  14354. for ( index = timers.length; index--; ) {
  14355. if ( timers[ index ].elem === this &&
  14356. ( type == null || timers[ index ].queue === type ) ) {
  14357. timers[ index ].anim.stop( gotoEnd );
  14358. dequeue = false;
  14359. timers.splice( index, 1 );
  14360. }
  14361. }
  14362. // Start the next in the queue if the last step wasn't forced.
  14363. // Timers currently will call their complete callbacks, which
  14364. // will dequeue but only if they were gotoEnd.
  14365. if ( dequeue || !gotoEnd ) {
  14366. jQuery.dequeue( this, type );
  14367. }
  14368. } );
  14369. },
  14370. finish: function( type ) {
  14371. if ( type !== false ) {
  14372. type = type || "fx";
  14373. }
  14374. return this.each( function() {
  14375. var index,
  14376. data = dataPriv.get( this ),
  14377. queue = data[ type + "queue" ],
  14378. hooks = data[ type + "queueHooks" ],
  14379. timers = jQuery.timers,
  14380. length = queue ? queue.length : 0;
  14381. // Enable finishing flag on private data
  14382. data.finish = true;
  14383. // Empty the queue first
  14384. jQuery.queue( this, type, [] );
  14385. if ( hooks && hooks.stop ) {
  14386. hooks.stop.call( this, true );
  14387. }
  14388. // Look for any active animations, and finish them
  14389. for ( index = timers.length; index--; ) {
  14390. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14391. timers[ index ].anim.stop( true );
  14392. timers.splice( index, 1 );
  14393. }
  14394. }
  14395. // Look for any animations in the old queue and finish them
  14396. for ( index = 0; index < length; index++ ) {
  14397. if ( queue[ index ] && queue[ index ].finish ) {
  14398. queue[ index ].finish.call( this );
  14399. }
  14400. }
  14401. // Turn off finishing flag
  14402. delete data.finish;
  14403. } );
  14404. }
  14405. } );
  14406. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14407. var cssFn = jQuery.fn[ name ];
  14408. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14409. return speed == null || typeof speed === "boolean" ?
  14410. cssFn.apply( this, arguments ) :
  14411. this.animate( genFx( name, true ), speed, easing, callback );
  14412. };
  14413. } );
  14414. // Generate shortcuts for custom animations
  14415. jQuery.each( {
  14416. slideDown: genFx( "show" ),
  14417. slideUp: genFx( "hide" ),
  14418. slideToggle: genFx( "toggle" ),
  14419. fadeIn: { opacity: "show" },
  14420. fadeOut: { opacity: "hide" },
  14421. fadeToggle: { opacity: "toggle" }
  14422. }, function( name, props ) {
  14423. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14424. return this.animate( props, speed, easing, callback );
  14425. };
  14426. } );
  14427. jQuery.timers = [];
  14428. jQuery.fx.tick = function() {
  14429. var timer,
  14430. i = 0,
  14431. timers = jQuery.timers;
  14432. fxNow = Date.now();
  14433. for ( ; i < timers.length; i++ ) {
  14434. timer = timers[ i ];
  14435. // Run the timer and safely remove it when done (allowing for external removal)
  14436. if ( !timer() && timers[ i ] === timer ) {
  14437. timers.splice( i--, 1 );
  14438. }
  14439. }
  14440. if ( !timers.length ) {
  14441. jQuery.fx.stop();
  14442. }
  14443. fxNow = undefined;
  14444. };
  14445. jQuery.fx.timer = function( timer ) {
  14446. jQuery.timers.push( timer );
  14447. jQuery.fx.start();
  14448. };
  14449. jQuery.fx.interval = 13;
  14450. jQuery.fx.start = function() {
  14451. if ( inProgress ) {
  14452. return;
  14453. }
  14454. inProgress = true;
  14455. schedule();
  14456. };
  14457. jQuery.fx.stop = function() {
  14458. inProgress = null;
  14459. };
  14460. jQuery.fx.speeds = {
  14461. slow: 600,
  14462. fast: 200,
  14463. // Default speed
  14464. _default: 400
  14465. };
  14466. // Based off of the plugin by Clint Helfers, with permission.
  14467. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14468. jQuery.fn.delay = function( time, type ) {
  14469. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14470. type = type || "fx";
  14471. return this.queue( type, function( next, hooks ) {
  14472. var timeout = window.setTimeout( next, time );
  14473. hooks.stop = function() {
  14474. window.clearTimeout( timeout );
  14475. };
  14476. } );
  14477. };
  14478. ( function() {
  14479. var input = document.createElement( "input" ),
  14480. select = document.createElement( "select" ),
  14481. opt = select.appendChild( document.createElement( "option" ) );
  14482. input.type = "checkbox";
  14483. // Support: Android <=4.3 only
  14484. // Default value for a checkbox should be "on"
  14485. support.checkOn = input.value !== "";
  14486. // Support: IE <=11 only
  14487. // Must access selectedIndex to make default options select
  14488. support.optSelected = opt.selected;
  14489. // Support: IE <=11 only
  14490. // An input loses its value after becoming a radio
  14491. input = document.createElement( "input" );
  14492. input.value = "t";
  14493. input.type = "radio";
  14494. support.radioValue = input.value === "t";
  14495. } )();
  14496. var boolHook,
  14497. attrHandle = jQuery.expr.attrHandle;
  14498. jQuery.fn.extend( {
  14499. attr: function( name, value ) {
  14500. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14501. },
  14502. removeAttr: function( name ) {
  14503. return this.each( function() {
  14504. jQuery.removeAttr( this, name );
  14505. } );
  14506. }
  14507. } );
  14508. jQuery.extend( {
  14509. attr: function( elem, name, value ) {
  14510. var ret, hooks,
  14511. nType = elem.nodeType;
  14512. // Don't get/set attributes on text, comment and attribute nodes
  14513. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14514. return;
  14515. }
  14516. // Fallback to prop when attributes are not supported
  14517. if ( typeof elem.getAttribute === "undefined" ) {
  14518. return jQuery.prop( elem, name, value );
  14519. }
  14520. // Attribute hooks are determined by the lowercase version
  14521. // Grab necessary hook if one is defined
  14522. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14523. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14524. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14525. }
  14526. if ( value !== undefined ) {
  14527. if ( value === null ) {
  14528. jQuery.removeAttr( elem, name );
  14529. return;
  14530. }
  14531. if ( hooks && "set" in hooks &&
  14532. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14533. return ret;
  14534. }
  14535. elem.setAttribute( name, value + "" );
  14536. return value;
  14537. }
  14538. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14539. return ret;
  14540. }
  14541. ret = jQuery.find.attr( elem, name );
  14542. // Non-existent attributes return null, we normalize to undefined
  14543. return ret == null ? undefined : ret;
  14544. },
  14545. attrHooks: {
  14546. type: {
  14547. set: function( elem, value ) {
  14548. if ( !support.radioValue && value === "radio" &&
  14549. nodeName( elem, "input" ) ) {
  14550. var val = elem.value;
  14551. elem.setAttribute( "type", value );
  14552. if ( val ) {
  14553. elem.value = val;
  14554. }
  14555. return value;
  14556. }
  14557. }
  14558. }
  14559. },
  14560. removeAttr: function( elem, value ) {
  14561. var name,
  14562. i = 0,
  14563. // Attribute names can contain non-HTML whitespace characters
  14564. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14565. attrNames = value && value.match( rnothtmlwhite );
  14566. if ( attrNames && elem.nodeType === 1 ) {
  14567. while ( ( name = attrNames[ i++ ] ) ) {
  14568. elem.removeAttribute( name );
  14569. }
  14570. }
  14571. }
  14572. } );
  14573. // Hooks for boolean attributes
  14574. boolHook = {
  14575. set: function( elem, value, name ) {
  14576. if ( value === false ) {
  14577. // Remove boolean attributes when set to false
  14578. jQuery.removeAttr( elem, name );
  14579. } else {
  14580. elem.setAttribute( name, name );
  14581. }
  14582. return name;
  14583. }
  14584. };
  14585. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14586. var getter = attrHandle[ name ] || jQuery.find.attr;
  14587. attrHandle[ name ] = function( elem, name, isXML ) {
  14588. var ret, handle,
  14589. lowercaseName = name.toLowerCase();
  14590. if ( !isXML ) {
  14591. // Avoid an infinite loop by temporarily removing this function from the getter
  14592. handle = attrHandle[ lowercaseName ];
  14593. attrHandle[ lowercaseName ] = ret;
  14594. ret = getter( elem, name, isXML ) != null ?
  14595. lowercaseName :
  14596. null;
  14597. attrHandle[ lowercaseName ] = handle;
  14598. }
  14599. return ret;
  14600. };
  14601. } );
  14602. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14603. rclickable = /^(?:a|area)$/i;
  14604. jQuery.fn.extend( {
  14605. prop: function( name, value ) {
  14606. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14607. },
  14608. removeProp: function( name ) {
  14609. return this.each( function() {
  14610. delete this[ jQuery.propFix[ name ] || name ];
  14611. } );
  14612. }
  14613. } );
  14614. jQuery.extend( {
  14615. prop: function( elem, name, value ) {
  14616. var ret, hooks,
  14617. nType = elem.nodeType;
  14618. // Don't get/set properties on text, comment and attribute nodes
  14619. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14620. return;
  14621. }
  14622. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14623. // Fix name and attach hooks
  14624. name = jQuery.propFix[ name ] || name;
  14625. hooks = jQuery.propHooks[ name ];
  14626. }
  14627. if ( value !== undefined ) {
  14628. if ( hooks && "set" in hooks &&
  14629. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14630. return ret;
  14631. }
  14632. return ( elem[ name ] = value );
  14633. }
  14634. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14635. return ret;
  14636. }
  14637. return elem[ name ];
  14638. },
  14639. propHooks: {
  14640. tabIndex: {
  14641. get: function( elem ) {
  14642. // Support: IE <=9 - 11 only
  14643. // elem.tabIndex doesn't always return the
  14644. // correct value when it hasn't been explicitly set
  14645. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14646. // Use proper attribute retrieval(#12072)
  14647. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14648. if ( tabindex ) {
  14649. return parseInt( tabindex, 10 );
  14650. }
  14651. if (
  14652. rfocusable.test( elem.nodeName ) ||
  14653. rclickable.test( elem.nodeName ) &&
  14654. elem.href
  14655. ) {
  14656. return 0;
  14657. }
  14658. return -1;
  14659. }
  14660. }
  14661. },
  14662. propFix: {
  14663. "for": "htmlFor",
  14664. "class": "className"
  14665. }
  14666. } );
  14667. // Support: IE <=11 only
  14668. // Accessing the selectedIndex property
  14669. // forces the browser to respect setting selected
  14670. // on the option
  14671. // The getter ensures a default option is selected
  14672. // when in an optgroup
  14673. // eslint rule "no-unused-expressions" is disabled for this code
  14674. // since it considers such accessions noop
  14675. if ( !support.optSelected ) {
  14676. jQuery.propHooks.selected = {
  14677. get: function( elem ) {
  14678. /* eslint no-unused-expressions: "off" */
  14679. var parent = elem.parentNode;
  14680. if ( parent && parent.parentNode ) {
  14681. parent.parentNode.selectedIndex;
  14682. }
  14683. return null;
  14684. },
  14685. set: function( elem ) {
  14686. /* eslint no-unused-expressions: "off" */
  14687. var parent = elem.parentNode;
  14688. if ( parent ) {
  14689. parent.selectedIndex;
  14690. if ( parent.parentNode ) {
  14691. parent.parentNode.selectedIndex;
  14692. }
  14693. }
  14694. }
  14695. };
  14696. }
  14697. jQuery.each( [
  14698. "tabIndex",
  14699. "readOnly",
  14700. "maxLength",
  14701. "cellSpacing",
  14702. "cellPadding",
  14703. "rowSpan",
  14704. "colSpan",
  14705. "useMap",
  14706. "frameBorder",
  14707. "contentEditable"
  14708. ], function() {
  14709. jQuery.propFix[ this.toLowerCase() ] = this;
  14710. } );
  14711. // Strip and collapse whitespace according to HTML spec
  14712. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14713. function stripAndCollapse( value ) {
  14714. var tokens = value.match( rnothtmlwhite ) || [];
  14715. return tokens.join( " " );
  14716. }
  14717. function getClass( elem ) {
  14718. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14719. }
  14720. function classesToArray( value ) {
  14721. if ( Array.isArray( value ) ) {
  14722. return value;
  14723. }
  14724. if ( typeof value === "string" ) {
  14725. return value.match( rnothtmlwhite ) || [];
  14726. }
  14727. return [];
  14728. }
  14729. jQuery.fn.extend( {
  14730. addClass: function( value ) {
  14731. var classes, elem, cur, curValue, clazz, j, finalValue,
  14732. i = 0;
  14733. if ( isFunction( value ) ) {
  14734. return this.each( function( j ) {
  14735. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14736. } );
  14737. }
  14738. classes = classesToArray( value );
  14739. if ( classes.length ) {
  14740. while ( ( elem = this[ i++ ] ) ) {
  14741. curValue = getClass( elem );
  14742. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14743. if ( cur ) {
  14744. j = 0;
  14745. while ( ( clazz = classes[ j++ ] ) ) {
  14746. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14747. cur += clazz + " ";
  14748. }
  14749. }
  14750. // Only assign if different to avoid unneeded rendering.
  14751. finalValue = stripAndCollapse( cur );
  14752. if ( curValue !== finalValue ) {
  14753. elem.setAttribute( "class", finalValue );
  14754. }
  14755. }
  14756. }
  14757. }
  14758. return this;
  14759. },
  14760. removeClass: function( value ) {
  14761. var classes, elem, cur, curValue, clazz, j, finalValue,
  14762. i = 0;
  14763. if ( isFunction( value ) ) {
  14764. return this.each( function( j ) {
  14765. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14766. } );
  14767. }
  14768. if ( !arguments.length ) {
  14769. return this.attr( "class", "" );
  14770. }
  14771. classes = classesToArray( value );
  14772. if ( classes.length ) {
  14773. while ( ( elem = this[ i++ ] ) ) {
  14774. curValue = getClass( elem );
  14775. // This expression is here for better compressibility (see addClass)
  14776. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14777. if ( cur ) {
  14778. j = 0;
  14779. while ( ( clazz = classes[ j++ ] ) ) {
  14780. // Remove *all* instances
  14781. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14782. cur = cur.replace( " " + clazz + " ", " " );
  14783. }
  14784. }
  14785. // Only assign if different to avoid unneeded rendering.
  14786. finalValue = stripAndCollapse( cur );
  14787. if ( curValue !== finalValue ) {
  14788. elem.setAttribute( "class", finalValue );
  14789. }
  14790. }
  14791. }
  14792. }
  14793. return this;
  14794. },
  14795. toggleClass: function( value, stateVal ) {
  14796. var type = typeof value,
  14797. isValidValue = type === "string" || Array.isArray( value );
  14798. if ( typeof stateVal === "boolean" && isValidValue ) {
  14799. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14800. }
  14801. if ( isFunction( value ) ) {
  14802. return this.each( function( i ) {
  14803. jQuery( this ).toggleClass(
  14804. value.call( this, i, getClass( this ), stateVal ),
  14805. stateVal
  14806. );
  14807. } );
  14808. }
  14809. return this.each( function() {
  14810. var className, i, self, classNames;
  14811. if ( isValidValue ) {
  14812. // Toggle individual class names
  14813. i = 0;
  14814. self = jQuery( this );
  14815. classNames = classesToArray( value );
  14816. while ( ( className = classNames[ i++ ] ) ) {
  14817. // Check each className given, space separated list
  14818. if ( self.hasClass( className ) ) {
  14819. self.removeClass( className );
  14820. } else {
  14821. self.addClass( className );
  14822. }
  14823. }
  14824. // Toggle whole class name
  14825. } else if ( value === undefined || type === "boolean" ) {
  14826. className = getClass( this );
  14827. if ( className ) {
  14828. // Store className if set
  14829. dataPriv.set( this, "__className__", className );
  14830. }
  14831. // If the element has a class name or if we're passed `false`,
  14832. // then remove the whole classname (if there was one, the above saved it).
  14833. // Otherwise bring back whatever was previously saved (if anything),
  14834. // falling back to the empty string if nothing was stored.
  14835. if ( this.setAttribute ) {
  14836. this.setAttribute( "class",
  14837. className || value === false ?
  14838. "" :
  14839. dataPriv.get( this, "__className__" ) || ""
  14840. );
  14841. }
  14842. }
  14843. } );
  14844. },
  14845. hasClass: function( selector ) {
  14846. var className, elem,
  14847. i = 0;
  14848. className = " " + selector + " ";
  14849. while ( ( elem = this[ i++ ] ) ) {
  14850. if ( elem.nodeType === 1 &&
  14851. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14852. return true;
  14853. }
  14854. }
  14855. return false;
  14856. }
  14857. } );
  14858. var rreturn = /\r/g;
  14859. jQuery.fn.extend( {
  14860. val: function( value ) {
  14861. var hooks, ret, valueIsFunction,
  14862. elem = this[ 0 ];
  14863. if ( !arguments.length ) {
  14864. if ( elem ) {
  14865. hooks = jQuery.valHooks[ elem.type ] ||
  14866. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14867. if ( hooks &&
  14868. "get" in hooks &&
  14869. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14870. ) {
  14871. return ret;
  14872. }
  14873. ret = elem.value;
  14874. // Handle most common string cases
  14875. if ( typeof ret === "string" ) {
  14876. return ret.replace( rreturn, "" );
  14877. }
  14878. // Handle cases where value is null/undef or number
  14879. return ret == null ? "" : ret;
  14880. }
  14881. return;
  14882. }
  14883. valueIsFunction = isFunction( value );
  14884. return this.each( function( i ) {
  14885. var val;
  14886. if ( this.nodeType !== 1 ) {
  14887. return;
  14888. }
  14889. if ( valueIsFunction ) {
  14890. val = value.call( this, i, jQuery( this ).val() );
  14891. } else {
  14892. val = value;
  14893. }
  14894. // Treat null/undefined as ""; convert numbers to string
  14895. if ( val == null ) {
  14896. val = "";
  14897. } else if ( typeof val === "number" ) {
  14898. val += "";
  14899. } else if ( Array.isArray( val ) ) {
  14900. val = jQuery.map( val, function( value ) {
  14901. return value == null ? "" : value + "";
  14902. } );
  14903. }
  14904. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14905. // If set returns undefined, fall back to normal setting
  14906. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14907. this.value = val;
  14908. }
  14909. } );
  14910. }
  14911. } );
  14912. jQuery.extend( {
  14913. valHooks: {
  14914. option: {
  14915. get: function( elem ) {
  14916. var val = jQuery.find.attr( elem, "value" );
  14917. return val != null ?
  14918. val :
  14919. // Support: IE <=10 - 11 only
  14920. // option.text throws exceptions (#14686, #14858)
  14921. // Strip and collapse whitespace
  14922. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14923. stripAndCollapse( jQuery.text( elem ) );
  14924. }
  14925. },
  14926. select: {
  14927. get: function( elem ) {
  14928. var value, option, i,
  14929. options = elem.options,
  14930. index = elem.selectedIndex,
  14931. one = elem.type === "select-one",
  14932. values = one ? null : [],
  14933. max = one ? index + 1 : options.length;
  14934. if ( index < 0 ) {
  14935. i = max;
  14936. } else {
  14937. i = one ? index : 0;
  14938. }
  14939. // Loop through all the selected options
  14940. for ( ; i < max; i++ ) {
  14941. option = options[ i ];
  14942. // Support: IE <=9 only
  14943. // IE8-9 doesn't update selected after form reset (#2551)
  14944. if ( ( option.selected || i === index ) &&
  14945. // Don't return options that are disabled or in a disabled optgroup
  14946. !option.disabled &&
  14947. ( !option.parentNode.disabled ||
  14948. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14949. // Get the specific value for the option
  14950. value = jQuery( option ).val();
  14951. // We don't need an array for one selects
  14952. if ( one ) {
  14953. return value;
  14954. }
  14955. // Multi-Selects return an array
  14956. values.push( value );
  14957. }
  14958. }
  14959. return values;
  14960. },
  14961. set: function( elem, value ) {
  14962. var optionSet, option,
  14963. options = elem.options,
  14964. values = jQuery.makeArray( value ),
  14965. i = options.length;
  14966. while ( i-- ) {
  14967. option = options[ i ];
  14968. /* eslint-disable no-cond-assign */
  14969. if ( option.selected =
  14970. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14971. ) {
  14972. optionSet = true;
  14973. }
  14974. /* eslint-enable no-cond-assign */
  14975. }
  14976. // Force browsers to behave consistently when non-matching value is set
  14977. if ( !optionSet ) {
  14978. elem.selectedIndex = -1;
  14979. }
  14980. return values;
  14981. }
  14982. }
  14983. }
  14984. } );
  14985. // Radios and checkboxes getter/setter
  14986. jQuery.each( [ "radio", "checkbox" ], function() {
  14987. jQuery.valHooks[ this ] = {
  14988. set: function( elem, value ) {
  14989. if ( Array.isArray( value ) ) {
  14990. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14991. }
  14992. }
  14993. };
  14994. if ( !support.checkOn ) {
  14995. jQuery.valHooks[ this ].get = function( elem ) {
  14996. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  14997. };
  14998. }
  14999. } );
  15000. // Return jQuery for attributes-only inclusion
  15001. support.focusin = "onfocusin" in window;
  15002. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15003. stopPropagationCallback = function( e ) {
  15004. e.stopPropagation();
  15005. };
  15006. jQuery.extend( jQuery.event, {
  15007. trigger: function( event, data, elem, onlyHandlers ) {
  15008. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15009. eventPath = [ elem || document ],
  15010. type = hasOwn.call( event, "type" ) ? event.type : event,
  15011. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15012. cur = lastElement = tmp = elem = elem || document;
  15013. // Don't do events on text and comment nodes
  15014. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15015. return;
  15016. }
  15017. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15018. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15019. return;
  15020. }
  15021. if ( type.indexOf( "." ) > -1 ) {
  15022. // Namespaced trigger; create a regexp to match event type in handle()
  15023. namespaces = type.split( "." );
  15024. type = namespaces.shift();
  15025. namespaces.sort();
  15026. }
  15027. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15028. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15029. event = event[ jQuery.expando ] ?
  15030. event :
  15031. new jQuery.Event( type, typeof event === "object" && event );
  15032. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15033. event.isTrigger = onlyHandlers ? 2 : 3;
  15034. event.namespace = namespaces.join( "." );
  15035. event.rnamespace = event.namespace ?
  15036. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15037. null;
  15038. // Clean up the event in case it is being reused
  15039. event.result = undefined;
  15040. if ( !event.target ) {
  15041. event.target = elem;
  15042. }
  15043. // Clone any incoming data and prepend the event, creating the handler arg list
  15044. data = data == null ?
  15045. [ event ] :
  15046. jQuery.makeArray( data, [ event ] );
  15047. // Allow special events to draw outside the lines
  15048. special = jQuery.event.special[ type ] || {};
  15049. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15050. return;
  15051. }
  15052. // Determine event propagation path in advance, per W3C events spec (#9951)
  15053. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15054. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15055. bubbleType = special.delegateType || type;
  15056. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15057. cur = cur.parentNode;
  15058. }
  15059. for ( ; cur; cur = cur.parentNode ) {
  15060. eventPath.push( cur );
  15061. tmp = cur;
  15062. }
  15063. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15064. if ( tmp === ( elem.ownerDocument || document ) ) {
  15065. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15066. }
  15067. }
  15068. // Fire handlers on the event path
  15069. i = 0;
  15070. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15071. lastElement = cur;
  15072. event.type = i > 1 ?
  15073. bubbleType :
  15074. special.bindType || type;
  15075. // jQuery handler
  15076. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15077. dataPriv.get( cur, "handle" );
  15078. if ( handle ) {
  15079. handle.apply( cur, data );
  15080. }
  15081. // Native handler
  15082. handle = ontype && cur[ ontype ];
  15083. if ( handle && handle.apply && acceptData( cur ) ) {
  15084. event.result = handle.apply( cur, data );
  15085. if ( event.result === false ) {
  15086. event.preventDefault();
  15087. }
  15088. }
  15089. }
  15090. event.type = type;
  15091. // If nobody prevented the default action, do it now
  15092. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15093. if ( ( !special._default ||
  15094. special._default.apply( eventPath.pop(), data ) === false ) &&
  15095. acceptData( elem ) ) {
  15096. // Call a native DOM method on the target with the same name as the event.
  15097. // Don't do default actions on window, that's where global variables be (#6170)
  15098. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15099. // Don't re-trigger an onFOO event when we call its FOO() method
  15100. tmp = elem[ ontype ];
  15101. if ( tmp ) {
  15102. elem[ ontype ] = null;
  15103. }
  15104. // Prevent re-triggering of the same event, since we already bubbled it above
  15105. jQuery.event.triggered = type;
  15106. if ( event.isPropagationStopped() ) {
  15107. lastElement.addEventListener( type, stopPropagationCallback );
  15108. }
  15109. elem[ type ]();
  15110. if ( event.isPropagationStopped() ) {
  15111. lastElement.removeEventListener( type, stopPropagationCallback );
  15112. }
  15113. jQuery.event.triggered = undefined;
  15114. if ( tmp ) {
  15115. elem[ ontype ] = tmp;
  15116. }
  15117. }
  15118. }
  15119. }
  15120. return event.result;
  15121. },
  15122. // Piggyback on a donor event to simulate a different one
  15123. // Used only for `focus(in | out)` events
  15124. simulate: function( type, elem, event ) {
  15125. var e = jQuery.extend(
  15126. new jQuery.Event(),
  15127. event,
  15128. {
  15129. type: type,
  15130. isSimulated: true
  15131. }
  15132. );
  15133. jQuery.event.trigger( e, null, elem );
  15134. }
  15135. } );
  15136. jQuery.fn.extend( {
  15137. trigger: function( type, data ) {
  15138. return this.each( function() {
  15139. jQuery.event.trigger( type, data, this );
  15140. } );
  15141. },
  15142. triggerHandler: function( type, data ) {
  15143. var elem = this[ 0 ];
  15144. if ( elem ) {
  15145. return jQuery.event.trigger( type, data, elem, true );
  15146. }
  15147. }
  15148. } );
  15149. // Support: Firefox <=44
  15150. // Firefox doesn't have focus(in | out) events
  15151. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15152. //
  15153. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15154. // focus(in | out) events fire after focus & blur events,
  15155. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15156. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15157. if ( !support.focusin ) {
  15158. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15159. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15160. var handler = function( event ) {
  15161. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15162. };
  15163. jQuery.event.special[ fix ] = {
  15164. setup: function() {
  15165. var doc = this.ownerDocument || this,
  15166. attaches = dataPriv.access( doc, fix );
  15167. if ( !attaches ) {
  15168. doc.addEventListener( orig, handler, true );
  15169. }
  15170. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15171. },
  15172. teardown: function() {
  15173. var doc = this.ownerDocument || this,
  15174. attaches = dataPriv.access( doc, fix ) - 1;
  15175. if ( !attaches ) {
  15176. doc.removeEventListener( orig, handler, true );
  15177. dataPriv.remove( doc, fix );
  15178. } else {
  15179. dataPriv.access( doc, fix, attaches );
  15180. }
  15181. }
  15182. };
  15183. } );
  15184. }
  15185. var location = window.location;
  15186. var nonce = Date.now();
  15187. var rquery = ( /\?/ );
  15188. // Cross-browser xml parsing
  15189. jQuery.parseXML = function( data ) {
  15190. var xml;
  15191. if ( !data || typeof data !== "string" ) {
  15192. return null;
  15193. }
  15194. // Support: IE 9 - 11 only
  15195. // IE throws on parseFromString with invalid input.
  15196. try {
  15197. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15198. } catch ( e ) {
  15199. xml = undefined;
  15200. }
  15201. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15202. jQuery.error( "Invalid XML: " + data );
  15203. }
  15204. return xml;
  15205. };
  15206. var
  15207. rbracket = /\[\]$/,
  15208. rCRLF = /\r?\n/g,
  15209. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15210. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15211. function buildParams( prefix, obj, traditional, add ) {
  15212. var name;
  15213. if ( Array.isArray( obj ) ) {
  15214. // Serialize array item.
  15215. jQuery.each( obj, function( i, v ) {
  15216. if ( traditional || rbracket.test( prefix ) ) {
  15217. // Treat each array item as a scalar.
  15218. add( prefix, v );
  15219. } else {
  15220. // Item is non-scalar (array or object), encode its numeric index.
  15221. buildParams(
  15222. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15223. v,
  15224. traditional,
  15225. add
  15226. );
  15227. }
  15228. } );
  15229. } else if ( !traditional && toType( obj ) === "object" ) {
  15230. // Serialize object item.
  15231. for ( name in obj ) {
  15232. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15233. }
  15234. } else {
  15235. // Serialize scalar item.
  15236. add( prefix, obj );
  15237. }
  15238. }
  15239. // Serialize an array of form elements or a set of
  15240. // key/values into a query string
  15241. jQuery.param = function( a, traditional ) {
  15242. var prefix,
  15243. s = [],
  15244. add = function( key, valueOrFunction ) {
  15245. // If value is a function, invoke it and use its return value
  15246. var value = isFunction( valueOrFunction ) ?
  15247. valueOrFunction() :
  15248. valueOrFunction;
  15249. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15250. encodeURIComponent( value == null ? "" : value );
  15251. };
  15252. if ( a == null ) {
  15253. return "";
  15254. }
  15255. // If an array was passed in, assume that it is an array of form elements.
  15256. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15257. // Serialize the form elements
  15258. jQuery.each( a, function() {
  15259. add( this.name, this.value );
  15260. } );
  15261. } else {
  15262. // If traditional, encode the "old" way (the way 1.3.2 or older
  15263. // did it), otherwise encode params recursively.
  15264. for ( prefix in a ) {
  15265. buildParams( prefix, a[ prefix ], traditional, add );
  15266. }
  15267. }
  15268. // Return the resulting serialization
  15269. return s.join( "&" );
  15270. };
  15271. jQuery.fn.extend( {
  15272. serialize: function() {
  15273. return jQuery.param( this.serializeArray() );
  15274. },
  15275. serializeArray: function() {
  15276. return this.map( function() {
  15277. // Can add propHook for "elements" to filter or add form elements
  15278. var elements = jQuery.prop( this, "elements" );
  15279. return elements ? jQuery.makeArray( elements ) : this;
  15280. } )
  15281. .filter( function() {
  15282. var type = this.type;
  15283. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15284. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15285. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15286. ( this.checked || !rcheckableType.test( type ) );
  15287. } )
  15288. .map( function( i, elem ) {
  15289. var val = jQuery( this ).val();
  15290. if ( val == null ) {
  15291. return null;
  15292. }
  15293. if ( Array.isArray( val ) ) {
  15294. return jQuery.map( val, function( val ) {
  15295. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15296. } );
  15297. }
  15298. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15299. } ).get();
  15300. }
  15301. } );
  15302. var
  15303. r20 = /%20/g,
  15304. rhash = /#.*$/,
  15305. rantiCache = /([?&])_=[^&]*/,
  15306. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15307. // #7653, #8125, #8152: local protocol detection
  15308. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15309. rnoContent = /^(?:GET|HEAD)$/,
  15310. rprotocol = /^\/\//,
  15311. /* Prefilters
  15312. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15313. * 2) These are called:
  15314. * - BEFORE asking for a transport
  15315. * - AFTER param serialization (s.data is a string if s.processData is true)
  15316. * 3) key is the dataType
  15317. * 4) the catchall symbol "*" can be used
  15318. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15319. */
  15320. prefilters = {},
  15321. /* Transports bindings
  15322. * 1) key is the dataType
  15323. * 2) the catchall symbol "*" can be used
  15324. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15325. */
  15326. transports = {},
  15327. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15328. allTypes = "*/".concat( "*" ),
  15329. // Anchor tag for parsing the document origin
  15330. originAnchor = document.createElement( "a" );
  15331. originAnchor.href = location.href;
  15332. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15333. function addToPrefiltersOrTransports( structure ) {
  15334. // dataTypeExpression is optional and defaults to "*"
  15335. return function( dataTypeExpression, func ) {
  15336. if ( typeof dataTypeExpression !== "string" ) {
  15337. func = dataTypeExpression;
  15338. dataTypeExpression = "*";
  15339. }
  15340. var dataType,
  15341. i = 0,
  15342. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15343. if ( isFunction( func ) ) {
  15344. // For each dataType in the dataTypeExpression
  15345. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15346. // Prepend if requested
  15347. if ( dataType[ 0 ] === "+" ) {
  15348. dataType = dataType.slice( 1 ) || "*";
  15349. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15350. // Otherwise append
  15351. } else {
  15352. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15353. }
  15354. }
  15355. }
  15356. };
  15357. }
  15358. // Base inspection function for prefilters and transports
  15359. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15360. var inspected = {},
  15361. seekingTransport = ( structure === transports );
  15362. function inspect( dataType ) {
  15363. var selected;
  15364. inspected[ dataType ] = true;
  15365. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15366. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15367. if ( typeof dataTypeOrTransport === "string" &&
  15368. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15369. options.dataTypes.unshift( dataTypeOrTransport );
  15370. inspect( dataTypeOrTransport );
  15371. return false;
  15372. } else if ( seekingTransport ) {
  15373. return !( selected = dataTypeOrTransport );
  15374. }
  15375. } );
  15376. return selected;
  15377. }
  15378. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15379. }
  15380. // A special extend for ajax options
  15381. // that takes "flat" options (not to be deep extended)
  15382. // Fixes #9887
  15383. function ajaxExtend( target, src ) {
  15384. var key, deep,
  15385. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15386. for ( key in src ) {
  15387. if ( src[ key ] !== undefined ) {
  15388. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15389. }
  15390. }
  15391. if ( deep ) {
  15392. jQuery.extend( true, target, deep );
  15393. }
  15394. return target;
  15395. }
  15396. /* Handles responses to an ajax request:
  15397. * - finds the right dataType (mediates between content-type and expected dataType)
  15398. * - returns the corresponding response
  15399. */
  15400. function ajaxHandleResponses( s, jqXHR, responses ) {
  15401. var ct, type, finalDataType, firstDataType,
  15402. contents = s.contents,
  15403. dataTypes = s.dataTypes;
  15404. // Remove auto dataType and get content-type in the process
  15405. while ( dataTypes[ 0 ] === "*" ) {
  15406. dataTypes.shift();
  15407. if ( ct === undefined ) {
  15408. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15409. }
  15410. }
  15411. // Check if we're dealing with a known content-type
  15412. if ( ct ) {
  15413. for ( type in contents ) {
  15414. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15415. dataTypes.unshift( type );
  15416. break;
  15417. }
  15418. }
  15419. }
  15420. // Check to see if we have a response for the expected dataType
  15421. if ( dataTypes[ 0 ] in responses ) {
  15422. finalDataType = dataTypes[ 0 ];
  15423. } else {
  15424. // Try convertible dataTypes
  15425. for ( type in responses ) {
  15426. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15427. finalDataType = type;
  15428. break;
  15429. }
  15430. if ( !firstDataType ) {
  15431. firstDataType = type;
  15432. }
  15433. }
  15434. // Or just use first one
  15435. finalDataType = finalDataType || firstDataType;
  15436. }
  15437. // If we found a dataType
  15438. // We add the dataType to the list if needed
  15439. // and return the corresponding response
  15440. if ( finalDataType ) {
  15441. if ( finalDataType !== dataTypes[ 0 ] ) {
  15442. dataTypes.unshift( finalDataType );
  15443. }
  15444. return responses[ finalDataType ];
  15445. }
  15446. }
  15447. /* Chain conversions given the request and the original response
  15448. * Also sets the responseXXX fields on the jqXHR instance
  15449. */
  15450. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15451. var conv2, current, conv, tmp, prev,
  15452. converters = {},
  15453. // Work with a copy of dataTypes in case we need to modify it for conversion
  15454. dataTypes = s.dataTypes.slice();
  15455. // Create converters map with lowercased keys
  15456. if ( dataTypes[ 1 ] ) {
  15457. for ( conv in s.converters ) {
  15458. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15459. }
  15460. }
  15461. current = dataTypes.shift();
  15462. // Convert to each sequential dataType
  15463. while ( current ) {
  15464. if ( s.responseFields[ current ] ) {
  15465. jqXHR[ s.responseFields[ current ] ] = response;
  15466. }
  15467. // Apply the dataFilter if provided
  15468. if ( !prev && isSuccess && s.dataFilter ) {
  15469. response = s.dataFilter( response, s.dataType );
  15470. }
  15471. prev = current;
  15472. current = dataTypes.shift();
  15473. if ( current ) {
  15474. // There's only work to do if current dataType is non-auto
  15475. if ( current === "*" ) {
  15476. current = prev;
  15477. // Convert response if prev dataType is non-auto and differs from current
  15478. } else if ( prev !== "*" && prev !== current ) {
  15479. // Seek a direct converter
  15480. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15481. // If none found, seek a pair
  15482. if ( !conv ) {
  15483. for ( conv2 in converters ) {
  15484. // If conv2 outputs current
  15485. tmp = conv2.split( " " );
  15486. if ( tmp[ 1 ] === current ) {
  15487. // If prev can be converted to accepted input
  15488. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15489. converters[ "* " + tmp[ 0 ] ];
  15490. if ( conv ) {
  15491. // Condense equivalence converters
  15492. if ( conv === true ) {
  15493. conv = converters[ conv2 ];
  15494. // Otherwise, insert the intermediate dataType
  15495. } else if ( converters[ conv2 ] !== true ) {
  15496. current = tmp[ 0 ];
  15497. dataTypes.unshift( tmp[ 1 ] );
  15498. }
  15499. break;
  15500. }
  15501. }
  15502. }
  15503. }
  15504. // Apply converter (if not an equivalence)
  15505. if ( conv !== true ) {
  15506. // Unless errors are allowed to bubble, catch and return them
  15507. if ( conv && s.throws ) {
  15508. response = conv( response );
  15509. } else {
  15510. try {
  15511. response = conv( response );
  15512. } catch ( e ) {
  15513. return {
  15514. state: "parsererror",
  15515. error: conv ? e : "No conversion from " + prev + " to " + current
  15516. };
  15517. }
  15518. }
  15519. }
  15520. }
  15521. }
  15522. }
  15523. return { state: "success", data: response };
  15524. }
  15525. jQuery.extend( {
  15526. // Counter for holding the number of active queries
  15527. active: 0,
  15528. // Last-Modified header cache for next request
  15529. lastModified: {},
  15530. etag: {},
  15531. ajaxSettings: {
  15532. url: location.href,
  15533. type: "GET",
  15534. isLocal: rlocalProtocol.test( location.protocol ),
  15535. global: true,
  15536. processData: true,
  15537. async: true,
  15538. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15539. /*
  15540. timeout: 0,
  15541. data: null,
  15542. dataType: null,
  15543. username: null,
  15544. password: null,
  15545. cache: null,
  15546. throws: false,
  15547. traditional: false,
  15548. headers: {},
  15549. */
  15550. accepts: {
  15551. "*": allTypes,
  15552. text: "text/plain",
  15553. html: "text/html",
  15554. xml: "application/xml, text/xml",
  15555. json: "application/json, text/javascript"
  15556. },
  15557. contents: {
  15558. xml: /\bxml\b/,
  15559. html: /\bhtml/,
  15560. json: /\bjson\b/
  15561. },
  15562. responseFields: {
  15563. xml: "responseXML",
  15564. text: "responseText",
  15565. json: "responseJSON"
  15566. },
  15567. // Data converters
  15568. // Keys separate source (or catchall "*") and destination types with a single space
  15569. converters: {
  15570. // Convert anything to text
  15571. "* text": String,
  15572. // Text to html (true = no transformation)
  15573. "text html": true,
  15574. // Evaluate text as a json expression
  15575. "text json": JSON.parse,
  15576. // Parse text as xml
  15577. "text xml": jQuery.parseXML
  15578. },
  15579. // For options that shouldn't be deep extended:
  15580. // you can add your own custom options here if
  15581. // and when you create one that shouldn't be
  15582. // deep extended (see ajaxExtend)
  15583. flatOptions: {
  15584. url: true,
  15585. context: true
  15586. }
  15587. },
  15588. // Creates a full fledged settings object into target
  15589. // with both ajaxSettings and settings fields.
  15590. // If target is omitted, writes into ajaxSettings.
  15591. ajaxSetup: function( target, settings ) {
  15592. return settings ?
  15593. // Building a settings object
  15594. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15595. // Extending ajaxSettings
  15596. ajaxExtend( jQuery.ajaxSettings, target );
  15597. },
  15598. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15599. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15600. // Main method
  15601. ajax: function( url, options ) {
  15602. // If url is an object, simulate pre-1.5 signature
  15603. if ( typeof url === "object" ) {
  15604. options = url;
  15605. url = undefined;
  15606. }
  15607. // Force options to be an object
  15608. options = options || {};
  15609. var transport,
  15610. // URL without anti-cache param
  15611. cacheURL,
  15612. // Response headers
  15613. responseHeadersString,
  15614. responseHeaders,
  15615. // timeout handle
  15616. timeoutTimer,
  15617. // Url cleanup var
  15618. urlAnchor,
  15619. // Request state (becomes false upon send and true upon completion)
  15620. completed,
  15621. // To know if global events are to be dispatched
  15622. fireGlobals,
  15623. // Loop variable
  15624. i,
  15625. // uncached part of the url
  15626. uncached,
  15627. // Create the final options object
  15628. s = jQuery.ajaxSetup( {}, options ),
  15629. // Callbacks context
  15630. callbackContext = s.context || s,
  15631. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15632. globalEventContext = s.context &&
  15633. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15634. jQuery( callbackContext ) :
  15635. jQuery.event,
  15636. // Deferreds
  15637. deferred = jQuery.Deferred(),
  15638. completeDeferred = jQuery.Callbacks( "once memory" ),
  15639. // Status-dependent callbacks
  15640. statusCode = s.statusCode || {},
  15641. // Headers (they are sent all at once)
  15642. requestHeaders = {},
  15643. requestHeadersNames = {},
  15644. // Default abort message
  15645. strAbort = "canceled",
  15646. // Fake xhr
  15647. jqXHR = {
  15648. readyState: 0,
  15649. // Builds headers hashtable if needed
  15650. getResponseHeader: function( key ) {
  15651. var match;
  15652. if ( completed ) {
  15653. if ( !responseHeaders ) {
  15654. responseHeaders = {};
  15655. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15656. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15657. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15658. .concat( match[ 2 ] );
  15659. }
  15660. }
  15661. match = responseHeaders[ key.toLowerCase() + " " ];
  15662. }
  15663. return match == null ? null : match.join( ", " );
  15664. },
  15665. // Raw string
  15666. getAllResponseHeaders: function() {
  15667. return completed ? responseHeadersString : null;
  15668. },
  15669. // Caches the header
  15670. setRequestHeader: function( name, value ) {
  15671. if ( completed == null ) {
  15672. name = requestHeadersNames[ name.toLowerCase() ] =
  15673. requestHeadersNames[ name.toLowerCase() ] || name;
  15674. requestHeaders[ name ] = value;
  15675. }
  15676. return this;
  15677. },
  15678. // Overrides response content-type header
  15679. overrideMimeType: function( type ) {
  15680. if ( completed == null ) {
  15681. s.mimeType = type;
  15682. }
  15683. return this;
  15684. },
  15685. // Status-dependent callbacks
  15686. statusCode: function( map ) {
  15687. var code;
  15688. if ( map ) {
  15689. if ( completed ) {
  15690. // Execute the appropriate callbacks
  15691. jqXHR.always( map[ jqXHR.status ] );
  15692. } else {
  15693. // Lazy-add the new callbacks in a way that preserves old ones
  15694. for ( code in map ) {
  15695. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15696. }
  15697. }
  15698. }
  15699. return this;
  15700. },
  15701. // Cancel the request
  15702. abort: function( statusText ) {
  15703. var finalText = statusText || strAbort;
  15704. if ( transport ) {
  15705. transport.abort( finalText );
  15706. }
  15707. done( 0, finalText );
  15708. return this;
  15709. }
  15710. };
  15711. // Attach deferreds
  15712. deferred.promise( jqXHR );
  15713. // Add protocol if not provided (prefilters might expect it)
  15714. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15715. // We also use the url parameter if available
  15716. s.url = ( ( url || s.url || location.href ) + "" )
  15717. .replace( rprotocol, location.protocol + "//" );
  15718. // Alias method option to type as per ticket #12004
  15719. s.type = options.method || options.type || s.method || s.type;
  15720. // Extract dataTypes list
  15721. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15722. // A cross-domain request is in order when the origin doesn't match the current origin.
  15723. if ( s.crossDomain == null ) {
  15724. urlAnchor = document.createElement( "a" );
  15725. // Support: IE <=8 - 11, Edge 12 - 15
  15726. // IE throws exception on accessing the href property if url is malformed,
  15727. // e.g. http://example.com:80x/
  15728. try {
  15729. urlAnchor.href = s.url;
  15730. // Support: IE <=8 - 11 only
  15731. // Anchor's host property isn't correctly set when s.url is relative
  15732. urlAnchor.href = urlAnchor.href;
  15733. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15734. urlAnchor.protocol + "//" + urlAnchor.host;
  15735. } catch ( e ) {
  15736. // If there is an error parsing the URL, assume it is crossDomain,
  15737. // it can be rejected by the transport if it is invalid
  15738. s.crossDomain = true;
  15739. }
  15740. }
  15741. // Convert data if not already a string
  15742. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15743. s.data = jQuery.param( s.data, s.traditional );
  15744. }
  15745. // Apply prefilters
  15746. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15747. // If request was aborted inside a prefilter, stop there
  15748. if ( completed ) {
  15749. return jqXHR;
  15750. }
  15751. // We can fire global events as of now if asked to
  15752. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15753. fireGlobals = jQuery.event && s.global;
  15754. // Watch for a new set of requests
  15755. if ( fireGlobals && jQuery.active++ === 0 ) {
  15756. jQuery.event.trigger( "ajaxStart" );
  15757. }
  15758. // Uppercase the type
  15759. s.type = s.type.toUpperCase();
  15760. // Determine if request has content
  15761. s.hasContent = !rnoContent.test( s.type );
  15762. // Save the URL in case we're toying with the If-Modified-Since
  15763. // and/or If-None-Match header later on
  15764. // Remove hash to simplify url manipulation
  15765. cacheURL = s.url.replace( rhash, "" );
  15766. // More options handling for requests with no content
  15767. if ( !s.hasContent ) {
  15768. // Remember the hash so we can put it back
  15769. uncached = s.url.slice( cacheURL.length );
  15770. // If data is available and should be processed, append data to url
  15771. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15772. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15773. // #9682: remove data so that it's not used in an eventual retry
  15774. delete s.data;
  15775. }
  15776. // Add or update anti-cache param if needed
  15777. if ( s.cache === false ) {
  15778. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15779. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15780. }
  15781. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15782. s.url = cacheURL + uncached;
  15783. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15784. } else if ( s.data && s.processData &&
  15785. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15786. s.data = s.data.replace( r20, "+" );
  15787. }
  15788. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15789. if ( s.ifModified ) {
  15790. if ( jQuery.lastModified[ cacheURL ] ) {
  15791. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15792. }
  15793. if ( jQuery.etag[ cacheURL ] ) {
  15794. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15795. }
  15796. }
  15797. // Set the correct header, if data is being sent
  15798. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15799. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15800. }
  15801. // Set the Accepts header for the server, depending on the dataType
  15802. jqXHR.setRequestHeader(
  15803. "Accept",
  15804. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15805. s.accepts[ s.dataTypes[ 0 ] ] +
  15806. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15807. s.accepts[ "*" ]
  15808. );
  15809. // Check for headers option
  15810. for ( i in s.headers ) {
  15811. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15812. }
  15813. // Allow custom headers/mimetypes and early abort
  15814. if ( s.beforeSend &&
  15815. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15816. // Abort if not done already and return
  15817. return jqXHR.abort();
  15818. }
  15819. // Aborting is no longer a cancellation
  15820. strAbort = "abort";
  15821. // Install callbacks on deferreds
  15822. completeDeferred.add( s.complete );
  15823. jqXHR.done( s.success );
  15824. jqXHR.fail( s.error );
  15825. // Get transport
  15826. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15827. // If no transport, we auto-abort
  15828. if ( !transport ) {
  15829. done( -1, "No Transport" );
  15830. } else {
  15831. jqXHR.readyState = 1;
  15832. // Send global event
  15833. if ( fireGlobals ) {
  15834. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15835. }
  15836. // If request was aborted inside ajaxSend, stop there
  15837. if ( completed ) {
  15838. return jqXHR;
  15839. }
  15840. // Timeout
  15841. if ( s.async && s.timeout > 0 ) {
  15842. timeoutTimer = window.setTimeout( function() {
  15843. jqXHR.abort( "timeout" );
  15844. }, s.timeout );
  15845. }
  15846. try {
  15847. completed = false;
  15848. transport.send( requestHeaders, done );
  15849. } catch ( e ) {
  15850. // Rethrow post-completion exceptions
  15851. if ( completed ) {
  15852. throw e;
  15853. }
  15854. // Propagate others as results
  15855. done( -1, e );
  15856. }
  15857. }
  15858. // Callback for when everything is done
  15859. function done( status, nativeStatusText, responses, headers ) {
  15860. var isSuccess, success, error, response, modified,
  15861. statusText = nativeStatusText;
  15862. // Ignore repeat invocations
  15863. if ( completed ) {
  15864. return;
  15865. }
  15866. completed = true;
  15867. // Clear timeout if it exists
  15868. if ( timeoutTimer ) {
  15869. window.clearTimeout( timeoutTimer );
  15870. }
  15871. // Dereference transport for early garbage collection
  15872. // (no matter how long the jqXHR object will be used)
  15873. transport = undefined;
  15874. // Cache response headers
  15875. responseHeadersString = headers || "";
  15876. // Set readyState
  15877. jqXHR.readyState = status > 0 ? 4 : 0;
  15878. // Determine if successful
  15879. isSuccess = status >= 200 && status < 300 || status === 304;
  15880. // Get response data
  15881. if ( responses ) {
  15882. response = ajaxHandleResponses( s, jqXHR, responses );
  15883. }
  15884. // Convert no matter what (that way responseXXX fields are always set)
  15885. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15886. // If successful, handle type chaining
  15887. if ( isSuccess ) {
  15888. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15889. if ( s.ifModified ) {
  15890. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15891. if ( modified ) {
  15892. jQuery.lastModified[ cacheURL ] = modified;
  15893. }
  15894. modified = jqXHR.getResponseHeader( "etag" );
  15895. if ( modified ) {
  15896. jQuery.etag[ cacheURL ] = modified;
  15897. }
  15898. }
  15899. // if no content
  15900. if ( status === 204 || s.type === "HEAD" ) {
  15901. statusText = "nocontent";
  15902. // if not modified
  15903. } else if ( status === 304 ) {
  15904. statusText = "notmodified";
  15905. // If we have data, let's convert it
  15906. } else {
  15907. statusText = response.state;
  15908. success = response.data;
  15909. error = response.error;
  15910. isSuccess = !error;
  15911. }
  15912. } else {
  15913. // Extract error from statusText and normalize for non-aborts
  15914. error = statusText;
  15915. if ( status || !statusText ) {
  15916. statusText = "error";
  15917. if ( status < 0 ) {
  15918. status = 0;
  15919. }
  15920. }
  15921. }
  15922. // Set data for the fake xhr object
  15923. jqXHR.status = status;
  15924. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15925. // Success/Error
  15926. if ( isSuccess ) {
  15927. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15928. } else {
  15929. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15930. }
  15931. // Status-dependent callbacks
  15932. jqXHR.statusCode( statusCode );
  15933. statusCode = undefined;
  15934. if ( fireGlobals ) {
  15935. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15936. [ jqXHR, s, isSuccess ? success : error ] );
  15937. }
  15938. // Complete
  15939. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15940. if ( fireGlobals ) {
  15941. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15942. // Handle the global AJAX counter
  15943. if ( !( --jQuery.active ) ) {
  15944. jQuery.event.trigger( "ajaxStop" );
  15945. }
  15946. }
  15947. }
  15948. return jqXHR;
  15949. },
  15950. getJSON: function( url, data, callback ) {
  15951. return jQuery.get( url, data, callback, "json" );
  15952. },
  15953. getScript: function( url, callback ) {
  15954. return jQuery.get( url, undefined, callback, "script" );
  15955. }
  15956. } );
  15957. jQuery.each( [ "get", "post" ], function( i, method ) {
  15958. jQuery[ method ] = function( url, data, callback, type ) {
  15959. // Shift arguments if data argument was omitted
  15960. if ( isFunction( data ) ) {
  15961. type = type || callback;
  15962. callback = data;
  15963. data = undefined;
  15964. }
  15965. // The url can be an options object (which then must have .url)
  15966. return jQuery.ajax( jQuery.extend( {
  15967. url: url,
  15968. type: method,
  15969. dataType: type,
  15970. data: data,
  15971. success: callback
  15972. }, jQuery.isPlainObject( url ) && url ) );
  15973. };
  15974. } );
  15975. jQuery._evalUrl = function( url, options ) {
  15976. return jQuery.ajax( {
  15977. url: url,
  15978. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15979. type: "GET",
  15980. dataType: "script",
  15981. cache: true,
  15982. async: false,
  15983. global: false,
  15984. // Only evaluate the response if it is successful (gh-4126)
  15985. // dataFilter is not invoked for failure responses, so using it instead
  15986. // of the default converter is kludgy but it works.
  15987. converters: {
  15988. "text script": function() {}
  15989. },
  15990. dataFilter: function( response ) {
  15991. jQuery.globalEval( response, options );
  15992. }
  15993. } );
  15994. };
  15995. jQuery.fn.extend( {
  15996. wrapAll: function( html ) {
  15997. var wrap;
  15998. if ( this[ 0 ] ) {
  15999. if ( isFunction( html ) ) {
  16000. html = html.call( this[ 0 ] );
  16001. }
  16002. // The elements to wrap the target around
  16003. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16004. if ( this[ 0 ].parentNode ) {
  16005. wrap.insertBefore( this[ 0 ] );
  16006. }
  16007. wrap.map( function() {
  16008. var elem = this;
  16009. while ( elem.firstElementChild ) {
  16010. elem = elem.firstElementChild;
  16011. }
  16012. return elem;
  16013. } ).append( this );
  16014. }
  16015. return this;
  16016. },
  16017. wrapInner: function( html ) {
  16018. if ( isFunction( html ) ) {
  16019. return this.each( function( i ) {
  16020. jQuery( this ).wrapInner( html.call( this, i ) );
  16021. } );
  16022. }
  16023. return this.each( function() {
  16024. var self = jQuery( this ),
  16025. contents = self.contents();
  16026. if ( contents.length ) {
  16027. contents.wrapAll( html );
  16028. } else {
  16029. self.append( html );
  16030. }
  16031. } );
  16032. },
  16033. wrap: function( html ) {
  16034. var htmlIsFunction = isFunction( html );
  16035. return this.each( function( i ) {
  16036. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16037. } );
  16038. },
  16039. unwrap: function( selector ) {
  16040. this.parent( selector ).not( "body" ).each( function() {
  16041. jQuery( this ).replaceWith( this.childNodes );
  16042. } );
  16043. return this;
  16044. }
  16045. } );
  16046. jQuery.expr.pseudos.hidden = function( elem ) {
  16047. return !jQuery.expr.pseudos.visible( elem );
  16048. };
  16049. jQuery.expr.pseudos.visible = function( elem ) {
  16050. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16051. };
  16052. jQuery.ajaxSettings.xhr = function() {
  16053. try {
  16054. return new window.XMLHttpRequest();
  16055. } catch ( e ) {}
  16056. };
  16057. var xhrSuccessStatus = {
  16058. // File protocol always yields status code 0, assume 200
  16059. 0: 200,
  16060. // Support: IE <=9 only
  16061. // #1450: sometimes IE returns 1223 when it should be 204
  16062. 1223: 204
  16063. },
  16064. xhrSupported = jQuery.ajaxSettings.xhr();
  16065. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16066. support.ajax = xhrSupported = !!xhrSupported;
  16067. jQuery.ajaxTransport( function( options ) {
  16068. var callback, errorCallback;
  16069. // Cross domain only allowed if supported through XMLHttpRequest
  16070. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16071. return {
  16072. send: function( headers, complete ) {
  16073. var i,
  16074. xhr = options.xhr();
  16075. xhr.open(
  16076. options.type,
  16077. options.url,
  16078. options.async,
  16079. options.username,
  16080. options.password
  16081. );
  16082. // Apply custom fields if provided
  16083. if ( options.xhrFields ) {
  16084. for ( i in options.xhrFields ) {
  16085. xhr[ i ] = options.xhrFields[ i ];
  16086. }
  16087. }
  16088. // Override mime type if needed
  16089. if ( options.mimeType && xhr.overrideMimeType ) {
  16090. xhr.overrideMimeType( options.mimeType );
  16091. }
  16092. // X-Requested-With header
  16093. // For cross-domain requests, seeing as conditions for a preflight are
  16094. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16095. // (it can always be set on a per-request basis or even using ajaxSetup)
  16096. // For same-domain requests, won't change header if already provided.
  16097. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16098. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16099. }
  16100. // Set headers
  16101. for ( i in headers ) {
  16102. xhr.setRequestHeader( i, headers[ i ] );
  16103. }
  16104. // Callback
  16105. callback = function( type ) {
  16106. return function() {
  16107. if ( callback ) {
  16108. callback = errorCallback = xhr.onload =
  16109. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16110. xhr.onreadystatechange = null;
  16111. if ( type === "abort" ) {
  16112. xhr.abort();
  16113. } else if ( type === "error" ) {
  16114. // Support: IE <=9 only
  16115. // On a manual native abort, IE9 throws
  16116. // errors on any property access that is not readyState
  16117. if ( typeof xhr.status !== "number" ) {
  16118. complete( 0, "error" );
  16119. } else {
  16120. complete(
  16121. // File: protocol always yields status 0; see #8605, #14207
  16122. xhr.status,
  16123. xhr.statusText
  16124. );
  16125. }
  16126. } else {
  16127. complete(
  16128. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16129. xhr.statusText,
  16130. // Support: IE <=9 only
  16131. // IE9 has no XHR2 but throws on binary (trac-11426)
  16132. // For XHR2 non-text, let the caller handle it (gh-2498)
  16133. ( xhr.responseType || "text" ) !== "text" ||
  16134. typeof xhr.responseText !== "string" ?
  16135. { binary: xhr.response } :
  16136. { text: xhr.responseText },
  16137. xhr.getAllResponseHeaders()
  16138. );
  16139. }
  16140. }
  16141. };
  16142. };
  16143. // Listen to events
  16144. xhr.onload = callback();
  16145. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16146. // Support: IE 9 only
  16147. // Use onreadystatechange to replace onabort
  16148. // to handle uncaught aborts
  16149. if ( xhr.onabort !== undefined ) {
  16150. xhr.onabort = errorCallback;
  16151. } else {
  16152. xhr.onreadystatechange = function() {
  16153. // Check readyState before timeout as it changes
  16154. if ( xhr.readyState === 4 ) {
  16155. // Allow onerror to be called first,
  16156. // but that will not handle a native abort
  16157. // Also, save errorCallback to a variable
  16158. // as xhr.onerror cannot be accessed
  16159. window.setTimeout( function() {
  16160. if ( callback ) {
  16161. errorCallback();
  16162. }
  16163. } );
  16164. }
  16165. };
  16166. }
  16167. // Create the abort callback
  16168. callback = callback( "abort" );
  16169. try {
  16170. // Do send the request (this may raise an exception)
  16171. xhr.send( options.hasContent && options.data || null );
  16172. } catch ( e ) {
  16173. // #14683: Only rethrow if this hasn't been notified as an error yet
  16174. if ( callback ) {
  16175. throw e;
  16176. }
  16177. }
  16178. },
  16179. abort: function() {
  16180. if ( callback ) {
  16181. callback();
  16182. }
  16183. }
  16184. };
  16185. }
  16186. } );
  16187. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16188. jQuery.ajaxPrefilter( function( s ) {
  16189. if ( s.crossDomain ) {
  16190. s.contents.script = false;
  16191. }
  16192. } );
  16193. // Install script dataType
  16194. jQuery.ajaxSetup( {
  16195. accepts: {
  16196. script: "text/javascript, application/javascript, " +
  16197. "application/ecmascript, application/x-ecmascript"
  16198. },
  16199. contents: {
  16200. script: /\b(?:java|ecma)script\b/
  16201. },
  16202. converters: {
  16203. "text script": function( text ) {
  16204. jQuery.globalEval( text );
  16205. return text;
  16206. }
  16207. }
  16208. } );
  16209. // Handle cache's special case and crossDomain
  16210. jQuery.ajaxPrefilter( "script", function( s ) {
  16211. if ( s.cache === undefined ) {
  16212. s.cache = false;
  16213. }
  16214. if ( s.crossDomain ) {
  16215. s.type = "GET";
  16216. }
  16217. } );
  16218. // Bind script tag hack transport
  16219. jQuery.ajaxTransport( "script", function( s ) {
  16220. // This transport only deals with cross domain or forced-by-attrs requests
  16221. if ( s.crossDomain || s.scriptAttrs ) {
  16222. var script, callback;
  16223. return {
  16224. send: function( _, complete ) {
  16225. script = jQuery( "<script>" )
  16226. .attr( s.scriptAttrs || {} )
  16227. .prop( { charset: s.scriptCharset, src: s.url } )
  16228. .on( "load error", callback = function( evt ) {
  16229. script.remove();
  16230. callback = null;
  16231. if ( evt ) {
  16232. complete( evt.type === "error" ? 404 : 200, evt.type );
  16233. }
  16234. } );
  16235. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16236. document.head.appendChild( script[ 0 ] );
  16237. },
  16238. abort: function() {
  16239. if ( callback ) {
  16240. callback();
  16241. }
  16242. }
  16243. };
  16244. }
  16245. } );
  16246. var oldCallbacks = [],
  16247. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16248. // Default jsonp settings
  16249. jQuery.ajaxSetup( {
  16250. jsonp: "callback",
  16251. jsonpCallback: function() {
  16252. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16253. this[ callback ] = true;
  16254. return callback;
  16255. }
  16256. } );
  16257. // Detect, normalize options and install callbacks for jsonp requests
  16258. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16259. var callbackName, overwritten, responseContainer,
  16260. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16261. "url" :
  16262. typeof s.data === "string" &&
  16263. ( s.contentType || "" )
  16264. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16265. rjsonp.test( s.data ) && "data"
  16266. );
  16267. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16268. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16269. // Get callback name, remembering preexisting value associated with it
  16270. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16271. s.jsonpCallback() :
  16272. s.jsonpCallback;
  16273. // Insert callback into url or form data
  16274. if ( jsonProp ) {
  16275. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16276. } else if ( s.jsonp !== false ) {
  16277. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16278. }
  16279. // Use data converter to retrieve json after script execution
  16280. s.converters[ "script json" ] = function() {
  16281. if ( !responseContainer ) {
  16282. jQuery.error( callbackName + " was not called" );
  16283. }
  16284. return responseContainer[ 0 ];
  16285. };
  16286. // Force json dataType
  16287. s.dataTypes[ 0 ] = "json";
  16288. // Install callback
  16289. overwritten = window[ callbackName ];
  16290. window[ callbackName ] = function() {
  16291. responseContainer = arguments;
  16292. };
  16293. // Clean-up function (fires after converters)
  16294. jqXHR.always( function() {
  16295. // If previous value didn't exist - remove it
  16296. if ( overwritten === undefined ) {
  16297. jQuery( window ).removeProp( callbackName );
  16298. // Otherwise restore preexisting value
  16299. } else {
  16300. window[ callbackName ] = overwritten;
  16301. }
  16302. // Save back as free
  16303. if ( s[ callbackName ] ) {
  16304. // Make sure that re-using the options doesn't screw things around
  16305. s.jsonpCallback = originalSettings.jsonpCallback;
  16306. // Save the callback name for future use
  16307. oldCallbacks.push( callbackName );
  16308. }
  16309. // Call if it was a function and we have a response
  16310. if ( responseContainer && isFunction( overwritten ) ) {
  16311. overwritten( responseContainer[ 0 ] );
  16312. }
  16313. responseContainer = overwritten = undefined;
  16314. } );
  16315. // Delegate to script
  16316. return "script";
  16317. }
  16318. } );
  16319. // Support: Safari 8 only
  16320. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16321. // collapse sibling forms: the second one becomes a child of the first one.
  16322. // Because of that, this security measure has to be disabled in Safari 8.
  16323. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16324. support.createHTMLDocument = ( function() {
  16325. var body = document.implementation.createHTMLDocument( "" ).body;
  16326. body.innerHTML = "<form></form><form></form>";
  16327. return body.childNodes.length === 2;
  16328. } )();
  16329. // Argument "data" should be string of html
  16330. // context (optional): If specified, the fragment will be created in this context,
  16331. // defaults to document
  16332. // keepScripts (optional): If true, will include scripts passed in the html string
  16333. jQuery.parseHTML = function( data, context, keepScripts ) {
  16334. if ( typeof data !== "string" ) {
  16335. return [];
  16336. }
  16337. if ( typeof context === "boolean" ) {
  16338. keepScripts = context;
  16339. context = false;
  16340. }
  16341. var base, parsed, scripts;
  16342. if ( !context ) {
  16343. // Stop scripts or inline event handlers from being executed immediately
  16344. // by using document.implementation
  16345. if ( support.createHTMLDocument ) {
  16346. context = document.implementation.createHTMLDocument( "" );
  16347. // Set the base href for the created document
  16348. // so any parsed elements with URLs
  16349. // are based on the document's URL (gh-2965)
  16350. base = context.createElement( "base" );
  16351. base.href = document.location.href;
  16352. context.head.appendChild( base );
  16353. } else {
  16354. context = document;
  16355. }
  16356. }
  16357. parsed = rsingleTag.exec( data );
  16358. scripts = !keepScripts && [];
  16359. // Single tag
  16360. if ( parsed ) {
  16361. return [ context.createElement( parsed[ 1 ] ) ];
  16362. }
  16363. parsed = buildFragment( [ data ], context, scripts );
  16364. if ( scripts && scripts.length ) {
  16365. jQuery( scripts ).remove();
  16366. }
  16367. return jQuery.merge( [], parsed.childNodes );
  16368. };
  16369. /**
  16370. * Load a url into a page
  16371. */
  16372. jQuery.fn.load = function( url, params, callback ) {
  16373. var selector, type, response,
  16374. self = this,
  16375. off = url.indexOf( " " );
  16376. if ( off > -1 ) {
  16377. selector = stripAndCollapse( url.slice( off ) );
  16378. url = url.slice( 0, off );
  16379. }
  16380. // If it's a function
  16381. if ( isFunction( params ) ) {
  16382. // We assume that it's the callback
  16383. callback = params;
  16384. params = undefined;
  16385. // Otherwise, build a param string
  16386. } else if ( params && typeof params === "object" ) {
  16387. type = "POST";
  16388. }
  16389. // If we have elements to modify, make the request
  16390. if ( self.length > 0 ) {
  16391. jQuery.ajax( {
  16392. url: url,
  16393. // If "type" variable is undefined, then "GET" method will be used.
  16394. // Make value of this field explicit since
  16395. // user can override it through ajaxSetup method
  16396. type: type || "GET",
  16397. dataType: "html",
  16398. data: params
  16399. } ).done( function( responseText ) {
  16400. // Save response for use in complete callback
  16401. response = arguments;
  16402. self.html( selector ?
  16403. // If a selector was specified, locate the right elements in a dummy div
  16404. // Exclude scripts to avoid IE 'Permission Denied' errors
  16405. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16406. // Otherwise use the full result
  16407. responseText );
  16408. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16409. // but they are ignored because response was set above.
  16410. // If it fails, this function gets "jqXHR", "status", "error"
  16411. } ).always( callback && function( jqXHR, status ) {
  16412. self.each( function() {
  16413. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16414. } );
  16415. } );
  16416. }
  16417. return this;
  16418. };
  16419. // Attach a bunch of functions for handling common AJAX events
  16420. jQuery.each( [
  16421. "ajaxStart",
  16422. "ajaxStop",
  16423. "ajaxComplete",
  16424. "ajaxError",
  16425. "ajaxSuccess",
  16426. "ajaxSend"
  16427. ], function( i, type ) {
  16428. jQuery.fn[ type ] = function( fn ) {
  16429. return this.on( type, fn );
  16430. };
  16431. } );
  16432. jQuery.expr.pseudos.animated = function( elem ) {
  16433. return jQuery.grep( jQuery.timers, function( fn ) {
  16434. return elem === fn.elem;
  16435. } ).length;
  16436. };
  16437. jQuery.offset = {
  16438. setOffset: function( elem, options, i ) {
  16439. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16440. position = jQuery.css( elem, "position" ),
  16441. curElem = jQuery( elem ),
  16442. props = {};
  16443. // Set position first, in-case top/left are set even on static elem
  16444. if ( position === "static" ) {
  16445. elem.style.position = "relative";
  16446. }
  16447. curOffset = curElem.offset();
  16448. curCSSTop = jQuery.css( elem, "top" );
  16449. curCSSLeft = jQuery.css( elem, "left" );
  16450. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16451. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16452. // Need to be able to calculate position if either
  16453. // top or left is auto and position is either absolute or fixed
  16454. if ( calculatePosition ) {
  16455. curPosition = curElem.position();
  16456. curTop = curPosition.top;
  16457. curLeft = curPosition.left;
  16458. } else {
  16459. curTop = parseFloat( curCSSTop ) || 0;
  16460. curLeft = parseFloat( curCSSLeft ) || 0;
  16461. }
  16462. if ( isFunction( options ) ) {
  16463. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16464. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16465. }
  16466. if ( options.top != null ) {
  16467. props.top = ( options.top - curOffset.top ) + curTop;
  16468. }
  16469. if ( options.left != null ) {
  16470. props.left = ( options.left - curOffset.left ) + curLeft;
  16471. }
  16472. if ( "using" in options ) {
  16473. options.using.call( elem, props );
  16474. } else {
  16475. curElem.css( props );
  16476. }
  16477. }
  16478. };
  16479. jQuery.fn.extend( {
  16480. // offset() relates an element's border box to the document origin
  16481. offset: function( options ) {
  16482. // Preserve chaining for setter
  16483. if ( arguments.length ) {
  16484. return options === undefined ?
  16485. this :
  16486. this.each( function( i ) {
  16487. jQuery.offset.setOffset( this, options, i );
  16488. } );
  16489. }
  16490. var rect, win,
  16491. elem = this[ 0 ];
  16492. if ( !elem ) {
  16493. return;
  16494. }
  16495. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16496. // Support: IE <=11 only
  16497. // Running getBoundingClientRect on a
  16498. // disconnected node in IE throws an error
  16499. if ( !elem.getClientRects().length ) {
  16500. return { top: 0, left: 0 };
  16501. }
  16502. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16503. rect = elem.getBoundingClientRect();
  16504. win = elem.ownerDocument.defaultView;
  16505. return {
  16506. top: rect.top + win.pageYOffset,
  16507. left: rect.left + win.pageXOffset
  16508. };
  16509. },
  16510. // position() relates an element's margin box to its offset parent's padding box
  16511. // This corresponds to the behavior of CSS absolute positioning
  16512. position: function() {
  16513. if ( !this[ 0 ] ) {
  16514. return;
  16515. }
  16516. var offsetParent, offset, doc,
  16517. elem = this[ 0 ],
  16518. parentOffset = { top: 0, left: 0 };
  16519. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16520. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16521. // Assume position:fixed implies availability of getBoundingClientRect
  16522. offset = elem.getBoundingClientRect();
  16523. } else {
  16524. offset = this.offset();
  16525. // Account for the *real* offset parent, which can be the document or its root element
  16526. // when a statically positioned element is identified
  16527. doc = elem.ownerDocument;
  16528. offsetParent = elem.offsetParent || doc.documentElement;
  16529. while ( offsetParent &&
  16530. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16531. jQuery.css( offsetParent, "position" ) === "static" ) {
  16532. offsetParent = offsetParent.parentNode;
  16533. }
  16534. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16535. // Incorporate borders into its offset, since they are outside its content origin
  16536. parentOffset = jQuery( offsetParent ).offset();
  16537. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16538. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16539. }
  16540. }
  16541. // Subtract parent offsets and element margins
  16542. return {
  16543. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16544. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16545. };
  16546. },
  16547. // This method will return documentElement in the following cases:
  16548. // 1) For the element inside the iframe without offsetParent, this method will return
  16549. // documentElement of the parent window
  16550. // 2) For the hidden or detached element
  16551. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16552. //
  16553. // but those exceptions were never presented as a real life use-cases
  16554. // and might be considered as more preferable results.
  16555. //
  16556. // This logic, however, is not guaranteed and can change at any point in the future
  16557. offsetParent: function() {
  16558. return this.map( function() {
  16559. var offsetParent = this.offsetParent;
  16560. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16561. offsetParent = offsetParent.offsetParent;
  16562. }
  16563. return offsetParent || documentElement;
  16564. } );
  16565. }
  16566. } );
  16567. // Create scrollLeft and scrollTop methods
  16568. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16569. var top = "pageYOffset" === prop;
  16570. jQuery.fn[ method ] = function( val ) {
  16571. return access( this, function( elem, method, val ) {
  16572. // Coalesce documents and windows
  16573. var win;
  16574. if ( isWindow( elem ) ) {
  16575. win = elem;
  16576. } else if ( elem.nodeType === 9 ) {
  16577. win = elem.defaultView;
  16578. }
  16579. if ( val === undefined ) {
  16580. return win ? win[ prop ] : elem[ method ];
  16581. }
  16582. if ( win ) {
  16583. win.scrollTo(
  16584. !top ? val : win.pageXOffset,
  16585. top ? val : win.pageYOffset
  16586. );
  16587. } else {
  16588. elem[ method ] = val;
  16589. }
  16590. }, method, val, arguments.length );
  16591. };
  16592. } );
  16593. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16594. // Add the top/left cssHooks using jQuery.fn.position
  16595. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16596. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16597. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16598. // rather than make the css module depend on the offset module, just check for it here
  16599. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16600. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16601. function( elem, computed ) {
  16602. if ( computed ) {
  16603. computed = curCSS( elem, prop );
  16604. // If curCSS returns percentage, fallback to offset
  16605. return rnumnonpx.test( computed ) ?
  16606. jQuery( elem ).position()[ prop ] + "px" :
  16607. computed;
  16608. }
  16609. }
  16610. );
  16611. } );
  16612. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16613. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16614. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16615. function( defaultExtra, funcName ) {
  16616. // Margin is only for outerHeight, outerWidth
  16617. jQuery.fn[ funcName ] = function( margin, value ) {
  16618. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16619. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16620. return access( this, function( elem, type, value ) {
  16621. var doc;
  16622. if ( isWindow( elem ) ) {
  16623. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16624. return funcName.indexOf( "outer" ) === 0 ?
  16625. elem[ "inner" + name ] :
  16626. elem.document.documentElement[ "client" + name ];
  16627. }
  16628. // Get document width or height
  16629. if ( elem.nodeType === 9 ) {
  16630. doc = elem.documentElement;
  16631. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16632. // whichever is greatest
  16633. return Math.max(
  16634. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16635. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16636. doc[ "client" + name ]
  16637. );
  16638. }
  16639. return value === undefined ?
  16640. // Get width or height on the element, requesting but not forcing parseFloat
  16641. jQuery.css( elem, type, extra ) :
  16642. // Set width or height on the element
  16643. jQuery.style( elem, type, value, extra );
  16644. }, type, chainable ? margin : undefined, chainable );
  16645. };
  16646. } );
  16647. } );
  16648. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16649. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16650. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16651. function( i, name ) {
  16652. // Handle event binding
  16653. jQuery.fn[ name ] = function( data, fn ) {
  16654. return arguments.length > 0 ?
  16655. this.on( name, null, data, fn ) :
  16656. this.trigger( name );
  16657. };
  16658. } );
  16659. jQuery.fn.extend( {
  16660. hover: function( fnOver, fnOut ) {
  16661. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16662. }
  16663. } );
  16664. jQuery.fn.extend( {
  16665. bind: function( types, data, fn ) {
  16666. return this.on( types, null, data, fn );
  16667. },
  16668. unbind: function( types, fn ) {
  16669. return this.off( types, null, fn );
  16670. },
  16671. delegate: function( selector, types, data, fn ) {
  16672. return this.on( types, selector, data, fn );
  16673. },
  16674. undelegate: function( selector, types, fn ) {
  16675. // ( namespace ) or ( selector, types [, fn] )
  16676. return arguments.length === 1 ?
  16677. this.off( selector, "**" ) :
  16678. this.off( types, selector || "**", fn );
  16679. }
  16680. } );
  16681. // Bind a function to a context, optionally partially applying any
  16682. // arguments.
  16683. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16684. // However, it is not slated for removal any time soon
  16685. jQuery.proxy = function( fn, context ) {
  16686. var tmp, args, proxy;
  16687. if ( typeof context === "string" ) {
  16688. tmp = fn[ context ];
  16689. context = fn;
  16690. fn = tmp;
  16691. }
  16692. // Quick check to determine if target is callable, in the spec
  16693. // this throws a TypeError, but we will just return undefined.
  16694. if ( !isFunction( fn ) ) {
  16695. return undefined;
  16696. }
  16697. // Simulated bind
  16698. args = slice.call( arguments, 2 );
  16699. proxy = function() {
  16700. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16701. };
  16702. // Set the guid of unique handler to the same of original handler, so it can be removed
  16703. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16704. return proxy;
  16705. };
  16706. jQuery.holdReady = function( hold ) {
  16707. if ( hold ) {
  16708. jQuery.readyWait++;
  16709. } else {
  16710. jQuery.ready( true );
  16711. }
  16712. };
  16713. jQuery.isArray = Array.isArray;
  16714. jQuery.parseJSON = JSON.parse;
  16715. jQuery.nodeName = nodeName;
  16716. jQuery.isFunction = isFunction;
  16717. jQuery.isWindow = isWindow;
  16718. jQuery.camelCase = camelCase;
  16719. jQuery.type = toType;
  16720. jQuery.now = Date.now;
  16721. jQuery.isNumeric = function( obj ) {
  16722. // As of jQuery 3.0, isNumeric is limited to
  16723. // strings and numbers (primitives or objects)
  16724. // that can be coerced to finite numbers (gh-2662)
  16725. var type = jQuery.type( obj );
  16726. return ( type === "number" || type === "string" ) &&
  16727. // parseFloat NaNs numeric-cast false positives ("")
  16728. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16729. // subtraction forces infinities to NaN
  16730. !isNaN( obj - parseFloat( obj ) );
  16731. };
  16732. // Register as a named AMD module, since jQuery can be concatenated with other
  16733. // files that may use define, but not via a proper concatenation script that
  16734. // understands anonymous AMD modules. A named AMD is safest and most robust
  16735. // way to register. Lowercase jquery is used because AMD module names are
  16736. // derived from file names, and jQuery is normally delivered in a lowercase
  16737. // file name. Do this after creating the global so that if an AMD module wants
  16738. // to call noConflict to hide this version of jQuery, it will work.
  16739. // Note that for maximum portability, libraries that are not jQuery should
  16740. // declare themselves as anonymous modules, and avoid setting a global if an
  16741. // AMD loader is present. jQuery is a special case. For more information, see
  16742. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16743. if ( true ) {
  16744. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16745. return jQuery;
  16746. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16747. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16748. }
  16749. var
  16750. // Map over jQuery in case of overwrite
  16751. _jQuery = window.jQuery,
  16752. // Map over the $ in case of overwrite
  16753. _$ = window.$;
  16754. jQuery.noConflict = function( deep ) {
  16755. if ( window.$ === jQuery ) {
  16756. window.$ = _$;
  16757. }
  16758. if ( deep && window.jQuery === jQuery ) {
  16759. window.jQuery = _jQuery;
  16760. }
  16761. return jQuery;
  16762. };
  16763. // Expose jQuery and $ identifiers, even in AMD
  16764. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16765. // and CommonJS for browser emulators (#13566)
  16766. if ( !noGlobal ) {
  16767. window.jQuery = window.$ = jQuery;
  16768. }
  16769. return jQuery;
  16770. } );
  16771. /***/ }),
  16772. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16773. /*!************************************************!*\
  16774. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16775. \************************************************/
  16776. /*! exports provided: default */
  16777. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16778. "use strict";
  16779. __webpack_require__.r(__webpack_exports__);
  16780. var classCallCheck = function (instance, Constructor) {
  16781. if (!(instance instanceof Constructor)) {
  16782. throw new TypeError("Cannot call a class as a function");
  16783. }
  16784. };
  16785. var createClass = function () {
  16786. function defineProperties(target, props) {
  16787. for (var i = 0; i < props.length; i++) {
  16788. var descriptor = props[i];
  16789. descriptor.enumerable = descriptor.enumerable || false;
  16790. descriptor.configurable = true;
  16791. if ("value" in descriptor) descriptor.writable = true;
  16792. Object.defineProperty(target, descriptor.key, descriptor);
  16793. }
  16794. }
  16795. return function (Constructor, protoProps, staticProps) {
  16796. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16797. if (staticProps) defineProperties(Constructor, staticProps);
  16798. return Constructor;
  16799. };
  16800. }();
  16801. var _extends = Object.assign || function (target) {
  16802. for (var i = 1; i < arguments.length; i++) {
  16803. var source = arguments[i];
  16804. for (var key in source) {
  16805. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16806. target[key] = source[key];
  16807. }
  16808. }
  16809. }
  16810. return target;
  16811. };
  16812. var inherits = function (subClass, superClass) {
  16813. if (typeof superClass !== "function" && superClass !== null) {
  16814. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16815. }
  16816. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16817. constructor: {
  16818. value: subClass,
  16819. enumerable: false,
  16820. writable: true,
  16821. configurable: true
  16822. }
  16823. });
  16824. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16825. };
  16826. var possibleConstructorReturn = function (self, call) {
  16827. if (!self) {
  16828. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16829. }
  16830. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16831. };
  16832. var Connector = function () {
  16833. /**
  16834. * Create a new class instance.
  16835. */
  16836. function Connector(options) {
  16837. classCallCheck(this, Connector);
  16838. /**
  16839. * Default connector options.
  16840. */
  16841. this._defaultOptions = {
  16842. auth: {
  16843. headers: {}
  16844. },
  16845. authEndpoint: '/broadcasting/auth',
  16846. broadcaster: 'pusher',
  16847. csrfToken: null,
  16848. host: null,
  16849. key: null,
  16850. namespace: 'App.Events'
  16851. };
  16852. this.setOptions(options);
  16853. this.connect();
  16854. }
  16855. /**
  16856. * Merge the custom options with the defaults.
  16857. */
  16858. createClass(Connector, [{
  16859. key: 'setOptions',
  16860. value: function setOptions(options) {
  16861. this.options = _extends(this._defaultOptions, options);
  16862. if (this.csrfToken()) {
  16863. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16864. }
  16865. return options;
  16866. }
  16867. /**
  16868. * Extract the CSRF token from the page.
  16869. */
  16870. }, {
  16871. key: 'csrfToken',
  16872. value: function csrfToken() {
  16873. var selector = void 0;
  16874. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16875. return window['Laravel'].csrfToken;
  16876. } else if (this.options.csrfToken) {
  16877. return this.options.csrfToken;
  16878. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16879. return selector.getAttribute('content');
  16880. }
  16881. return null;
  16882. }
  16883. }]);
  16884. return Connector;
  16885. }();
  16886. /**
  16887. * This class represents a basic channel.
  16888. */
  16889. var Channel = function () {
  16890. function Channel() {
  16891. classCallCheck(this, Channel);
  16892. }
  16893. createClass(Channel, [{
  16894. key: 'listenForWhisper',
  16895. /**
  16896. * Listen for a whisper event on the channel instance.
  16897. */
  16898. value: function listenForWhisper(event, callback) {
  16899. return this.listen('.client-' + event, callback);
  16900. }
  16901. /**
  16902. * Listen for an event on the channel instance.
  16903. */
  16904. }, {
  16905. key: 'notification',
  16906. value: function notification(callback) {
  16907. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16908. }
  16909. /**
  16910. * Stop listening for a whispser event on the channel instance.
  16911. */
  16912. }, {
  16913. key: 'stopListeningForWhisper',
  16914. value: function stopListeningForWhisper(event) {
  16915. return this.stopListening('.client-' + event);
  16916. }
  16917. }]);
  16918. return Channel;
  16919. }();
  16920. /**
  16921. * Event name formatter
  16922. */
  16923. var EventFormatter = function () {
  16924. /**
  16925. * Create a new class instance.
  16926. */
  16927. function EventFormatter(namespace) {
  16928. classCallCheck(this, EventFormatter);
  16929. this.setNamespace(namespace);
  16930. }
  16931. /**
  16932. * Format the given event name.
  16933. */
  16934. createClass(EventFormatter, [{
  16935. key: 'format',
  16936. value: function format(event) {
  16937. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16938. return event.substr(1);
  16939. } else if (this.namespace) {
  16940. event = this.namespace + '.' + event;
  16941. }
  16942. return event.replace(/\./g, '\\');
  16943. }
  16944. /**
  16945. * Set the event namespace.
  16946. */
  16947. }, {
  16948. key: 'setNamespace',
  16949. value: function setNamespace(value) {
  16950. this.namespace = value;
  16951. }
  16952. }]);
  16953. return EventFormatter;
  16954. }();
  16955. /**
  16956. * This class represents a Pusher channel.
  16957. */
  16958. var PusherChannel = function (_Channel) {
  16959. inherits(PusherChannel, _Channel);
  16960. /**
  16961. * Create a new class instance.
  16962. */
  16963. function PusherChannel(pusher, name, options) {
  16964. classCallCheck(this, PusherChannel);
  16965. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16966. _this.name = name;
  16967. _this.pusher = pusher;
  16968. _this.options = options;
  16969. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16970. _this.subscribe();
  16971. return _this;
  16972. }
  16973. /**
  16974. * Subscribe to a Pusher channel.
  16975. */
  16976. createClass(PusherChannel, [{
  16977. key: 'subscribe',
  16978. value: function subscribe() {
  16979. this.subscription = this.pusher.subscribe(this.name);
  16980. }
  16981. /**
  16982. * Unsubscribe from a Pusher channel.
  16983. */
  16984. }, {
  16985. key: 'unsubscribe',
  16986. value: function unsubscribe() {
  16987. this.pusher.unsubscribe(this.name);
  16988. }
  16989. /**
  16990. * Listen for an event on the channel instance.
  16991. */
  16992. }, {
  16993. key: 'listen',
  16994. value: function listen(event, callback) {
  16995. this.on(this.eventFormatter.format(event), callback);
  16996. return this;
  16997. }
  16998. /**
  16999. * Stop listening for an event on the channel instance.
  17000. */
  17001. }, {
  17002. key: 'stopListening',
  17003. value: function stopListening(event) {
  17004. this.subscription.unbind(this.eventFormatter.format(event));
  17005. return this;
  17006. }
  17007. /**
  17008. * Bind a channel to an event.
  17009. */
  17010. }, {
  17011. key: 'on',
  17012. value: function on(event, callback) {
  17013. this.subscription.bind(event, callback);
  17014. return this;
  17015. }
  17016. }]);
  17017. return PusherChannel;
  17018. }(Channel);
  17019. /**
  17020. * This class represents a Pusher private channel.
  17021. */
  17022. var PusherPrivateChannel = function (_PusherChannel) {
  17023. inherits(PusherPrivateChannel, _PusherChannel);
  17024. function PusherPrivateChannel() {
  17025. classCallCheck(this, PusherPrivateChannel);
  17026. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17027. }
  17028. createClass(PusherPrivateChannel, [{
  17029. key: 'whisper',
  17030. /**
  17031. * Trigger client event on the channel.
  17032. */
  17033. value: function whisper(eventName, data) {
  17034. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17035. return this;
  17036. }
  17037. }]);
  17038. return PusherPrivateChannel;
  17039. }(PusherChannel);
  17040. /**
  17041. * This class represents a Pusher presence channel.
  17042. */
  17043. var PusherPresenceChannel = function (_PusherChannel) {
  17044. inherits(PusherPresenceChannel, _PusherChannel);
  17045. function PusherPresenceChannel() {
  17046. classCallCheck(this, PusherPresenceChannel);
  17047. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17048. }
  17049. createClass(PusherPresenceChannel, [{
  17050. key: 'here',
  17051. /**
  17052. * Register a callback to be called anytime the member list changes.
  17053. */
  17054. value: function here(callback) {
  17055. this.on('pusher:subscription_succeeded', function (data) {
  17056. callback(Object.keys(data.members).map(function (k) {
  17057. return data.members[k];
  17058. }));
  17059. });
  17060. return this;
  17061. }
  17062. /**
  17063. * Listen for someone joining the channel.
  17064. */
  17065. }, {
  17066. key: 'joining',
  17067. value: function joining(callback) {
  17068. this.on('pusher:member_added', function (member) {
  17069. callback(member.info);
  17070. });
  17071. return this;
  17072. }
  17073. /**
  17074. * Listen for someone leaving the channel.
  17075. */
  17076. }, {
  17077. key: 'leaving',
  17078. value: function leaving(callback) {
  17079. this.on('pusher:member_removed', function (member) {
  17080. callback(member.info);
  17081. });
  17082. return this;
  17083. }
  17084. /**
  17085. * Trigger client event on the channel.
  17086. */
  17087. }, {
  17088. key: 'whisper',
  17089. value: function whisper(eventName, data) {
  17090. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17091. return this;
  17092. }
  17093. }]);
  17094. return PusherPresenceChannel;
  17095. }(PusherChannel);
  17096. /**
  17097. * This class represents a Socket.io channel.
  17098. */
  17099. var SocketIoChannel = function (_Channel) {
  17100. inherits(SocketIoChannel, _Channel);
  17101. /**
  17102. * Create a new class instance.
  17103. */
  17104. function SocketIoChannel(socket, name, options) {
  17105. classCallCheck(this, SocketIoChannel);
  17106. /**
  17107. * The event callbacks applied to the channel.
  17108. */
  17109. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17110. _this.events = {};
  17111. _this.name = name;
  17112. _this.socket = socket;
  17113. _this.options = options;
  17114. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17115. _this.subscribe();
  17116. _this.configureReconnector();
  17117. return _this;
  17118. }
  17119. /**
  17120. * Subscribe to a Socket.io channel.
  17121. */
  17122. createClass(SocketIoChannel, [{
  17123. key: 'subscribe',
  17124. value: function subscribe() {
  17125. this.socket.emit('subscribe', {
  17126. channel: this.name,
  17127. auth: this.options.auth || {}
  17128. });
  17129. }
  17130. /**
  17131. * Unsubscribe from channel and ubind event callbacks.
  17132. */
  17133. }, {
  17134. key: 'unsubscribe',
  17135. value: function unsubscribe() {
  17136. this.unbind();
  17137. this.socket.emit('unsubscribe', {
  17138. channel: this.name,
  17139. auth: this.options.auth || {}
  17140. });
  17141. }
  17142. /**
  17143. * Listen for an event on the channel instance.
  17144. */
  17145. }, {
  17146. key: 'listen',
  17147. value: function listen(event, callback) {
  17148. this.on(this.eventFormatter.format(event), callback);
  17149. return this;
  17150. }
  17151. /**
  17152. * Stop listening for an event on the channel instance.
  17153. */
  17154. }, {
  17155. key: 'stopListening',
  17156. value: function stopListening(event) {
  17157. var name = this.eventFormatter.format(event);
  17158. this.socket.removeListener(name);
  17159. delete this.events[name];
  17160. return this;
  17161. }
  17162. /**
  17163. * Bind the channel's socket to an event and store the callback.
  17164. */
  17165. }, {
  17166. key: 'on',
  17167. value: function on(event, callback) {
  17168. var _this2 = this;
  17169. var listener = function listener(channel, data) {
  17170. if (_this2.name == channel) {
  17171. callback(data);
  17172. }
  17173. };
  17174. this.socket.on(event, listener);
  17175. this.bind(event, listener);
  17176. }
  17177. /**
  17178. * Attach a 'reconnect' listener and bind the event.
  17179. */
  17180. }, {
  17181. key: 'configureReconnector',
  17182. value: function configureReconnector() {
  17183. var _this3 = this;
  17184. var listener = function listener() {
  17185. _this3.subscribe();
  17186. };
  17187. this.socket.on('reconnect', listener);
  17188. this.bind('reconnect', listener);
  17189. }
  17190. /**
  17191. * Bind the channel's socket to an event and store the callback.
  17192. */
  17193. }, {
  17194. key: 'bind',
  17195. value: function bind(event, callback) {
  17196. this.events[event] = this.events[event] || [];
  17197. this.events[event].push(callback);
  17198. }
  17199. /**
  17200. * Unbind the channel's socket from all stored event callbacks.
  17201. */
  17202. }, {
  17203. key: 'unbind',
  17204. value: function unbind() {
  17205. var _this4 = this;
  17206. Object.keys(this.events).forEach(function (event) {
  17207. _this4.events[event].forEach(function (callback) {
  17208. _this4.socket.removeListener(event, callback);
  17209. });
  17210. delete _this4.events[event];
  17211. });
  17212. }
  17213. }]);
  17214. return SocketIoChannel;
  17215. }(Channel);
  17216. /**
  17217. * This class represents a Socket.io presence channel.
  17218. */
  17219. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17220. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17221. function SocketIoPrivateChannel() {
  17222. classCallCheck(this, SocketIoPrivateChannel);
  17223. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17224. }
  17225. createClass(SocketIoPrivateChannel, [{
  17226. key: 'whisper',
  17227. /**
  17228. * Trigger client event on the channel.
  17229. */
  17230. value: function whisper(eventName, data) {
  17231. this.socket.emit('client event', {
  17232. channel: this.name,
  17233. event: 'client-' + eventName,
  17234. data: data
  17235. });
  17236. return this;
  17237. }
  17238. }]);
  17239. return SocketIoPrivateChannel;
  17240. }(SocketIoChannel);
  17241. /**
  17242. * This class represents a Socket.io presence channel.
  17243. */
  17244. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17245. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17246. function SocketIoPresenceChannel() {
  17247. classCallCheck(this, SocketIoPresenceChannel);
  17248. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17249. }
  17250. createClass(SocketIoPresenceChannel, [{
  17251. key: 'here',
  17252. /**
  17253. * Register a callback to be called anytime the member list changes.
  17254. */
  17255. value: function here(callback) {
  17256. this.on('presence:subscribed', function (members) {
  17257. callback(members.map(function (m) {
  17258. return m.user_info;
  17259. }));
  17260. });
  17261. return this;
  17262. }
  17263. /**
  17264. * Listen for someone joining the channel.
  17265. */
  17266. }, {
  17267. key: 'joining',
  17268. value: function joining(callback) {
  17269. this.on('presence:joining', function (member) {
  17270. return callback(member.user_info);
  17271. });
  17272. return this;
  17273. }
  17274. /**
  17275. * Listen for someone leaving the channel.
  17276. */
  17277. }, {
  17278. key: 'leaving',
  17279. value: function leaving(callback) {
  17280. this.on('presence:leaving', function (member) {
  17281. return callback(member.user_info);
  17282. });
  17283. return this;
  17284. }
  17285. }]);
  17286. return SocketIoPresenceChannel;
  17287. }(SocketIoPrivateChannel);
  17288. /**
  17289. * This class represents a null channel.
  17290. */
  17291. var NullChannel = function (_Channel) {
  17292. inherits(NullChannel, _Channel);
  17293. function NullChannel() {
  17294. classCallCheck(this, NullChannel);
  17295. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17296. }
  17297. createClass(NullChannel, [{
  17298. key: 'subscribe',
  17299. /**
  17300. * Subscribe to a channel.
  17301. */
  17302. value: function subscribe() {}
  17303. //
  17304. /**
  17305. * Unsubscribe from a channel.
  17306. */
  17307. }, {
  17308. key: 'unsubscribe',
  17309. value: function unsubscribe() {}
  17310. //
  17311. /**
  17312. * Listen for an event on the channel instance.
  17313. */
  17314. }, {
  17315. key: 'listen',
  17316. value: function listen(event, callback) {
  17317. return this;
  17318. }
  17319. /**
  17320. * Stop listening for an event on the channel instance.
  17321. */
  17322. }, {
  17323. key: 'stopListening',
  17324. value: function stopListening(event) {
  17325. return this;
  17326. }
  17327. /**
  17328. * Bind a channel to an event.
  17329. */
  17330. }, {
  17331. key: 'on',
  17332. value: function on(event, callback) {
  17333. return this;
  17334. }
  17335. }]);
  17336. return NullChannel;
  17337. }(Channel);
  17338. /**
  17339. * This class represents a null private channel.
  17340. */
  17341. var NullPrivateChannel = function (_NullChannel) {
  17342. inherits(NullPrivateChannel, _NullChannel);
  17343. function NullPrivateChannel() {
  17344. classCallCheck(this, NullPrivateChannel);
  17345. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17346. }
  17347. createClass(NullPrivateChannel, [{
  17348. key: 'whisper',
  17349. /**
  17350. * Trigger client event on the channel.
  17351. */
  17352. value: function whisper(eventName, data) {
  17353. return this;
  17354. }
  17355. }]);
  17356. return NullPrivateChannel;
  17357. }(NullChannel);
  17358. /**
  17359. * This class represents a null presence channel.
  17360. */
  17361. var NullPresenceChannel = function (_NullChannel) {
  17362. inherits(NullPresenceChannel, _NullChannel);
  17363. function NullPresenceChannel() {
  17364. classCallCheck(this, NullPresenceChannel);
  17365. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17366. }
  17367. createClass(NullPresenceChannel, [{
  17368. key: 'here',
  17369. /**
  17370. * Register a callback to be called anytime the member list changes.
  17371. */
  17372. value: function here(callback) {
  17373. return this;
  17374. }
  17375. /**
  17376. * Listen for someone joining the channel.
  17377. */
  17378. }, {
  17379. key: 'joining',
  17380. value: function joining(callback) {
  17381. return this;
  17382. }
  17383. /**
  17384. * Listen for someone leaving the channel.
  17385. */
  17386. }, {
  17387. key: 'leaving',
  17388. value: function leaving(callback) {
  17389. return this;
  17390. }
  17391. /**
  17392. * Trigger client event on the channel.
  17393. */
  17394. }, {
  17395. key: 'whisper',
  17396. value: function whisper(eventName, data) {
  17397. return this;
  17398. }
  17399. }]);
  17400. return NullPresenceChannel;
  17401. }(NullChannel);
  17402. /**
  17403. * This class creates a connector to Pusher.
  17404. */
  17405. var PusherConnector = function (_Connector) {
  17406. inherits(PusherConnector, _Connector);
  17407. function PusherConnector() {
  17408. classCallCheck(this, PusherConnector);
  17409. /**
  17410. * All of the subscribed channel names.
  17411. */
  17412. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17413. _this.channels = {};
  17414. return _this;
  17415. }
  17416. /**
  17417. * Create a fresh Pusher connection.
  17418. */
  17419. createClass(PusherConnector, [{
  17420. key: 'connect',
  17421. value: function connect() {
  17422. if (typeof this.options.client !== 'undefined') {
  17423. this.pusher = this.options.client;
  17424. } else {
  17425. this.pusher = new Pusher(this.options.key, this.options);
  17426. }
  17427. }
  17428. /**
  17429. * Listen for an event on a channel instance.
  17430. */
  17431. }, {
  17432. key: 'listen',
  17433. value: function listen(name, event, callback) {
  17434. return this.channel(name).listen(event, callback);
  17435. }
  17436. /**
  17437. * Get a channel instance by name.
  17438. */
  17439. }, {
  17440. key: 'channel',
  17441. value: function channel(name) {
  17442. if (!this.channels[name]) {
  17443. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17444. }
  17445. return this.channels[name];
  17446. }
  17447. /**
  17448. * Get a private channel instance by name.
  17449. */
  17450. }, {
  17451. key: 'privateChannel',
  17452. value: function privateChannel(name) {
  17453. if (!this.channels['private-' + name]) {
  17454. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17455. }
  17456. return this.channels['private-' + name];
  17457. }
  17458. /**
  17459. * Get a presence channel instance by name.
  17460. */
  17461. }, {
  17462. key: 'presenceChannel',
  17463. value: function presenceChannel(name) {
  17464. if (!this.channels['presence-' + name]) {
  17465. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17466. }
  17467. return this.channels['presence-' + name];
  17468. }
  17469. /**
  17470. * Leave the given channel, as well as its private and presence variants.
  17471. */
  17472. }, {
  17473. key: 'leave',
  17474. value: function leave(name) {
  17475. var _this2 = this;
  17476. var channels = [name, 'private-' + name, 'presence-' + name];
  17477. channels.forEach(function (name, index) {
  17478. _this2.leaveChannel(name);
  17479. });
  17480. }
  17481. /**
  17482. * Leave the given channel.
  17483. */
  17484. }, {
  17485. key: 'leaveChannel',
  17486. value: function leaveChannel(name) {
  17487. if (this.channels[name]) {
  17488. this.channels[name].unsubscribe();
  17489. delete this.channels[name];
  17490. }
  17491. }
  17492. /**
  17493. * Get the socket ID for the connection.
  17494. */
  17495. }, {
  17496. key: 'socketId',
  17497. value: function socketId() {
  17498. return this.pusher.connection.socket_id;
  17499. }
  17500. /**
  17501. * Disconnect Pusher connection.
  17502. */
  17503. }, {
  17504. key: 'disconnect',
  17505. value: function disconnect() {
  17506. this.pusher.disconnect();
  17507. }
  17508. }]);
  17509. return PusherConnector;
  17510. }(Connector);
  17511. /**
  17512. * This class creates a connnector to a Socket.io server.
  17513. */
  17514. var SocketIoConnector = function (_Connector) {
  17515. inherits(SocketIoConnector, _Connector);
  17516. function SocketIoConnector() {
  17517. classCallCheck(this, SocketIoConnector);
  17518. /**
  17519. * All of the subscribed channel names.
  17520. */
  17521. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17522. _this.channels = {};
  17523. return _this;
  17524. }
  17525. /**
  17526. * Create a fresh Socket.io connection.
  17527. */
  17528. createClass(SocketIoConnector, [{
  17529. key: 'connect',
  17530. value: function connect() {
  17531. var io = this.getSocketIO();
  17532. this.socket = io(this.options.host, this.options);
  17533. return this.socket;
  17534. }
  17535. /**
  17536. * Get socket.io module from global scope or options.
  17537. */
  17538. }, {
  17539. key: 'getSocketIO',
  17540. value: function getSocketIO() {
  17541. if (typeof this.options.client !== 'undefined') {
  17542. return this.options.client;
  17543. }
  17544. if (typeof io !== 'undefined') {
  17545. return io;
  17546. }
  17547. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17548. }
  17549. /**
  17550. * Listen for an event on a channel instance.
  17551. */
  17552. }, {
  17553. key: 'listen',
  17554. value: function listen(name, event, callback) {
  17555. return this.channel(name).listen(event, callback);
  17556. }
  17557. /**
  17558. * Get a channel instance by name.
  17559. */
  17560. }, {
  17561. key: 'channel',
  17562. value: function channel(name) {
  17563. if (!this.channels[name]) {
  17564. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17565. }
  17566. return this.channels[name];
  17567. }
  17568. /**
  17569. * Get a private channel instance by name.
  17570. */
  17571. }, {
  17572. key: 'privateChannel',
  17573. value: function privateChannel(name) {
  17574. if (!this.channels['private-' + name]) {
  17575. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17576. }
  17577. return this.channels['private-' + name];
  17578. }
  17579. /**
  17580. * Get a presence channel instance by name.
  17581. */
  17582. }, {
  17583. key: 'presenceChannel',
  17584. value: function presenceChannel(name) {
  17585. if (!this.channels['presence-' + name]) {
  17586. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17587. }
  17588. return this.channels['presence-' + name];
  17589. }
  17590. /**
  17591. * Leave the given channel, as well as its private and presence variants.
  17592. */
  17593. }, {
  17594. key: 'leave',
  17595. value: function leave(name) {
  17596. var _this2 = this;
  17597. var channels = [name, 'private-' + name, 'presence-' + name];
  17598. channels.forEach(function (name) {
  17599. _this2.leaveChannel(name);
  17600. });
  17601. }
  17602. /**
  17603. * Leave the given channel.
  17604. */
  17605. }, {
  17606. key: 'leaveChannel',
  17607. value: function leaveChannel(name) {
  17608. if (this.channels[name]) {
  17609. this.channels[name].unsubscribe();
  17610. delete this.channels[name];
  17611. }
  17612. }
  17613. /**
  17614. * Get the socket ID for the connection.
  17615. */
  17616. }, {
  17617. key: 'socketId',
  17618. value: function socketId() {
  17619. return this.socket.id;
  17620. }
  17621. /**
  17622. * Disconnect Socketio connection.
  17623. */
  17624. }, {
  17625. key: 'disconnect',
  17626. value: function disconnect() {
  17627. this.socket.disconnect();
  17628. }
  17629. }]);
  17630. return SocketIoConnector;
  17631. }(Connector);
  17632. /**
  17633. * This class creates a null connector.
  17634. */
  17635. var NullConnector = function (_Connector) {
  17636. inherits(NullConnector, _Connector);
  17637. function NullConnector() {
  17638. classCallCheck(this, NullConnector);
  17639. /**
  17640. * All of the subscribed channel names.
  17641. */
  17642. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17643. _this.channels = {};
  17644. return _this;
  17645. }
  17646. /**
  17647. * Create a fresh connection.
  17648. */
  17649. createClass(NullConnector, [{
  17650. key: 'connect',
  17651. value: function connect() {}
  17652. //
  17653. /**
  17654. * Listen for an event on a channel instance.
  17655. */
  17656. }, {
  17657. key: 'listen',
  17658. value: function listen(name, event, callback) {
  17659. return new NullChannel();
  17660. }
  17661. /**
  17662. * Get a channel instance by name.
  17663. */
  17664. }, {
  17665. key: 'channel',
  17666. value: function channel(name) {
  17667. return new NullChannel();
  17668. }
  17669. /**
  17670. * Get a private channel instance by name.
  17671. */
  17672. }, {
  17673. key: 'privateChannel',
  17674. value: function privateChannel(name) {
  17675. return new NullPrivateChannel();
  17676. }
  17677. /**
  17678. * Get a presence channel instance by name.
  17679. */
  17680. }, {
  17681. key: 'presenceChannel',
  17682. value: function presenceChannel(name) {
  17683. return new NullPresenceChannel();
  17684. }
  17685. /**
  17686. * Leave the given channel, as well as its private and presence variants.
  17687. */
  17688. }, {
  17689. key: 'leave',
  17690. value: function leave(name) {}
  17691. //
  17692. /**
  17693. * Leave the given channel.
  17694. */
  17695. }, {
  17696. key: 'leaveChannel',
  17697. value: function leaveChannel(name) {}
  17698. //
  17699. /**
  17700. * Get the socket ID for the connection.
  17701. */
  17702. }, {
  17703. key: 'socketId',
  17704. value: function socketId() {
  17705. return 'fake-socket-id';
  17706. }
  17707. /**
  17708. * Disconnect the connection.
  17709. */
  17710. }, {
  17711. key: 'disconnect',
  17712. value: function disconnect() {
  17713. //
  17714. }
  17715. }]);
  17716. return NullConnector;
  17717. }(Connector);
  17718. /**
  17719. * This class is the primary API for interacting with broadcasting.
  17720. */
  17721. var Echo = function () {
  17722. /**
  17723. * Create a new class instance.
  17724. */
  17725. function Echo(options) {
  17726. classCallCheck(this, Echo);
  17727. this.options = options;
  17728. this.connect();
  17729. if (!this.options.withoutInterceptors) {
  17730. this.registerInterceptors();
  17731. }
  17732. }
  17733. /**
  17734. * Get a channel instance by name.
  17735. */
  17736. createClass(Echo, [{
  17737. key: 'channel',
  17738. value: function channel(_channel) {
  17739. return this.connector.channel(_channel);
  17740. }
  17741. /**
  17742. * Create a new connection.
  17743. */
  17744. }, {
  17745. key: 'connect',
  17746. value: function connect() {
  17747. if (this.options.broadcaster == 'pusher') {
  17748. this.connector = new PusherConnector(this.options);
  17749. } else if (this.options.broadcaster == 'socket.io') {
  17750. this.connector = new SocketIoConnector(this.options);
  17751. } else if (this.options.broadcaster == 'null') {
  17752. this.connector = new NullConnector(this.options);
  17753. } else if (typeof this.options.broadcaster == 'function') {
  17754. this.connector = new this.options.broadcaster(this.options);
  17755. }
  17756. }
  17757. /**
  17758. * Disconnect from the Echo server.
  17759. */
  17760. }, {
  17761. key: 'disconnect',
  17762. value: function disconnect() {
  17763. this.connector.disconnect();
  17764. }
  17765. /**
  17766. * Get a presence channel instance by name.
  17767. */
  17768. }, {
  17769. key: 'join',
  17770. value: function join(channel) {
  17771. return this.connector.presenceChannel(channel);
  17772. }
  17773. /**
  17774. * Leave the given channel, as well as its private and presence variants.
  17775. */
  17776. }, {
  17777. key: 'leave',
  17778. value: function leave(channel) {
  17779. this.connector.leave(channel);
  17780. }
  17781. /**
  17782. * Leave the given channel.
  17783. */
  17784. }, {
  17785. key: 'leaveChannel',
  17786. value: function leaveChannel(channel) {
  17787. this.connector.leaveChannel(channel);
  17788. }
  17789. /**
  17790. * Listen for an event on a channel instance.
  17791. */
  17792. }, {
  17793. key: 'listen',
  17794. value: function listen(channel, event, callback) {
  17795. return this.connector.listen(channel, event, callback);
  17796. }
  17797. /**
  17798. * Get a private channel instance by name.
  17799. */
  17800. }, {
  17801. key: 'private',
  17802. value: function _private(channel) {
  17803. return this.connector.privateChannel(channel);
  17804. }
  17805. /**
  17806. * Get the Socket ID for the connection.
  17807. */
  17808. }, {
  17809. key: 'socketId',
  17810. value: function socketId() {
  17811. return this.connector.socketId();
  17812. }
  17813. /**
  17814. * Register 3rd party request interceptiors. These are used to automatically
  17815. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17816. */
  17817. }, {
  17818. key: 'registerInterceptors',
  17819. value: function registerInterceptors() {
  17820. if (typeof Vue === 'function' && Vue.http) {
  17821. this.registerVueRequestInterceptor();
  17822. }
  17823. if (typeof axios === 'function') {
  17824. this.registerAxiosRequestInterceptor();
  17825. }
  17826. if (typeof jQuery === 'function') {
  17827. this.registerjQueryAjaxSetup();
  17828. }
  17829. }
  17830. /**
  17831. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17832. */
  17833. }, {
  17834. key: 'registerVueRequestInterceptor',
  17835. value: function registerVueRequestInterceptor() {
  17836. var _this = this;
  17837. Vue.http.interceptors.push(function (request, next) {
  17838. if (_this.socketId()) {
  17839. request.headers.set('X-Socket-ID', _this.socketId());
  17840. }
  17841. next();
  17842. });
  17843. }
  17844. /**
  17845. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17846. */
  17847. }, {
  17848. key: 'registerAxiosRequestInterceptor',
  17849. value: function registerAxiosRequestInterceptor() {
  17850. var _this2 = this;
  17851. axios.interceptors.request.use(function (config) {
  17852. if (_this2.socketId()) {
  17853. config.headers['X-Socket-Id'] = _this2.socketId();
  17854. }
  17855. return config;
  17856. });
  17857. }
  17858. /**
  17859. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17860. */
  17861. }, {
  17862. key: 'registerjQueryAjaxSetup',
  17863. value: function registerjQueryAjaxSetup() {
  17864. var _this3 = this;
  17865. if (typeof jQuery.ajax != 'undefined') {
  17866. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17867. if (_this3.socketId()) {
  17868. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17869. }
  17870. });
  17871. }
  17872. }
  17873. }]);
  17874. return Echo;
  17875. }();
  17876. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17877. /***/ }),
  17878. /***/ "./node_modules/lodash/lodash.js":
  17879. /*!***************************************!*\
  17880. !*** ./node_modules/lodash/lodash.js ***!
  17881. \***************************************/
  17882. /*! no static exports found */
  17883. /***/ (function(module, exports, __webpack_require__) {
  17884. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17885. * @license
  17886. * Lodash <https://lodash.com/>
  17887. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17888. * Released under MIT license <https://lodash.com/license>
  17889. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17890. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17891. */
  17892. ;(function() {
  17893. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17894. var undefined;
  17895. /** Used as the semantic version number. */
  17896. var VERSION = '4.17.15';
  17897. /** Used as the size to enable large array optimizations. */
  17898. var LARGE_ARRAY_SIZE = 200;
  17899. /** Error message constants. */
  17900. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17901. FUNC_ERROR_TEXT = 'Expected a function';
  17902. /** Used to stand-in for `undefined` hash values. */
  17903. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17904. /** Used as the maximum memoize cache size. */
  17905. var MAX_MEMOIZE_SIZE = 500;
  17906. /** Used as the internal argument placeholder. */
  17907. var PLACEHOLDER = '__lodash_placeholder__';
  17908. /** Used to compose bitmasks for cloning. */
  17909. var CLONE_DEEP_FLAG = 1,
  17910. CLONE_FLAT_FLAG = 2,
  17911. CLONE_SYMBOLS_FLAG = 4;
  17912. /** Used to compose bitmasks for value comparisons. */
  17913. var COMPARE_PARTIAL_FLAG = 1,
  17914. COMPARE_UNORDERED_FLAG = 2;
  17915. /** Used to compose bitmasks for function metadata. */
  17916. var WRAP_BIND_FLAG = 1,
  17917. WRAP_BIND_KEY_FLAG = 2,
  17918. WRAP_CURRY_BOUND_FLAG = 4,
  17919. WRAP_CURRY_FLAG = 8,
  17920. WRAP_CURRY_RIGHT_FLAG = 16,
  17921. WRAP_PARTIAL_FLAG = 32,
  17922. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17923. WRAP_ARY_FLAG = 128,
  17924. WRAP_REARG_FLAG = 256,
  17925. WRAP_FLIP_FLAG = 512;
  17926. /** Used as default options for `_.truncate`. */
  17927. var DEFAULT_TRUNC_LENGTH = 30,
  17928. DEFAULT_TRUNC_OMISSION = '...';
  17929. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17930. var HOT_COUNT = 800,
  17931. HOT_SPAN = 16;
  17932. /** Used to indicate the type of lazy iteratees. */
  17933. var LAZY_FILTER_FLAG = 1,
  17934. LAZY_MAP_FLAG = 2,
  17935. LAZY_WHILE_FLAG = 3;
  17936. /** Used as references for various `Number` constants. */
  17937. var INFINITY = 1 / 0,
  17938. MAX_SAFE_INTEGER = 9007199254740991,
  17939. MAX_INTEGER = 1.7976931348623157e+308,
  17940. NAN = 0 / 0;
  17941. /** Used as references for the maximum length and index of an array. */
  17942. var MAX_ARRAY_LENGTH = 4294967295,
  17943. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17944. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17945. /** Used to associate wrap methods with their bit flags. */
  17946. var wrapFlags = [
  17947. ['ary', WRAP_ARY_FLAG],
  17948. ['bind', WRAP_BIND_FLAG],
  17949. ['bindKey', WRAP_BIND_KEY_FLAG],
  17950. ['curry', WRAP_CURRY_FLAG],
  17951. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17952. ['flip', WRAP_FLIP_FLAG],
  17953. ['partial', WRAP_PARTIAL_FLAG],
  17954. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17955. ['rearg', WRAP_REARG_FLAG]
  17956. ];
  17957. /** `Object#toString` result references. */
  17958. var argsTag = '[object Arguments]',
  17959. arrayTag = '[object Array]',
  17960. asyncTag = '[object AsyncFunction]',
  17961. boolTag = '[object Boolean]',
  17962. dateTag = '[object Date]',
  17963. domExcTag = '[object DOMException]',
  17964. errorTag = '[object Error]',
  17965. funcTag = '[object Function]',
  17966. genTag = '[object GeneratorFunction]',
  17967. mapTag = '[object Map]',
  17968. numberTag = '[object Number]',
  17969. nullTag = '[object Null]',
  17970. objectTag = '[object Object]',
  17971. promiseTag = '[object Promise]',
  17972. proxyTag = '[object Proxy]',
  17973. regexpTag = '[object RegExp]',
  17974. setTag = '[object Set]',
  17975. stringTag = '[object String]',
  17976. symbolTag = '[object Symbol]',
  17977. undefinedTag = '[object Undefined]',
  17978. weakMapTag = '[object WeakMap]',
  17979. weakSetTag = '[object WeakSet]';
  17980. var arrayBufferTag = '[object ArrayBuffer]',
  17981. dataViewTag = '[object DataView]',
  17982. float32Tag = '[object Float32Array]',
  17983. float64Tag = '[object Float64Array]',
  17984. int8Tag = '[object Int8Array]',
  17985. int16Tag = '[object Int16Array]',
  17986. int32Tag = '[object Int32Array]',
  17987. uint8Tag = '[object Uint8Array]',
  17988. uint8ClampedTag = '[object Uint8ClampedArray]',
  17989. uint16Tag = '[object Uint16Array]',
  17990. uint32Tag = '[object Uint32Array]';
  17991. /** Used to match empty string literals in compiled template source. */
  17992. var reEmptyStringLeading = /\b__p \+= '';/g,
  17993. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  17994. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  17995. /** Used to match HTML entities and HTML characters. */
  17996. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  17997. reUnescapedHtml = /[&<>"']/g,
  17998. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  17999. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18000. /** Used to match template delimiters. */
  18001. var reEscape = /<%-([\s\S]+?)%>/g,
  18002. reEvaluate = /<%([\s\S]+?)%>/g,
  18003. reInterpolate = /<%=([\s\S]+?)%>/g;
  18004. /** Used to match property names within property paths. */
  18005. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18006. reIsPlainProp = /^\w*$/,
  18007. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18008. /**
  18009. * Used to match `RegExp`
  18010. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18011. */
  18012. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18013. reHasRegExpChar = RegExp(reRegExpChar.source);
  18014. /** Used to match leading and trailing whitespace. */
  18015. var reTrim = /^\s+|\s+$/g,
  18016. reTrimStart = /^\s+/,
  18017. reTrimEnd = /\s+$/;
  18018. /** Used to match wrap detail comments. */
  18019. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18020. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18021. reSplitDetails = /,? & /;
  18022. /** Used to match words composed of alphanumeric characters. */
  18023. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18024. /** Used to match backslashes in property paths. */
  18025. var reEscapeChar = /\\(\\)?/g;
  18026. /**
  18027. * Used to match
  18028. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18029. */
  18030. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18031. /** Used to match `RegExp` flags from their coerced string values. */
  18032. var reFlags = /\w*$/;
  18033. /** Used to detect bad signed hexadecimal string values. */
  18034. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18035. /** Used to detect binary string values. */
  18036. var reIsBinary = /^0b[01]+$/i;
  18037. /** Used to detect host constructors (Safari). */
  18038. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18039. /** Used to detect octal string values. */
  18040. var reIsOctal = /^0o[0-7]+$/i;
  18041. /** Used to detect unsigned integer values. */
  18042. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18043. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18044. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18045. /** Used to ensure capturing order of template delimiters. */
  18046. var reNoMatch = /($^)/;
  18047. /** Used to match unescaped characters in compiled string literals. */
  18048. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18049. /** Used to compose unicode character classes. */
  18050. var rsAstralRange = '\\ud800-\\udfff',
  18051. rsComboMarksRange = '\\u0300-\\u036f',
  18052. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18053. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18054. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18055. rsDingbatRange = '\\u2700-\\u27bf',
  18056. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18057. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18058. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18059. rsPunctuationRange = '\\u2000-\\u206f',
  18060. 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',
  18061. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18062. rsVarRange = '\\ufe0e\\ufe0f',
  18063. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18064. /** Used to compose unicode capture groups. */
  18065. var rsApos = "['\u2019]",
  18066. rsAstral = '[' + rsAstralRange + ']',
  18067. rsBreak = '[' + rsBreakRange + ']',
  18068. rsCombo = '[' + rsComboRange + ']',
  18069. rsDigits = '\\d+',
  18070. rsDingbat = '[' + rsDingbatRange + ']',
  18071. rsLower = '[' + rsLowerRange + ']',
  18072. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18073. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18074. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18075. rsNonAstral = '[^' + rsAstralRange + ']',
  18076. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18077. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18078. rsUpper = '[' + rsUpperRange + ']',
  18079. rsZWJ = '\\u200d';
  18080. /** Used to compose unicode regexes. */
  18081. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18082. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18083. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18084. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18085. reOptMod = rsModifier + '?',
  18086. rsOptVar = '[' + rsVarRange + ']?',
  18087. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18088. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18089. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18090. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18091. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18092. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18093. /** Used to match apostrophes. */
  18094. var reApos = RegExp(rsApos, 'g');
  18095. /**
  18096. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18097. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18098. */
  18099. var reComboMark = RegExp(rsCombo, 'g');
  18100. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18101. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18102. /** Used to match complex or compound words. */
  18103. var reUnicodeWord = RegExp([
  18104. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18105. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18106. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18107. rsUpper + '+' + rsOptContrUpper,
  18108. rsOrdUpper,
  18109. rsOrdLower,
  18110. rsDigits,
  18111. rsEmoji
  18112. ].join('|'), 'g');
  18113. /** 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/). */
  18114. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18115. /** Used to detect strings that need a more robust regexp to match words. */
  18116. 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 ]/;
  18117. /** Used to assign default `context` object properties. */
  18118. var contextProps = [
  18119. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18120. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18121. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18122. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18123. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18124. ];
  18125. /** Used to make template sourceURLs easier to identify. */
  18126. var templateCounter = -1;
  18127. /** Used to identify `toStringTag` values of typed arrays. */
  18128. var typedArrayTags = {};
  18129. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18130. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18131. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18132. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18133. typedArrayTags[uint32Tag] = true;
  18134. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18135. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18136. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18137. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18138. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18139. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18140. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18141. typedArrayTags[weakMapTag] = false;
  18142. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18143. var cloneableTags = {};
  18144. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18145. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18146. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18147. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18148. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18149. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18150. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18151. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18152. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18153. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18154. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18155. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18156. cloneableTags[weakMapTag] = false;
  18157. /** Used to map Latin Unicode letters to basic Latin letters. */
  18158. var deburredLetters = {
  18159. // Latin-1 Supplement block.
  18160. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18161. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18162. '\xc7': 'C', '\xe7': 'c',
  18163. '\xd0': 'D', '\xf0': 'd',
  18164. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18165. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18166. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18167. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18168. '\xd1': 'N', '\xf1': 'n',
  18169. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18170. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18171. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18172. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18173. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18174. '\xc6': 'Ae', '\xe6': 'ae',
  18175. '\xde': 'Th', '\xfe': 'th',
  18176. '\xdf': 'ss',
  18177. // Latin Extended-A block.
  18178. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18179. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18180. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18181. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18182. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18183. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18184. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18185. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18186. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18187. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18188. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18189. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18190. '\u0134': 'J', '\u0135': 'j',
  18191. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18192. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18193. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18194. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18195. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18196. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18197. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18198. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18199. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18200. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18201. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18202. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18203. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18204. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18205. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18206. '\u0174': 'W', '\u0175': 'w',
  18207. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18208. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18209. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18210. '\u0132': 'IJ', '\u0133': 'ij',
  18211. '\u0152': 'Oe', '\u0153': 'oe',
  18212. '\u0149': "'n", '\u017f': 's'
  18213. };
  18214. /** Used to map characters to HTML entities. */
  18215. var htmlEscapes = {
  18216. '&': '&amp;',
  18217. '<': '&lt;',
  18218. '>': '&gt;',
  18219. '"': '&quot;',
  18220. "'": '&#39;'
  18221. };
  18222. /** Used to map HTML entities to characters. */
  18223. var htmlUnescapes = {
  18224. '&amp;': '&',
  18225. '&lt;': '<',
  18226. '&gt;': '>',
  18227. '&quot;': '"',
  18228. '&#39;': "'"
  18229. };
  18230. /** Used to escape characters for inclusion in compiled string literals. */
  18231. var stringEscapes = {
  18232. '\\': '\\',
  18233. "'": "'",
  18234. '\n': 'n',
  18235. '\r': 'r',
  18236. '\u2028': 'u2028',
  18237. '\u2029': 'u2029'
  18238. };
  18239. /** Built-in method references without a dependency on `root`. */
  18240. var freeParseFloat = parseFloat,
  18241. freeParseInt = parseInt;
  18242. /** Detect free variable `global` from Node.js. */
  18243. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18244. /** Detect free variable `self`. */
  18245. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18246. /** Used as a reference to the global object. */
  18247. var root = freeGlobal || freeSelf || Function('return this')();
  18248. /** Detect free variable `exports`. */
  18249. var freeExports = true && exports && !exports.nodeType && exports;
  18250. /** Detect free variable `module`. */
  18251. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18252. /** Detect the popular CommonJS extension `module.exports`. */
  18253. var moduleExports = freeModule && freeModule.exports === freeExports;
  18254. /** Detect free variable `process` from Node.js. */
  18255. var freeProcess = moduleExports && freeGlobal.process;
  18256. /** Used to access faster Node.js helpers. */
  18257. var nodeUtil = (function() {
  18258. try {
  18259. // Use `util.types` for Node.js 10+.
  18260. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18261. if (types) {
  18262. return types;
  18263. }
  18264. // Legacy `process.binding('util')` for Node.js < 10.
  18265. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18266. } catch (e) {}
  18267. }());
  18268. /* Node.js helper references. */
  18269. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18270. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18271. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18272. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18273. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18274. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18275. /*--------------------------------------------------------------------------*/
  18276. /**
  18277. * A faster alternative to `Function#apply`, this function invokes `func`
  18278. * with the `this` binding of `thisArg` and the arguments of `args`.
  18279. *
  18280. * @private
  18281. * @param {Function} func The function to invoke.
  18282. * @param {*} thisArg The `this` binding of `func`.
  18283. * @param {Array} args The arguments to invoke `func` with.
  18284. * @returns {*} Returns the result of `func`.
  18285. */
  18286. function apply(func, thisArg, args) {
  18287. switch (args.length) {
  18288. case 0: return func.call(thisArg);
  18289. case 1: return func.call(thisArg, args[0]);
  18290. case 2: return func.call(thisArg, args[0], args[1]);
  18291. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18292. }
  18293. return func.apply(thisArg, args);
  18294. }
  18295. /**
  18296. * A specialized version of `baseAggregator` for arrays.
  18297. *
  18298. * @private
  18299. * @param {Array} [array] The array to iterate over.
  18300. * @param {Function} setter The function to set `accumulator` values.
  18301. * @param {Function} iteratee The iteratee to transform keys.
  18302. * @param {Object} accumulator The initial aggregated object.
  18303. * @returns {Function} Returns `accumulator`.
  18304. */
  18305. function arrayAggregator(array, setter, iteratee, accumulator) {
  18306. var index = -1,
  18307. length = array == null ? 0 : array.length;
  18308. while (++index < length) {
  18309. var value = array[index];
  18310. setter(accumulator, value, iteratee(value), array);
  18311. }
  18312. return accumulator;
  18313. }
  18314. /**
  18315. * A specialized version of `_.forEach` for arrays without support for
  18316. * iteratee shorthands.
  18317. *
  18318. * @private
  18319. * @param {Array} [array] The array to iterate over.
  18320. * @param {Function} iteratee The function invoked per iteration.
  18321. * @returns {Array} Returns `array`.
  18322. */
  18323. function arrayEach(array, iteratee) {
  18324. var index = -1,
  18325. length = array == null ? 0 : array.length;
  18326. while (++index < length) {
  18327. if (iteratee(array[index], index, array) === false) {
  18328. break;
  18329. }
  18330. }
  18331. return array;
  18332. }
  18333. /**
  18334. * A specialized version of `_.forEachRight` for arrays without support for
  18335. * iteratee shorthands.
  18336. *
  18337. * @private
  18338. * @param {Array} [array] The array to iterate over.
  18339. * @param {Function} iteratee The function invoked per iteration.
  18340. * @returns {Array} Returns `array`.
  18341. */
  18342. function arrayEachRight(array, iteratee) {
  18343. var length = array == null ? 0 : array.length;
  18344. while (length--) {
  18345. if (iteratee(array[length], length, array) === false) {
  18346. break;
  18347. }
  18348. }
  18349. return array;
  18350. }
  18351. /**
  18352. * A specialized version of `_.every` for arrays without support for
  18353. * iteratee shorthands.
  18354. *
  18355. * @private
  18356. * @param {Array} [array] The array to iterate over.
  18357. * @param {Function} predicate The function invoked per iteration.
  18358. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18359. * else `false`.
  18360. */
  18361. function arrayEvery(array, predicate) {
  18362. var index = -1,
  18363. length = array == null ? 0 : array.length;
  18364. while (++index < length) {
  18365. if (!predicate(array[index], index, array)) {
  18366. return false;
  18367. }
  18368. }
  18369. return true;
  18370. }
  18371. /**
  18372. * A specialized version of `_.filter` for arrays without support for
  18373. * iteratee shorthands.
  18374. *
  18375. * @private
  18376. * @param {Array} [array] The array to iterate over.
  18377. * @param {Function} predicate The function invoked per iteration.
  18378. * @returns {Array} Returns the new filtered array.
  18379. */
  18380. function arrayFilter(array, predicate) {
  18381. var index = -1,
  18382. length = array == null ? 0 : array.length,
  18383. resIndex = 0,
  18384. result = [];
  18385. while (++index < length) {
  18386. var value = array[index];
  18387. if (predicate(value, index, array)) {
  18388. result[resIndex++] = value;
  18389. }
  18390. }
  18391. return result;
  18392. }
  18393. /**
  18394. * A specialized version of `_.includes` for arrays without support for
  18395. * specifying an index to search from.
  18396. *
  18397. * @private
  18398. * @param {Array} [array] The array to inspect.
  18399. * @param {*} target The value to search for.
  18400. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18401. */
  18402. function arrayIncludes(array, value) {
  18403. var length = array == null ? 0 : array.length;
  18404. return !!length && baseIndexOf(array, value, 0) > -1;
  18405. }
  18406. /**
  18407. * This function is like `arrayIncludes` except that it accepts a comparator.
  18408. *
  18409. * @private
  18410. * @param {Array} [array] The array to inspect.
  18411. * @param {*} target The value to search for.
  18412. * @param {Function} comparator The comparator invoked per element.
  18413. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18414. */
  18415. function arrayIncludesWith(array, value, comparator) {
  18416. var index = -1,
  18417. length = array == null ? 0 : array.length;
  18418. while (++index < length) {
  18419. if (comparator(value, array[index])) {
  18420. return true;
  18421. }
  18422. }
  18423. return false;
  18424. }
  18425. /**
  18426. * A specialized version of `_.map` for arrays without support for iteratee
  18427. * shorthands.
  18428. *
  18429. * @private
  18430. * @param {Array} [array] The array to iterate over.
  18431. * @param {Function} iteratee The function invoked per iteration.
  18432. * @returns {Array} Returns the new mapped array.
  18433. */
  18434. function arrayMap(array, iteratee) {
  18435. var index = -1,
  18436. length = array == null ? 0 : array.length,
  18437. result = Array(length);
  18438. while (++index < length) {
  18439. result[index] = iteratee(array[index], index, array);
  18440. }
  18441. return result;
  18442. }
  18443. /**
  18444. * Appends the elements of `values` to `array`.
  18445. *
  18446. * @private
  18447. * @param {Array} array The array to modify.
  18448. * @param {Array} values The values to append.
  18449. * @returns {Array} Returns `array`.
  18450. */
  18451. function arrayPush(array, values) {
  18452. var index = -1,
  18453. length = values.length,
  18454. offset = array.length;
  18455. while (++index < length) {
  18456. array[offset + index] = values[index];
  18457. }
  18458. return array;
  18459. }
  18460. /**
  18461. * A specialized version of `_.reduce` for arrays without support for
  18462. * iteratee shorthands.
  18463. *
  18464. * @private
  18465. * @param {Array} [array] The array to iterate over.
  18466. * @param {Function} iteratee The function invoked per iteration.
  18467. * @param {*} [accumulator] The initial value.
  18468. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18469. * the initial value.
  18470. * @returns {*} Returns the accumulated value.
  18471. */
  18472. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18473. var index = -1,
  18474. length = array == null ? 0 : array.length;
  18475. if (initAccum && length) {
  18476. accumulator = array[++index];
  18477. }
  18478. while (++index < length) {
  18479. accumulator = iteratee(accumulator, array[index], index, array);
  18480. }
  18481. return accumulator;
  18482. }
  18483. /**
  18484. * A specialized version of `_.reduceRight` for arrays without support for
  18485. * iteratee shorthands.
  18486. *
  18487. * @private
  18488. * @param {Array} [array] The array to iterate over.
  18489. * @param {Function} iteratee The function invoked per iteration.
  18490. * @param {*} [accumulator] The initial value.
  18491. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18492. * the initial value.
  18493. * @returns {*} Returns the accumulated value.
  18494. */
  18495. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18496. var length = array == null ? 0 : array.length;
  18497. if (initAccum && length) {
  18498. accumulator = array[--length];
  18499. }
  18500. while (length--) {
  18501. accumulator = iteratee(accumulator, array[length], length, array);
  18502. }
  18503. return accumulator;
  18504. }
  18505. /**
  18506. * A specialized version of `_.some` for arrays without support for iteratee
  18507. * shorthands.
  18508. *
  18509. * @private
  18510. * @param {Array} [array] The array to iterate over.
  18511. * @param {Function} predicate The function invoked per iteration.
  18512. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18513. * else `false`.
  18514. */
  18515. function arraySome(array, predicate) {
  18516. var index = -1,
  18517. length = array == null ? 0 : array.length;
  18518. while (++index < length) {
  18519. if (predicate(array[index], index, array)) {
  18520. return true;
  18521. }
  18522. }
  18523. return false;
  18524. }
  18525. /**
  18526. * Gets the size of an ASCII `string`.
  18527. *
  18528. * @private
  18529. * @param {string} string The string inspect.
  18530. * @returns {number} Returns the string size.
  18531. */
  18532. var asciiSize = baseProperty('length');
  18533. /**
  18534. * Converts an ASCII `string` to an array.
  18535. *
  18536. * @private
  18537. * @param {string} string The string to convert.
  18538. * @returns {Array} Returns the converted array.
  18539. */
  18540. function asciiToArray(string) {
  18541. return string.split('');
  18542. }
  18543. /**
  18544. * Splits an ASCII `string` into an array of its words.
  18545. *
  18546. * @private
  18547. * @param {string} The string to inspect.
  18548. * @returns {Array} Returns the words of `string`.
  18549. */
  18550. function asciiWords(string) {
  18551. return string.match(reAsciiWord) || [];
  18552. }
  18553. /**
  18554. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18555. * without support for iteratee shorthands, which iterates over `collection`
  18556. * using `eachFunc`.
  18557. *
  18558. * @private
  18559. * @param {Array|Object} collection The collection to inspect.
  18560. * @param {Function} predicate The function invoked per iteration.
  18561. * @param {Function} eachFunc The function to iterate over `collection`.
  18562. * @returns {*} Returns the found element or its key, else `undefined`.
  18563. */
  18564. function baseFindKey(collection, predicate, eachFunc) {
  18565. var result;
  18566. eachFunc(collection, function(value, key, collection) {
  18567. if (predicate(value, key, collection)) {
  18568. result = key;
  18569. return false;
  18570. }
  18571. });
  18572. return result;
  18573. }
  18574. /**
  18575. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18576. * support for iteratee shorthands.
  18577. *
  18578. * @private
  18579. * @param {Array} array The array to inspect.
  18580. * @param {Function} predicate The function invoked per iteration.
  18581. * @param {number} fromIndex The index to search from.
  18582. * @param {boolean} [fromRight] Specify iterating from right to left.
  18583. * @returns {number} Returns the index of the matched value, else `-1`.
  18584. */
  18585. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18586. var length = array.length,
  18587. index = fromIndex + (fromRight ? 1 : -1);
  18588. while ((fromRight ? index-- : ++index < length)) {
  18589. if (predicate(array[index], index, array)) {
  18590. return index;
  18591. }
  18592. }
  18593. return -1;
  18594. }
  18595. /**
  18596. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18597. *
  18598. * @private
  18599. * @param {Array} array The array to inspect.
  18600. * @param {*} value The value to search for.
  18601. * @param {number} fromIndex The index to search from.
  18602. * @returns {number} Returns the index of the matched value, else `-1`.
  18603. */
  18604. function baseIndexOf(array, value, fromIndex) {
  18605. return value === value
  18606. ? strictIndexOf(array, value, fromIndex)
  18607. : baseFindIndex(array, baseIsNaN, fromIndex);
  18608. }
  18609. /**
  18610. * This function is like `baseIndexOf` except that it accepts a comparator.
  18611. *
  18612. * @private
  18613. * @param {Array} array The array to inspect.
  18614. * @param {*} value The value to search for.
  18615. * @param {number} fromIndex The index to search from.
  18616. * @param {Function} comparator The comparator invoked per element.
  18617. * @returns {number} Returns the index of the matched value, else `-1`.
  18618. */
  18619. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18620. var index = fromIndex - 1,
  18621. length = array.length;
  18622. while (++index < length) {
  18623. if (comparator(array[index], value)) {
  18624. return index;
  18625. }
  18626. }
  18627. return -1;
  18628. }
  18629. /**
  18630. * The base implementation of `_.isNaN` without support for number objects.
  18631. *
  18632. * @private
  18633. * @param {*} value The value to check.
  18634. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18635. */
  18636. function baseIsNaN(value) {
  18637. return value !== value;
  18638. }
  18639. /**
  18640. * The base implementation of `_.mean` and `_.meanBy` without support for
  18641. * iteratee shorthands.
  18642. *
  18643. * @private
  18644. * @param {Array} array The array to iterate over.
  18645. * @param {Function} iteratee The function invoked per iteration.
  18646. * @returns {number} Returns the mean.
  18647. */
  18648. function baseMean(array, iteratee) {
  18649. var length = array == null ? 0 : array.length;
  18650. return length ? (baseSum(array, iteratee) / length) : NAN;
  18651. }
  18652. /**
  18653. * The base implementation of `_.property` without support for deep paths.
  18654. *
  18655. * @private
  18656. * @param {string} key The key of the property to get.
  18657. * @returns {Function} Returns the new accessor function.
  18658. */
  18659. function baseProperty(key) {
  18660. return function(object) {
  18661. return object == null ? undefined : object[key];
  18662. };
  18663. }
  18664. /**
  18665. * The base implementation of `_.propertyOf` without support for deep paths.
  18666. *
  18667. * @private
  18668. * @param {Object} object The object to query.
  18669. * @returns {Function} Returns the new accessor function.
  18670. */
  18671. function basePropertyOf(object) {
  18672. return function(key) {
  18673. return object == null ? undefined : object[key];
  18674. };
  18675. }
  18676. /**
  18677. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18678. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18679. *
  18680. * @private
  18681. * @param {Array|Object} collection The collection to iterate over.
  18682. * @param {Function} iteratee The function invoked per iteration.
  18683. * @param {*} accumulator The initial value.
  18684. * @param {boolean} initAccum Specify using the first or last element of
  18685. * `collection` as the initial value.
  18686. * @param {Function} eachFunc The function to iterate over `collection`.
  18687. * @returns {*} Returns the accumulated value.
  18688. */
  18689. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18690. eachFunc(collection, function(value, index, collection) {
  18691. accumulator = initAccum
  18692. ? (initAccum = false, value)
  18693. : iteratee(accumulator, value, index, collection);
  18694. });
  18695. return accumulator;
  18696. }
  18697. /**
  18698. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18699. * sort order of `array` and replaces criteria objects with their corresponding
  18700. * values.
  18701. *
  18702. * @private
  18703. * @param {Array} array The array to sort.
  18704. * @param {Function} comparer The function to define sort order.
  18705. * @returns {Array} Returns `array`.
  18706. */
  18707. function baseSortBy(array, comparer) {
  18708. var length = array.length;
  18709. array.sort(comparer);
  18710. while (length--) {
  18711. array[length] = array[length].value;
  18712. }
  18713. return array;
  18714. }
  18715. /**
  18716. * The base implementation of `_.sum` and `_.sumBy` without support for
  18717. * iteratee shorthands.
  18718. *
  18719. * @private
  18720. * @param {Array} array The array to iterate over.
  18721. * @param {Function} iteratee The function invoked per iteration.
  18722. * @returns {number} Returns the sum.
  18723. */
  18724. function baseSum(array, iteratee) {
  18725. var result,
  18726. index = -1,
  18727. length = array.length;
  18728. while (++index < length) {
  18729. var current = iteratee(array[index]);
  18730. if (current !== undefined) {
  18731. result = result === undefined ? current : (result + current);
  18732. }
  18733. }
  18734. return result;
  18735. }
  18736. /**
  18737. * The base implementation of `_.times` without support for iteratee shorthands
  18738. * or max array length checks.
  18739. *
  18740. * @private
  18741. * @param {number} n The number of times to invoke `iteratee`.
  18742. * @param {Function} iteratee The function invoked per iteration.
  18743. * @returns {Array} Returns the array of results.
  18744. */
  18745. function baseTimes(n, iteratee) {
  18746. var index = -1,
  18747. result = Array(n);
  18748. while (++index < n) {
  18749. result[index] = iteratee(index);
  18750. }
  18751. return result;
  18752. }
  18753. /**
  18754. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18755. * of key-value pairs for `object` corresponding to the property names of `props`.
  18756. *
  18757. * @private
  18758. * @param {Object} object The object to query.
  18759. * @param {Array} props The property names to get values for.
  18760. * @returns {Object} Returns the key-value pairs.
  18761. */
  18762. function baseToPairs(object, props) {
  18763. return arrayMap(props, function(key) {
  18764. return [key, object[key]];
  18765. });
  18766. }
  18767. /**
  18768. * The base implementation of `_.unary` without support for storing metadata.
  18769. *
  18770. * @private
  18771. * @param {Function} func The function to cap arguments for.
  18772. * @returns {Function} Returns the new capped function.
  18773. */
  18774. function baseUnary(func) {
  18775. return function(value) {
  18776. return func(value);
  18777. };
  18778. }
  18779. /**
  18780. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18781. * array of `object` property values corresponding to the property names
  18782. * of `props`.
  18783. *
  18784. * @private
  18785. * @param {Object} object The object to query.
  18786. * @param {Array} props The property names to get values for.
  18787. * @returns {Object} Returns the array of property values.
  18788. */
  18789. function baseValues(object, props) {
  18790. return arrayMap(props, function(key) {
  18791. return object[key];
  18792. });
  18793. }
  18794. /**
  18795. * Checks if a `cache` value for `key` exists.
  18796. *
  18797. * @private
  18798. * @param {Object} cache The cache to query.
  18799. * @param {string} key The key of the entry to check.
  18800. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18801. */
  18802. function cacheHas(cache, key) {
  18803. return cache.has(key);
  18804. }
  18805. /**
  18806. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18807. * that is not found in the character symbols.
  18808. *
  18809. * @private
  18810. * @param {Array} strSymbols The string symbols to inspect.
  18811. * @param {Array} chrSymbols The character symbols to find.
  18812. * @returns {number} Returns the index of the first unmatched string symbol.
  18813. */
  18814. function charsStartIndex(strSymbols, chrSymbols) {
  18815. var index = -1,
  18816. length = strSymbols.length;
  18817. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18818. return index;
  18819. }
  18820. /**
  18821. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18822. * that is not found in the character symbols.
  18823. *
  18824. * @private
  18825. * @param {Array} strSymbols The string symbols to inspect.
  18826. * @param {Array} chrSymbols The character symbols to find.
  18827. * @returns {number} Returns the index of the last unmatched string symbol.
  18828. */
  18829. function charsEndIndex(strSymbols, chrSymbols) {
  18830. var index = strSymbols.length;
  18831. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18832. return index;
  18833. }
  18834. /**
  18835. * Gets the number of `placeholder` occurrences in `array`.
  18836. *
  18837. * @private
  18838. * @param {Array} array The array to inspect.
  18839. * @param {*} placeholder The placeholder to search for.
  18840. * @returns {number} Returns the placeholder count.
  18841. */
  18842. function countHolders(array, placeholder) {
  18843. var length = array.length,
  18844. result = 0;
  18845. while (length--) {
  18846. if (array[length] === placeholder) {
  18847. ++result;
  18848. }
  18849. }
  18850. return result;
  18851. }
  18852. /**
  18853. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18854. * letters to basic Latin letters.
  18855. *
  18856. * @private
  18857. * @param {string} letter The matched letter to deburr.
  18858. * @returns {string} Returns the deburred letter.
  18859. */
  18860. var deburrLetter = basePropertyOf(deburredLetters);
  18861. /**
  18862. * Used by `_.escape` to convert characters to HTML entities.
  18863. *
  18864. * @private
  18865. * @param {string} chr The matched character to escape.
  18866. * @returns {string} Returns the escaped character.
  18867. */
  18868. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18869. /**
  18870. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18871. *
  18872. * @private
  18873. * @param {string} chr The matched character to escape.
  18874. * @returns {string} Returns the escaped character.
  18875. */
  18876. function escapeStringChar(chr) {
  18877. return '\\' + stringEscapes[chr];
  18878. }
  18879. /**
  18880. * Gets the value at `key` of `object`.
  18881. *
  18882. * @private
  18883. * @param {Object} [object] The object to query.
  18884. * @param {string} key The key of the property to get.
  18885. * @returns {*} Returns the property value.
  18886. */
  18887. function getValue(object, key) {
  18888. return object == null ? undefined : object[key];
  18889. }
  18890. /**
  18891. * Checks if `string` contains Unicode symbols.
  18892. *
  18893. * @private
  18894. * @param {string} string The string to inspect.
  18895. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18896. */
  18897. function hasUnicode(string) {
  18898. return reHasUnicode.test(string);
  18899. }
  18900. /**
  18901. * Checks if `string` contains a word composed of Unicode symbols.
  18902. *
  18903. * @private
  18904. * @param {string} string The string to inspect.
  18905. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18906. */
  18907. function hasUnicodeWord(string) {
  18908. return reHasUnicodeWord.test(string);
  18909. }
  18910. /**
  18911. * Converts `iterator` to an array.
  18912. *
  18913. * @private
  18914. * @param {Object} iterator The iterator to convert.
  18915. * @returns {Array} Returns the converted array.
  18916. */
  18917. function iteratorToArray(iterator) {
  18918. var data,
  18919. result = [];
  18920. while (!(data = iterator.next()).done) {
  18921. result.push(data.value);
  18922. }
  18923. return result;
  18924. }
  18925. /**
  18926. * Converts `map` to its key-value pairs.
  18927. *
  18928. * @private
  18929. * @param {Object} map The map to convert.
  18930. * @returns {Array} Returns the key-value pairs.
  18931. */
  18932. function mapToArray(map) {
  18933. var index = -1,
  18934. result = Array(map.size);
  18935. map.forEach(function(value, key) {
  18936. result[++index] = [key, value];
  18937. });
  18938. return result;
  18939. }
  18940. /**
  18941. * Creates a unary function that invokes `func` with its argument transformed.
  18942. *
  18943. * @private
  18944. * @param {Function} func The function to wrap.
  18945. * @param {Function} transform The argument transform.
  18946. * @returns {Function} Returns the new function.
  18947. */
  18948. function overArg(func, transform) {
  18949. return function(arg) {
  18950. return func(transform(arg));
  18951. };
  18952. }
  18953. /**
  18954. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18955. * and returns an array of their indexes.
  18956. *
  18957. * @private
  18958. * @param {Array} array The array to modify.
  18959. * @param {*} placeholder The placeholder to replace.
  18960. * @returns {Array} Returns the new array of placeholder indexes.
  18961. */
  18962. function replaceHolders(array, placeholder) {
  18963. var index = -1,
  18964. length = array.length,
  18965. resIndex = 0,
  18966. result = [];
  18967. while (++index < length) {
  18968. var value = array[index];
  18969. if (value === placeholder || value === PLACEHOLDER) {
  18970. array[index] = PLACEHOLDER;
  18971. result[resIndex++] = index;
  18972. }
  18973. }
  18974. return result;
  18975. }
  18976. /**
  18977. * Converts `set` to an array of its values.
  18978. *
  18979. * @private
  18980. * @param {Object} set The set to convert.
  18981. * @returns {Array} Returns the values.
  18982. */
  18983. function setToArray(set) {
  18984. var index = -1,
  18985. result = Array(set.size);
  18986. set.forEach(function(value) {
  18987. result[++index] = value;
  18988. });
  18989. return result;
  18990. }
  18991. /**
  18992. * Converts `set` to its value-value pairs.
  18993. *
  18994. * @private
  18995. * @param {Object} set The set to convert.
  18996. * @returns {Array} Returns the value-value pairs.
  18997. */
  18998. function setToPairs(set) {
  18999. var index = -1,
  19000. result = Array(set.size);
  19001. set.forEach(function(value) {
  19002. result[++index] = [value, value];
  19003. });
  19004. return result;
  19005. }
  19006. /**
  19007. * A specialized version of `_.indexOf` which performs strict equality
  19008. * comparisons of values, i.e. `===`.
  19009. *
  19010. * @private
  19011. * @param {Array} array The array to inspect.
  19012. * @param {*} value The value to search for.
  19013. * @param {number} fromIndex The index to search from.
  19014. * @returns {number} Returns the index of the matched value, else `-1`.
  19015. */
  19016. function strictIndexOf(array, value, fromIndex) {
  19017. var index = fromIndex - 1,
  19018. length = array.length;
  19019. while (++index < length) {
  19020. if (array[index] === value) {
  19021. return index;
  19022. }
  19023. }
  19024. return -1;
  19025. }
  19026. /**
  19027. * A specialized version of `_.lastIndexOf` which performs strict equality
  19028. * comparisons of values, i.e. `===`.
  19029. *
  19030. * @private
  19031. * @param {Array} array The array to inspect.
  19032. * @param {*} value The value to search for.
  19033. * @param {number} fromIndex The index to search from.
  19034. * @returns {number} Returns the index of the matched value, else `-1`.
  19035. */
  19036. function strictLastIndexOf(array, value, fromIndex) {
  19037. var index = fromIndex + 1;
  19038. while (index--) {
  19039. if (array[index] === value) {
  19040. return index;
  19041. }
  19042. }
  19043. return index;
  19044. }
  19045. /**
  19046. * Gets the number of symbols in `string`.
  19047. *
  19048. * @private
  19049. * @param {string} string The string to inspect.
  19050. * @returns {number} Returns the string size.
  19051. */
  19052. function stringSize(string) {
  19053. return hasUnicode(string)
  19054. ? unicodeSize(string)
  19055. : asciiSize(string);
  19056. }
  19057. /**
  19058. * Converts `string` to an array.
  19059. *
  19060. * @private
  19061. * @param {string} string The string to convert.
  19062. * @returns {Array} Returns the converted array.
  19063. */
  19064. function stringToArray(string) {
  19065. return hasUnicode(string)
  19066. ? unicodeToArray(string)
  19067. : asciiToArray(string);
  19068. }
  19069. /**
  19070. * Used by `_.unescape` to convert HTML entities to characters.
  19071. *
  19072. * @private
  19073. * @param {string} chr The matched character to unescape.
  19074. * @returns {string} Returns the unescaped character.
  19075. */
  19076. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19077. /**
  19078. * Gets the size of a Unicode `string`.
  19079. *
  19080. * @private
  19081. * @param {string} string The string inspect.
  19082. * @returns {number} Returns the string size.
  19083. */
  19084. function unicodeSize(string) {
  19085. var result = reUnicode.lastIndex = 0;
  19086. while (reUnicode.test(string)) {
  19087. ++result;
  19088. }
  19089. return result;
  19090. }
  19091. /**
  19092. * Converts a Unicode `string` to an array.
  19093. *
  19094. * @private
  19095. * @param {string} string The string to convert.
  19096. * @returns {Array} Returns the converted array.
  19097. */
  19098. function unicodeToArray(string) {
  19099. return string.match(reUnicode) || [];
  19100. }
  19101. /**
  19102. * Splits a Unicode `string` into an array of its words.
  19103. *
  19104. * @private
  19105. * @param {string} The string to inspect.
  19106. * @returns {Array} Returns the words of `string`.
  19107. */
  19108. function unicodeWords(string) {
  19109. return string.match(reUnicodeWord) || [];
  19110. }
  19111. /*--------------------------------------------------------------------------*/
  19112. /**
  19113. * Create a new pristine `lodash` function using the `context` object.
  19114. *
  19115. * @static
  19116. * @memberOf _
  19117. * @since 1.1.0
  19118. * @category Util
  19119. * @param {Object} [context=root] The context object.
  19120. * @returns {Function} Returns a new `lodash` function.
  19121. * @example
  19122. *
  19123. * _.mixin({ 'foo': _.constant('foo') });
  19124. *
  19125. * var lodash = _.runInContext();
  19126. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19127. *
  19128. * _.isFunction(_.foo);
  19129. * // => true
  19130. * _.isFunction(_.bar);
  19131. * // => false
  19132. *
  19133. * lodash.isFunction(lodash.foo);
  19134. * // => false
  19135. * lodash.isFunction(lodash.bar);
  19136. * // => true
  19137. *
  19138. * // Create a suped-up `defer` in Node.js.
  19139. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19140. */
  19141. var runInContext = (function runInContext(context) {
  19142. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19143. /** Built-in constructor references. */
  19144. var Array = context.Array,
  19145. Date = context.Date,
  19146. Error = context.Error,
  19147. Function = context.Function,
  19148. Math = context.Math,
  19149. Object = context.Object,
  19150. RegExp = context.RegExp,
  19151. String = context.String,
  19152. TypeError = context.TypeError;
  19153. /** Used for built-in method references. */
  19154. var arrayProto = Array.prototype,
  19155. funcProto = Function.prototype,
  19156. objectProto = Object.prototype;
  19157. /** Used to detect overreaching core-js shims. */
  19158. var coreJsData = context['__core-js_shared__'];
  19159. /** Used to resolve the decompiled source of functions. */
  19160. var funcToString = funcProto.toString;
  19161. /** Used to check objects for own properties. */
  19162. var hasOwnProperty = objectProto.hasOwnProperty;
  19163. /** Used to generate unique IDs. */
  19164. var idCounter = 0;
  19165. /** Used to detect methods masquerading as native. */
  19166. var maskSrcKey = (function() {
  19167. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19168. return uid ? ('Symbol(src)_1.' + uid) : '';
  19169. }());
  19170. /**
  19171. * Used to resolve the
  19172. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19173. * of values.
  19174. */
  19175. var nativeObjectToString = objectProto.toString;
  19176. /** Used to infer the `Object` constructor. */
  19177. var objectCtorString = funcToString.call(Object);
  19178. /** Used to restore the original `_` reference in `_.noConflict`. */
  19179. var oldDash = root._;
  19180. /** Used to detect if a method is native. */
  19181. var reIsNative = RegExp('^' +
  19182. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19183. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19184. );
  19185. /** Built-in value references. */
  19186. var Buffer = moduleExports ? context.Buffer : undefined,
  19187. Symbol = context.Symbol,
  19188. Uint8Array = context.Uint8Array,
  19189. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19190. getPrototype = overArg(Object.getPrototypeOf, Object),
  19191. objectCreate = Object.create,
  19192. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19193. splice = arrayProto.splice,
  19194. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19195. symIterator = Symbol ? Symbol.iterator : undefined,
  19196. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19197. var defineProperty = (function() {
  19198. try {
  19199. var func = getNative(Object, 'defineProperty');
  19200. func({}, '', {});
  19201. return func;
  19202. } catch (e) {}
  19203. }());
  19204. /** Mocked built-ins. */
  19205. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19206. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19207. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19208. /* Built-in method references for those with the same name as other `lodash` methods. */
  19209. var nativeCeil = Math.ceil,
  19210. nativeFloor = Math.floor,
  19211. nativeGetSymbols = Object.getOwnPropertySymbols,
  19212. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19213. nativeIsFinite = context.isFinite,
  19214. nativeJoin = arrayProto.join,
  19215. nativeKeys = overArg(Object.keys, Object),
  19216. nativeMax = Math.max,
  19217. nativeMin = Math.min,
  19218. nativeNow = Date.now,
  19219. nativeParseInt = context.parseInt,
  19220. nativeRandom = Math.random,
  19221. nativeReverse = arrayProto.reverse;
  19222. /* Built-in method references that are verified to be native. */
  19223. var DataView = getNative(context, 'DataView'),
  19224. Map = getNative(context, 'Map'),
  19225. Promise = getNative(context, 'Promise'),
  19226. Set = getNative(context, 'Set'),
  19227. WeakMap = getNative(context, 'WeakMap'),
  19228. nativeCreate = getNative(Object, 'create');
  19229. /** Used to store function metadata. */
  19230. var metaMap = WeakMap && new WeakMap;
  19231. /** Used to lookup unminified function names. */
  19232. var realNames = {};
  19233. /** Used to detect maps, sets, and weakmaps. */
  19234. var dataViewCtorString = toSource(DataView),
  19235. mapCtorString = toSource(Map),
  19236. promiseCtorString = toSource(Promise),
  19237. setCtorString = toSource(Set),
  19238. weakMapCtorString = toSource(WeakMap);
  19239. /** Used to convert symbols to primitives and strings. */
  19240. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19241. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19242. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19243. /*------------------------------------------------------------------------*/
  19244. /**
  19245. * Creates a `lodash` object which wraps `value` to enable implicit method
  19246. * chain sequences. Methods that operate on and return arrays, collections,
  19247. * and functions can be chained together. Methods that retrieve a single value
  19248. * or may return a primitive value will automatically end the chain sequence
  19249. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19250. * with `_#value`.
  19251. *
  19252. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19253. * enabled using `_.chain`.
  19254. *
  19255. * The execution of chained methods is lazy, that is, it's deferred until
  19256. * `_#value` is implicitly or explicitly called.
  19257. *
  19258. * Lazy evaluation allows several methods to support shortcut fusion.
  19259. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19260. * the creation of intermediate arrays and can greatly reduce the number of
  19261. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19262. * fusion if the section is applied to an array and iteratees accept only
  19263. * one argument. The heuristic for whether a section qualifies for shortcut
  19264. * fusion is subject to change.
  19265. *
  19266. * Chaining is supported in custom builds as long as the `_#value` method is
  19267. * directly or indirectly included in the build.
  19268. *
  19269. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19270. *
  19271. * The wrapper `Array` methods are:
  19272. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19273. *
  19274. * The wrapper `String` methods are:
  19275. * `replace` and `split`
  19276. *
  19277. * The wrapper methods that support shortcut fusion are:
  19278. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19279. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19280. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19281. *
  19282. * The chainable wrapper methods are:
  19283. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19284. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19285. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19286. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19287. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19288. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19289. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19290. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19291. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19292. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19293. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19294. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19295. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19296. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19297. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19298. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19299. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19300. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19301. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19302. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19303. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19304. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19305. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19306. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19307. *
  19308. * The wrapper methods that are **not** chainable by default are:
  19309. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19310. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19311. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19312. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19313. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19314. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19315. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19316. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19317. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19318. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19319. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19320. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19321. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19322. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19323. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19324. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19325. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19326. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19327. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19328. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19329. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19330. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19331. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19332. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19333. * `upperFirst`, `value`, and `words`
  19334. *
  19335. * @name _
  19336. * @constructor
  19337. * @category Seq
  19338. * @param {*} value The value to wrap in a `lodash` instance.
  19339. * @returns {Object} Returns the new `lodash` wrapper instance.
  19340. * @example
  19341. *
  19342. * function square(n) {
  19343. * return n * n;
  19344. * }
  19345. *
  19346. * var wrapped = _([1, 2, 3]);
  19347. *
  19348. * // Returns an unwrapped value.
  19349. * wrapped.reduce(_.add);
  19350. * // => 6
  19351. *
  19352. * // Returns a wrapped value.
  19353. * var squares = wrapped.map(square);
  19354. *
  19355. * _.isArray(squares);
  19356. * // => false
  19357. *
  19358. * _.isArray(squares.value());
  19359. * // => true
  19360. */
  19361. function lodash(value) {
  19362. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19363. if (value instanceof LodashWrapper) {
  19364. return value;
  19365. }
  19366. if (hasOwnProperty.call(value, '__wrapped__')) {
  19367. return wrapperClone(value);
  19368. }
  19369. }
  19370. return new LodashWrapper(value);
  19371. }
  19372. /**
  19373. * The base implementation of `_.create` without support for assigning
  19374. * properties to the created object.
  19375. *
  19376. * @private
  19377. * @param {Object} proto The object to inherit from.
  19378. * @returns {Object} Returns the new object.
  19379. */
  19380. var baseCreate = (function() {
  19381. function object() {}
  19382. return function(proto) {
  19383. if (!isObject(proto)) {
  19384. return {};
  19385. }
  19386. if (objectCreate) {
  19387. return objectCreate(proto);
  19388. }
  19389. object.prototype = proto;
  19390. var result = new object;
  19391. object.prototype = undefined;
  19392. return result;
  19393. };
  19394. }());
  19395. /**
  19396. * The function whose prototype chain sequence wrappers inherit from.
  19397. *
  19398. * @private
  19399. */
  19400. function baseLodash() {
  19401. // No operation performed.
  19402. }
  19403. /**
  19404. * The base constructor for creating `lodash` wrapper objects.
  19405. *
  19406. * @private
  19407. * @param {*} value The value to wrap.
  19408. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19409. */
  19410. function LodashWrapper(value, chainAll) {
  19411. this.__wrapped__ = value;
  19412. this.__actions__ = [];
  19413. this.__chain__ = !!chainAll;
  19414. this.__index__ = 0;
  19415. this.__values__ = undefined;
  19416. }
  19417. /**
  19418. * By default, the template delimiters used by lodash are like those in
  19419. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19420. * following template settings to use alternative delimiters.
  19421. *
  19422. * @static
  19423. * @memberOf _
  19424. * @type {Object}
  19425. */
  19426. lodash.templateSettings = {
  19427. /**
  19428. * Used to detect `data` property values to be HTML-escaped.
  19429. *
  19430. * @memberOf _.templateSettings
  19431. * @type {RegExp}
  19432. */
  19433. 'escape': reEscape,
  19434. /**
  19435. * Used to detect code to be evaluated.
  19436. *
  19437. * @memberOf _.templateSettings
  19438. * @type {RegExp}
  19439. */
  19440. 'evaluate': reEvaluate,
  19441. /**
  19442. * Used to detect `data` property values to inject.
  19443. *
  19444. * @memberOf _.templateSettings
  19445. * @type {RegExp}
  19446. */
  19447. 'interpolate': reInterpolate,
  19448. /**
  19449. * Used to reference the data object in the template text.
  19450. *
  19451. * @memberOf _.templateSettings
  19452. * @type {string}
  19453. */
  19454. 'variable': '',
  19455. /**
  19456. * Used to import variables into the compiled template.
  19457. *
  19458. * @memberOf _.templateSettings
  19459. * @type {Object}
  19460. */
  19461. 'imports': {
  19462. /**
  19463. * A reference to the `lodash` function.
  19464. *
  19465. * @memberOf _.templateSettings.imports
  19466. * @type {Function}
  19467. */
  19468. '_': lodash
  19469. }
  19470. };
  19471. // Ensure wrappers are instances of `baseLodash`.
  19472. lodash.prototype = baseLodash.prototype;
  19473. lodash.prototype.constructor = lodash;
  19474. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19475. LodashWrapper.prototype.constructor = LodashWrapper;
  19476. /*------------------------------------------------------------------------*/
  19477. /**
  19478. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19479. *
  19480. * @private
  19481. * @constructor
  19482. * @param {*} value The value to wrap.
  19483. */
  19484. function LazyWrapper(value) {
  19485. this.__wrapped__ = value;
  19486. this.__actions__ = [];
  19487. this.__dir__ = 1;
  19488. this.__filtered__ = false;
  19489. this.__iteratees__ = [];
  19490. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19491. this.__views__ = [];
  19492. }
  19493. /**
  19494. * Creates a clone of the lazy wrapper object.
  19495. *
  19496. * @private
  19497. * @name clone
  19498. * @memberOf LazyWrapper
  19499. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19500. */
  19501. function lazyClone() {
  19502. var result = new LazyWrapper(this.__wrapped__);
  19503. result.__actions__ = copyArray(this.__actions__);
  19504. result.__dir__ = this.__dir__;
  19505. result.__filtered__ = this.__filtered__;
  19506. result.__iteratees__ = copyArray(this.__iteratees__);
  19507. result.__takeCount__ = this.__takeCount__;
  19508. result.__views__ = copyArray(this.__views__);
  19509. return result;
  19510. }
  19511. /**
  19512. * Reverses the direction of lazy iteration.
  19513. *
  19514. * @private
  19515. * @name reverse
  19516. * @memberOf LazyWrapper
  19517. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19518. */
  19519. function lazyReverse() {
  19520. if (this.__filtered__) {
  19521. var result = new LazyWrapper(this);
  19522. result.__dir__ = -1;
  19523. result.__filtered__ = true;
  19524. } else {
  19525. result = this.clone();
  19526. result.__dir__ *= -1;
  19527. }
  19528. return result;
  19529. }
  19530. /**
  19531. * Extracts the unwrapped value from its lazy wrapper.
  19532. *
  19533. * @private
  19534. * @name value
  19535. * @memberOf LazyWrapper
  19536. * @returns {*} Returns the unwrapped value.
  19537. */
  19538. function lazyValue() {
  19539. var array = this.__wrapped__.value(),
  19540. dir = this.__dir__,
  19541. isArr = isArray(array),
  19542. isRight = dir < 0,
  19543. arrLength = isArr ? array.length : 0,
  19544. view = getView(0, arrLength, this.__views__),
  19545. start = view.start,
  19546. end = view.end,
  19547. length = end - start,
  19548. index = isRight ? end : (start - 1),
  19549. iteratees = this.__iteratees__,
  19550. iterLength = iteratees.length,
  19551. resIndex = 0,
  19552. takeCount = nativeMin(length, this.__takeCount__);
  19553. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19554. return baseWrapperValue(array, this.__actions__);
  19555. }
  19556. var result = [];
  19557. outer:
  19558. while (length-- && resIndex < takeCount) {
  19559. index += dir;
  19560. var iterIndex = -1,
  19561. value = array[index];
  19562. while (++iterIndex < iterLength) {
  19563. var data = iteratees[iterIndex],
  19564. iteratee = data.iteratee,
  19565. type = data.type,
  19566. computed = iteratee(value);
  19567. if (type == LAZY_MAP_FLAG) {
  19568. value = computed;
  19569. } else if (!computed) {
  19570. if (type == LAZY_FILTER_FLAG) {
  19571. continue outer;
  19572. } else {
  19573. break outer;
  19574. }
  19575. }
  19576. }
  19577. result[resIndex++] = value;
  19578. }
  19579. return result;
  19580. }
  19581. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19582. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19583. LazyWrapper.prototype.constructor = LazyWrapper;
  19584. /*------------------------------------------------------------------------*/
  19585. /**
  19586. * Creates a hash object.
  19587. *
  19588. * @private
  19589. * @constructor
  19590. * @param {Array} [entries] The key-value pairs to cache.
  19591. */
  19592. function Hash(entries) {
  19593. var index = -1,
  19594. length = entries == null ? 0 : entries.length;
  19595. this.clear();
  19596. while (++index < length) {
  19597. var entry = entries[index];
  19598. this.set(entry[0], entry[1]);
  19599. }
  19600. }
  19601. /**
  19602. * Removes all key-value entries from the hash.
  19603. *
  19604. * @private
  19605. * @name clear
  19606. * @memberOf Hash
  19607. */
  19608. function hashClear() {
  19609. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19610. this.size = 0;
  19611. }
  19612. /**
  19613. * Removes `key` and its value from the hash.
  19614. *
  19615. * @private
  19616. * @name delete
  19617. * @memberOf Hash
  19618. * @param {Object} hash The hash to modify.
  19619. * @param {string} key The key of the value to remove.
  19620. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19621. */
  19622. function hashDelete(key) {
  19623. var result = this.has(key) && delete this.__data__[key];
  19624. this.size -= result ? 1 : 0;
  19625. return result;
  19626. }
  19627. /**
  19628. * Gets the hash value for `key`.
  19629. *
  19630. * @private
  19631. * @name get
  19632. * @memberOf Hash
  19633. * @param {string} key The key of the value to get.
  19634. * @returns {*} Returns the entry value.
  19635. */
  19636. function hashGet(key) {
  19637. var data = this.__data__;
  19638. if (nativeCreate) {
  19639. var result = data[key];
  19640. return result === HASH_UNDEFINED ? undefined : result;
  19641. }
  19642. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19643. }
  19644. /**
  19645. * Checks if a hash value for `key` exists.
  19646. *
  19647. * @private
  19648. * @name has
  19649. * @memberOf Hash
  19650. * @param {string} key The key of the entry to check.
  19651. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19652. */
  19653. function hashHas(key) {
  19654. var data = this.__data__;
  19655. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19656. }
  19657. /**
  19658. * Sets the hash `key` to `value`.
  19659. *
  19660. * @private
  19661. * @name set
  19662. * @memberOf Hash
  19663. * @param {string} key The key of the value to set.
  19664. * @param {*} value The value to set.
  19665. * @returns {Object} Returns the hash instance.
  19666. */
  19667. function hashSet(key, value) {
  19668. var data = this.__data__;
  19669. this.size += this.has(key) ? 0 : 1;
  19670. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19671. return this;
  19672. }
  19673. // Add methods to `Hash`.
  19674. Hash.prototype.clear = hashClear;
  19675. Hash.prototype['delete'] = hashDelete;
  19676. Hash.prototype.get = hashGet;
  19677. Hash.prototype.has = hashHas;
  19678. Hash.prototype.set = hashSet;
  19679. /*------------------------------------------------------------------------*/
  19680. /**
  19681. * Creates an list cache object.
  19682. *
  19683. * @private
  19684. * @constructor
  19685. * @param {Array} [entries] The key-value pairs to cache.
  19686. */
  19687. function ListCache(entries) {
  19688. var index = -1,
  19689. length = entries == null ? 0 : entries.length;
  19690. this.clear();
  19691. while (++index < length) {
  19692. var entry = entries[index];
  19693. this.set(entry[0], entry[1]);
  19694. }
  19695. }
  19696. /**
  19697. * Removes all key-value entries from the list cache.
  19698. *
  19699. * @private
  19700. * @name clear
  19701. * @memberOf ListCache
  19702. */
  19703. function listCacheClear() {
  19704. this.__data__ = [];
  19705. this.size = 0;
  19706. }
  19707. /**
  19708. * Removes `key` and its value from the list cache.
  19709. *
  19710. * @private
  19711. * @name delete
  19712. * @memberOf ListCache
  19713. * @param {string} key The key of the value to remove.
  19714. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19715. */
  19716. function listCacheDelete(key) {
  19717. var data = this.__data__,
  19718. index = assocIndexOf(data, key);
  19719. if (index < 0) {
  19720. return false;
  19721. }
  19722. var lastIndex = data.length - 1;
  19723. if (index == lastIndex) {
  19724. data.pop();
  19725. } else {
  19726. splice.call(data, index, 1);
  19727. }
  19728. --this.size;
  19729. return true;
  19730. }
  19731. /**
  19732. * Gets the list cache value for `key`.
  19733. *
  19734. * @private
  19735. * @name get
  19736. * @memberOf ListCache
  19737. * @param {string} key The key of the value to get.
  19738. * @returns {*} Returns the entry value.
  19739. */
  19740. function listCacheGet(key) {
  19741. var data = this.__data__,
  19742. index = assocIndexOf(data, key);
  19743. return index < 0 ? undefined : data[index][1];
  19744. }
  19745. /**
  19746. * Checks if a list cache value for `key` exists.
  19747. *
  19748. * @private
  19749. * @name has
  19750. * @memberOf ListCache
  19751. * @param {string} key The key of the entry to check.
  19752. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19753. */
  19754. function listCacheHas(key) {
  19755. return assocIndexOf(this.__data__, key) > -1;
  19756. }
  19757. /**
  19758. * Sets the list cache `key` to `value`.
  19759. *
  19760. * @private
  19761. * @name set
  19762. * @memberOf ListCache
  19763. * @param {string} key The key of the value to set.
  19764. * @param {*} value The value to set.
  19765. * @returns {Object} Returns the list cache instance.
  19766. */
  19767. function listCacheSet(key, value) {
  19768. var data = this.__data__,
  19769. index = assocIndexOf(data, key);
  19770. if (index < 0) {
  19771. ++this.size;
  19772. data.push([key, value]);
  19773. } else {
  19774. data[index][1] = value;
  19775. }
  19776. return this;
  19777. }
  19778. // Add methods to `ListCache`.
  19779. ListCache.prototype.clear = listCacheClear;
  19780. ListCache.prototype['delete'] = listCacheDelete;
  19781. ListCache.prototype.get = listCacheGet;
  19782. ListCache.prototype.has = listCacheHas;
  19783. ListCache.prototype.set = listCacheSet;
  19784. /*------------------------------------------------------------------------*/
  19785. /**
  19786. * Creates a map cache object to store key-value pairs.
  19787. *
  19788. * @private
  19789. * @constructor
  19790. * @param {Array} [entries] The key-value pairs to cache.
  19791. */
  19792. function MapCache(entries) {
  19793. var index = -1,
  19794. length = entries == null ? 0 : entries.length;
  19795. this.clear();
  19796. while (++index < length) {
  19797. var entry = entries[index];
  19798. this.set(entry[0], entry[1]);
  19799. }
  19800. }
  19801. /**
  19802. * Removes all key-value entries from the map.
  19803. *
  19804. * @private
  19805. * @name clear
  19806. * @memberOf MapCache
  19807. */
  19808. function mapCacheClear() {
  19809. this.size = 0;
  19810. this.__data__ = {
  19811. 'hash': new Hash,
  19812. 'map': new (Map || ListCache),
  19813. 'string': new Hash
  19814. };
  19815. }
  19816. /**
  19817. * Removes `key` and its value from the map.
  19818. *
  19819. * @private
  19820. * @name delete
  19821. * @memberOf MapCache
  19822. * @param {string} key The key of the value to remove.
  19823. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19824. */
  19825. function mapCacheDelete(key) {
  19826. var result = getMapData(this, key)['delete'](key);
  19827. this.size -= result ? 1 : 0;
  19828. return result;
  19829. }
  19830. /**
  19831. * Gets the map value for `key`.
  19832. *
  19833. * @private
  19834. * @name get
  19835. * @memberOf MapCache
  19836. * @param {string} key The key of the value to get.
  19837. * @returns {*} Returns the entry value.
  19838. */
  19839. function mapCacheGet(key) {
  19840. return getMapData(this, key).get(key);
  19841. }
  19842. /**
  19843. * Checks if a map value for `key` exists.
  19844. *
  19845. * @private
  19846. * @name has
  19847. * @memberOf MapCache
  19848. * @param {string} key The key of the entry to check.
  19849. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19850. */
  19851. function mapCacheHas(key) {
  19852. return getMapData(this, key).has(key);
  19853. }
  19854. /**
  19855. * Sets the map `key` to `value`.
  19856. *
  19857. * @private
  19858. * @name set
  19859. * @memberOf MapCache
  19860. * @param {string} key The key of the value to set.
  19861. * @param {*} value The value to set.
  19862. * @returns {Object} Returns the map cache instance.
  19863. */
  19864. function mapCacheSet(key, value) {
  19865. var data = getMapData(this, key),
  19866. size = data.size;
  19867. data.set(key, value);
  19868. this.size += data.size == size ? 0 : 1;
  19869. return this;
  19870. }
  19871. // Add methods to `MapCache`.
  19872. MapCache.prototype.clear = mapCacheClear;
  19873. MapCache.prototype['delete'] = mapCacheDelete;
  19874. MapCache.prototype.get = mapCacheGet;
  19875. MapCache.prototype.has = mapCacheHas;
  19876. MapCache.prototype.set = mapCacheSet;
  19877. /*------------------------------------------------------------------------*/
  19878. /**
  19879. *
  19880. * Creates an array cache object to store unique values.
  19881. *
  19882. * @private
  19883. * @constructor
  19884. * @param {Array} [values] The values to cache.
  19885. */
  19886. function SetCache(values) {
  19887. var index = -1,
  19888. length = values == null ? 0 : values.length;
  19889. this.__data__ = new MapCache;
  19890. while (++index < length) {
  19891. this.add(values[index]);
  19892. }
  19893. }
  19894. /**
  19895. * Adds `value` to the array cache.
  19896. *
  19897. * @private
  19898. * @name add
  19899. * @memberOf SetCache
  19900. * @alias push
  19901. * @param {*} value The value to cache.
  19902. * @returns {Object} Returns the cache instance.
  19903. */
  19904. function setCacheAdd(value) {
  19905. this.__data__.set(value, HASH_UNDEFINED);
  19906. return this;
  19907. }
  19908. /**
  19909. * Checks if `value` is in the array cache.
  19910. *
  19911. * @private
  19912. * @name has
  19913. * @memberOf SetCache
  19914. * @param {*} value The value to search for.
  19915. * @returns {number} Returns `true` if `value` is found, else `false`.
  19916. */
  19917. function setCacheHas(value) {
  19918. return this.__data__.has(value);
  19919. }
  19920. // Add methods to `SetCache`.
  19921. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19922. SetCache.prototype.has = setCacheHas;
  19923. /*------------------------------------------------------------------------*/
  19924. /**
  19925. * Creates a stack cache object to store key-value pairs.
  19926. *
  19927. * @private
  19928. * @constructor
  19929. * @param {Array} [entries] The key-value pairs to cache.
  19930. */
  19931. function Stack(entries) {
  19932. var data = this.__data__ = new ListCache(entries);
  19933. this.size = data.size;
  19934. }
  19935. /**
  19936. * Removes all key-value entries from the stack.
  19937. *
  19938. * @private
  19939. * @name clear
  19940. * @memberOf Stack
  19941. */
  19942. function stackClear() {
  19943. this.__data__ = new ListCache;
  19944. this.size = 0;
  19945. }
  19946. /**
  19947. * Removes `key` and its value from the stack.
  19948. *
  19949. * @private
  19950. * @name delete
  19951. * @memberOf Stack
  19952. * @param {string} key The key of the value to remove.
  19953. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19954. */
  19955. function stackDelete(key) {
  19956. var data = this.__data__,
  19957. result = data['delete'](key);
  19958. this.size = data.size;
  19959. return result;
  19960. }
  19961. /**
  19962. * Gets the stack value for `key`.
  19963. *
  19964. * @private
  19965. * @name get
  19966. * @memberOf Stack
  19967. * @param {string} key The key of the value to get.
  19968. * @returns {*} Returns the entry value.
  19969. */
  19970. function stackGet(key) {
  19971. return this.__data__.get(key);
  19972. }
  19973. /**
  19974. * Checks if a stack value for `key` exists.
  19975. *
  19976. * @private
  19977. * @name has
  19978. * @memberOf Stack
  19979. * @param {string} key The key of the entry to check.
  19980. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19981. */
  19982. function stackHas(key) {
  19983. return this.__data__.has(key);
  19984. }
  19985. /**
  19986. * Sets the stack `key` to `value`.
  19987. *
  19988. * @private
  19989. * @name set
  19990. * @memberOf Stack
  19991. * @param {string} key The key of the value to set.
  19992. * @param {*} value The value to set.
  19993. * @returns {Object} Returns the stack cache instance.
  19994. */
  19995. function stackSet(key, value) {
  19996. var data = this.__data__;
  19997. if (data instanceof ListCache) {
  19998. var pairs = data.__data__;
  19999. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20000. pairs.push([key, value]);
  20001. this.size = ++data.size;
  20002. return this;
  20003. }
  20004. data = this.__data__ = new MapCache(pairs);
  20005. }
  20006. data.set(key, value);
  20007. this.size = data.size;
  20008. return this;
  20009. }
  20010. // Add methods to `Stack`.
  20011. Stack.prototype.clear = stackClear;
  20012. Stack.prototype['delete'] = stackDelete;
  20013. Stack.prototype.get = stackGet;
  20014. Stack.prototype.has = stackHas;
  20015. Stack.prototype.set = stackSet;
  20016. /*------------------------------------------------------------------------*/
  20017. /**
  20018. * Creates an array of the enumerable property names of the array-like `value`.
  20019. *
  20020. * @private
  20021. * @param {*} value The value to query.
  20022. * @param {boolean} inherited Specify returning inherited property names.
  20023. * @returns {Array} Returns the array of property names.
  20024. */
  20025. function arrayLikeKeys(value, inherited) {
  20026. var isArr = isArray(value),
  20027. isArg = !isArr && isArguments(value),
  20028. isBuff = !isArr && !isArg && isBuffer(value),
  20029. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20030. skipIndexes = isArr || isArg || isBuff || isType,
  20031. result = skipIndexes ? baseTimes(value.length, String) : [],
  20032. length = result.length;
  20033. for (var key in value) {
  20034. if ((inherited || hasOwnProperty.call(value, key)) &&
  20035. !(skipIndexes && (
  20036. // Safari 9 has enumerable `arguments.length` in strict mode.
  20037. key == 'length' ||
  20038. // Node.js 0.10 has enumerable non-index properties on buffers.
  20039. (isBuff && (key == 'offset' || key == 'parent')) ||
  20040. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20041. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20042. // Skip index properties.
  20043. isIndex(key, length)
  20044. ))) {
  20045. result.push(key);
  20046. }
  20047. }
  20048. return result;
  20049. }
  20050. /**
  20051. * A specialized version of `_.sample` for arrays.
  20052. *
  20053. * @private
  20054. * @param {Array} array The array to sample.
  20055. * @returns {*} Returns the random element.
  20056. */
  20057. function arraySample(array) {
  20058. var length = array.length;
  20059. return length ? array[baseRandom(0, length - 1)] : undefined;
  20060. }
  20061. /**
  20062. * A specialized version of `_.sampleSize` for arrays.
  20063. *
  20064. * @private
  20065. * @param {Array} array The array to sample.
  20066. * @param {number} n The number of elements to sample.
  20067. * @returns {Array} Returns the random elements.
  20068. */
  20069. function arraySampleSize(array, n) {
  20070. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20071. }
  20072. /**
  20073. * A specialized version of `_.shuffle` for arrays.
  20074. *
  20075. * @private
  20076. * @param {Array} array The array to shuffle.
  20077. * @returns {Array} Returns the new shuffled array.
  20078. */
  20079. function arrayShuffle(array) {
  20080. return shuffleSelf(copyArray(array));
  20081. }
  20082. /**
  20083. * This function is like `assignValue` except that it doesn't assign
  20084. * `undefined` values.
  20085. *
  20086. * @private
  20087. * @param {Object} object The object to modify.
  20088. * @param {string} key The key of the property to assign.
  20089. * @param {*} value The value to assign.
  20090. */
  20091. function assignMergeValue(object, key, value) {
  20092. if ((value !== undefined && !eq(object[key], value)) ||
  20093. (value === undefined && !(key in object))) {
  20094. baseAssignValue(object, key, value);
  20095. }
  20096. }
  20097. /**
  20098. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20099. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20100. * for equality comparisons.
  20101. *
  20102. * @private
  20103. * @param {Object} object The object to modify.
  20104. * @param {string} key The key of the property to assign.
  20105. * @param {*} value The value to assign.
  20106. */
  20107. function assignValue(object, key, value) {
  20108. var objValue = object[key];
  20109. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20110. (value === undefined && !(key in object))) {
  20111. baseAssignValue(object, key, value);
  20112. }
  20113. }
  20114. /**
  20115. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20116. *
  20117. * @private
  20118. * @param {Array} array The array to inspect.
  20119. * @param {*} key The key to search for.
  20120. * @returns {number} Returns the index of the matched value, else `-1`.
  20121. */
  20122. function assocIndexOf(array, key) {
  20123. var length = array.length;
  20124. while (length--) {
  20125. if (eq(array[length][0], key)) {
  20126. return length;
  20127. }
  20128. }
  20129. return -1;
  20130. }
  20131. /**
  20132. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20133. * by `iteratee` and values set by `setter`.
  20134. *
  20135. * @private
  20136. * @param {Array|Object} collection The collection to iterate over.
  20137. * @param {Function} setter The function to set `accumulator` values.
  20138. * @param {Function} iteratee The iteratee to transform keys.
  20139. * @param {Object} accumulator The initial aggregated object.
  20140. * @returns {Function} Returns `accumulator`.
  20141. */
  20142. function baseAggregator(collection, setter, iteratee, accumulator) {
  20143. baseEach(collection, function(value, key, collection) {
  20144. setter(accumulator, value, iteratee(value), collection);
  20145. });
  20146. return accumulator;
  20147. }
  20148. /**
  20149. * The base implementation of `_.assign` without support for multiple sources
  20150. * or `customizer` functions.
  20151. *
  20152. * @private
  20153. * @param {Object} object The destination object.
  20154. * @param {Object} source The source object.
  20155. * @returns {Object} Returns `object`.
  20156. */
  20157. function baseAssign(object, source) {
  20158. return object && copyObject(source, keys(source), object);
  20159. }
  20160. /**
  20161. * The base implementation of `_.assignIn` without support for multiple sources
  20162. * or `customizer` functions.
  20163. *
  20164. * @private
  20165. * @param {Object} object The destination object.
  20166. * @param {Object} source The source object.
  20167. * @returns {Object} Returns `object`.
  20168. */
  20169. function baseAssignIn(object, source) {
  20170. return object && copyObject(source, keysIn(source), object);
  20171. }
  20172. /**
  20173. * The base implementation of `assignValue` and `assignMergeValue` without
  20174. * value checks.
  20175. *
  20176. * @private
  20177. * @param {Object} object The object to modify.
  20178. * @param {string} key The key of the property to assign.
  20179. * @param {*} value The value to assign.
  20180. */
  20181. function baseAssignValue(object, key, value) {
  20182. if (key == '__proto__' && defineProperty) {
  20183. defineProperty(object, key, {
  20184. 'configurable': true,
  20185. 'enumerable': true,
  20186. 'value': value,
  20187. 'writable': true
  20188. });
  20189. } else {
  20190. object[key] = value;
  20191. }
  20192. }
  20193. /**
  20194. * The base implementation of `_.at` without support for individual paths.
  20195. *
  20196. * @private
  20197. * @param {Object} object The object to iterate over.
  20198. * @param {string[]} paths The property paths to pick.
  20199. * @returns {Array} Returns the picked elements.
  20200. */
  20201. function baseAt(object, paths) {
  20202. var index = -1,
  20203. length = paths.length,
  20204. result = Array(length),
  20205. skip = object == null;
  20206. while (++index < length) {
  20207. result[index] = skip ? undefined : get(object, paths[index]);
  20208. }
  20209. return result;
  20210. }
  20211. /**
  20212. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20213. *
  20214. * @private
  20215. * @param {number} number The number to clamp.
  20216. * @param {number} [lower] The lower bound.
  20217. * @param {number} upper The upper bound.
  20218. * @returns {number} Returns the clamped number.
  20219. */
  20220. function baseClamp(number, lower, upper) {
  20221. if (number === number) {
  20222. if (upper !== undefined) {
  20223. number = number <= upper ? number : upper;
  20224. }
  20225. if (lower !== undefined) {
  20226. number = number >= lower ? number : lower;
  20227. }
  20228. }
  20229. return number;
  20230. }
  20231. /**
  20232. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20233. * traversed objects.
  20234. *
  20235. * @private
  20236. * @param {*} value The value to clone.
  20237. * @param {boolean} bitmask The bitmask flags.
  20238. * 1 - Deep clone
  20239. * 2 - Flatten inherited properties
  20240. * 4 - Clone symbols
  20241. * @param {Function} [customizer] The function to customize cloning.
  20242. * @param {string} [key] The key of `value`.
  20243. * @param {Object} [object] The parent object of `value`.
  20244. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20245. * @returns {*} Returns the cloned value.
  20246. */
  20247. function baseClone(value, bitmask, customizer, key, object, stack) {
  20248. var result,
  20249. isDeep = bitmask & CLONE_DEEP_FLAG,
  20250. isFlat = bitmask & CLONE_FLAT_FLAG,
  20251. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20252. if (customizer) {
  20253. result = object ? customizer(value, key, object, stack) : customizer(value);
  20254. }
  20255. if (result !== undefined) {
  20256. return result;
  20257. }
  20258. if (!isObject(value)) {
  20259. return value;
  20260. }
  20261. var isArr = isArray(value);
  20262. if (isArr) {
  20263. result = initCloneArray(value);
  20264. if (!isDeep) {
  20265. return copyArray(value, result);
  20266. }
  20267. } else {
  20268. var tag = getTag(value),
  20269. isFunc = tag == funcTag || tag == genTag;
  20270. if (isBuffer(value)) {
  20271. return cloneBuffer(value, isDeep);
  20272. }
  20273. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20274. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20275. if (!isDeep) {
  20276. return isFlat
  20277. ? copySymbolsIn(value, baseAssignIn(result, value))
  20278. : copySymbols(value, baseAssign(result, value));
  20279. }
  20280. } else {
  20281. if (!cloneableTags[tag]) {
  20282. return object ? value : {};
  20283. }
  20284. result = initCloneByTag(value, tag, isDeep);
  20285. }
  20286. }
  20287. // Check for circular references and return its corresponding clone.
  20288. stack || (stack = new Stack);
  20289. var stacked = stack.get(value);
  20290. if (stacked) {
  20291. return stacked;
  20292. }
  20293. stack.set(value, result);
  20294. if (isSet(value)) {
  20295. value.forEach(function(subValue) {
  20296. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20297. });
  20298. } else if (isMap(value)) {
  20299. value.forEach(function(subValue, key) {
  20300. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20301. });
  20302. }
  20303. var keysFunc = isFull
  20304. ? (isFlat ? getAllKeysIn : getAllKeys)
  20305. : (isFlat ? keysIn : keys);
  20306. var props = isArr ? undefined : keysFunc(value);
  20307. arrayEach(props || value, function(subValue, key) {
  20308. if (props) {
  20309. key = subValue;
  20310. subValue = value[key];
  20311. }
  20312. // Recursively populate clone (susceptible to call stack limits).
  20313. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20314. });
  20315. return result;
  20316. }
  20317. /**
  20318. * The base implementation of `_.conforms` which doesn't clone `source`.
  20319. *
  20320. * @private
  20321. * @param {Object} source The object of property predicates to conform to.
  20322. * @returns {Function} Returns the new spec function.
  20323. */
  20324. function baseConforms(source) {
  20325. var props = keys(source);
  20326. return function(object) {
  20327. return baseConformsTo(object, source, props);
  20328. };
  20329. }
  20330. /**
  20331. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20332. *
  20333. * @private
  20334. * @param {Object} object The object to inspect.
  20335. * @param {Object} source The object of property predicates to conform to.
  20336. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20337. */
  20338. function baseConformsTo(object, source, props) {
  20339. var length = props.length;
  20340. if (object == null) {
  20341. return !length;
  20342. }
  20343. object = Object(object);
  20344. while (length--) {
  20345. var key = props[length],
  20346. predicate = source[key],
  20347. value = object[key];
  20348. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20349. return false;
  20350. }
  20351. }
  20352. return true;
  20353. }
  20354. /**
  20355. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20356. * to provide to `func`.
  20357. *
  20358. * @private
  20359. * @param {Function} func The function to delay.
  20360. * @param {number} wait The number of milliseconds to delay invocation.
  20361. * @param {Array} args The arguments to provide to `func`.
  20362. * @returns {number|Object} Returns the timer id or timeout object.
  20363. */
  20364. function baseDelay(func, wait, args) {
  20365. if (typeof func != 'function') {
  20366. throw new TypeError(FUNC_ERROR_TEXT);
  20367. }
  20368. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20369. }
  20370. /**
  20371. * The base implementation of methods like `_.difference` without support
  20372. * for excluding multiple arrays or iteratee shorthands.
  20373. *
  20374. * @private
  20375. * @param {Array} array The array to inspect.
  20376. * @param {Array} values The values to exclude.
  20377. * @param {Function} [iteratee] The iteratee invoked per element.
  20378. * @param {Function} [comparator] The comparator invoked per element.
  20379. * @returns {Array} Returns the new array of filtered values.
  20380. */
  20381. function baseDifference(array, values, iteratee, comparator) {
  20382. var index = -1,
  20383. includes = arrayIncludes,
  20384. isCommon = true,
  20385. length = array.length,
  20386. result = [],
  20387. valuesLength = values.length;
  20388. if (!length) {
  20389. return result;
  20390. }
  20391. if (iteratee) {
  20392. values = arrayMap(values, baseUnary(iteratee));
  20393. }
  20394. if (comparator) {
  20395. includes = arrayIncludesWith;
  20396. isCommon = false;
  20397. }
  20398. else if (values.length >= LARGE_ARRAY_SIZE) {
  20399. includes = cacheHas;
  20400. isCommon = false;
  20401. values = new SetCache(values);
  20402. }
  20403. outer:
  20404. while (++index < length) {
  20405. var value = array[index],
  20406. computed = iteratee == null ? value : iteratee(value);
  20407. value = (comparator || value !== 0) ? value : 0;
  20408. if (isCommon && computed === computed) {
  20409. var valuesIndex = valuesLength;
  20410. while (valuesIndex--) {
  20411. if (values[valuesIndex] === computed) {
  20412. continue outer;
  20413. }
  20414. }
  20415. result.push(value);
  20416. }
  20417. else if (!includes(values, computed, comparator)) {
  20418. result.push(value);
  20419. }
  20420. }
  20421. return result;
  20422. }
  20423. /**
  20424. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20425. *
  20426. * @private
  20427. * @param {Array|Object} collection The collection to iterate over.
  20428. * @param {Function} iteratee The function invoked per iteration.
  20429. * @returns {Array|Object} Returns `collection`.
  20430. */
  20431. var baseEach = createBaseEach(baseForOwn);
  20432. /**
  20433. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20434. *
  20435. * @private
  20436. * @param {Array|Object} collection The collection to iterate over.
  20437. * @param {Function} iteratee The function invoked per iteration.
  20438. * @returns {Array|Object} Returns `collection`.
  20439. */
  20440. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20441. /**
  20442. * The base implementation of `_.every` without support for iteratee shorthands.
  20443. *
  20444. * @private
  20445. * @param {Array|Object} collection The collection to iterate over.
  20446. * @param {Function} predicate The function invoked per iteration.
  20447. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20448. * else `false`
  20449. */
  20450. function baseEvery(collection, predicate) {
  20451. var result = true;
  20452. baseEach(collection, function(value, index, collection) {
  20453. result = !!predicate(value, index, collection);
  20454. return result;
  20455. });
  20456. return result;
  20457. }
  20458. /**
  20459. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20460. * `comparator` to determine the extremum value.
  20461. *
  20462. * @private
  20463. * @param {Array} array The array to iterate over.
  20464. * @param {Function} iteratee The iteratee invoked per iteration.
  20465. * @param {Function} comparator The comparator used to compare values.
  20466. * @returns {*} Returns the extremum value.
  20467. */
  20468. function baseExtremum(array, iteratee, comparator) {
  20469. var index = -1,
  20470. length = array.length;
  20471. while (++index < length) {
  20472. var value = array[index],
  20473. current = iteratee(value);
  20474. if (current != null && (computed === undefined
  20475. ? (current === current && !isSymbol(current))
  20476. : comparator(current, computed)
  20477. )) {
  20478. var computed = current,
  20479. result = value;
  20480. }
  20481. }
  20482. return result;
  20483. }
  20484. /**
  20485. * The base implementation of `_.fill` without an iteratee call guard.
  20486. *
  20487. * @private
  20488. * @param {Array} array The array to fill.
  20489. * @param {*} value The value to fill `array` with.
  20490. * @param {number} [start=0] The start position.
  20491. * @param {number} [end=array.length] The end position.
  20492. * @returns {Array} Returns `array`.
  20493. */
  20494. function baseFill(array, value, start, end) {
  20495. var length = array.length;
  20496. start = toInteger(start);
  20497. if (start < 0) {
  20498. start = -start > length ? 0 : (length + start);
  20499. }
  20500. end = (end === undefined || end > length) ? length : toInteger(end);
  20501. if (end < 0) {
  20502. end += length;
  20503. }
  20504. end = start > end ? 0 : toLength(end);
  20505. while (start < end) {
  20506. array[start++] = value;
  20507. }
  20508. return array;
  20509. }
  20510. /**
  20511. * The base implementation of `_.filter` without support for iteratee shorthands.
  20512. *
  20513. * @private
  20514. * @param {Array|Object} collection The collection to iterate over.
  20515. * @param {Function} predicate The function invoked per iteration.
  20516. * @returns {Array} Returns the new filtered array.
  20517. */
  20518. function baseFilter(collection, predicate) {
  20519. var result = [];
  20520. baseEach(collection, function(value, index, collection) {
  20521. if (predicate(value, index, collection)) {
  20522. result.push(value);
  20523. }
  20524. });
  20525. return result;
  20526. }
  20527. /**
  20528. * The base implementation of `_.flatten` with support for restricting flattening.
  20529. *
  20530. * @private
  20531. * @param {Array} array The array to flatten.
  20532. * @param {number} depth The maximum recursion depth.
  20533. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20534. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20535. * @param {Array} [result=[]] The initial result value.
  20536. * @returns {Array} Returns the new flattened array.
  20537. */
  20538. function baseFlatten(array, depth, predicate, isStrict, result) {
  20539. var index = -1,
  20540. length = array.length;
  20541. predicate || (predicate = isFlattenable);
  20542. result || (result = []);
  20543. while (++index < length) {
  20544. var value = array[index];
  20545. if (depth > 0 && predicate(value)) {
  20546. if (depth > 1) {
  20547. // Recursively flatten arrays (susceptible to call stack limits).
  20548. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20549. } else {
  20550. arrayPush(result, value);
  20551. }
  20552. } else if (!isStrict) {
  20553. result[result.length] = value;
  20554. }
  20555. }
  20556. return result;
  20557. }
  20558. /**
  20559. * The base implementation of `baseForOwn` which iterates over `object`
  20560. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20561. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20562. *
  20563. * @private
  20564. * @param {Object} object The object to iterate over.
  20565. * @param {Function} iteratee The function invoked per iteration.
  20566. * @param {Function} keysFunc The function to get the keys of `object`.
  20567. * @returns {Object} Returns `object`.
  20568. */
  20569. var baseFor = createBaseFor();
  20570. /**
  20571. * This function is like `baseFor` except that it iterates over properties
  20572. * in the opposite order.
  20573. *
  20574. * @private
  20575. * @param {Object} object The object to iterate over.
  20576. * @param {Function} iteratee The function invoked per iteration.
  20577. * @param {Function} keysFunc The function to get the keys of `object`.
  20578. * @returns {Object} Returns `object`.
  20579. */
  20580. var baseForRight = createBaseFor(true);
  20581. /**
  20582. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20583. *
  20584. * @private
  20585. * @param {Object} object The object to iterate over.
  20586. * @param {Function} iteratee The function invoked per iteration.
  20587. * @returns {Object} Returns `object`.
  20588. */
  20589. function baseForOwn(object, iteratee) {
  20590. return object && baseFor(object, iteratee, keys);
  20591. }
  20592. /**
  20593. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20594. *
  20595. * @private
  20596. * @param {Object} object The object to iterate over.
  20597. * @param {Function} iteratee The function invoked per iteration.
  20598. * @returns {Object} Returns `object`.
  20599. */
  20600. function baseForOwnRight(object, iteratee) {
  20601. return object && baseForRight(object, iteratee, keys);
  20602. }
  20603. /**
  20604. * The base implementation of `_.functions` which creates an array of
  20605. * `object` function property names filtered from `props`.
  20606. *
  20607. * @private
  20608. * @param {Object} object The object to inspect.
  20609. * @param {Array} props The property names to filter.
  20610. * @returns {Array} Returns the function names.
  20611. */
  20612. function baseFunctions(object, props) {
  20613. return arrayFilter(props, function(key) {
  20614. return isFunction(object[key]);
  20615. });
  20616. }
  20617. /**
  20618. * The base implementation of `_.get` without support for default values.
  20619. *
  20620. * @private
  20621. * @param {Object} object The object to query.
  20622. * @param {Array|string} path The path of the property to get.
  20623. * @returns {*} Returns the resolved value.
  20624. */
  20625. function baseGet(object, path) {
  20626. path = castPath(path, object);
  20627. var index = 0,
  20628. length = path.length;
  20629. while (object != null && index < length) {
  20630. object = object[toKey(path[index++])];
  20631. }
  20632. return (index && index == length) ? object : undefined;
  20633. }
  20634. /**
  20635. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20636. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20637. * symbols of `object`.
  20638. *
  20639. * @private
  20640. * @param {Object} object The object to query.
  20641. * @param {Function} keysFunc The function to get the keys of `object`.
  20642. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20643. * @returns {Array} Returns the array of property names and symbols.
  20644. */
  20645. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20646. var result = keysFunc(object);
  20647. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20648. }
  20649. /**
  20650. * The base implementation of `getTag` without fallbacks for buggy environments.
  20651. *
  20652. * @private
  20653. * @param {*} value The value to query.
  20654. * @returns {string} Returns the `toStringTag`.
  20655. */
  20656. function baseGetTag(value) {
  20657. if (value == null) {
  20658. return value === undefined ? undefinedTag : nullTag;
  20659. }
  20660. return (symToStringTag && symToStringTag in Object(value))
  20661. ? getRawTag(value)
  20662. : objectToString(value);
  20663. }
  20664. /**
  20665. * The base implementation of `_.gt` which doesn't coerce arguments.
  20666. *
  20667. * @private
  20668. * @param {*} value The value to compare.
  20669. * @param {*} other The other value to compare.
  20670. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20671. * else `false`.
  20672. */
  20673. function baseGt(value, other) {
  20674. return value > other;
  20675. }
  20676. /**
  20677. * The base implementation of `_.has` without support for deep paths.
  20678. *
  20679. * @private
  20680. * @param {Object} [object] The object to query.
  20681. * @param {Array|string} key The key to check.
  20682. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20683. */
  20684. function baseHas(object, key) {
  20685. return object != null && hasOwnProperty.call(object, key);
  20686. }
  20687. /**
  20688. * The base implementation of `_.hasIn` without support for deep paths.
  20689. *
  20690. * @private
  20691. * @param {Object} [object] The object to query.
  20692. * @param {Array|string} key The key to check.
  20693. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20694. */
  20695. function baseHasIn(object, key) {
  20696. return object != null && key in Object(object);
  20697. }
  20698. /**
  20699. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20700. *
  20701. * @private
  20702. * @param {number} number The number to check.
  20703. * @param {number} start The start of the range.
  20704. * @param {number} end The end of the range.
  20705. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20706. */
  20707. function baseInRange(number, start, end) {
  20708. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20709. }
  20710. /**
  20711. * The base implementation of methods like `_.intersection`, without support
  20712. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20713. *
  20714. * @private
  20715. * @param {Array} arrays The arrays to inspect.
  20716. * @param {Function} [iteratee] The iteratee invoked per element.
  20717. * @param {Function} [comparator] The comparator invoked per element.
  20718. * @returns {Array} Returns the new array of shared values.
  20719. */
  20720. function baseIntersection(arrays, iteratee, comparator) {
  20721. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20722. length = arrays[0].length,
  20723. othLength = arrays.length,
  20724. othIndex = othLength,
  20725. caches = Array(othLength),
  20726. maxLength = Infinity,
  20727. result = [];
  20728. while (othIndex--) {
  20729. var array = arrays[othIndex];
  20730. if (othIndex && iteratee) {
  20731. array = arrayMap(array, baseUnary(iteratee));
  20732. }
  20733. maxLength = nativeMin(array.length, maxLength);
  20734. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20735. ? new SetCache(othIndex && array)
  20736. : undefined;
  20737. }
  20738. array = arrays[0];
  20739. var index = -1,
  20740. seen = caches[0];
  20741. outer:
  20742. while (++index < length && result.length < maxLength) {
  20743. var value = array[index],
  20744. computed = iteratee ? iteratee(value) : value;
  20745. value = (comparator || value !== 0) ? value : 0;
  20746. if (!(seen
  20747. ? cacheHas(seen, computed)
  20748. : includes(result, computed, comparator)
  20749. )) {
  20750. othIndex = othLength;
  20751. while (--othIndex) {
  20752. var cache = caches[othIndex];
  20753. if (!(cache
  20754. ? cacheHas(cache, computed)
  20755. : includes(arrays[othIndex], computed, comparator))
  20756. ) {
  20757. continue outer;
  20758. }
  20759. }
  20760. if (seen) {
  20761. seen.push(computed);
  20762. }
  20763. result.push(value);
  20764. }
  20765. }
  20766. return result;
  20767. }
  20768. /**
  20769. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20770. * `object` with values transformed by `iteratee` and set by `setter`.
  20771. *
  20772. * @private
  20773. * @param {Object} object The object to iterate over.
  20774. * @param {Function} setter The function to set `accumulator` values.
  20775. * @param {Function} iteratee The iteratee to transform values.
  20776. * @param {Object} accumulator The initial inverted object.
  20777. * @returns {Function} Returns `accumulator`.
  20778. */
  20779. function baseInverter(object, setter, iteratee, accumulator) {
  20780. baseForOwn(object, function(value, key, object) {
  20781. setter(accumulator, iteratee(value), key, object);
  20782. });
  20783. return accumulator;
  20784. }
  20785. /**
  20786. * The base implementation of `_.invoke` without support for individual
  20787. * method arguments.
  20788. *
  20789. * @private
  20790. * @param {Object} object The object to query.
  20791. * @param {Array|string} path The path of the method to invoke.
  20792. * @param {Array} args The arguments to invoke the method with.
  20793. * @returns {*} Returns the result of the invoked method.
  20794. */
  20795. function baseInvoke(object, path, args) {
  20796. path = castPath(path, object);
  20797. object = parent(object, path);
  20798. var func = object == null ? object : object[toKey(last(path))];
  20799. return func == null ? undefined : apply(func, object, args);
  20800. }
  20801. /**
  20802. * The base implementation of `_.isArguments`.
  20803. *
  20804. * @private
  20805. * @param {*} value The value to check.
  20806. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20807. */
  20808. function baseIsArguments(value) {
  20809. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20810. }
  20811. /**
  20812. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20813. *
  20814. * @private
  20815. * @param {*} value The value to check.
  20816. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20817. */
  20818. function baseIsArrayBuffer(value) {
  20819. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20820. }
  20821. /**
  20822. * The base implementation of `_.isDate` without Node.js optimizations.
  20823. *
  20824. * @private
  20825. * @param {*} value The value to check.
  20826. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20827. */
  20828. function baseIsDate(value) {
  20829. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20830. }
  20831. /**
  20832. * The base implementation of `_.isEqual` which supports partial comparisons
  20833. * and tracks traversed objects.
  20834. *
  20835. * @private
  20836. * @param {*} value The value to compare.
  20837. * @param {*} other The other value to compare.
  20838. * @param {boolean} bitmask The bitmask flags.
  20839. * 1 - Unordered comparison
  20840. * 2 - Partial comparison
  20841. * @param {Function} [customizer] The function to customize comparisons.
  20842. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20843. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20844. */
  20845. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20846. if (value === other) {
  20847. return true;
  20848. }
  20849. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20850. return value !== value && other !== other;
  20851. }
  20852. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20853. }
  20854. /**
  20855. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20856. * deep comparisons and tracks traversed objects enabling objects with circular
  20857. * references to be compared.
  20858. *
  20859. * @private
  20860. * @param {Object} object The object to compare.
  20861. * @param {Object} other The other object to compare.
  20862. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20863. * @param {Function} customizer The function to customize comparisons.
  20864. * @param {Function} equalFunc The function to determine equivalents of values.
  20865. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20866. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20867. */
  20868. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20869. var objIsArr = isArray(object),
  20870. othIsArr = isArray(other),
  20871. objTag = objIsArr ? arrayTag : getTag(object),
  20872. othTag = othIsArr ? arrayTag : getTag(other);
  20873. objTag = objTag == argsTag ? objectTag : objTag;
  20874. othTag = othTag == argsTag ? objectTag : othTag;
  20875. var objIsObj = objTag == objectTag,
  20876. othIsObj = othTag == objectTag,
  20877. isSameTag = objTag == othTag;
  20878. if (isSameTag && isBuffer(object)) {
  20879. if (!isBuffer(other)) {
  20880. return false;
  20881. }
  20882. objIsArr = true;
  20883. objIsObj = false;
  20884. }
  20885. if (isSameTag && !objIsObj) {
  20886. stack || (stack = new Stack);
  20887. return (objIsArr || isTypedArray(object))
  20888. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20889. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20890. }
  20891. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20892. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20893. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20894. if (objIsWrapped || othIsWrapped) {
  20895. var objUnwrapped = objIsWrapped ? object.value() : object,
  20896. othUnwrapped = othIsWrapped ? other.value() : other;
  20897. stack || (stack = new Stack);
  20898. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20899. }
  20900. }
  20901. if (!isSameTag) {
  20902. return false;
  20903. }
  20904. stack || (stack = new Stack);
  20905. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20906. }
  20907. /**
  20908. * The base implementation of `_.isMap` without Node.js optimizations.
  20909. *
  20910. * @private
  20911. * @param {*} value The value to check.
  20912. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20913. */
  20914. function baseIsMap(value) {
  20915. return isObjectLike(value) && getTag(value) == mapTag;
  20916. }
  20917. /**
  20918. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20919. *
  20920. * @private
  20921. * @param {Object} object The object to inspect.
  20922. * @param {Object} source The object of property values to match.
  20923. * @param {Array} matchData The property names, values, and compare flags to match.
  20924. * @param {Function} [customizer] The function to customize comparisons.
  20925. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20926. */
  20927. function baseIsMatch(object, source, matchData, customizer) {
  20928. var index = matchData.length,
  20929. length = index,
  20930. noCustomizer = !customizer;
  20931. if (object == null) {
  20932. return !length;
  20933. }
  20934. object = Object(object);
  20935. while (index--) {
  20936. var data = matchData[index];
  20937. if ((noCustomizer && data[2])
  20938. ? data[1] !== object[data[0]]
  20939. : !(data[0] in object)
  20940. ) {
  20941. return false;
  20942. }
  20943. }
  20944. while (++index < length) {
  20945. data = matchData[index];
  20946. var key = data[0],
  20947. objValue = object[key],
  20948. srcValue = data[1];
  20949. if (noCustomizer && data[2]) {
  20950. if (objValue === undefined && !(key in object)) {
  20951. return false;
  20952. }
  20953. } else {
  20954. var stack = new Stack;
  20955. if (customizer) {
  20956. var result = customizer(objValue, srcValue, key, object, source, stack);
  20957. }
  20958. if (!(result === undefined
  20959. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20960. : result
  20961. )) {
  20962. return false;
  20963. }
  20964. }
  20965. }
  20966. return true;
  20967. }
  20968. /**
  20969. * The base implementation of `_.isNative` without bad shim checks.
  20970. *
  20971. * @private
  20972. * @param {*} value The value to check.
  20973. * @returns {boolean} Returns `true` if `value` is a native function,
  20974. * else `false`.
  20975. */
  20976. function baseIsNative(value) {
  20977. if (!isObject(value) || isMasked(value)) {
  20978. return false;
  20979. }
  20980. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20981. return pattern.test(toSource(value));
  20982. }
  20983. /**
  20984. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20985. *
  20986. * @private
  20987. * @param {*} value The value to check.
  20988. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20989. */
  20990. function baseIsRegExp(value) {
  20991. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20992. }
  20993. /**
  20994. * The base implementation of `_.isSet` without Node.js optimizations.
  20995. *
  20996. * @private
  20997. * @param {*} value The value to check.
  20998. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20999. */
  21000. function baseIsSet(value) {
  21001. return isObjectLike(value) && getTag(value) == setTag;
  21002. }
  21003. /**
  21004. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21005. *
  21006. * @private
  21007. * @param {*} value The value to check.
  21008. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21009. */
  21010. function baseIsTypedArray(value) {
  21011. return isObjectLike(value) &&
  21012. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21013. }
  21014. /**
  21015. * The base implementation of `_.iteratee`.
  21016. *
  21017. * @private
  21018. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21019. * @returns {Function} Returns the iteratee.
  21020. */
  21021. function baseIteratee(value) {
  21022. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21023. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21024. if (typeof value == 'function') {
  21025. return value;
  21026. }
  21027. if (value == null) {
  21028. return identity;
  21029. }
  21030. if (typeof value == 'object') {
  21031. return isArray(value)
  21032. ? baseMatchesProperty(value[0], value[1])
  21033. : baseMatches(value);
  21034. }
  21035. return property(value);
  21036. }
  21037. /**
  21038. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21039. *
  21040. * @private
  21041. * @param {Object} object The object to query.
  21042. * @returns {Array} Returns the array of property names.
  21043. */
  21044. function baseKeys(object) {
  21045. if (!isPrototype(object)) {
  21046. return nativeKeys(object);
  21047. }
  21048. var result = [];
  21049. for (var key in Object(object)) {
  21050. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21051. result.push(key);
  21052. }
  21053. }
  21054. return result;
  21055. }
  21056. /**
  21057. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21058. *
  21059. * @private
  21060. * @param {Object} object The object to query.
  21061. * @returns {Array} Returns the array of property names.
  21062. */
  21063. function baseKeysIn(object) {
  21064. if (!isObject(object)) {
  21065. return nativeKeysIn(object);
  21066. }
  21067. var isProto = isPrototype(object),
  21068. result = [];
  21069. for (var key in object) {
  21070. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21071. result.push(key);
  21072. }
  21073. }
  21074. return result;
  21075. }
  21076. /**
  21077. * The base implementation of `_.lt` which doesn't coerce arguments.
  21078. *
  21079. * @private
  21080. * @param {*} value The value to compare.
  21081. * @param {*} other The other value to compare.
  21082. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21083. * else `false`.
  21084. */
  21085. function baseLt(value, other) {
  21086. return value < other;
  21087. }
  21088. /**
  21089. * The base implementation of `_.map` without support for iteratee shorthands.
  21090. *
  21091. * @private
  21092. * @param {Array|Object} collection The collection to iterate over.
  21093. * @param {Function} iteratee The function invoked per iteration.
  21094. * @returns {Array} Returns the new mapped array.
  21095. */
  21096. function baseMap(collection, iteratee) {
  21097. var index = -1,
  21098. result = isArrayLike(collection) ? Array(collection.length) : [];
  21099. baseEach(collection, function(value, key, collection) {
  21100. result[++index] = iteratee(value, key, collection);
  21101. });
  21102. return result;
  21103. }
  21104. /**
  21105. * The base implementation of `_.matches` which doesn't clone `source`.
  21106. *
  21107. * @private
  21108. * @param {Object} source The object of property values to match.
  21109. * @returns {Function} Returns the new spec function.
  21110. */
  21111. function baseMatches(source) {
  21112. var matchData = getMatchData(source);
  21113. if (matchData.length == 1 && matchData[0][2]) {
  21114. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21115. }
  21116. return function(object) {
  21117. return object === source || baseIsMatch(object, source, matchData);
  21118. };
  21119. }
  21120. /**
  21121. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21122. *
  21123. * @private
  21124. * @param {string} path The path of the property to get.
  21125. * @param {*} srcValue The value to match.
  21126. * @returns {Function} Returns the new spec function.
  21127. */
  21128. function baseMatchesProperty(path, srcValue) {
  21129. if (isKey(path) && isStrictComparable(srcValue)) {
  21130. return matchesStrictComparable(toKey(path), srcValue);
  21131. }
  21132. return function(object) {
  21133. var objValue = get(object, path);
  21134. return (objValue === undefined && objValue === srcValue)
  21135. ? hasIn(object, path)
  21136. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21137. };
  21138. }
  21139. /**
  21140. * The base implementation of `_.merge` without support for multiple sources.
  21141. *
  21142. * @private
  21143. * @param {Object} object The destination object.
  21144. * @param {Object} source The source object.
  21145. * @param {number} srcIndex The index of `source`.
  21146. * @param {Function} [customizer] The function to customize merged values.
  21147. * @param {Object} [stack] Tracks traversed source values and their merged
  21148. * counterparts.
  21149. */
  21150. function baseMerge(object, source, srcIndex, customizer, stack) {
  21151. if (object === source) {
  21152. return;
  21153. }
  21154. baseFor(source, function(srcValue, key) {
  21155. stack || (stack = new Stack);
  21156. if (isObject(srcValue)) {
  21157. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21158. }
  21159. else {
  21160. var newValue = customizer
  21161. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21162. : undefined;
  21163. if (newValue === undefined) {
  21164. newValue = srcValue;
  21165. }
  21166. assignMergeValue(object, key, newValue);
  21167. }
  21168. }, keysIn);
  21169. }
  21170. /**
  21171. * A specialized version of `baseMerge` for arrays and objects which performs
  21172. * deep merges and tracks traversed objects enabling objects with circular
  21173. * references to be merged.
  21174. *
  21175. * @private
  21176. * @param {Object} object The destination object.
  21177. * @param {Object} source The source object.
  21178. * @param {string} key The key of the value to merge.
  21179. * @param {number} srcIndex The index of `source`.
  21180. * @param {Function} mergeFunc The function to merge values.
  21181. * @param {Function} [customizer] The function to customize assigned values.
  21182. * @param {Object} [stack] Tracks traversed source values and their merged
  21183. * counterparts.
  21184. */
  21185. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21186. var objValue = safeGet(object, key),
  21187. srcValue = safeGet(source, key),
  21188. stacked = stack.get(srcValue);
  21189. if (stacked) {
  21190. assignMergeValue(object, key, stacked);
  21191. return;
  21192. }
  21193. var newValue = customizer
  21194. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21195. : undefined;
  21196. var isCommon = newValue === undefined;
  21197. if (isCommon) {
  21198. var isArr = isArray(srcValue),
  21199. isBuff = !isArr && isBuffer(srcValue),
  21200. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21201. newValue = srcValue;
  21202. if (isArr || isBuff || isTyped) {
  21203. if (isArray(objValue)) {
  21204. newValue = objValue;
  21205. }
  21206. else if (isArrayLikeObject(objValue)) {
  21207. newValue = copyArray(objValue);
  21208. }
  21209. else if (isBuff) {
  21210. isCommon = false;
  21211. newValue = cloneBuffer(srcValue, true);
  21212. }
  21213. else if (isTyped) {
  21214. isCommon = false;
  21215. newValue = cloneTypedArray(srcValue, true);
  21216. }
  21217. else {
  21218. newValue = [];
  21219. }
  21220. }
  21221. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21222. newValue = objValue;
  21223. if (isArguments(objValue)) {
  21224. newValue = toPlainObject(objValue);
  21225. }
  21226. else if (!isObject(objValue) || isFunction(objValue)) {
  21227. newValue = initCloneObject(srcValue);
  21228. }
  21229. }
  21230. else {
  21231. isCommon = false;
  21232. }
  21233. }
  21234. if (isCommon) {
  21235. // Recursively merge objects and arrays (susceptible to call stack limits).
  21236. stack.set(srcValue, newValue);
  21237. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21238. stack['delete'](srcValue);
  21239. }
  21240. assignMergeValue(object, key, newValue);
  21241. }
  21242. /**
  21243. * The base implementation of `_.nth` which doesn't coerce arguments.
  21244. *
  21245. * @private
  21246. * @param {Array} array The array to query.
  21247. * @param {number} n The index of the element to return.
  21248. * @returns {*} Returns the nth element of `array`.
  21249. */
  21250. function baseNth(array, n) {
  21251. var length = array.length;
  21252. if (!length) {
  21253. return;
  21254. }
  21255. n += n < 0 ? length : 0;
  21256. return isIndex(n, length) ? array[n] : undefined;
  21257. }
  21258. /**
  21259. * The base implementation of `_.orderBy` without param guards.
  21260. *
  21261. * @private
  21262. * @param {Array|Object} collection The collection to iterate over.
  21263. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21264. * @param {string[]} orders The sort orders of `iteratees`.
  21265. * @returns {Array} Returns the new sorted array.
  21266. */
  21267. function baseOrderBy(collection, iteratees, orders) {
  21268. var index = -1;
  21269. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21270. var result = baseMap(collection, function(value, key, collection) {
  21271. var criteria = arrayMap(iteratees, function(iteratee) {
  21272. return iteratee(value);
  21273. });
  21274. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21275. });
  21276. return baseSortBy(result, function(object, other) {
  21277. return compareMultiple(object, other, orders);
  21278. });
  21279. }
  21280. /**
  21281. * The base implementation of `_.pick` without support for individual
  21282. * property identifiers.
  21283. *
  21284. * @private
  21285. * @param {Object} object The source object.
  21286. * @param {string[]} paths The property paths to pick.
  21287. * @returns {Object} Returns the new object.
  21288. */
  21289. function basePick(object, paths) {
  21290. return basePickBy(object, paths, function(value, path) {
  21291. return hasIn(object, path);
  21292. });
  21293. }
  21294. /**
  21295. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21296. *
  21297. * @private
  21298. * @param {Object} object The source object.
  21299. * @param {string[]} paths The property paths to pick.
  21300. * @param {Function} predicate The function invoked per property.
  21301. * @returns {Object} Returns the new object.
  21302. */
  21303. function basePickBy(object, paths, predicate) {
  21304. var index = -1,
  21305. length = paths.length,
  21306. result = {};
  21307. while (++index < length) {
  21308. var path = paths[index],
  21309. value = baseGet(object, path);
  21310. if (predicate(value, path)) {
  21311. baseSet(result, castPath(path, object), value);
  21312. }
  21313. }
  21314. return result;
  21315. }
  21316. /**
  21317. * A specialized version of `baseProperty` which supports deep paths.
  21318. *
  21319. * @private
  21320. * @param {Array|string} path The path of the property to get.
  21321. * @returns {Function} Returns the new accessor function.
  21322. */
  21323. function basePropertyDeep(path) {
  21324. return function(object) {
  21325. return baseGet(object, path);
  21326. };
  21327. }
  21328. /**
  21329. * The base implementation of `_.pullAllBy` without support for iteratee
  21330. * shorthands.
  21331. *
  21332. * @private
  21333. * @param {Array} array The array to modify.
  21334. * @param {Array} values The values to remove.
  21335. * @param {Function} [iteratee] The iteratee invoked per element.
  21336. * @param {Function} [comparator] The comparator invoked per element.
  21337. * @returns {Array} Returns `array`.
  21338. */
  21339. function basePullAll(array, values, iteratee, comparator) {
  21340. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21341. index = -1,
  21342. length = values.length,
  21343. seen = array;
  21344. if (array === values) {
  21345. values = copyArray(values);
  21346. }
  21347. if (iteratee) {
  21348. seen = arrayMap(array, baseUnary(iteratee));
  21349. }
  21350. while (++index < length) {
  21351. var fromIndex = 0,
  21352. value = values[index],
  21353. computed = iteratee ? iteratee(value) : value;
  21354. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21355. if (seen !== array) {
  21356. splice.call(seen, fromIndex, 1);
  21357. }
  21358. splice.call(array, fromIndex, 1);
  21359. }
  21360. }
  21361. return array;
  21362. }
  21363. /**
  21364. * The base implementation of `_.pullAt` without support for individual
  21365. * indexes or capturing the removed elements.
  21366. *
  21367. * @private
  21368. * @param {Array} array The array to modify.
  21369. * @param {number[]} indexes The indexes of elements to remove.
  21370. * @returns {Array} Returns `array`.
  21371. */
  21372. function basePullAt(array, indexes) {
  21373. var length = array ? indexes.length : 0,
  21374. lastIndex = length - 1;
  21375. while (length--) {
  21376. var index = indexes[length];
  21377. if (length == lastIndex || index !== previous) {
  21378. var previous = index;
  21379. if (isIndex(index)) {
  21380. splice.call(array, index, 1);
  21381. } else {
  21382. baseUnset(array, index);
  21383. }
  21384. }
  21385. }
  21386. return array;
  21387. }
  21388. /**
  21389. * The base implementation of `_.random` without support for returning
  21390. * floating-point numbers.
  21391. *
  21392. * @private
  21393. * @param {number} lower The lower bound.
  21394. * @param {number} upper The upper bound.
  21395. * @returns {number} Returns the random number.
  21396. */
  21397. function baseRandom(lower, upper) {
  21398. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21399. }
  21400. /**
  21401. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21402. * coerce arguments.
  21403. *
  21404. * @private
  21405. * @param {number} start The start of the range.
  21406. * @param {number} end The end of the range.
  21407. * @param {number} step The value to increment or decrement by.
  21408. * @param {boolean} [fromRight] Specify iterating from right to left.
  21409. * @returns {Array} Returns the range of numbers.
  21410. */
  21411. function baseRange(start, end, step, fromRight) {
  21412. var index = -1,
  21413. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21414. result = Array(length);
  21415. while (length--) {
  21416. result[fromRight ? length : ++index] = start;
  21417. start += step;
  21418. }
  21419. return result;
  21420. }
  21421. /**
  21422. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21423. *
  21424. * @private
  21425. * @param {string} string The string to repeat.
  21426. * @param {number} n The number of times to repeat the string.
  21427. * @returns {string} Returns the repeated string.
  21428. */
  21429. function baseRepeat(string, n) {
  21430. var result = '';
  21431. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21432. return result;
  21433. }
  21434. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21435. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21436. do {
  21437. if (n % 2) {
  21438. result += string;
  21439. }
  21440. n = nativeFloor(n / 2);
  21441. if (n) {
  21442. string += string;
  21443. }
  21444. } while (n);
  21445. return result;
  21446. }
  21447. /**
  21448. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21449. *
  21450. * @private
  21451. * @param {Function} func The function to apply a rest parameter to.
  21452. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21453. * @returns {Function} Returns the new function.
  21454. */
  21455. function baseRest(func, start) {
  21456. return setToString(overRest(func, start, identity), func + '');
  21457. }
  21458. /**
  21459. * The base implementation of `_.sample`.
  21460. *
  21461. * @private
  21462. * @param {Array|Object} collection The collection to sample.
  21463. * @returns {*} Returns the random element.
  21464. */
  21465. function baseSample(collection) {
  21466. return arraySample(values(collection));
  21467. }
  21468. /**
  21469. * The base implementation of `_.sampleSize` without param guards.
  21470. *
  21471. * @private
  21472. * @param {Array|Object} collection The collection to sample.
  21473. * @param {number} n The number of elements to sample.
  21474. * @returns {Array} Returns the random elements.
  21475. */
  21476. function baseSampleSize(collection, n) {
  21477. var array = values(collection);
  21478. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21479. }
  21480. /**
  21481. * The base implementation of `_.set`.
  21482. *
  21483. * @private
  21484. * @param {Object} object The object to modify.
  21485. * @param {Array|string} path The path of the property to set.
  21486. * @param {*} value The value to set.
  21487. * @param {Function} [customizer] The function to customize path creation.
  21488. * @returns {Object} Returns `object`.
  21489. */
  21490. function baseSet(object, path, value, customizer) {
  21491. if (!isObject(object)) {
  21492. return object;
  21493. }
  21494. path = castPath(path, object);
  21495. var index = -1,
  21496. length = path.length,
  21497. lastIndex = length - 1,
  21498. nested = object;
  21499. while (nested != null && ++index < length) {
  21500. var key = toKey(path[index]),
  21501. newValue = value;
  21502. if (index != lastIndex) {
  21503. var objValue = nested[key];
  21504. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21505. if (newValue === undefined) {
  21506. newValue = isObject(objValue)
  21507. ? objValue
  21508. : (isIndex(path[index + 1]) ? [] : {});
  21509. }
  21510. }
  21511. assignValue(nested, key, newValue);
  21512. nested = nested[key];
  21513. }
  21514. return object;
  21515. }
  21516. /**
  21517. * The base implementation of `setData` without support for hot loop shorting.
  21518. *
  21519. * @private
  21520. * @param {Function} func The function to associate metadata with.
  21521. * @param {*} data The metadata.
  21522. * @returns {Function} Returns `func`.
  21523. */
  21524. var baseSetData = !metaMap ? identity : function(func, data) {
  21525. metaMap.set(func, data);
  21526. return func;
  21527. };
  21528. /**
  21529. * The base implementation of `setToString` without support for hot loop shorting.
  21530. *
  21531. * @private
  21532. * @param {Function} func The function to modify.
  21533. * @param {Function} string The `toString` result.
  21534. * @returns {Function} Returns `func`.
  21535. */
  21536. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21537. return defineProperty(func, 'toString', {
  21538. 'configurable': true,
  21539. 'enumerable': false,
  21540. 'value': constant(string),
  21541. 'writable': true
  21542. });
  21543. };
  21544. /**
  21545. * The base implementation of `_.shuffle`.
  21546. *
  21547. * @private
  21548. * @param {Array|Object} collection The collection to shuffle.
  21549. * @returns {Array} Returns the new shuffled array.
  21550. */
  21551. function baseShuffle(collection) {
  21552. return shuffleSelf(values(collection));
  21553. }
  21554. /**
  21555. * The base implementation of `_.slice` without an iteratee call guard.
  21556. *
  21557. * @private
  21558. * @param {Array} array The array to slice.
  21559. * @param {number} [start=0] The start position.
  21560. * @param {number} [end=array.length] The end position.
  21561. * @returns {Array} Returns the slice of `array`.
  21562. */
  21563. function baseSlice(array, start, end) {
  21564. var index = -1,
  21565. length = array.length;
  21566. if (start < 0) {
  21567. start = -start > length ? 0 : (length + start);
  21568. }
  21569. end = end > length ? length : end;
  21570. if (end < 0) {
  21571. end += length;
  21572. }
  21573. length = start > end ? 0 : ((end - start) >>> 0);
  21574. start >>>= 0;
  21575. var result = Array(length);
  21576. while (++index < length) {
  21577. result[index] = array[index + start];
  21578. }
  21579. return result;
  21580. }
  21581. /**
  21582. * The base implementation of `_.some` without support for iteratee shorthands.
  21583. *
  21584. * @private
  21585. * @param {Array|Object} collection The collection to iterate over.
  21586. * @param {Function} predicate The function invoked per iteration.
  21587. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21588. * else `false`.
  21589. */
  21590. function baseSome(collection, predicate) {
  21591. var result;
  21592. baseEach(collection, function(value, index, collection) {
  21593. result = predicate(value, index, collection);
  21594. return !result;
  21595. });
  21596. return !!result;
  21597. }
  21598. /**
  21599. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21600. * performs a binary search of `array` to determine the index at which `value`
  21601. * should be inserted into `array` in order to maintain its sort order.
  21602. *
  21603. * @private
  21604. * @param {Array} array The sorted array to inspect.
  21605. * @param {*} value The value to evaluate.
  21606. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21607. * @returns {number} Returns the index at which `value` should be inserted
  21608. * into `array`.
  21609. */
  21610. function baseSortedIndex(array, value, retHighest) {
  21611. var low = 0,
  21612. high = array == null ? low : array.length;
  21613. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21614. while (low < high) {
  21615. var mid = (low + high) >>> 1,
  21616. computed = array[mid];
  21617. if (computed !== null && !isSymbol(computed) &&
  21618. (retHighest ? (computed <= value) : (computed < value))) {
  21619. low = mid + 1;
  21620. } else {
  21621. high = mid;
  21622. }
  21623. }
  21624. return high;
  21625. }
  21626. return baseSortedIndexBy(array, value, identity, retHighest);
  21627. }
  21628. /**
  21629. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21630. * which invokes `iteratee` for `value` and each element of `array` to compute
  21631. * their sort ranking. The iteratee is invoked with one argument; (value).
  21632. *
  21633. * @private
  21634. * @param {Array} array The sorted array to inspect.
  21635. * @param {*} value The value to evaluate.
  21636. * @param {Function} iteratee The iteratee invoked per element.
  21637. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21638. * @returns {number} Returns the index at which `value` should be inserted
  21639. * into `array`.
  21640. */
  21641. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21642. value = iteratee(value);
  21643. var low = 0,
  21644. high = array == null ? 0 : array.length,
  21645. valIsNaN = value !== value,
  21646. valIsNull = value === null,
  21647. valIsSymbol = isSymbol(value),
  21648. valIsUndefined = value === undefined;
  21649. while (low < high) {
  21650. var mid = nativeFloor((low + high) / 2),
  21651. computed = iteratee(array[mid]),
  21652. othIsDefined = computed !== undefined,
  21653. othIsNull = computed === null,
  21654. othIsReflexive = computed === computed,
  21655. othIsSymbol = isSymbol(computed);
  21656. if (valIsNaN) {
  21657. var setLow = retHighest || othIsReflexive;
  21658. } else if (valIsUndefined) {
  21659. setLow = othIsReflexive && (retHighest || othIsDefined);
  21660. } else if (valIsNull) {
  21661. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21662. } else if (valIsSymbol) {
  21663. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21664. } else if (othIsNull || othIsSymbol) {
  21665. setLow = false;
  21666. } else {
  21667. setLow = retHighest ? (computed <= value) : (computed < value);
  21668. }
  21669. if (setLow) {
  21670. low = mid + 1;
  21671. } else {
  21672. high = mid;
  21673. }
  21674. }
  21675. return nativeMin(high, MAX_ARRAY_INDEX);
  21676. }
  21677. /**
  21678. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21679. * support for iteratee shorthands.
  21680. *
  21681. * @private
  21682. * @param {Array} array The array to inspect.
  21683. * @param {Function} [iteratee] The iteratee invoked per element.
  21684. * @returns {Array} Returns the new duplicate free array.
  21685. */
  21686. function baseSortedUniq(array, iteratee) {
  21687. var index = -1,
  21688. length = array.length,
  21689. resIndex = 0,
  21690. result = [];
  21691. while (++index < length) {
  21692. var value = array[index],
  21693. computed = iteratee ? iteratee(value) : value;
  21694. if (!index || !eq(computed, seen)) {
  21695. var seen = computed;
  21696. result[resIndex++] = value === 0 ? 0 : value;
  21697. }
  21698. }
  21699. return result;
  21700. }
  21701. /**
  21702. * The base implementation of `_.toNumber` which doesn't ensure correct
  21703. * conversions of binary, hexadecimal, or octal string values.
  21704. *
  21705. * @private
  21706. * @param {*} value The value to process.
  21707. * @returns {number} Returns the number.
  21708. */
  21709. function baseToNumber(value) {
  21710. if (typeof value == 'number') {
  21711. return value;
  21712. }
  21713. if (isSymbol(value)) {
  21714. return NAN;
  21715. }
  21716. return +value;
  21717. }
  21718. /**
  21719. * The base implementation of `_.toString` which doesn't convert nullish
  21720. * values to empty strings.
  21721. *
  21722. * @private
  21723. * @param {*} value The value to process.
  21724. * @returns {string} Returns the string.
  21725. */
  21726. function baseToString(value) {
  21727. // Exit early for strings to avoid a performance hit in some environments.
  21728. if (typeof value == 'string') {
  21729. return value;
  21730. }
  21731. if (isArray(value)) {
  21732. // Recursively convert values (susceptible to call stack limits).
  21733. return arrayMap(value, baseToString) + '';
  21734. }
  21735. if (isSymbol(value)) {
  21736. return symbolToString ? symbolToString.call(value) : '';
  21737. }
  21738. var result = (value + '');
  21739. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21740. }
  21741. /**
  21742. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21743. *
  21744. * @private
  21745. * @param {Array} array The array to inspect.
  21746. * @param {Function} [iteratee] The iteratee invoked per element.
  21747. * @param {Function} [comparator] The comparator invoked per element.
  21748. * @returns {Array} Returns the new duplicate free array.
  21749. */
  21750. function baseUniq(array, iteratee, comparator) {
  21751. var index = -1,
  21752. includes = arrayIncludes,
  21753. length = array.length,
  21754. isCommon = true,
  21755. result = [],
  21756. seen = result;
  21757. if (comparator) {
  21758. isCommon = false;
  21759. includes = arrayIncludesWith;
  21760. }
  21761. else if (length >= LARGE_ARRAY_SIZE) {
  21762. var set = iteratee ? null : createSet(array);
  21763. if (set) {
  21764. return setToArray(set);
  21765. }
  21766. isCommon = false;
  21767. includes = cacheHas;
  21768. seen = new SetCache;
  21769. }
  21770. else {
  21771. seen = iteratee ? [] : result;
  21772. }
  21773. outer:
  21774. while (++index < length) {
  21775. var value = array[index],
  21776. computed = iteratee ? iteratee(value) : value;
  21777. value = (comparator || value !== 0) ? value : 0;
  21778. if (isCommon && computed === computed) {
  21779. var seenIndex = seen.length;
  21780. while (seenIndex--) {
  21781. if (seen[seenIndex] === computed) {
  21782. continue outer;
  21783. }
  21784. }
  21785. if (iteratee) {
  21786. seen.push(computed);
  21787. }
  21788. result.push(value);
  21789. }
  21790. else if (!includes(seen, computed, comparator)) {
  21791. if (seen !== result) {
  21792. seen.push(computed);
  21793. }
  21794. result.push(value);
  21795. }
  21796. }
  21797. return result;
  21798. }
  21799. /**
  21800. * The base implementation of `_.unset`.
  21801. *
  21802. * @private
  21803. * @param {Object} object The object to modify.
  21804. * @param {Array|string} path The property path to unset.
  21805. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21806. */
  21807. function baseUnset(object, path) {
  21808. path = castPath(path, object);
  21809. object = parent(object, path);
  21810. return object == null || delete object[toKey(last(path))];
  21811. }
  21812. /**
  21813. * The base implementation of `_.update`.
  21814. *
  21815. * @private
  21816. * @param {Object} object The object to modify.
  21817. * @param {Array|string} path The path of the property to update.
  21818. * @param {Function} updater The function to produce the updated value.
  21819. * @param {Function} [customizer] The function to customize path creation.
  21820. * @returns {Object} Returns `object`.
  21821. */
  21822. function baseUpdate(object, path, updater, customizer) {
  21823. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21824. }
  21825. /**
  21826. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21827. * without support for iteratee shorthands.
  21828. *
  21829. * @private
  21830. * @param {Array} array The array to query.
  21831. * @param {Function} predicate The function invoked per iteration.
  21832. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21833. * @param {boolean} [fromRight] Specify iterating from right to left.
  21834. * @returns {Array} Returns the slice of `array`.
  21835. */
  21836. function baseWhile(array, predicate, isDrop, fromRight) {
  21837. var length = array.length,
  21838. index = fromRight ? length : -1;
  21839. while ((fromRight ? index-- : ++index < length) &&
  21840. predicate(array[index], index, array)) {}
  21841. return isDrop
  21842. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21843. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21844. }
  21845. /**
  21846. * The base implementation of `wrapperValue` which returns the result of
  21847. * performing a sequence of actions on the unwrapped `value`, where each
  21848. * successive action is supplied the return value of the previous.
  21849. *
  21850. * @private
  21851. * @param {*} value The unwrapped value.
  21852. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21853. * @returns {*} Returns the resolved value.
  21854. */
  21855. function baseWrapperValue(value, actions) {
  21856. var result = value;
  21857. if (result instanceof LazyWrapper) {
  21858. result = result.value();
  21859. }
  21860. return arrayReduce(actions, function(result, action) {
  21861. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21862. }, result);
  21863. }
  21864. /**
  21865. * The base implementation of methods like `_.xor`, without support for
  21866. * iteratee shorthands, that accepts an array of arrays to inspect.
  21867. *
  21868. * @private
  21869. * @param {Array} arrays The arrays to inspect.
  21870. * @param {Function} [iteratee] The iteratee invoked per element.
  21871. * @param {Function} [comparator] The comparator invoked per element.
  21872. * @returns {Array} Returns the new array of values.
  21873. */
  21874. function baseXor(arrays, iteratee, comparator) {
  21875. var length = arrays.length;
  21876. if (length < 2) {
  21877. return length ? baseUniq(arrays[0]) : [];
  21878. }
  21879. var index = -1,
  21880. result = Array(length);
  21881. while (++index < length) {
  21882. var array = arrays[index],
  21883. othIndex = -1;
  21884. while (++othIndex < length) {
  21885. if (othIndex != index) {
  21886. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21887. }
  21888. }
  21889. }
  21890. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21891. }
  21892. /**
  21893. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21894. *
  21895. * @private
  21896. * @param {Array} props The property identifiers.
  21897. * @param {Array} values The property values.
  21898. * @param {Function} assignFunc The function to assign values.
  21899. * @returns {Object} Returns the new object.
  21900. */
  21901. function baseZipObject(props, values, assignFunc) {
  21902. var index = -1,
  21903. length = props.length,
  21904. valsLength = values.length,
  21905. result = {};
  21906. while (++index < length) {
  21907. var value = index < valsLength ? values[index] : undefined;
  21908. assignFunc(result, props[index], value);
  21909. }
  21910. return result;
  21911. }
  21912. /**
  21913. * Casts `value` to an empty array if it's not an array like object.
  21914. *
  21915. * @private
  21916. * @param {*} value The value to inspect.
  21917. * @returns {Array|Object} Returns the cast array-like object.
  21918. */
  21919. function castArrayLikeObject(value) {
  21920. return isArrayLikeObject(value) ? value : [];
  21921. }
  21922. /**
  21923. * Casts `value` to `identity` if it's not a function.
  21924. *
  21925. * @private
  21926. * @param {*} value The value to inspect.
  21927. * @returns {Function} Returns cast function.
  21928. */
  21929. function castFunction(value) {
  21930. return typeof value == 'function' ? value : identity;
  21931. }
  21932. /**
  21933. * Casts `value` to a path array if it's not one.
  21934. *
  21935. * @private
  21936. * @param {*} value The value to inspect.
  21937. * @param {Object} [object] The object to query keys on.
  21938. * @returns {Array} Returns the cast property path array.
  21939. */
  21940. function castPath(value, object) {
  21941. if (isArray(value)) {
  21942. return value;
  21943. }
  21944. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21945. }
  21946. /**
  21947. * A `baseRest` alias which can be replaced with `identity` by module
  21948. * replacement plugins.
  21949. *
  21950. * @private
  21951. * @type {Function}
  21952. * @param {Function} func The function to apply a rest parameter to.
  21953. * @returns {Function} Returns the new function.
  21954. */
  21955. var castRest = baseRest;
  21956. /**
  21957. * Casts `array` to a slice if it's needed.
  21958. *
  21959. * @private
  21960. * @param {Array} array The array to inspect.
  21961. * @param {number} start The start position.
  21962. * @param {number} [end=array.length] The end position.
  21963. * @returns {Array} Returns the cast slice.
  21964. */
  21965. function castSlice(array, start, end) {
  21966. var length = array.length;
  21967. end = end === undefined ? length : end;
  21968. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21969. }
  21970. /**
  21971. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21972. *
  21973. * @private
  21974. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21975. */
  21976. var clearTimeout = ctxClearTimeout || function(id) {
  21977. return root.clearTimeout(id);
  21978. };
  21979. /**
  21980. * Creates a clone of `buffer`.
  21981. *
  21982. * @private
  21983. * @param {Buffer} buffer The buffer to clone.
  21984. * @param {boolean} [isDeep] Specify a deep clone.
  21985. * @returns {Buffer} Returns the cloned buffer.
  21986. */
  21987. function cloneBuffer(buffer, isDeep) {
  21988. if (isDeep) {
  21989. return buffer.slice();
  21990. }
  21991. var length = buffer.length,
  21992. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21993. buffer.copy(result);
  21994. return result;
  21995. }
  21996. /**
  21997. * Creates a clone of `arrayBuffer`.
  21998. *
  21999. * @private
  22000. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22001. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22002. */
  22003. function cloneArrayBuffer(arrayBuffer) {
  22004. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22005. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22006. return result;
  22007. }
  22008. /**
  22009. * Creates a clone of `dataView`.
  22010. *
  22011. * @private
  22012. * @param {Object} dataView The data view to clone.
  22013. * @param {boolean} [isDeep] Specify a deep clone.
  22014. * @returns {Object} Returns the cloned data view.
  22015. */
  22016. function cloneDataView(dataView, isDeep) {
  22017. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22018. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22019. }
  22020. /**
  22021. * Creates a clone of `regexp`.
  22022. *
  22023. * @private
  22024. * @param {Object} regexp The regexp to clone.
  22025. * @returns {Object} Returns the cloned regexp.
  22026. */
  22027. function cloneRegExp(regexp) {
  22028. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22029. result.lastIndex = regexp.lastIndex;
  22030. return result;
  22031. }
  22032. /**
  22033. * Creates a clone of the `symbol` object.
  22034. *
  22035. * @private
  22036. * @param {Object} symbol The symbol object to clone.
  22037. * @returns {Object} Returns the cloned symbol object.
  22038. */
  22039. function cloneSymbol(symbol) {
  22040. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22041. }
  22042. /**
  22043. * Creates a clone of `typedArray`.
  22044. *
  22045. * @private
  22046. * @param {Object} typedArray The typed array to clone.
  22047. * @param {boolean} [isDeep] Specify a deep clone.
  22048. * @returns {Object} Returns the cloned typed array.
  22049. */
  22050. function cloneTypedArray(typedArray, isDeep) {
  22051. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22052. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22053. }
  22054. /**
  22055. * Compares values to sort them in ascending order.
  22056. *
  22057. * @private
  22058. * @param {*} value The value to compare.
  22059. * @param {*} other The other value to compare.
  22060. * @returns {number} Returns the sort order indicator for `value`.
  22061. */
  22062. function compareAscending(value, other) {
  22063. if (value !== other) {
  22064. var valIsDefined = value !== undefined,
  22065. valIsNull = value === null,
  22066. valIsReflexive = value === value,
  22067. valIsSymbol = isSymbol(value);
  22068. var othIsDefined = other !== undefined,
  22069. othIsNull = other === null,
  22070. othIsReflexive = other === other,
  22071. othIsSymbol = isSymbol(other);
  22072. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22073. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22074. (valIsNull && othIsDefined && othIsReflexive) ||
  22075. (!valIsDefined && othIsReflexive) ||
  22076. !valIsReflexive) {
  22077. return 1;
  22078. }
  22079. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22080. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22081. (othIsNull && valIsDefined && valIsReflexive) ||
  22082. (!othIsDefined && valIsReflexive) ||
  22083. !othIsReflexive) {
  22084. return -1;
  22085. }
  22086. }
  22087. return 0;
  22088. }
  22089. /**
  22090. * Used by `_.orderBy` to compare multiple properties of a value to another
  22091. * and stable sort them.
  22092. *
  22093. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22094. * specify an order of "desc" for descending or "asc" for ascending sort order
  22095. * of corresponding values.
  22096. *
  22097. * @private
  22098. * @param {Object} object The object to compare.
  22099. * @param {Object} other The other object to compare.
  22100. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22101. * @returns {number} Returns the sort order indicator for `object`.
  22102. */
  22103. function compareMultiple(object, other, orders) {
  22104. var index = -1,
  22105. objCriteria = object.criteria,
  22106. othCriteria = other.criteria,
  22107. length = objCriteria.length,
  22108. ordersLength = orders.length;
  22109. while (++index < length) {
  22110. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22111. if (result) {
  22112. if (index >= ordersLength) {
  22113. return result;
  22114. }
  22115. var order = orders[index];
  22116. return result * (order == 'desc' ? -1 : 1);
  22117. }
  22118. }
  22119. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22120. // that causes it, under certain circumstances, to provide the same value for
  22121. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22122. // for more details.
  22123. //
  22124. // This also ensures a stable sort in V8 and other engines.
  22125. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22126. return object.index - other.index;
  22127. }
  22128. /**
  22129. * Creates an array that is the composition of partially applied arguments,
  22130. * placeholders, and provided arguments into a single array of arguments.
  22131. *
  22132. * @private
  22133. * @param {Array} args The provided arguments.
  22134. * @param {Array} partials The arguments to prepend to those provided.
  22135. * @param {Array} holders The `partials` placeholder indexes.
  22136. * @params {boolean} [isCurried] Specify composing for a curried function.
  22137. * @returns {Array} Returns the new array of composed arguments.
  22138. */
  22139. function composeArgs(args, partials, holders, isCurried) {
  22140. var argsIndex = -1,
  22141. argsLength = args.length,
  22142. holdersLength = holders.length,
  22143. leftIndex = -1,
  22144. leftLength = partials.length,
  22145. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22146. result = Array(leftLength + rangeLength),
  22147. isUncurried = !isCurried;
  22148. while (++leftIndex < leftLength) {
  22149. result[leftIndex] = partials[leftIndex];
  22150. }
  22151. while (++argsIndex < holdersLength) {
  22152. if (isUncurried || argsIndex < argsLength) {
  22153. result[holders[argsIndex]] = args[argsIndex];
  22154. }
  22155. }
  22156. while (rangeLength--) {
  22157. result[leftIndex++] = args[argsIndex++];
  22158. }
  22159. return result;
  22160. }
  22161. /**
  22162. * This function is like `composeArgs` except that the arguments composition
  22163. * is tailored for `_.partialRight`.
  22164. *
  22165. * @private
  22166. * @param {Array} args The provided arguments.
  22167. * @param {Array} partials The arguments to append to those provided.
  22168. * @param {Array} holders The `partials` placeholder indexes.
  22169. * @params {boolean} [isCurried] Specify composing for a curried function.
  22170. * @returns {Array} Returns the new array of composed arguments.
  22171. */
  22172. function composeArgsRight(args, partials, holders, isCurried) {
  22173. var argsIndex = -1,
  22174. argsLength = args.length,
  22175. holdersIndex = -1,
  22176. holdersLength = holders.length,
  22177. rightIndex = -1,
  22178. rightLength = partials.length,
  22179. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22180. result = Array(rangeLength + rightLength),
  22181. isUncurried = !isCurried;
  22182. while (++argsIndex < rangeLength) {
  22183. result[argsIndex] = args[argsIndex];
  22184. }
  22185. var offset = argsIndex;
  22186. while (++rightIndex < rightLength) {
  22187. result[offset + rightIndex] = partials[rightIndex];
  22188. }
  22189. while (++holdersIndex < holdersLength) {
  22190. if (isUncurried || argsIndex < argsLength) {
  22191. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22192. }
  22193. }
  22194. return result;
  22195. }
  22196. /**
  22197. * Copies the values of `source` to `array`.
  22198. *
  22199. * @private
  22200. * @param {Array} source The array to copy values from.
  22201. * @param {Array} [array=[]] The array to copy values to.
  22202. * @returns {Array} Returns `array`.
  22203. */
  22204. function copyArray(source, array) {
  22205. var index = -1,
  22206. length = source.length;
  22207. array || (array = Array(length));
  22208. while (++index < length) {
  22209. array[index] = source[index];
  22210. }
  22211. return array;
  22212. }
  22213. /**
  22214. * Copies properties of `source` to `object`.
  22215. *
  22216. * @private
  22217. * @param {Object} source The object to copy properties from.
  22218. * @param {Array} props The property identifiers to copy.
  22219. * @param {Object} [object={}] The object to copy properties to.
  22220. * @param {Function} [customizer] The function to customize copied values.
  22221. * @returns {Object} Returns `object`.
  22222. */
  22223. function copyObject(source, props, object, customizer) {
  22224. var isNew = !object;
  22225. object || (object = {});
  22226. var index = -1,
  22227. length = props.length;
  22228. while (++index < length) {
  22229. var key = props[index];
  22230. var newValue = customizer
  22231. ? customizer(object[key], source[key], key, object, source)
  22232. : undefined;
  22233. if (newValue === undefined) {
  22234. newValue = source[key];
  22235. }
  22236. if (isNew) {
  22237. baseAssignValue(object, key, newValue);
  22238. } else {
  22239. assignValue(object, key, newValue);
  22240. }
  22241. }
  22242. return object;
  22243. }
  22244. /**
  22245. * Copies own symbols of `source` to `object`.
  22246. *
  22247. * @private
  22248. * @param {Object} source The object to copy symbols from.
  22249. * @param {Object} [object={}] The object to copy symbols to.
  22250. * @returns {Object} Returns `object`.
  22251. */
  22252. function copySymbols(source, object) {
  22253. return copyObject(source, getSymbols(source), object);
  22254. }
  22255. /**
  22256. * Copies own and inherited symbols of `source` to `object`.
  22257. *
  22258. * @private
  22259. * @param {Object} source The object to copy symbols from.
  22260. * @param {Object} [object={}] The object to copy symbols to.
  22261. * @returns {Object} Returns `object`.
  22262. */
  22263. function copySymbolsIn(source, object) {
  22264. return copyObject(source, getSymbolsIn(source), object);
  22265. }
  22266. /**
  22267. * Creates a function like `_.groupBy`.
  22268. *
  22269. * @private
  22270. * @param {Function} setter The function to set accumulator values.
  22271. * @param {Function} [initializer] The accumulator object initializer.
  22272. * @returns {Function} Returns the new aggregator function.
  22273. */
  22274. function createAggregator(setter, initializer) {
  22275. return function(collection, iteratee) {
  22276. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22277. accumulator = initializer ? initializer() : {};
  22278. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22279. };
  22280. }
  22281. /**
  22282. * Creates a function like `_.assign`.
  22283. *
  22284. * @private
  22285. * @param {Function} assigner The function to assign values.
  22286. * @returns {Function} Returns the new assigner function.
  22287. */
  22288. function createAssigner(assigner) {
  22289. return baseRest(function(object, sources) {
  22290. var index = -1,
  22291. length = sources.length,
  22292. customizer = length > 1 ? sources[length - 1] : undefined,
  22293. guard = length > 2 ? sources[2] : undefined;
  22294. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22295. ? (length--, customizer)
  22296. : undefined;
  22297. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22298. customizer = length < 3 ? undefined : customizer;
  22299. length = 1;
  22300. }
  22301. object = Object(object);
  22302. while (++index < length) {
  22303. var source = sources[index];
  22304. if (source) {
  22305. assigner(object, source, index, customizer);
  22306. }
  22307. }
  22308. return object;
  22309. });
  22310. }
  22311. /**
  22312. * Creates a `baseEach` or `baseEachRight` function.
  22313. *
  22314. * @private
  22315. * @param {Function} eachFunc The function to iterate over a collection.
  22316. * @param {boolean} [fromRight] Specify iterating from right to left.
  22317. * @returns {Function} Returns the new base function.
  22318. */
  22319. function createBaseEach(eachFunc, fromRight) {
  22320. return function(collection, iteratee) {
  22321. if (collection == null) {
  22322. return collection;
  22323. }
  22324. if (!isArrayLike(collection)) {
  22325. return eachFunc(collection, iteratee);
  22326. }
  22327. var length = collection.length,
  22328. index = fromRight ? length : -1,
  22329. iterable = Object(collection);
  22330. while ((fromRight ? index-- : ++index < length)) {
  22331. if (iteratee(iterable[index], index, iterable) === false) {
  22332. break;
  22333. }
  22334. }
  22335. return collection;
  22336. };
  22337. }
  22338. /**
  22339. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22340. *
  22341. * @private
  22342. * @param {boolean} [fromRight] Specify iterating from right to left.
  22343. * @returns {Function} Returns the new base function.
  22344. */
  22345. function createBaseFor(fromRight) {
  22346. return function(object, iteratee, keysFunc) {
  22347. var index = -1,
  22348. iterable = Object(object),
  22349. props = keysFunc(object),
  22350. length = props.length;
  22351. while (length--) {
  22352. var key = props[fromRight ? length : ++index];
  22353. if (iteratee(iterable[key], key, iterable) === false) {
  22354. break;
  22355. }
  22356. }
  22357. return object;
  22358. };
  22359. }
  22360. /**
  22361. * Creates a function that wraps `func` to invoke it with the optional `this`
  22362. * binding of `thisArg`.
  22363. *
  22364. * @private
  22365. * @param {Function} func The function to wrap.
  22366. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22367. * @param {*} [thisArg] The `this` binding of `func`.
  22368. * @returns {Function} Returns the new wrapped function.
  22369. */
  22370. function createBind(func, bitmask, thisArg) {
  22371. var isBind = bitmask & WRAP_BIND_FLAG,
  22372. Ctor = createCtor(func);
  22373. function wrapper() {
  22374. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22375. return fn.apply(isBind ? thisArg : this, arguments);
  22376. }
  22377. return wrapper;
  22378. }
  22379. /**
  22380. * Creates a function like `_.lowerFirst`.
  22381. *
  22382. * @private
  22383. * @param {string} methodName The name of the `String` case method to use.
  22384. * @returns {Function} Returns the new case function.
  22385. */
  22386. function createCaseFirst(methodName) {
  22387. return function(string) {
  22388. string = toString(string);
  22389. var strSymbols = hasUnicode(string)
  22390. ? stringToArray(string)
  22391. : undefined;
  22392. var chr = strSymbols
  22393. ? strSymbols[0]
  22394. : string.charAt(0);
  22395. var trailing = strSymbols
  22396. ? castSlice(strSymbols, 1).join('')
  22397. : string.slice(1);
  22398. return chr[methodName]() + trailing;
  22399. };
  22400. }
  22401. /**
  22402. * Creates a function like `_.camelCase`.
  22403. *
  22404. * @private
  22405. * @param {Function} callback The function to combine each word.
  22406. * @returns {Function} Returns the new compounder function.
  22407. */
  22408. function createCompounder(callback) {
  22409. return function(string) {
  22410. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22411. };
  22412. }
  22413. /**
  22414. * Creates a function that produces an instance of `Ctor` regardless of
  22415. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22416. *
  22417. * @private
  22418. * @param {Function} Ctor The constructor to wrap.
  22419. * @returns {Function} Returns the new wrapped function.
  22420. */
  22421. function createCtor(Ctor) {
  22422. return function() {
  22423. // Use a `switch` statement to work with class constructors. See
  22424. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22425. // for more details.
  22426. var args = arguments;
  22427. switch (args.length) {
  22428. case 0: return new Ctor;
  22429. case 1: return new Ctor(args[0]);
  22430. case 2: return new Ctor(args[0], args[1]);
  22431. case 3: return new Ctor(args[0], args[1], args[2]);
  22432. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22433. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22434. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22435. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22436. }
  22437. var thisBinding = baseCreate(Ctor.prototype),
  22438. result = Ctor.apply(thisBinding, args);
  22439. // Mimic the constructor's `return` behavior.
  22440. // See https://es5.github.io/#x13.2.2 for more details.
  22441. return isObject(result) ? result : thisBinding;
  22442. };
  22443. }
  22444. /**
  22445. * Creates a function that wraps `func` to enable currying.
  22446. *
  22447. * @private
  22448. * @param {Function} func The function to wrap.
  22449. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22450. * @param {number} arity The arity of `func`.
  22451. * @returns {Function} Returns the new wrapped function.
  22452. */
  22453. function createCurry(func, bitmask, arity) {
  22454. var Ctor = createCtor(func);
  22455. function wrapper() {
  22456. var length = arguments.length,
  22457. args = Array(length),
  22458. index = length,
  22459. placeholder = getHolder(wrapper);
  22460. while (index--) {
  22461. args[index] = arguments[index];
  22462. }
  22463. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22464. ? []
  22465. : replaceHolders(args, placeholder);
  22466. length -= holders.length;
  22467. if (length < arity) {
  22468. return createRecurry(
  22469. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22470. args, holders, undefined, undefined, arity - length);
  22471. }
  22472. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22473. return apply(fn, this, args);
  22474. }
  22475. return wrapper;
  22476. }
  22477. /**
  22478. * Creates a `_.find` or `_.findLast` function.
  22479. *
  22480. * @private
  22481. * @param {Function} findIndexFunc The function to find the collection index.
  22482. * @returns {Function} Returns the new find function.
  22483. */
  22484. function createFind(findIndexFunc) {
  22485. return function(collection, predicate, fromIndex) {
  22486. var iterable = Object(collection);
  22487. if (!isArrayLike(collection)) {
  22488. var iteratee = getIteratee(predicate, 3);
  22489. collection = keys(collection);
  22490. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22491. }
  22492. var index = findIndexFunc(collection, predicate, fromIndex);
  22493. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22494. };
  22495. }
  22496. /**
  22497. * Creates a `_.flow` or `_.flowRight` function.
  22498. *
  22499. * @private
  22500. * @param {boolean} [fromRight] Specify iterating from right to left.
  22501. * @returns {Function} Returns the new flow function.
  22502. */
  22503. function createFlow(fromRight) {
  22504. return flatRest(function(funcs) {
  22505. var length = funcs.length,
  22506. index = length,
  22507. prereq = LodashWrapper.prototype.thru;
  22508. if (fromRight) {
  22509. funcs.reverse();
  22510. }
  22511. while (index--) {
  22512. var func = funcs[index];
  22513. if (typeof func != 'function') {
  22514. throw new TypeError(FUNC_ERROR_TEXT);
  22515. }
  22516. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22517. var wrapper = new LodashWrapper([], true);
  22518. }
  22519. }
  22520. index = wrapper ? index : length;
  22521. while (++index < length) {
  22522. func = funcs[index];
  22523. var funcName = getFuncName(func),
  22524. data = funcName == 'wrapper' ? getData(func) : undefined;
  22525. if (data && isLaziable(data[0]) &&
  22526. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22527. !data[4].length && data[9] == 1
  22528. ) {
  22529. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22530. } else {
  22531. wrapper = (func.length == 1 && isLaziable(func))
  22532. ? wrapper[funcName]()
  22533. : wrapper.thru(func);
  22534. }
  22535. }
  22536. return function() {
  22537. var args = arguments,
  22538. value = args[0];
  22539. if (wrapper && args.length == 1 && isArray(value)) {
  22540. return wrapper.plant(value).value();
  22541. }
  22542. var index = 0,
  22543. result = length ? funcs[index].apply(this, args) : value;
  22544. while (++index < length) {
  22545. result = funcs[index].call(this, result);
  22546. }
  22547. return result;
  22548. };
  22549. });
  22550. }
  22551. /**
  22552. * Creates a function that wraps `func` to invoke it with optional `this`
  22553. * binding of `thisArg`, partial application, and currying.
  22554. *
  22555. * @private
  22556. * @param {Function|string} func The function or method name to wrap.
  22557. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22558. * @param {*} [thisArg] The `this` binding of `func`.
  22559. * @param {Array} [partials] The arguments to prepend to those provided to
  22560. * the new function.
  22561. * @param {Array} [holders] The `partials` placeholder indexes.
  22562. * @param {Array} [partialsRight] The arguments to append to those provided
  22563. * to the new function.
  22564. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22565. * @param {Array} [argPos] The argument positions of the new function.
  22566. * @param {number} [ary] The arity cap of `func`.
  22567. * @param {number} [arity] The arity of `func`.
  22568. * @returns {Function} Returns the new wrapped function.
  22569. */
  22570. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22571. var isAry = bitmask & WRAP_ARY_FLAG,
  22572. isBind = bitmask & WRAP_BIND_FLAG,
  22573. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22574. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22575. isFlip = bitmask & WRAP_FLIP_FLAG,
  22576. Ctor = isBindKey ? undefined : createCtor(func);
  22577. function wrapper() {
  22578. var length = arguments.length,
  22579. args = Array(length),
  22580. index = length;
  22581. while (index--) {
  22582. args[index] = arguments[index];
  22583. }
  22584. if (isCurried) {
  22585. var placeholder = getHolder(wrapper),
  22586. holdersCount = countHolders(args, placeholder);
  22587. }
  22588. if (partials) {
  22589. args = composeArgs(args, partials, holders, isCurried);
  22590. }
  22591. if (partialsRight) {
  22592. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22593. }
  22594. length -= holdersCount;
  22595. if (isCurried && length < arity) {
  22596. var newHolders = replaceHolders(args, placeholder);
  22597. return createRecurry(
  22598. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22599. args, newHolders, argPos, ary, arity - length
  22600. );
  22601. }
  22602. var thisBinding = isBind ? thisArg : this,
  22603. fn = isBindKey ? thisBinding[func] : func;
  22604. length = args.length;
  22605. if (argPos) {
  22606. args = reorder(args, argPos);
  22607. } else if (isFlip && length > 1) {
  22608. args.reverse();
  22609. }
  22610. if (isAry && ary < length) {
  22611. args.length = ary;
  22612. }
  22613. if (this && this !== root && this instanceof wrapper) {
  22614. fn = Ctor || createCtor(fn);
  22615. }
  22616. return fn.apply(thisBinding, args);
  22617. }
  22618. return wrapper;
  22619. }
  22620. /**
  22621. * Creates a function like `_.invertBy`.
  22622. *
  22623. * @private
  22624. * @param {Function} setter The function to set accumulator values.
  22625. * @param {Function} toIteratee The function to resolve iteratees.
  22626. * @returns {Function} Returns the new inverter function.
  22627. */
  22628. function createInverter(setter, toIteratee) {
  22629. return function(object, iteratee) {
  22630. return baseInverter(object, setter, toIteratee(iteratee), {});
  22631. };
  22632. }
  22633. /**
  22634. * Creates a function that performs a mathematical operation on two values.
  22635. *
  22636. * @private
  22637. * @param {Function} operator The function to perform the operation.
  22638. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22639. * @returns {Function} Returns the new mathematical operation function.
  22640. */
  22641. function createMathOperation(operator, defaultValue) {
  22642. return function(value, other) {
  22643. var result;
  22644. if (value === undefined && other === undefined) {
  22645. return defaultValue;
  22646. }
  22647. if (value !== undefined) {
  22648. result = value;
  22649. }
  22650. if (other !== undefined) {
  22651. if (result === undefined) {
  22652. return other;
  22653. }
  22654. if (typeof value == 'string' || typeof other == 'string') {
  22655. value = baseToString(value);
  22656. other = baseToString(other);
  22657. } else {
  22658. value = baseToNumber(value);
  22659. other = baseToNumber(other);
  22660. }
  22661. result = operator(value, other);
  22662. }
  22663. return result;
  22664. };
  22665. }
  22666. /**
  22667. * Creates a function like `_.over`.
  22668. *
  22669. * @private
  22670. * @param {Function} arrayFunc The function to iterate over iteratees.
  22671. * @returns {Function} Returns the new over function.
  22672. */
  22673. function createOver(arrayFunc) {
  22674. return flatRest(function(iteratees) {
  22675. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22676. return baseRest(function(args) {
  22677. var thisArg = this;
  22678. return arrayFunc(iteratees, function(iteratee) {
  22679. return apply(iteratee, thisArg, args);
  22680. });
  22681. });
  22682. });
  22683. }
  22684. /**
  22685. * Creates the padding for `string` based on `length`. The `chars` string
  22686. * is truncated if the number of characters exceeds `length`.
  22687. *
  22688. * @private
  22689. * @param {number} length The padding length.
  22690. * @param {string} [chars=' '] The string used as padding.
  22691. * @returns {string} Returns the padding for `string`.
  22692. */
  22693. function createPadding(length, chars) {
  22694. chars = chars === undefined ? ' ' : baseToString(chars);
  22695. var charsLength = chars.length;
  22696. if (charsLength < 2) {
  22697. return charsLength ? baseRepeat(chars, length) : chars;
  22698. }
  22699. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22700. return hasUnicode(chars)
  22701. ? castSlice(stringToArray(result), 0, length).join('')
  22702. : result.slice(0, length);
  22703. }
  22704. /**
  22705. * Creates a function that wraps `func` to invoke it with the `this` binding
  22706. * of `thisArg` and `partials` prepended to the arguments it receives.
  22707. *
  22708. * @private
  22709. * @param {Function} func The function to wrap.
  22710. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22711. * @param {*} thisArg The `this` binding of `func`.
  22712. * @param {Array} partials The arguments to prepend to those provided to
  22713. * the new function.
  22714. * @returns {Function} Returns the new wrapped function.
  22715. */
  22716. function createPartial(func, bitmask, thisArg, partials) {
  22717. var isBind = bitmask & WRAP_BIND_FLAG,
  22718. Ctor = createCtor(func);
  22719. function wrapper() {
  22720. var argsIndex = -1,
  22721. argsLength = arguments.length,
  22722. leftIndex = -1,
  22723. leftLength = partials.length,
  22724. args = Array(leftLength + argsLength),
  22725. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22726. while (++leftIndex < leftLength) {
  22727. args[leftIndex] = partials[leftIndex];
  22728. }
  22729. while (argsLength--) {
  22730. args[leftIndex++] = arguments[++argsIndex];
  22731. }
  22732. return apply(fn, isBind ? thisArg : this, args);
  22733. }
  22734. return wrapper;
  22735. }
  22736. /**
  22737. * Creates a `_.range` or `_.rangeRight` function.
  22738. *
  22739. * @private
  22740. * @param {boolean} [fromRight] Specify iterating from right to left.
  22741. * @returns {Function} Returns the new range function.
  22742. */
  22743. function createRange(fromRight) {
  22744. return function(start, end, step) {
  22745. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22746. end = step = undefined;
  22747. }
  22748. // Ensure the sign of `-0` is preserved.
  22749. start = toFinite(start);
  22750. if (end === undefined) {
  22751. end = start;
  22752. start = 0;
  22753. } else {
  22754. end = toFinite(end);
  22755. }
  22756. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22757. return baseRange(start, end, step, fromRight);
  22758. };
  22759. }
  22760. /**
  22761. * Creates a function that performs a relational operation on two values.
  22762. *
  22763. * @private
  22764. * @param {Function} operator The function to perform the operation.
  22765. * @returns {Function} Returns the new relational operation function.
  22766. */
  22767. function createRelationalOperation(operator) {
  22768. return function(value, other) {
  22769. if (!(typeof value == 'string' && typeof other == 'string')) {
  22770. value = toNumber(value);
  22771. other = toNumber(other);
  22772. }
  22773. return operator(value, other);
  22774. };
  22775. }
  22776. /**
  22777. * Creates a function that wraps `func` to continue currying.
  22778. *
  22779. * @private
  22780. * @param {Function} func The function to wrap.
  22781. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22782. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22783. * @param {*} placeholder The placeholder value.
  22784. * @param {*} [thisArg] The `this` binding of `func`.
  22785. * @param {Array} [partials] The arguments to prepend to those provided to
  22786. * the new function.
  22787. * @param {Array} [holders] The `partials` placeholder indexes.
  22788. * @param {Array} [argPos] The argument positions of the new function.
  22789. * @param {number} [ary] The arity cap of `func`.
  22790. * @param {number} [arity] The arity of `func`.
  22791. * @returns {Function} Returns the new wrapped function.
  22792. */
  22793. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22794. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22795. newHolders = isCurry ? holders : undefined,
  22796. newHoldersRight = isCurry ? undefined : holders,
  22797. newPartials = isCurry ? partials : undefined,
  22798. newPartialsRight = isCurry ? undefined : partials;
  22799. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22800. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22801. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22802. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22803. }
  22804. var newData = [
  22805. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22806. newHoldersRight, argPos, ary, arity
  22807. ];
  22808. var result = wrapFunc.apply(undefined, newData);
  22809. if (isLaziable(func)) {
  22810. setData(result, newData);
  22811. }
  22812. result.placeholder = placeholder;
  22813. return setWrapToString(result, func, bitmask);
  22814. }
  22815. /**
  22816. * Creates a function like `_.round`.
  22817. *
  22818. * @private
  22819. * @param {string} methodName The name of the `Math` method to use when rounding.
  22820. * @returns {Function} Returns the new round function.
  22821. */
  22822. function createRound(methodName) {
  22823. var func = Math[methodName];
  22824. return function(number, precision) {
  22825. number = toNumber(number);
  22826. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22827. if (precision && nativeIsFinite(number)) {
  22828. // Shift with exponential notation to avoid floating-point issues.
  22829. // See [MDN](https://mdn.io/round#Examples) for more details.
  22830. var pair = (toString(number) + 'e').split('e'),
  22831. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22832. pair = (toString(value) + 'e').split('e');
  22833. return +(pair[0] + 'e' + (+pair[1] - precision));
  22834. }
  22835. return func(number);
  22836. };
  22837. }
  22838. /**
  22839. * Creates a set object of `values`.
  22840. *
  22841. * @private
  22842. * @param {Array} values The values to add to the set.
  22843. * @returns {Object} Returns the new set.
  22844. */
  22845. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22846. return new Set(values);
  22847. };
  22848. /**
  22849. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22850. *
  22851. * @private
  22852. * @param {Function} keysFunc The function to get the keys of a given object.
  22853. * @returns {Function} Returns the new pairs function.
  22854. */
  22855. function createToPairs(keysFunc) {
  22856. return function(object) {
  22857. var tag = getTag(object);
  22858. if (tag == mapTag) {
  22859. return mapToArray(object);
  22860. }
  22861. if (tag == setTag) {
  22862. return setToPairs(object);
  22863. }
  22864. return baseToPairs(object, keysFunc(object));
  22865. };
  22866. }
  22867. /**
  22868. * Creates a function that either curries or invokes `func` with optional
  22869. * `this` binding and partially applied arguments.
  22870. *
  22871. * @private
  22872. * @param {Function|string} func The function or method name to wrap.
  22873. * @param {number} bitmask The bitmask flags.
  22874. * 1 - `_.bind`
  22875. * 2 - `_.bindKey`
  22876. * 4 - `_.curry` or `_.curryRight` of a bound function
  22877. * 8 - `_.curry`
  22878. * 16 - `_.curryRight`
  22879. * 32 - `_.partial`
  22880. * 64 - `_.partialRight`
  22881. * 128 - `_.rearg`
  22882. * 256 - `_.ary`
  22883. * 512 - `_.flip`
  22884. * @param {*} [thisArg] The `this` binding of `func`.
  22885. * @param {Array} [partials] The arguments to be partially applied.
  22886. * @param {Array} [holders] The `partials` placeholder indexes.
  22887. * @param {Array} [argPos] The argument positions of the new function.
  22888. * @param {number} [ary] The arity cap of `func`.
  22889. * @param {number} [arity] The arity of `func`.
  22890. * @returns {Function} Returns the new wrapped function.
  22891. */
  22892. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22893. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22894. if (!isBindKey && typeof func != 'function') {
  22895. throw new TypeError(FUNC_ERROR_TEXT);
  22896. }
  22897. var length = partials ? partials.length : 0;
  22898. if (!length) {
  22899. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22900. partials = holders = undefined;
  22901. }
  22902. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22903. arity = arity === undefined ? arity : toInteger(arity);
  22904. length -= holders ? holders.length : 0;
  22905. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22906. var partialsRight = partials,
  22907. holdersRight = holders;
  22908. partials = holders = undefined;
  22909. }
  22910. var data = isBindKey ? undefined : getData(func);
  22911. var newData = [
  22912. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22913. argPos, ary, arity
  22914. ];
  22915. if (data) {
  22916. mergeData(newData, data);
  22917. }
  22918. func = newData[0];
  22919. bitmask = newData[1];
  22920. thisArg = newData[2];
  22921. partials = newData[3];
  22922. holders = newData[4];
  22923. arity = newData[9] = newData[9] === undefined
  22924. ? (isBindKey ? 0 : func.length)
  22925. : nativeMax(newData[9] - length, 0);
  22926. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22927. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22928. }
  22929. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22930. var result = createBind(func, bitmask, thisArg);
  22931. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22932. result = createCurry(func, bitmask, arity);
  22933. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22934. result = createPartial(func, bitmask, thisArg, partials);
  22935. } else {
  22936. result = createHybrid.apply(undefined, newData);
  22937. }
  22938. var setter = data ? baseSetData : setData;
  22939. return setWrapToString(setter(result, newData), func, bitmask);
  22940. }
  22941. /**
  22942. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22943. * of source objects to the destination object for all destination properties
  22944. * that resolve to `undefined`.
  22945. *
  22946. * @private
  22947. * @param {*} objValue The destination value.
  22948. * @param {*} srcValue The source value.
  22949. * @param {string} key The key of the property to assign.
  22950. * @param {Object} object The parent object of `objValue`.
  22951. * @returns {*} Returns the value to assign.
  22952. */
  22953. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22954. if (objValue === undefined ||
  22955. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22956. return srcValue;
  22957. }
  22958. return objValue;
  22959. }
  22960. /**
  22961. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22962. * objects into destination objects that are passed thru.
  22963. *
  22964. * @private
  22965. * @param {*} objValue The destination value.
  22966. * @param {*} srcValue The source value.
  22967. * @param {string} key The key of the property to merge.
  22968. * @param {Object} object The parent object of `objValue`.
  22969. * @param {Object} source The parent object of `srcValue`.
  22970. * @param {Object} [stack] Tracks traversed source values and their merged
  22971. * counterparts.
  22972. * @returns {*} Returns the value to assign.
  22973. */
  22974. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22975. if (isObject(objValue) && isObject(srcValue)) {
  22976. // Recursively merge objects and arrays (susceptible to call stack limits).
  22977. stack.set(srcValue, objValue);
  22978. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22979. stack['delete'](srcValue);
  22980. }
  22981. return objValue;
  22982. }
  22983. /**
  22984. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22985. * objects.
  22986. *
  22987. * @private
  22988. * @param {*} value The value to inspect.
  22989. * @param {string} key The key of the property to inspect.
  22990. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22991. */
  22992. function customOmitClone(value) {
  22993. return isPlainObject(value) ? undefined : value;
  22994. }
  22995. /**
  22996. * A specialized version of `baseIsEqualDeep` for arrays with support for
  22997. * partial deep comparisons.
  22998. *
  22999. * @private
  23000. * @param {Array} array The array to compare.
  23001. * @param {Array} other The other array to compare.
  23002. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23003. * @param {Function} customizer The function to customize comparisons.
  23004. * @param {Function} equalFunc The function to determine equivalents of values.
  23005. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23006. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23007. */
  23008. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23009. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23010. arrLength = array.length,
  23011. othLength = other.length;
  23012. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23013. return false;
  23014. }
  23015. // Assume cyclic values are equal.
  23016. var stacked = stack.get(array);
  23017. if (stacked && stack.get(other)) {
  23018. return stacked == other;
  23019. }
  23020. var index = -1,
  23021. result = true,
  23022. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23023. stack.set(array, other);
  23024. stack.set(other, array);
  23025. // Ignore non-index properties.
  23026. while (++index < arrLength) {
  23027. var arrValue = array[index],
  23028. othValue = other[index];
  23029. if (customizer) {
  23030. var compared = isPartial
  23031. ? customizer(othValue, arrValue, index, other, array, stack)
  23032. : customizer(arrValue, othValue, index, array, other, stack);
  23033. }
  23034. if (compared !== undefined) {
  23035. if (compared) {
  23036. continue;
  23037. }
  23038. result = false;
  23039. break;
  23040. }
  23041. // Recursively compare arrays (susceptible to call stack limits).
  23042. if (seen) {
  23043. if (!arraySome(other, function(othValue, othIndex) {
  23044. if (!cacheHas(seen, othIndex) &&
  23045. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23046. return seen.push(othIndex);
  23047. }
  23048. })) {
  23049. result = false;
  23050. break;
  23051. }
  23052. } else if (!(
  23053. arrValue === othValue ||
  23054. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23055. )) {
  23056. result = false;
  23057. break;
  23058. }
  23059. }
  23060. stack['delete'](array);
  23061. stack['delete'](other);
  23062. return result;
  23063. }
  23064. /**
  23065. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23066. * the same `toStringTag`.
  23067. *
  23068. * **Note:** This function only supports comparing values with tags of
  23069. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23070. *
  23071. * @private
  23072. * @param {Object} object The object to compare.
  23073. * @param {Object} other The other object to compare.
  23074. * @param {string} tag The `toStringTag` of the objects to compare.
  23075. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23076. * @param {Function} customizer The function to customize comparisons.
  23077. * @param {Function} equalFunc The function to determine equivalents of values.
  23078. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23079. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23080. */
  23081. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23082. switch (tag) {
  23083. case dataViewTag:
  23084. if ((object.byteLength != other.byteLength) ||
  23085. (object.byteOffset != other.byteOffset)) {
  23086. return false;
  23087. }
  23088. object = object.buffer;
  23089. other = other.buffer;
  23090. case arrayBufferTag:
  23091. if ((object.byteLength != other.byteLength) ||
  23092. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23093. return false;
  23094. }
  23095. return true;
  23096. case boolTag:
  23097. case dateTag:
  23098. case numberTag:
  23099. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23100. // Invalid dates are coerced to `NaN`.
  23101. return eq(+object, +other);
  23102. case errorTag:
  23103. return object.name == other.name && object.message == other.message;
  23104. case regexpTag:
  23105. case stringTag:
  23106. // Coerce regexes to strings and treat strings, primitives and objects,
  23107. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23108. // for more details.
  23109. return object == (other + '');
  23110. case mapTag:
  23111. var convert = mapToArray;
  23112. case setTag:
  23113. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23114. convert || (convert = setToArray);
  23115. if (object.size != other.size && !isPartial) {
  23116. return false;
  23117. }
  23118. // Assume cyclic values are equal.
  23119. var stacked = stack.get(object);
  23120. if (stacked) {
  23121. return stacked == other;
  23122. }
  23123. bitmask |= COMPARE_UNORDERED_FLAG;
  23124. // Recursively compare objects (susceptible to call stack limits).
  23125. stack.set(object, other);
  23126. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23127. stack['delete'](object);
  23128. return result;
  23129. case symbolTag:
  23130. if (symbolValueOf) {
  23131. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23132. }
  23133. }
  23134. return false;
  23135. }
  23136. /**
  23137. * A specialized version of `baseIsEqualDeep` for objects with support for
  23138. * partial deep comparisons.
  23139. *
  23140. * @private
  23141. * @param {Object} object The object to compare.
  23142. * @param {Object} other The other object to compare.
  23143. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23144. * @param {Function} customizer The function to customize comparisons.
  23145. * @param {Function} equalFunc The function to determine equivalents of values.
  23146. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23147. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23148. */
  23149. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23150. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23151. objProps = getAllKeys(object),
  23152. objLength = objProps.length,
  23153. othProps = getAllKeys(other),
  23154. othLength = othProps.length;
  23155. if (objLength != othLength && !isPartial) {
  23156. return false;
  23157. }
  23158. var index = objLength;
  23159. while (index--) {
  23160. var key = objProps[index];
  23161. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23162. return false;
  23163. }
  23164. }
  23165. // Assume cyclic values are equal.
  23166. var stacked = stack.get(object);
  23167. if (stacked && stack.get(other)) {
  23168. return stacked == other;
  23169. }
  23170. var result = true;
  23171. stack.set(object, other);
  23172. stack.set(other, object);
  23173. var skipCtor = isPartial;
  23174. while (++index < objLength) {
  23175. key = objProps[index];
  23176. var objValue = object[key],
  23177. othValue = other[key];
  23178. if (customizer) {
  23179. var compared = isPartial
  23180. ? customizer(othValue, objValue, key, other, object, stack)
  23181. : customizer(objValue, othValue, key, object, other, stack);
  23182. }
  23183. // Recursively compare objects (susceptible to call stack limits).
  23184. if (!(compared === undefined
  23185. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23186. : compared
  23187. )) {
  23188. result = false;
  23189. break;
  23190. }
  23191. skipCtor || (skipCtor = key == 'constructor');
  23192. }
  23193. if (result && !skipCtor) {
  23194. var objCtor = object.constructor,
  23195. othCtor = other.constructor;
  23196. // Non `Object` object instances with different constructors are not equal.
  23197. if (objCtor != othCtor &&
  23198. ('constructor' in object && 'constructor' in other) &&
  23199. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23200. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23201. result = false;
  23202. }
  23203. }
  23204. stack['delete'](object);
  23205. stack['delete'](other);
  23206. return result;
  23207. }
  23208. /**
  23209. * A specialized version of `baseRest` which flattens the rest array.
  23210. *
  23211. * @private
  23212. * @param {Function} func The function to apply a rest parameter to.
  23213. * @returns {Function} Returns the new function.
  23214. */
  23215. function flatRest(func) {
  23216. return setToString(overRest(func, undefined, flatten), func + '');
  23217. }
  23218. /**
  23219. * Creates an array of own enumerable property names and symbols of `object`.
  23220. *
  23221. * @private
  23222. * @param {Object} object The object to query.
  23223. * @returns {Array} Returns the array of property names and symbols.
  23224. */
  23225. function getAllKeys(object) {
  23226. return baseGetAllKeys(object, keys, getSymbols);
  23227. }
  23228. /**
  23229. * Creates an array of own and inherited enumerable property names and
  23230. * symbols of `object`.
  23231. *
  23232. * @private
  23233. * @param {Object} object The object to query.
  23234. * @returns {Array} Returns the array of property names and symbols.
  23235. */
  23236. function getAllKeysIn(object) {
  23237. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23238. }
  23239. /**
  23240. * Gets metadata for `func`.
  23241. *
  23242. * @private
  23243. * @param {Function} func The function to query.
  23244. * @returns {*} Returns the metadata for `func`.
  23245. */
  23246. var getData = !metaMap ? noop : function(func) {
  23247. return metaMap.get(func);
  23248. };
  23249. /**
  23250. * Gets the name of `func`.
  23251. *
  23252. * @private
  23253. * @param {Function} func The function to query.
  23254. * @returns {string} Returns the function name.
  23255. */
  23256. function getFuncName(func) {
  23257. var result = (func.name + ''),
  23258. array = realNames[result],
  23259. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23260. while (length--) {
  23261. var data = array[length],
  23262. otherFunc = data.func;
  23263. if (otherFunc == null || otherFunc == func) {
  23264. return data.name;
  23265. }
  23266. }
  23267. return result;
  23268. }
  23269. /**
  23270. * Gets the argument placeholder value for `func`.
  23271. *
  23272. * @private
  23273. * @param {Function} func The function to inspect.
  23274. * @returns {*} Returns the placeholder value.
  23275. */
  23276. function getHolder(func) {
  23277. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23278. return object.placeholder;
  23279. }
  23280. /**
  23281. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23282. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23283. * If arguments are provided, the chosen function is invoked with them and
  23284. * its result is returned.
  23285. *
  23286. * @private
  23287. * @param {*} [value] The value to convert to an iteratee.
  23288. * @param {number} [arity] The arity of the created iteratee.
  23289. * @returns {Function} Returns the chosen function or its result.
  23290. */
  23291. function getIteratee() {
  23292. var result = lodash.iteratee || iteratee;
  23293. result = result === iteratee ? baseIteratee : result;
  23294. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23295. }
  23296. /**
  23297. * Gets the data for `map`.
  23298. *
  23299. * @private
  23300. * @param {Object} map The map to query.
  23301. * @param {string} key The reference key.
  23302. * @returns {*} Returns the map data.
  23303. */
  23304. function getMapData(map, key) {
  23305. var data = map.__data__;
  23306. return isKeyable(key)
  23307. ? data[typeof key == 'string' ? 'string' : 'hash']
  23308. : data.map;
  23309. }
  23310. /**
  23311. * Gets the property names, values, and compare flags of `object`.
  23312. *
  23313. * @private
  23314. * @param {Object} object The object to query.
  23315. * @returns {Array} Returns the match data of `object`.
  23316. */
  23317. function getMatchData(object) {
  23318. var result = keys(object),
  23319. length = result.length;
  23320. while (length--) {
  23321. var key = result[length],
  23322. value = object[key];
  23323. result[length] = [key, value, isStrictComparable(value)];
  23324. }
  23325. return result;
  23326. }
  23327. /**
  23328. * Gets the native function at `key` of `object`.
  23329. *
  23330. * @private
  23331. * @param {Object} object The object to query.
  23332. * @param {string} key The key of the method to get.
  23333. * @returns {*} Returns the function if it's native, else `undefined`.
  23334. */
  23335. function getNative(object, key) {
  23336. var value = getValue(object, key);
  23337. return baseIsNative(value) ? value : undefined;
  23338. }
  23339. /**
  23340. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23341. *
  23342. * @private
  23343. * @param {*} value The value to query.
  23344. * @returns {string} Returns the raw `toStringTag`.
  23345. */
  23346. function getRawTag(value) {
  23347. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23348. tag = value[symToStringTag];
  23349. try {
  23350. value[symToStringTag] = undefined;
  23351. var unmasked = true;
  23352. } catch (e) {}
  23353. var result = nativeObjectToString.call(value);
  23354. if (unmasked) {
  23355. if (isOwn) {
  23356. value[symToStringTag] = tag;
  23357. } else {
  23358. delete value[symToStringTag];
  23359. }
  23360. }
  23361. return result;
  23362. }
  23363. /**
  23364. * Creates an array of the own enumerable symbols of `object`.
  23365. *
  23366. * @private
  23367. * @param {Object} object The object to query.
  23368. * @returns {Array} Returns the array of symbols.
  23369. */
  23370. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23371. if (object == null) {
  23372. return [];
  23373. }
  23374. object = Object(object);
  23375. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23376. return propertyIsEnumerable.call(object, symbol);
  23377. });
  23378. };
  23379. /**
  23380. * Creates an array of the own and inherited enumerable symbols of `object`.
  23381. *
  23382. * @private
  23383. * @param {Object} object The object to query.
  23384. * @returns {Array} Returns the array of symbols.
  23385. */
  23386. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23387. var result = [];
  23388. while (object) {
  23389. arrayPush(result, getSymbols(object));
  23390. object = getPrototype(object);
  23391. }
  23392. return result;
  23393. };
  23394. /**
  23395. * Gets the `toStringTag` of `value`.
  23396. *
  23397. * @private
  23398. * @param {*} value The value to query.
  23399. * @returns {string} Returns the `toStringTag`.
  23400. */
  23401. var getTag = baseGetTag;
  23402. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23403. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23404. (Map && getTag(new Map) != mapTag) ||
  23405. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23406. (Set && getTag(new Set) != setTag) ||
  23407. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23408. getTag = function(value) {
  23409. var result = baseGetTag(value),
  23410. Ctor = result == objectTag ? value.constructor : undefined,
  23411. ctorString = Ctor ? toSource(Ctor) : '';
  23412. if (ctorString) {
  23413. switch (ctorString) {
  23414. case dataViewCtorString: return dataViewTag;
  23415. case mapCtorString: return mapTag;
  23416. case promiseCtorString: return promiseTag;
  23417. case setCtorString: return setTag;
  23418. case weakMapCtorString: return weakMapTag;
  23419. }
  23420. }
  23421. return result;
  23422. };
  23423. }
  23424. /**
  23425. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23426. *
  23427. * @private
  23428. * @param {number} start The start of the view.
  23429. * @param {number} end The end of the view.
  23430. * @param {Array} transforms The transformations to apply to the view.
  23431. * @returns {Object} Returns an object containing the `start` and `end`
  23432. * positions of the view.
  23433. */
  23434. function getView(start, end, transforms) {
  23435. var index = -1,
  23436. length = transforms.length;
  23437. while (++index < length) {
  23438. var data = transforms[index],
  23439. size = data.size;
  23440. switch (data.type) {
  23441. case 'drop': start += size; break;
  23442. case 'dropRight': end -= size; break;
  23443. case 'take': end = nativeMin(end, start + size); break;
  23444. case 'takeRight': start = nativeMax(start, end - size); break;
  23445. }
  23446. }
  23447. return { 'start': start, 'end': end };
  23448. }
  23449. /**
  23450. * Extracts wrapper details from the `source` body comment.
  23451. *
  23452. * @private
  23453. * @param {string} source The source to inspect.
  23454. * @returns {Array} Returns the wrapper details.
  23455. */
  23456. function getWrapDetails(source) {
  23457. var match = source.match(reWrapDetails);
  23458. return match ? match[1].split(reSplitDetails) : [];
  23459. }
  23460. /**
  23461. * Checks if `path` exists on `object`.
  23462. *
  23463. * @private
  23464. * @param {Object} object The object to query.
  23465. * @param {Array|string} path The path to check.
  23466. * @param {Function} hasFunc The function to check properties.
  23467. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23468. */
  23469. function hasPath(object, path, hasFunc) {
  23470. path = castPath(path, object);
  23471. var index = -1,
  23472. length = path.length,
  23473. result = false;
  23474. while (++index < length) {
  23475. var key = toKey(path[index]);
  23476. if (!(result = object != null && hasFunc(object, key))) {
  23477. break;
  23478. }
  23479. object = object[key];
  23480. }
  23481. if (result || ++index != length) {
  23482. return result;
  23483. }
  23484. length = object == null ? 0 : object.length;
  23485. return !!length && isLength(length) && isIndex(key, length) &&
  23486. (isArray(object) || isArguments(object));
  23487. }
  23488. /**
  23489. * Initializes an array clone.
  23490. *
  23491. * @private
  23492. * @param {Array} array The array to clone.
  23493. * @returns {Array} Returns the initialized clone.
  23494. */
  23495. function initCloneArray(array) {
  23496. var length = array.length,
  23497. result = new array.constructor(length);
  23498. // Add properties assigned by `RegExp#exec`.
  23499. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23500. result.index = array.index;
  23501. result.input = array.input;
  23502. }
  23503. return result;
  23504. }
  23505. /**
  23506. * Initializes an object clone.
  23507. *
  23508. * @private
  23509. * @param {Object} object The object to clone.
  23510. * @returns {Object} Returns the initialized clone.
  23511. */
  23512. function initCloneObject(object) {
  23513. return (typeof object.constructor == 'function' && !isPrototype(object))
  23514. ? baseCreate(getPrototype(object))
  23515. : {};
  23516. }
  23517. /**
  23518. * Initializes an object clone based on its `toStringTag`.
  23519. *
  23520. * **Note:** This function only supports cloning values with tags of
  23521. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23522. *
  23523. * @private
  23524. * @param {Object} object The object to clone.
  23525. * @param {string} tag The `toStringTag` of the object to clone.
  23526. * @param {boolean} [isDeep] Specify a deep clone.
  23527. * @returns {Object} Returns the initialized clone.
  23528. */
  23529. function initCloneByTag(object, tag, isDeep) {
  23530. var Ctor = object.constructor;
  23531. switch (tag) {
  23532. case arrayBufferTag:
  23533. return cloneArrayBuffer(object);
  23534. case boolTag:
  23535. case dateTag:
  23536. return new Ctor(+object);
  23537. case dataViewTag:
  23538. return cloneDataView(object, isDeep);
  23539. case float32Tag: case float64Tag:
  23540. case int8Tag: case int16Tag: case int32Tag:
  23541. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23542. return cloneTypedArray(object, isDeep);
  23543. case mapTag:
  23544. return new Ctor;
  23545. case numberTag:
  23546. case stringTag:
  23547. return new Ctor(object);
  23548. case regexpTag:
  23549. return cloneRegExp(object);
  23550. case setTag:
  23551. return new Ctor;
  23552. case symbolTag:
  23553. return cloneSymbol(object);
  23554. }
  23555. }
  23556. /**
  23557. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23558. *
  23559. * @private
  23560. * @param {string} source The source to modify.
  23561. * @returns {Array} details The details to insert.
  23562. * @returns {string} Returns the modified source.
  23563. */
  23564. function insertWrapDetails(source, details) {
  23565. var length = details.length;
  23566. if (!length) {
  23567. return source;
  23568. }
  23569. var lastIndex = length - 1;
  23570. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23571. details = details.join(length > 2 ? ', ' : ' ');
  23572. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23573. }
  23574. /**
  23575. * Checks if `value` is a flattenable `arguments` object or array.
  23576. *
  23577. * @private
  23578. * @param {*} value The value to check.
  23579. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23580. */
  23581. function isFlattenable(value) {
  23582. return isArray(value) || isArguments(value) ||
  23583. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23584. }
  23585. /**
  23586. * Checks if `value` is a valid array-like index.
  23587. *
  23588. * @private
  23589. * @param {*} value The value to check.
  23590. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23591. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23592. */
  23593. function isIndex(value, length) {
  23594. var type = typeof value;
  23595. length = length == null ? MAX_SAFE_INTEGER : length;
  23596. return !!length &&
  23597. (type == 'number' ||
  23598. (type != 'symbol' && reIsUint.test(value))) &&
  23599. (value > -1 && value % 1 == 0 && value < length);
  23600. }
  23601. /**
  23602. * Checks if the given arguments are from an iteratee call.
  23603. *
  23604. * @private
  23605. * @param {*} value The potential iteratee value argument.
  23606. * @param {*} index The potential iteratee index or key argument.
  23607. * @param {*} object The potential iteratee object argument.
  23608. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23609. * else `false`.
  23610. */
  23611. function isIterateeCall(value, index, object) {
  23612. if (!isObject(object)) {
  23613. return false;
  23614. }
  23615. var type = typeof index;
  23616. if (type == 'number'
  23617. ? (isArrayLike(object) && isIndex(index, object.length))
  23618. : (type == 'string' && index in object)
  23619. ) {
  23620. return eq(object[index], value);
  23621. }
  23622. return false;
  23623. }
  23624. /**
  23625. * Checks if `value` is a property name and not a property path.
  23626. *
  23627. * @private
  23628. * @param {*} value The value to check.
  23629. * @param {Object} [object] The object to query keys on.
  23630. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23631. */
  23632. function isKey(value, object) {
  23633. if (isArray(value)) {
  23634. return false;
  23635. }
  23636. var type = typeof value;
  23637. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23638. value == null || isSymbol(value)) {
  23639. return true;
  23640. }
  23641. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23642. (object != null && value in Object(object));
  23643. }
  23644. /**
  23645. * Checks if `value` is suitable for use as unique object key.
  23646. *
  23647. * @private
  23648. * @param {*} value The value to check.
  23649. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23650. */
  23651. function isKeyable(value) {
  23652. var type = typeof value;
  23653. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23654. ? (value !== '__proto__')
  23655. : (value === null);
  23656. }
  23657. /**
  23658. * Checks if `func` has a lazy counterpart.
  23659. *
  23660. * @private
  23661. * @param {Function} func The function to check.
  23662. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23663. * else `false`.
  23664. */
  23665. function isLaziable(func) {
  23666. var funcName = getFuncName(func),
  23667. other = lodash[funcName];
  23668. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23669. return false;
  23670. }
  23671. if (func === other) {
  23672. return true;
  23673. }
  23674. var data = getData(other);
  23675. return !!data && func === data[0];
  23676. }
  23677. /**
  23678. * Checks if `func` has its source masked.
  23679. *
  23680. * @private
  23681. * @param {Function} func The function to check.
  23682. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23683. */
  23684. function isMasked(func) {
  23685. return !!maskSrcKey && (maskSrcKey in func);
  23686. }
  23687. /**
  23688. * Checks if `func` is capable of being masked.
  23689. *
  23690. * @private
  23691. * @param {*} value The value to check.
  23692. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23693. */
  23694. var isMaskable = coreJsData ? isFunction : stubFalse;
  23695. /**
  23696. * Checks if `value` is likely a prototype object.
  23697. *
  23698. * @private
  23699. * @param {*} value The value to check.
  23700. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23701. */
  23702. function isPrototype(value) {
  23703. var Ctor = value && value.constructor,
  23704. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23705. return value === proto;
  23706. }
  23707. /**
  23708. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23709. *
  23710. * @private
  23711. * @param {*} value The value to check.
  23712. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23713. * equality comparisons, else `false`.
  23714. */
  23715. function isStrictComparable(value) {
  23716. return value === value && !isObject(value);
  23717. }
  23718. /**
  23719. * A specialized version of `matchesProperty` for source values suitable
  23720. * for strict equality comparisons, i.e. `===`.
  23721. *
  23722. * @private
  23723. * @param {string} key The key of the property to get.
  23724. * @param {*} srcValue The value to match.
  23725. * @returns {Function} Returns the new spec function.
  23726. */
  23727. function matchesStrictComparable(key, srcValue) {
  23728. return function(object) {
  23729. if (object == null) {
  23730. return false;
  23731. }
  23732. return object[key] === srcValue &&
  23733. (srcValue !== undefined || (key in Object(object)));
  23734. };
  23735. }
  23736. /**
  23737. * A specialized version of `_.memoize` which clears the memoized function's
  23738. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23739. *
  23740. * @private
  23741. * @param {Function} func The function to have its output memoized.
  23742. * @returns {Function} Returns the new memoized function.
  23743. */
  23744. function memoizeCapped(func) {
  23745. var result = memoize(func, function(key) {
  23746. if (cache.size === MAX_MEMOIZE_SIZE) {
  23747. cache.clear();
  23748. }
  23749. return key;
  23750. });
  23751. var cache = result.cache;
  23752. return result;
  23753. }
  23754. /**
  23755. * Merges the function metadata of `source` into `data`.
  23756. *
  23757. * Merging metadata reduces the number of wrappers used to invoke a function.
  23758. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23759. * may be applied regardless of execution order. Methods like `_.ary` and
  23760. * `_.rearg` modify function arguments, making the order in which they are
  23761. * executed important, preventing the merging of metadata. However, we make
  23762. * an exception for a safe combined case where curried functions have `_.ary`
  23763. * and or `_.rearg` applied.
  23764. *
  23765. * @private
  23766. * @param {Array} data The destination metadata.
  23767. * @param {Array} source The source metadata.
  23768. * @returns {Array} Returns `data`.
  23769. */
  23770. function mergeData(data, source) {
  23771. var bitmask = data[1],
  23772. srcBitmask = source[1],
  23773. newBitmask = bitmask | srcBitmask,
  23774. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23775. var isCombo =
  23776. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23777. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23778. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23779. // Exit early if metadata can't be merged.
  23780. if (!(isCommon || isCombo)) {
  23781. return data;
  23782. }
  23783. // Use source `thisArg` if available.
  23784. if (srcBitmask & WRAP_BIND_FLAG) {
  23785. data[2] = source[2];
  23786. // Set when currying a bound function.
  23787. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23788. }
  23789. // Compose partial arguments.
  23790. var value = source[3];
  23791. if (value) {
  23792. var partials = data[3];
  23793. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23794. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23795. }
  23796. // Compose partial right arguments.
  23797. value = source[5];
  23798. if (value) {
  23799. partials = data[5];
  23800. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23801. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23802. }
  23803. // Use source `argPos` if available.
  23804. value = source[7];
  23805. if (value) {
  23806. data[7] = value;
  23807. }
  23808. // Use source `ary` if it's smaller.
  23809. if (srcBitmask & WRAP_ARY_FLAG) {
  23810. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23811. }
  23812. // Use source `arity` if one is not provided.
  23813. if (data[9] == null) {
  23814. data[9] = source[9];
  23815. }
  23816. // Use source `func` and merge bitmasks.
  23817. data[0] = source[0];
  23818. data[1] = newBitmask;
  23819. return data;
  23820. }
  23821. /**
  23822. * This function is like
  23823. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23824. * except that it includes inherited enumerable properties.
  23825. *
  23826. * @private
  23827. * @param {Object} object The object to query.
  23828. * @returns {Array} Returns the array of property names.
  23829. */
  23830. function nativeKeysIn(object) {
  23831. var result = [];
  23832. if (object != null) {
  23833. for (var key in Object(object)) {
  23834. result.push(key);
  23835. }
  23836. }
  23837. return result;
  23838. }
  23839. /**
  23840. * Converts `value` to a string using `Object.prototype.toString`.
  23841. *
  23842. * @private
  23843. * @param {*} value The value to convert.
  23844. * @returns {string} Returns the converted string.
  23845. */
  23846. function objectToString(value) {
  23847. return nativeObjectToString.call(value);
  23848. }
  23849. /**
  23850. * A specialized version of `baseRest` which transforms the rest array.
  23851. *
  23852. * @private
  23853. * @param {Function} func The function to apply a rest parameter to.
  23854. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23855. * @param {Function} transform The rest array transform.
  23856. * @returns {Function} Returns the new function.
  23857. */
  23858. function overRest(func, start, transform) {
  23859. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23860. return function() {
  23861. var args = arguments,
  23862. index = -1,
  23863. length = nativeMax(args.length - start, 0),
  23864. array = Array(length);
  23865. while (++index < length) {
  23866. array[index] = args[start + index];
  23867. }
  23868. index = -1;
  23869. var otherArgs = Array(start + 1);
  23870. while (++index < start) {
  23871. otherArgs[index] = args[index];
  23872. }
  23873. otherArgs[start] = transform(array);
  23874. return apply(func, this, otherArgs);
  23875. };
  23876. }
  23877. /**
  23878. * Gets the parent value at `path` of `object`.
  23879. *
  23880. * @private
  23881. * @param {Object} object The object to query.
  23882. * @param {Array} path The path to get the parent value of.
  23883. * @returns {*} Returns the parent value.
  23884. */
  23885. function parent(object, path) {
  23886. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23887. }
  23888. /**
  23889. * Reorder `array` according to the specified indexes where the element at
  23890. * the first index is assigned as the first element, the element at
  23891. * the second index is assigned as the second element, and so on.
  23892. *
  23893. * @private
  23894. * @param {Array} array The array to reorder.
  23895. * @param {Array} indexes The arranged array indexes.
  23896. * @returns {Array} Returns `array`.
  23897. */
  23898. function reorder(array, indexes) {
  23899. var arrLength = array.length,
  23900. length = nativeMin(indexes.length, arrLength),
  23901. oldArray = copyArray(array);
  23902. while (length--) {
  23903. var index = indexes[length];
  23904. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23905. }
  23906. return array;
  23907. }
  23908. /**
  23909. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23910. *
  23911. * @private
  23912. * @param {Object} object The object to query.
  23913. * @param {string} key The key of the property to get.
  23914. * @returns {*} Returns the property value.
  23915. */
  23916. function safeGet(object, key) {
  23917. if (key === 'constructor' && typeof object[key] === 'function') {
  23918. return;
  23919. }
  23920. if (key == '__proto__') {
  23921. return;
  23922. }
  23923. return object[key];
  23924. }
  23925. /**
  23926. * Sets metadata for `func`.
  23927. *
  23928. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23929. * period of time, it will trip its breaker and transition to an identity
  23930. * function to avoid garbage collection pauses in V8. See
  23931. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23932. * for more details.
  23933. *
  23934. * @private
  23935. * @param {Function} func The function to associate metadata with.
  23936. * @param {*} data The metadata.
  23937. * @returns {Function} Returns `func`.
  23938. */
  23939. var setData = shortOut(baseSetData);
  23940. /**
  23941. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23942. *
  23943. * @private
  23944. * @param {Function} func The function to delay.
  23945. * @param {number} wait The number of milliseconds to delay invocation.
  23946. * @returns {number|Object} Returns the timer id or timeout object.
  23947. */
  23948. var setTimeout = ctxSetTimeout || function(func, wait) {
  23949. return root.setTimeout(func, wait);
  23950. };
  23951. /**
  23952. * Sets the `toString` method of `func` to return `string`.
  23953. *
  23954. * @private
  23955. * @param {Function} func The function to modify.
  23956. * @param {Function} string The `toString` result.
  23957. * @returns {Function} Returns `func`.
  23958. */
  23959. var setToString = shortOut(baseSetToString);
  23960. /**
  23961. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23962. * with wrapper details in a comment at the top of the source body.
  23963. *
  23964. * @private
  23965. * @param {Function} wrapper The function to modify.
  23966. * @param {Function} reference The reference function.
  23967. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23968. * @returns {Function} Returns `wrapper`.
  23969. */
  23970. function setWrapToString(wrapper, reference, bitmask) {
  23971. var source = (reference + '');
  23972. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23973. }
  23974. /**
  23975. * Creates a function that'll short out and invoke `identity` instead
  23976. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23977. * milliseconds.
  23978. *
  23979. * @private
  23980. * @param {Function} func The function to restrict.
  23981. * @returns {Function} Returns the new shortable function.
  23982. */
  23983. function shortOut(func) {
  23984. var count = 0,
  23985. lastCalled = 0;
  23986. return function() {
  23987. var stamp = nativeNow(),
  23988. remaining = HOT_SPAN - (stamp - lastCalled);
  23989. lastCalled = stamp;
  23990. if (remaining > 0) {
  23991. if (++count >= HOT_COUNT) {
  23992. return arguments[0];
  23993. }
  23994. } else {
  23995. count = 0;
  23996. }
  23997. return func.apply(undefined, arguments);
  23998. };
  23999. }
  24000. /**
  24001. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24002. *
  24003. * @private
  24004. * @param {Array} array The array to shuffle.
  24005. * @param {number} [size=array.length] The size of `array`.
  24006. * @returns {Array} Returns `array`.
  24007. */
  24008. function shuffleSelf(array, size) {
  24009. var index = -1,
  24010. length = array.length,
  24011. lastIndex = length - 1;
  24012. size = size === undefined ? length : size;
  24013. while (++index < size) {
  24014. var rand = baseRandom(index, lastIndex),
  24015. value = array[rand];
  24016. array[rand] = array[index];
  24017. array[index] = value;
  24018. }
  24019. array.length = size;
  24020. return array;
  24021. }
  24022. /**
  24023. * Converts `string` to a property path array.
  24024. *
  24025. * @private
  24026. * @param {string} string The string to convert.
  24027. * @returns {Array} Returns the property path array.
  24028. */
  24029. var stringToPath = memoizeCapped(function(string) {
  24030. var result = [];
  24031. if (string.charCodeAt(0) === 46 /* . */) {
  24032. result.push('');
  24033. }
  24034. string.replace(rePropName, function(match, number, quote, subString) {
  24035. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24036. });
  24037. return result;
  24038. });
  24039. /**
  24040. * Converts `value` to a string key if it's not a string or symbol.
  24041. *
  24042. * @private
  24043. * @param {*} value The value to inspect.
  24044. * @returns {string|symbol} Returns the key.
  24045. */
  24046. function toKey(value) {
  24047. if (typeof value == 'string' || isSymbol(value)) {
  24048. return value;
  24049. }
  24050. var result = (value + '');
  24051. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24052. }
  24053. /**
  24054. * Converts `func` to its source code.
  24055. *
  24056. * @private
  24057. * @param {Function} func The function to convert.
  24058. * @returns {string} Returns the source code.
  24059. */
  24060. function toSource(func) {
  24061. if (func != null) {
  24062. try {
  24063. return funcToString.call(func);
  24064. } catch (e) {}
  24065. try {
  24066. return (func + '');
  24067. } catch (e) {}
  24068. }
  24069. return '';
  24070. }
  24071. /**
  24072. * Updates wrapper `details` based on `bitmask` flags.
  24073. *
  24074. * @private
  24075. * @returns {Array} details The details to modify.
  24076. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24077. * @returns {Array} Returns `details`.
  24078. */
  24079. function updateWrapDetails(details, bitmask) {
  24080. arrayEach(wrapFlags, function(pair) {
  24081. var value = '_.' + pair[0];
  24082. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24083. details.push(value);
  24084. }
  24085. });
  24086. return details.sort();
  24087. }
  24088. /**
  24089. * Creates a clone of `wrapper`.
  24090. *
  24091. * @private
  24092. * @param {Object} wrapper The wrapper to clone.
  24093. * @returns {Object} Returns the cloned wrapper.
  24094. */
  24095. function wrapperClone(wrapper) {
  24096. if (wrapper instanceof LazyWrapper) {
  24097. return wrapper.clone();
  24098. }
  24099. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24100. result.__actions__ = copyArray(wrapper.__actions__);
  24101. result.__index__ = wrapper.__index__;
  24102. result.__values__ = wrapper.__values__;
  24103. return result;
  24104. }
  24105. /*------------------------------------------------------------------------*/
  24106. /**
  24107. * Creates an array of elements split into groups the length of `size`.
  24108. * If `array` can't be split evenly, the final chunk will be the remaining
  24109. * elements.
  24110. *
  24111. * @static
  24112. * @memberOf _
  24113. * @since 3.0.0
  24114. * @category Array
  24115. * @param {Array} array The array to process.
  24116. * @param {number} [size=1] The length of each chunk
  24117. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24118. * @returns {Array} Returns the new array of chunks.
  24119. * @example
  24120. *
  24121. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24122. * // => [['a', 'b'], ['c', 'd']]
  24123. *
  24124. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24125. * // => [['a', 'b', 'c'], ['d']]
  24126. */
  24127. function chunk(array, size, guard) {
  24128. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24129. size = 1;
  24130. } else {
  24131. size = nativeMax(toInteger(size), 0);
  24132. }
  24133. var length = array == null ? 0 : array.length;
  24134. if (!length || size < 1) {
  24135. return [];
  24136. }
  24137. var index = 0,
  24138. resIndex = 0,
  24139. result = Array(nativeCeil(length / size));
  24140. while (index < length) {
  24141. result[resIndex++] = baseSlice(array, index, (index += size));
  24142. }
  24143. return result;
  24144. }
  24145. /**
  24146. * Creates an array with all falsey values removed. The values `false`, `null`,
  24147. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24148. *
  24149. * @static
  24150. * @memberOf _
  24151. * @since 0.1.0
  24152. * @category Array
  24153. * @param {Array} array The array to compact.
  24154. * @returns {Array} Returns the new array of filtered values.
  24155. * @example
  24156. *
  24157. * _.compact([0, 1, false, 2, '', 3]);
  24158. * // => [1, 2, 3]
  24159. */
  24160. function compact(array) {
  24161. var index = -1,
  24162. length = array == null ? 0 : array.length,
  24163. resIndex = 0,
  24164. result = [];
  24165. while (++index < length) {
  24166. var value = array[index];
  24167. if (value) {
  24168. result[resIndex++] = value;
  24169. }
  24170. }
  24171. return result;
  24172. }
  24173. /**
  24174. * Creates a new array concatenating `array` with any additional arrays
  24175. * and/or values.
  24176. *
  24177. * @static
  24178. * @memberOf _
  24179. * @since 4.0.0
  24180. * @category Array
  24181. * @param {Array} array The array to concatenate.
  24182. * @param {...*} [values] The values to concatenate.
  24183. * @returns {Array} Returns the new concatenated array.
  24184. * @example
  24185. *
  24186. * var array = [1];
  24187. * var other = _.concat(array, 2, [3], [[4]]);
  24188. *
  24189. * console.log(other);
  24190. * // => [1, 2, 3, [4]]
  24191. *
  24192. * console.log(array);
  24193. * // => [1]
  24194. */
  24195. function concat() {
  24196. var length = arguments.length;
  24197. if (!length) {
  24198. return [];
  24199. }
  24200. var args = Array(length - 1),
  24201. array = arguments[0],
  24202. index = length;
  24203. while (index--) {
  24204. args[index - 1] = arguments[index];
  24205. }
  24206. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24207. }
  24208. /**
  24209. * Creates an array of `array` values not included in the other given arrays
  24210. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24211. * for equality comparisons. The order and references of result values are
  24212. * determined by the first array.
  24213. *
  24214. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24215. *
  24216. * @static
  24217. * @memberOf _
  24218. * @since 0.1.0
  24219. * @category Array
  24220. * @param {Array} array The array to inspect.
  24221. * @param {...Array} [values] The values to exclude.
  24222. * @returns {Array} Returns the new array of filtered values.
  24223. * @see _.without, _.xor
  24224. * @example
  24225. *
  24226. * _.difference([2, 1], [2, 3]);
  24227. * // => [1]
  24228. */
  24229. var difference = baseRest(function(array, values) {
  24230. return isArrayLikeObject(array)
  24231. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24232. : [];
  24233. });
  24234. /**
  24235. * This method is like `_.difference` except that it accepts `iteratee` which
  24236. * is invoked for each element of `array` and `values` to generate the criterion
  24237. * by which they're compared. The order and references of result values are
  24238. * determined by the first array. The iteratee is invoked with one argument:
  24239. * (value).
  24240. *
  24241. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24242. *
  24243. * @static
  24244. * @memberOf _
  24245. * @since 4.0.0
  24246. * @category Array
  24247. * @param {Array} array The array to inspect.
  24248. * @param {...Array} [values] The values to exclude.
  24249. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24250. * @returns {Array} Returns the new array of filtered values.
  24251. * @example
  24252. *
  24253. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24254. * // => [1.2]
  24255. *
  24256. * // The `_.property` iteratee shorthand.
  24257. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24258. * // => [{ 'x': 2 }]
  24259. */
  24260. var differenceBy = baseRest(function(array, values) {
  24261. var iteratee = last(values);
  24262. if (isArrayLikeObject(iteratee)) {
  24263. iteratee = undefined;
  24264. }
  24265. return isArrayLikeObject(array)
  24266. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24267. : [];
  24268. });
  24269. /**
  24270. * This method is like `_.difference` except that it accepts `comparator`
  24271. * which is invoked to compare elements of `array` to `values`. The order and
  24272. * references of result values are determined by the first array. The comparator
  24273. * is invoked with two arguments: (arrVal, othVal).
  24274. *
  24275. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24276. *
  24277. * @static
  24278. * @memberOf _
  24279. * @since 4.0.0
  24280. * @category Array
  24281. * @param {Array} array The array to inspect.
  24282. * @param {...Array} [values] The values to exclude.
  24283. * @param {Function} [comparator] The comparator invoked per element.
  24284. * @returns {Array} Returns the new array of filtered values.
  24285. * @example
  24286. *
  24287. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24288. *
  24289. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24290. * // => [{ 'x': 2, 'y': 1 }]
  24291. */
  24292. var differenceWith = baseRest(function(array, values) {
  24293. var comparator = last(values);
  24294. if (isArrayLikeObject(comparator)) {
  24295. comparator = undefined;
  24296. }
  24297. return isArrayLikeObject(array)
  24298. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24299. : [];
  24300. });
  24301. /**
  24302. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24303. *
  24304. * @static
  24305. * @memberOf _
  24306. * @since 0.5.0
  24307. * @category Array
  24308. * @param {Array} array The array to query.
  24309. * @param {number} [n=1] The number of elements to drop.
  24310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24311. * @returns {Array} Returns the slice of `array`.
  24312. * @example
  24313. *
  24314. * _.drop([1, 2, 3]);
  24315. * // => [2, 3]
  24316. *
  24317. * _.drop([1, 2, 3], 2);
  24318. * // => [3]
  24319. *
  24320. * _.drop([1, 2, 3], 5);
  24321. * // => []
  24322. *
  24323. * _.drop([1, 2, 3], 0);
  24324. * // => [1, 2, 3]
  24325. */
  24326. function drop(array, n, guard) {
  24327. var length = array == null ? 0 : array.length;
  24328. if (!length) {
  24329. return [];
  24330. }
  24331. n = (guard || n === undefined) ? 1 : toInteger(n);
  24332. return baseSlice(array, n < 0 ? 0 : n, length);
  24333. }
  24334. /**
  24335. * Creates a slice of `array` with `n` elements dropped from the end.
  24336. *
  24337. * @static
  24338. * @memberOf _
  24339. * @since 3.0.0
  24340. * @category Array
  24341. * @param {Array} array The array to query.
  24342. * @param {number} [n=1] The number of elements to drop.
  24343. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24344. * @returns {Array} Returns the slice of `array`.
  24345. * @example
  24346. *
  24347. * _.dropRight([1, 2, 3]);
  24348. * // => [1, 2]
  24349. *
  24350. * _.dropRight([1, 2, 3], 2);
  24351. * // => [1]
  24352. *
  24353. * _.dropRight([1, 2, 3], 5);
  24354. * // => []
  24355. *
  24356. * _.dropRight([1, 2, 3], 0);
  24357. * // => [1, 2, 3]
  24358. */
  24359. function dropRight(array, n, guard) {
  24360. var length = array == null ? 0 : array.length;
  24361. if (!length) {
  24362. return [];
  24363. }
  24364. n = (guard || n === undefined) ? 1 : toInteger(n);
  24365. n = length - n;
  24366. return baseSlice(array, 0, n < 0 ? 0 : n);
  24367. }
  24368. /**
  24369. * Creates a slice of `array` excluding elements dropped from the end.
  24370. * Elements are dropped until `predicate` returns falsey. The predicate is
  24371. * invoked with three arguments: (value, index, array).
  24372. *
  24373. * @static
  24374. * @memberOf _
  24375. * @since 3.0.0
  24376. * @category Array
  24377. * @param {Array} array The array to query.
  24378. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24379. * @returns {Array} Returns the slice of `array`.
  24380. * @example
  24381. *
  24382. * var users = [
  24383. * { 'user': 'barney', 'active': true },
  24384. * { 'user': 'fred', 'active': false },
  24385. * { 'user': 'pebbles', 'active': false }
  24386. * ];
  24387. *
  24388. * _.dropRightWhile(users, function(o) { return !o.active; });
  24389. * // => objects for ['barney']
  24390. *
  24391. * // The `_.matches` iteratee shorthand.
  24392. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24393. * // => objects for ['barney', 'fred']
  24394. *
  24395. * // The `_.matchesProperty` iteratee shorthand.
  24396. * _.dropRightWhile(users, ['active', false]);
  24397. * // => objects for ['barney']
  24398. *
  24399. * // The `_.property` iteratee shorthand.
  24400. * _.dropRightWhile(users, 'active');
  24401. * // => objects for ['barney', 'fred', 'pebbles']
  24402. */
  24403. function dropRightWhile(array, predicate) {
  24404. return (array && array.length)
  24405. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24406. : [];
  24407. }
  24408. /**
  24409. * Creates a slice of `array` excluding elements dropped from the beginning.
  24410. * Elements are dropped until `predicate` returns falsey. The predicate is
  24411. * invoked with three arguments: (value, index, array).
  24412. *
  24413. * @static
  24414. * @memberOf _
  24415. * @since 3.0.0
  24416. * @category Array
  24417. * @param {Array} array The array to query.
  24418. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24419. * @returns {Array} Returns the slice of `array`.
  24420. * @example
  24421. *
  24422. * var users = [
  24423. * { 'user': 'barney', 'active': false },
  24424. * { 'user': 'fred', 'active': false },
  24425. * { 'user': 'pebbles', 'active': true }
  24426. * ];
  24427. *
  24428. * _.dropWhile(users, function(o) { return !o.active; });
  24429. * // => objects for ['pebbles']
  24430. *
  24431. * // The `_.matches` iteratee shorthand.
  24432. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24433. * // => objects for ['fred', 'pebbles']
  24434. *
  24435. * // The `_.matchesProperty` iteratee shorthand.
  24436. * _.dropWhile(users, ['active', false]);
  24437. * // => objects for ['pebbles']
  24438. *
  24439. * // The `_.property` iteratee shorthand.
  24440. * _.dropWhile(users, 'active');
  24441. * // => objects for ['barney', 'fred', 'pebbles']
  24442. */
  24443. function dropWhile(array, predicate) {
  24444. return (array && array.length)
  24445. ? baseWhile(array, getIteratee(predicate, 3), true)
  24446. : [];
  24447. }
  24448. /**
  24449. * Fills elements of `array` with `value` from `start` up to, but not
  24450. * including, `end`.
  24451. *
  24452. * **Note:** This method mutates `array`.
  24453. *
  24454. * @static
  24455. * @memberOf _
  24456. * @since 3.2.0
  24457. * @category Array
  24458. * @param {Array} array The array to fill.
  24459. * @param {*} value The value to fill `array` with.
  24460. * @param {number} [start=0] The start position.
  24461. * @param {number} [end=array.length] The end position.
  24462. * @returns {Array} Returns `array`.
  24463. * @example
  24464. *
  24465. * var array = [1, 2, 3];
  24466. *
  24467. * _.fill(array, 'a');
  24468. * console.log(array);
  24469. * // => ['a', 'a', 'a']
  24470. *
  24471. * _.fill(Array(3), 2);
  24472. * // => [2, 2, 2]
  24473. *
  24474. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24475. * // => [4, '*', '*', 10]
  24476. */
  24477. function fill(array, value, start, end) {
  24478. var length = array == null ? 0 : array.length;
  24479. if (!length) {
  24480. return [];
  24481. }
  24482. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24483. start = 0;
  24484. end = length;
  24485. }
  24486. return baseFill(array, value, start, end);
  24487. }
  24488. /**
  24489. * This method is like `_.find` except that it returns the index of the first
  24490. * element `predicate` returns truthy for instead of the element itself.
  24491. *
  24492. * @static
  24493. * @memberOf _
  24494. * @since 1.1.0
  24495. * @category Array
  24496. * @param {Array} array The array to inspect.
  24497. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24498. * @param {number} [fromIndex=0] The index to search from.
  24499. * @returns {number} Returns the index of the found element, else `-1`.
  24500. * @example
  24501. *
  24502. * var users = [
  24503. * { 'user': 'barney', 'active': false },
  24504. * { 'user': 'fred', 'active': false },
  24505. * { 'user': 'pebbles', 'active': true }
  24506. * ];
  24507. *
  24508. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24509. * // => 0
  24510. *
  24511. * // The `_.matches` iteratee shorthand.
  24512. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24513. * // => 1
  24514. *
  24515. * // The `_.matchesProperty` iteratee shorthand.
  24516. * _.findIndex(users, ['active', false]);
  24517. * // => 0
  24518. *
  24519. * // The `_.property` iteratee shorthand.
  24520. * _.findIndex(users, 'active');
  24521. * // => 2
  24522. */
  24523. function findIndex(array, predicate, fromIndex) {
  24524. var length = array == null ? 0 : array.length;
  24525. if (!length) {
  24526. return -1;
  24527. }
  24528. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24529. if (index < 0) {
  24530. index = nativeMax(length + index, 0);
  24531. }
  24532. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24533. }
  24534. /**
  24535. * This method is like `_.findIndex` except that it iterates over elements
  24536. * of `collection` from right to left.
  24537. *
  24538. * @static
  24539. * @memberOf _
  24540. * @since 2.0.0
  24541. * @category Array
  24542. * @param {Array} array The array to inspect.
  24543. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24544. * @param {number} [fromIndex=array.length-1] The index to search from.
  24545. * @returns {number} Returns the index of the found element, else `-1`.
  24546. * @example
  24547. *
  24548. * var users = [
  24549. * { 'user': 'barney', 'active': true },
  24550. * { 'user': 'fred', 'active': false },
  24551. * { 'user': 'pebbles', 'active': false }
  24552. * ];
  24553. *
  24554. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24555. * // => 2
  24556. *
  24557. * // The `_.matches` iteratee shorthand.
  24558. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24559. * // => 0
  24560. *
  24561. * // The `_.matchesProperty` iteratee shorthand.
  24562. * _.findLastIndex(users, ['active', false]);
  24563. * // => 2
  24564. *
  24565. * // The `_.property` iteratee shorthand.
  24566. * _.findLastIndex(users, 'active');
  24567. * // => 0
  24568. */
  24569. function findLastIndex(array, predicate, fromIndex) {
  24570. var length = array == null ? 0 : array.length;
  24571. if (!length) {
  24572. return -1;
  24573. }
  24574. var index = length - 1;
  24575. if (fromIndex !== undefined) {
  24576. index = toInteger(fromIndex);
  24577. index = fromIndex < 0
  24578. ? nativeMax(length + index, 0)
  24579. : nativeMin(index, length - 1);
  24580. }
  24581. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24582. }
  24583. /**
  24584. * Flattens `array` a single level deep.
  24585. *
  24586. * @static
  24587. * @memberOf _
  24588. * @since 0.1.0
  24589. * @category Array
  24590. * @param {Array} array The array to flatten.
  24591. * @returns {Array} Returns the new flattened array.
  24592. * @example
  24593. *
  24594. * _.flatten([1, [2, [3, [4]], 5]]);
  24595. * // => [1, 2, [3, [4]], 5]
  24596. */
  24597. function flatten(array) {
  24598. var length = array == null ? 0 : array.length;
  24599. return length ? baseFlatten(array, 1) : [];
  24600. }
  24601. /**
  24602. * Recursively flattens `array`.
  24603. *
  24604. * @static
  24605. * @memberOf _
  24606. * @since 3.0.0
  24607. * @category Array
  24608. * @param {Array} array The array to flatten.
  24609. * @returns {Array} Returns the new flattened array.
  24610. * @example
  24611. *
  24612. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24613. * // => [1, 2, 3, 4, 5]
  24614. */
  24615. function flattenDeep(array) {
  24616. var length = array == null ? 0 : array.length;
  24617. return length ? baseFlatten(array, INFINITY) : [];
  24618. }
  24619. /**
  24620. * Recursively flatten `array` up to `depth` times.
  24621. *
  24622. * @static
  24623. * @memberOf _
  24624. * @since 4.4.0
  24625. * @category Array
  24626. * @param {Array} array The array to flatten.
  24627. * @param {number} [depth=1] The maximum recursion depth.
  24628. * @returns {Array} Returns the new flattened array.
  24629. * @example
  24630. *
  24631. * var array = [1, [2, [3, [4]], 5]];
  24632. *
  24633. * _.flattenDepth(array, 1);
  24634. * // => [1, 2, [3, [4]], 5]
  24635. *
  24636. * _.flattenDepth(array, 2);
  24637. * // => [1, 2, 3, [4], 5]
  24638. */
  24639. function flattenDepth(array, depth) {
  24640. var length = array == null ? 0 : array.length;
  24641. if (!length) {
  24642. return [];
  24643. }
  24644. depth = depth === undefined ? 1 : toInteger(depth);
  24645. return baseFlatten(array, depth);
  24646. }
  24647. /**
  24648. * The inverse of `_.toPairs`; this method returns an object composed
  24649. * from key-value `pairs`.
  24650. *
  24651. * @static
  24652. * @memberOf _
  24653. * @since 4.0.0
  24654. * @category Array
  24655. * @param {Array} pairs The key-value pairs.
  24656. * @returns {Object} Returns the new object.
  24657. * @example
  24658. *
  24659. * _.fromPairs([['a', 1], ['b', 2]]);
  24660. * // => { 'a': 1, 'b': 2 }
  24661. */
  24662. function fromPairs(pairs) {
  24663. var index = -1,
  24664. length = pairs == null ? 0 : pairs.length,
  24665. result = {};
  24666. while (++index < length) {
  24667. var pair = pairs[index];
  24668. result[pair[0]] = pair[1];
  24669. }
  24670. return result;
  24671. }
  24672. /**
  24673. * Gets the first element of `array`.
  24674. *
  24675. * @static
  24676. * @memberOf _
  24677. * @since 0.1.0
  24678. * @alias first
  24679. * @category Array
  24680. * @param {Array} array The array to query.
  24681. * @returns {*} Returns the first element of `array`.
  24682. * @example
  24683. *
  24684. * _.head([1, 2, 3]);
  24685. * // => 1
  24686. *
  24687. * _.head([]);
  24688. * // => undefined
  24689. */
  24690. function head(array) {
  24691. return (array && array.length) ? array[0] : undefined;
  24692. }
  24693. /**
  24694. * Gets the index at which the first occurrence of `value` is found in `array`
  24695. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24696. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24697. * offset from the end of `array`.
  24698. *
  24699. * @static
  24700. * @memberOf _
  24701. * @since 0.1.0
  24702. * @category Array
  24703. * @param {Array} array The array to inspect.
  24704. * @param {*} value The value to search for.
  24705. * @param {number} [fromIndex=0] The index to search from.
  24706. * @returns {number} Returns the index of the matched value, else `-1`.
  24707. * @example
  24708. *
  24709. * _.indexOf([1, 2, 1, 2], 2);
  24710. * // => 1
  24711. *
  24712. * // Search from the `fromIndex`.
  24713. * _.indexOf([1, 2, 1, 2], 2, 2);
  24714. * // => 3
  24715. */
  24716. function indexOf(array, value, fromIndex) {
  24717. var length = array == null ? 0 : array.length;
  24718. if (!length) {
  24719. return -1;
  24720. }
  24721. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24722. if (index < 0) {
  24723. index = nativeMax(length + index, 0);
  24724. }
  24725. return baseIndexOf(array, value, index);
  24726. }
  24727. /**
  24728. * Gets all but the last element of `array`.
  24729. *
  24730. * @static
  24731. * @memberOf _
  24732. * @since 0.1.0
  24733. * @category Array
  24734. * @param {Array} array The array to query.
  24735. * @returns {Array} Returns the slice of `array`.
  24736. * @example
  24737. *
  24738. * _.initial([1, 2, 3]);
  24739. * // => [1, 2]
  24740. */
  24741. function initial(array) {
  24742. var length = array == null ? 0 : array.length;
  24743. return length ? baseSlice(array, 0, -1) : [];
  24744. }
  24745. /**
  24746. * Creates an array of unique values that are included in all given arrays
  24747. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24748. * for equality comparisons. The order and references of result values are
  24749. * determined by the first array.
  24750. *
  24751. * @static
  24752. * @memberOf _
  24753. * @since 0.1.0
  24754. * @category Array
  24755. * @param {...Array} [arrays] The arrays to inspect.
  24756. * @returns {Array} Returns the new array of intersecting values.
  24757. * @example
  24758. *
  24759. * _.intersection([2, 1], [2, 3]);
  24760. * // => [2]
  24761. */
  24762. var intersection = baseRest(function(arrays) {
  24763. var mapped = arrayMap(arrays, castArrayLikeObject);
  24764. return (mapped.length && mapped[0] === arrays[0])
  24765. ? baseIntersection(mapped)
  24766. : [];
  24767. });
  24768. /**
  24769. * This method is like `_.intersection` except that it accepts `iteratee`
  24770. * which is invoked for each element of each `arrays` to generate the criterion
  24771. * by which they're compared. The order and references of result values are
  24772. * determined by the first array. The iteratee is invoked with one argument:
  24773. * (value).
  24774. *
  24775. * @static
  24776. * @memberOf _
  24777. * @since 4.0.0
  24778. * @category Array
  24779. * @param {...Array} [arrays] The arrays to inspect.
  24780. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24781. * @returns {Array} Returns the new array of intersecting values.
  24782. * @example
  24783. *
  24784. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24785. * // => [2.1]
  24786. *
  24787. * // The `_.property` iteratee shorthand.
  24788. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24789. * // => [{ 'x': 1 }]
  24790. */
  24791. var intersectionBy = baseRest(function(arrays) {
  24792. var iteratee = last(arrays),
  24793. mapped = arrayMap(arrays, castArrayLikeObject);
  24794. if (iteratee === last(mapped)) {
  24795. iteratee = undefined;
  24796. } else {
  24797. mapped.pop();
  24798. }
  24799. return (mapped.length && mapped[0] === arrays[0])
  24800. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24801. : [];
  24802. });
  24803. /**
  24804. * This method is like `_.intersection` except that it accepts `comparator`
  24805. * which is invoked to compare elements of `arrays`. The order and references
  24806. * of result values are determined by the first array. The comparator is
  24807. * invoked with two arguments: (arrVal, othVal).
  24808. *
  24809. * @static
  24810. * @memberOf _
  24811. * @since 4.0.0
  24812. * @category Array
  24813. * @param {...Array} [arrays] The arrays to inspect.
  24814. * @param {Function} [comparator] The comparator invoked per element.
  24815. * @returns {Array} Returns the new array of intersecting values.
  24816. * @example
  24817. *
  24818. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24819. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24820. *
  24821. * _.intersectionWith(objects, others, _.isEqual);
  24822. * // => [{ 'x': 1, 'y': 2 }]
  24823. */
  24824. var intersectionWith = baseRest(function(arrays) {
  24825. var comparator = last(arrays),
  24826. mapped = arrayMap(arrays, castArrayLikeObject);
  24827. comparator = typeof comparator == 'function' ? comparator : undefined;
  24828. if (comparator) {
  24829. mapped.pop();
  24830. }
  24831. return (mapped.length && mapped[0] === arrays[0])
  24832. ? baseIntersection(mapped, undefined, comparator)
  24833. : [];
  24834. });
  24835. /**
  24836. * Converts all elements in `array` into a string separated by `separator`.
  24837. *
  24838. * @static
  24839. * @memberOf _
  24840. * @since 4.0.0
  24841. * @category Array
  24842. * @param {Array} array The array to convert.
  24843. * @param {string} [separator=','] The element separator.
  24844. * @returns {string} Returns the joined string.
  24845. * @example
  24846. *
  24847. * _.join(['a', 'b', 'c'], '~');
  24848. * // => 'a~b~c'
  24849. */
  24850. function join(array, separator) {
  24851. return array == null ? '' : nativeJoin.call(array, separator);
  24852. }
  24853. /**
  24854. * Gets the last element of `array`.
  24855. *
  24856. * @static
  24857. * @memberOf _
  24858. * @since 0.1.0
  24859. * @category Array
  24860. * @param {Array} array The array to query.
  24861. * @returns {*} Returns the last element of `array`.
  24862. * @example
  24863. *
  24864. * _.last([1, 2, 3]);
  24865. * // => 3
  24866. */
  24867. function last(array) {
  24868. var length = array == null ? 0 : array.length;
  24869. return length ? array[length - 1] : undefined;
  24870. }
  24871. /**
  24872. * This method is like `_.indexOf` except that it iterates over elements of
  24873. * `array` from right to left.
  24874. *
  24875. * @static
  24876. * @memberOf _
  24877. * @since 0.1.0
  24878. * @category Array
  24879. * @param {Array} array The array to inspect.
  24880. * @param {*} value The value to search for.
  24881. * @param {number} [fromIndex=array.length-1] The index to search from.
  24882. * @returns {number} Returns the index of the matched value, else `-1`.
  24883. * @example
  24884. *
  24885. * _.lastIndexOf([1, 2, 1, 2], 2);
  24886. * // => 3
  24887. *
  24888. * // Search from the `fromIndex`.
  24889. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24890. * // => 1
  24891. */
  24892. function lastIndexOf(array, value, fromIndex) {
  24893. var length = array == null ? 0 : array.length;
  24894. if (!length) {
  24895. return -1;
  24896. }
  24897. var index = length;
  24898. if (fromIndex !== undefined) {
  24899. index = toInteger(fromIndex);
  24900. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24901. }
  24902. return value === value
  24903. ? strictLastIndexOf(array, value, index)
  24904. : baseFindIndex(array, baseIsNaN, index, true);
  24905. }
  24906. /**
  24907. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24908. * element from the end is returned.
  24909. *
  24910. * @static
  24911. * @memberOf _
  24912. * @since 4.11.0
  24913. * @category Array
  24914. * @param {Array} array The array to query.
  24915. * @param {number} [n=0] The index of the element to return.
  24916. * @returns {*} Returns the nth element of `array`.
  24917. * @example
  24918. *
  24919. * var array = ['a', 'b', 'c', 'd'];
  24920. *
  24921. * _.nth(array, 1);
  24922. * // => 'b'
  24923. *
  24924. * _.nth(array, -2);
  24925. * // => 'c';
  24926. */
  24927. function nth(array, n) {
  24928. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24929. }
  24930. /**
  24931. * Removes all given values from `array` using
  24932. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24933. * for equality comparisons.
  24934. *
  24935. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24936. * to remove elements from an array by predicate.
  24937. *
  24938. * @static
  24939. * @memberOf _
  24940. * @since 2.0.0
  24941. * @category Array
  24942. * @param {Array} array The array to modify.
  24943. * @param {...*} [values] The values to remove.
  24944. * @returns {Array} Returns `array`.
  24945. * @example
  24946. *
  24947. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24948. *
  24949. * _.pull(array, 'a', 'c');
  24950. * console.log(array);
  24951. * // => ['b', 'b']
  24952. */
  24953. var pull = baseRest(pullAll);
  24954. /**
  24955. * This method is like `_.pull` except that it accepts an array of values to remove.
  24956. *
  24957. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24958. *
  24959. * @static
  24960. * @memberOf _
  24961. * @since 4.0.0
  24962. * @category Array
  24963. * @param {Array} array The array to modify.
  24964. * @param {Array} values The values to remove.
  24965. * @returns {Array} Returns `array`.
  24966. * @example
  24967. *
  24968. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24969. *
  24970. * _.pullAll(array, ['a', 'c']);
  24971. * console.log(array);
  24972. * // => ['b', 'b']
  24973. */
  24974. function pullAll(array, values) {
  24975. return (array && array.length && values && values.length)
  24976. ? basePullAll(array, values)
  24977. : array;
  24978. }
  24979. /**
  24980. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24981. * invoked for each element of `array` and `values` to generate the criterion
  24982. * by which they're compared. The iteratee is invoked with one argument: (value).
  24983. *
  24984. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24985. *
  24986. * @static
  24987. * @memberOf _
  24988. * @since 4.0.0
  24989. * @category Array
  24990. * @param {Array} array The array to modify.
  24991. * @param {Array} values The values to remove.
  24992. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24993. * @returns {Array} Returns `array`.
  24994. * @example
  24995. *
  24996. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  24997. *
  24998. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  24999. * console.log(array);
  25000. * // => [{ 'x': 2 }]
  25001. */
  25002. function pullAllBy(array, values, iteratee) {
  25003. return (array && array.length && values && values.length)
  25004. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25005. : array;
  25006. }
  25007. /**
  25008. * This method is like `_.pullAll` except that it accepts `comparator` which
  25009. * is invoked to compare elements of `array` to `values`. The comparator is
  25010. * invoked with two arguments: (arrVal, othVal).
  25011. *
  25012. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25013. *
  25014. * @static
  25015. * @memberOf _
  25016. * @since 4.6.0
  25017. * @category Array
  25018. * @param {Array} array The array to modify.
  25019. * @param {Array} values The values to remove.
  25020. * @param {Function} [comparator] The comparator invoked per element.
  25021. * @returns {Array} Returns `array`.
  25022. * @example
  25023. *
  25024. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25025. *
  25026. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25027. * console.log(array);
  25028. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25029. */
  25030. function pullAllWith(array, values, comparator) {
  25031. return (array && array.length && values && values.length)
  25032. ? basePullAll(array, values, undefined, comparator)
  25033. : array;
  25034. }
  25035. /**
  25036. * Removes elements from `array` corresponding to `indexes` and returns an
  25037. * array of removed elements.
  25038. *
  25039. * **Note:** Unlike `_.at`, this method mutates `array`.
  25040. *
  25041. * @static
  25042. * @memberOf _
  25043. * @since 3.0.0
  25044. * @category Array
  25045. * @param {Array} array The array to modify.
  25046. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25047. * @returns {Array} Returns the new array of removed elements.
  25048. * @example
  25049. *
  25050. * var array = ['a', 'b', 'c', 'd'];
  25051. * var pulled = _.pullAt(array, [1, 3]);
  25052. *
  25053. * console.log(array);
  25054. * // => ['a', 'c']
  25055. *
  25056. * console.log(pulled);
  25057. * // => ['b', 'd']
  25058. */
  25059. var pullAt = flatRest(function(array, indexes) {
  25060. var length = array == null ? 0 : array.length,
  25061. result = baseAt(array, indexes);
  25062. basePullAt(array, arrayMap(indexes, function(index) {
  25063. return isIndex(index, length) ? +index : index;
  25064. }).sort(compareAscending));
  25065. return result;
  25066. });
  25067. /**
  25068. * Removes all elements from `array` that `predicate` returns truthy for
  25069. * and returns an array of the removed elements. The predicate is invoked
  25070. * with three arguments: (value, index, array).
  25071. *
  25072. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25073. * to pull elements from an array by value.
  25074. *
  25075. * @static
  25076. * @memberOf _
  25077. * @since 2.0.0
  25078. * @category Array
  25079. * @param {Array} array The array to modify.
  25080. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25081. * @returns {Array} Returns the new array of removed elements.
  25082. * @example
  25083. *
  25084. * var array = [1, 2, 3, 4];
  25085. * var evens = _.remove(array, function(n) {
  25086. * return n % 2 == 0;
  25087. * });
  25088. *
  25089. * console.log(array);
  25090. * // => [1, 3]
  25091. *
  25092. * console.log(evens);
  25093. * // => [2, 4]
  25094. */
  25095. function remove(array, predicate) {
  25096. var result = [];
  25097. if (!(array && array.length)) {
  25098. return result;
  25099. }
  25100. var index = -1,
  25101. indexes = [],
  25102. length = array.length;
  25103. predicate = getIteratee(predicate, 3);
  25104. while (++index < length) {
  25105. var value = array[index];
  25106. if (predicate(value, index, array)) {
  25107. result.push(value);
  25108. indexes.push(index);
  25109. }
  25110. }
  25111. basePullAt(array, indexes);
  25112. return result;
  25113. }
  25114. /**
  25115. * Reverses `array` so that the first element becomes the last, the second
  25116. * element becomes the second to last, and so on.
  25117. *
  25118. * **Note:** This method mutates `array` and is based on
  25119. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25120. *
  25121. * @static
  25122. * @memberOf _
  25123. * @since 4.0.0
  25124. * @category Array
  25125. * @param {Array} array The array to modify.
  25126. * @returns {Array} Returns `array`.
  25127. * @example
  25128. *
  25129. * var array = [1, 2, 3];
  25130. *
  25131. * _.reverse(array);
  25132. * // => [3, 2, 1]
  25133. *
  25134. * console.log(array);
  25135. * // => [3, 2, 1]
  25136. */
  25137. function reverse(array) {
  25138. return array == null ? array : nativeReverse.call(array);
  25139. }
  25140. /**
  25141. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25142. *
  25143. * **Note:** This method is used instead of
  25144. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25145. * returned.
  25146. *
  25147. * @static
  25148. * @memberOf _
  25149. * @since 3.0.0
  25150. * @category Array
  25151. * @param {Array} array The array to slice.
  25152. * @param {number} [start=0] The start position.
  25153. * @param {number} [end=array.length] The end position.
  25154. * @returns {Array} Returns the slice of `array`.
  25155. */
  25156. function slice(array, start, end) {
  25157. var length = array == null ? 0 : array.length;
  25158. if (!length) {
  25159. return [];
  25160. }
  25161. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25162. start = 0;
  25163. end = length;
  25164. }
  25165. else {
  25166. start = start == null ? 0 : toInteger(start);
  25167. end = end === undefined ? length : toInteger(end);
  25168. }
  25169. return baseSlice(array, start, end);
  25170. }
  25171. /**
  25172. * Uses a binary search to determine the lowest index at which `value`
  25173. * should be inserted into `array` in order to maintain its sort order.
  25174. *
  25175. * @static
  25176. * @memberOf _
  25177. * @since 0.1.0
  25178. * @category Array
  25179. * @param {Array} array The sorted array to inspect.
  25180. * @param {*} value The value to evaluate.
  25181. * @returns {number} Returns the index at which `value` should be inserted
  25182. * into `array`.
  25183. * @example
  25184. *
  25185. * _.sortedIndex([30, 50], 40);
  25186. * // => 1
  25187. */
  25188. function sortedIndex(array, value) {
  25189. return baseSortedIndex(array, value);
  25190. }
  25191. /**
  25192. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25193. * which is invoked for `value` and each element of `array` to compute their
  25194. * sort ranking. The iteratee is invoked with one argument: (value).
  25195. *
  25196. * @static
  25197. * @memberOf _
  25198. * @since 4.0.0
  25199. * @category Array
  25200. * @param {Array} array The sorted array to inspect.
  25201. * @param {*} value The value to evaluate.
  25202. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25203. * @returns {number} Returns the index at which `value` should be inserted
  25204. * into `array`.
  25205. * @example
  25206. *
  25207. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25208. *
  25209. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25210. * // => 0
  25211. *
  25212. * // The `_.property` iteratee shorthand.
  25213. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25214. * // => 0
  25215. */
  25216. function sortedIndexBy(array, value, iteratee) {
  25217. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25218. }
  25219. /**
  25220. * This method is like `_.indexOf` except that it performs a binary
  25221. * search on a sorted `array`.
  25222. *
  25223. * @static
  25224. * @memberOf _
  25225. * @since 4.0.0
  25226. * @category Array
  25227. * @param {Array} array The array to inspect.
  25228. * @param {*} value The value to search for.
  25229. * @returns {number} Returns the index of the matched value, else `-1`.
  25230. * @example
  25231. *
  25232. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25233. * // => 1
  25234. */
  25235. function sortedIndexOf(array, value) {
  25236. var length = array == null ? 0 : array.length;
  25237. if (length) {
  25238. var index = baseSortedIndex(array, value);
  25239. if (index < length && eq(array[index], value)) {
  25240. return index;
  25241. }
  25242. }
  25243. return -1;
  25244. }
  25245. /**
  25246. * This method is like `_.sortedIndex` except that it returns the highest
  25247. * index at which `value` should be inserted into `array` in order to
  25248. * maintain its sort order.
  25249. *
  25250. * @static
  25251. * @memberOf _
  25252. * @since 3.0.0
  25253. * @category Array
  25254. * @param {Array} array The sorted array to inspect.
  25255. * @param {*} value The value to evaluate.
  25256. * @returns {number} Returns the index at which `value` should be inserted
  25257. * into `array`.
  25258. * @example
  25259. *
  25260. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25261. * // => 4
  25262. */
  25263. function sortedLastIndex(array, value) {
  25264. return baseSortedIndex(array, value, true);
  25265. }
  25266. /**
  25267. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25268. * which is invoked for `value` and each element of `array` to compute their
  25269. * sort ranking. The iteratee is invoked with one argument: (value).
  25270. *
  25271. * @static
  25272. * @memberOf _
  25273. * @since 4.0.0
  25274. * @category Array
  25275. * @param {Array} array The sorted array to inspect.
  25276. * @param {*} value The value to evaluate.
  25277. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25278. * @returns {number} Returns the index at which `value` should be inserted
  25279. * into `array`.
  25280. * @example
  25281. *
  25282. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25283. *
  25284. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25285. * // => 1
  25286. *
  25287. * // The `_.property` iteratee shorthand.
  25288. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25289. * // => 1
  25290. */
  25291. function sortedLastIndexBy(array, value, iteratee) {
  25292. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25293. }
  25294. /**
  25295. * This method is like `_.lastIndexOf` except that it performs a binary
  25296. * search on a sorted `array`.
  25297. *
  25298. * @static
  25299. * @memberOf _
  25300. * @since 4.0.0
  25301. * @category Array
  25302. * @param {Array} array The array to inspect.
  25303. * @param {*} value The value to search for.
  25304. * @returns {number} Returns the index of the matched value, else `-1`.
  25305. * @example
  25306. *
  25307. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25308. * // => 3
  25309. */
  25310. function sortedLastIndexOf(array, value) {
  25311. var length = array == null ? 0 : array.length;
  25312. if (length) {
  25313. var index = baseSortedIndex(array, value, true) - 1;
  25314. if (eq(array[index], value)) {
  25315. return index;
  25316. }
  25317. }
  25318. return -1;
  25319. }
  25320. /**
  25321. * This method is like `_.uniq` except that it's designed and optimized
  25322. * for sorted arrays.
  25323. *
  25324. * @static
  25325. * @memberOf _
  25326. * @since 4.0.0
  25327. * @category Array
  25328. * @param {Array} array The array to inspect.
  25329. * @returns {Array} Returns the new duplicate free array.
  25330. * @example
  25331. *
  25332. * _.sortedUniq([1, 1, 2]);
  25333. * // => [1, 2]
  25334. */
  25335. function sortedUniq(array) {
  25336. return (array && array.length)
  25337. ? baseSortedUniq(array)
  25338. : [];
  25339. }
  25340. /**
  25341. * This method is like `_.uniqBy` except that it's designed and optimized
  25342. * for sorted arrays.
  25343. *
  25344. * @static
  25345. * @memberOf _
  25346. * @since 4.0.0
  25347. * @category Array
  25348. * @param {Array} array The array to inspect.
  25349. * @param {Function} [iteratee] The iteratee invoked per element.
  25350. * @returns {Array} Returns the new duplicate free array.
  25351. * @example
  25352. *
  25353. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25354. * // => [1.1, 2.3]
  25355. */
  25356. function sortedUniqBy(array, iteratee) {
  25357. return (array && array.length)
  25358. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25359. : [];
  25360. }
  25361. /**
  25362. * Gets all but the first element of `array`.
  25363. *
  25364. * @static
  25365. * @memberOf _
  25366. * @since 4.0.0
  25367. * @category Array
  25368. * @param {Array} array The array to query.
  25369. * @returns {Array} Returns the slice of `array`.
  25370. * @example
  25371. *
  25372. * _.tail([1, 2, 3]);
  25373. * // => [2, 3]
  25374. */
  25375. function tail(array) {
  25376. var length = array == null ? 0 : array.length;
  25377. return length ? baseSlice(array, 1, length) : [];
  25378. }
  25379. /**
  25380. * Creates a slice of `array` with `n` elements taken from the beginning.
  25381. *
  25382. * @static
  25383. * @memberOf _
  25384. * @since 0.1.0
  25385. * @category Array
  25386. * @param {Array} array The array to query.
  25387. * @param {number} [n=1] The number of elements to take.
  25388. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25389. * @returns {Array} Returns the slice of `array`.
  25390. * @example
  25391. *
  25392. * _.take([1, 2, 3]);
  25393. * // => [1]
  25394. *
  25395. * _.take([1, 2, 3], 2);
  25396. * // => [1, 2]
  25397. *
  25398. * _.take([1, 2, 3], 5);
  25399. * // => [1, 2, 3]
  25400. *
  25401. * _.take([1, 2, 3], 0);
  25402. * // => []
  25403. */
  25404. function take(array, n, guard) {
  25405. if (!(array && array.length)) {
  25406. return [];
  25407. }
  25408. n = (guard || n === undefined) ? 1 : toInteger(n);
  25409. return baseSlice(array, 0, n < 0 ? 0 : n);
  25410. }
  25411. /**
  25412. * Creates a slice of `array` with `n` elements taken from the end.
  25413. *
  25414. * @static
  25415. * @memberOf _
  25416. * @since 3.0.0
  25417. * @category Array
  25418. * @param {Array} array The array to query.
  25419. * @param {number} [n=1] The number of elements to take.
  25420. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25421. * @returns {Array} Returns the slice of `array`.
  25422. * @example
  25423. *
  25424. * _.takeRight([1, 2, 3]);
  25425. * // => [3]
  25426. *
  25427. * _.takeRight([1, 2, 3], 2);
  25428. * // => [2, 3]
  25429. *
  25430. * _.takeRight([1, 2, 3], 5);
  25431. * // => [1, 2, 3]
  25432. *
  25433. * _.takeRight([1, 2, 3], 0);
  25434. * // => []
  25435. */
  25436. function takeRight(array, n, guard) {
  25437. var length = array == null ? 0 : array.length;
  25438. if (!length) {
  25439. return [];
  25440. }
  25441. n = (guard || n === undefined) ? 1 : toInteger(n);
  25442. n = length - n;
  25443. return baseSlice(array, n < 0 ? 0 : n, length);
  25444. }
  25445. /**
  25446. * Creates a slice of `array` with elements taken from the end. Elements are
  25447. * taken until `predicate` returns falsey. The predicate is invoked with
  25448. * three arguments: (value, index, array).
  25449. *
  25450. * @static
  25451. * @memberOf _
  25452. * @since 3.0.0
  25453. * @category Array
  25454. * @param {Array} array The array to query.
  25455. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25456. * @returns {Array} Returns the slice of `array`.
  25457. * @example
  25458. *
  25459. * var users = [
  25460. * { 'user': 'barney', 'active': true },
  25461. * { 'user': 'fred', 'active': false },
  25462. * { 'user': 'pebbles', 'active': false }
  25463. * ];
  25464. *
  25465. * _.takeRightWhile(users, function(o) { return !o.active; });
  25466. * // => objects for ['fred', 'pebbles']
  25467. *
  25468. * // The `_.matches` iteratee shorthand.
  25469. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25470. * // => objects for ['pebbles']
  25471. *
  25472. * // The `_.matchesProperty` iteratee shorthand.
  25473. * _.takeRightWhile(users, ['active', false]);
  25474. * // => objects for ['fred', 'pebbles']
  25475. *
  25476. * // The `_.property` iteratee shorthand.
  25477. * _.takeRightWhile(users, 'active');
  25478. * // => []
  25479. */
  25480. function takeRightWhile(array, predicate) {
  25481. return (array && array.length)
  25482. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25483. : [];
  25484. }
  25485. /**
  25486. * Creates a slice of `array` with elements taken from the beginning. Elements
  25487. * are taken until `predicate` returns falsey. The predicate is invoked with
  25488. * three arguments: (value, index, array).
  25489. *
  25490. * @static
  25491. * @memberOf _
  25492. * @since 3.0.0
  25493. * @category Array
  25494. * @param {Array} array The array to query.
  25495. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25496. * @returns {Array} Returns the slice of `array`.
  25497. * @example
  25498. *
  25499. * var users = [
  25500. * { 'user': 'barney', 'active': false },
  25501. * { 'user': 'fred', 'active': false },
  25502. * { 'user': 'pebbles', 'active': true }
  25503. * ];
  25504. *
  25505. * _.takeWhile(users, function(o) { return !o.active; });
  25506. * // => objects for ['barney', 'fred']
  25507. *
  25508. * // The `_.matches` iteratee shorthand.
  25509. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25510. * // => objects for ['barney']
  25511. *
  25512. * // The `_.matchesProperty` iteratee shorthand.
  25513. * _.takeWhile(users, ['active', false]);
  25514. * // => objects for ['barney', 'fred']
  25515. *
  25516. * // The `_.property` iteratee shorthand.
  25517. * _.takeWhile(users, 'active');
  25518. * // => []
  25519. */
  25520. function takeWhile(array, predicate) {
  25521. return (array && array.length)
  25522. ? baseWhile(array, getIteratee(predicate, 3))
  25523. : [];
  25524. }
  25525. /**
  25526. * Creates an array of unique values, in order, from all given arrays using
  25527. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25528. * for equality comparisons.
  25529. *
  25530. * @static
  25531. * @memberOf _
  25532. * @since 0.1.0
  25533. * @category Array
  25534. * @param {...Array} [arrays] The arrays to inspect.
  25535. * @returns {Array} Returns the new array of combined values.
  25536. * @example
  25537. *
  25538. * _.union([2], [1, 2]);
  25539. * // => [2, 1]
  25540. */
  25541. var union = baseRest(function(arrays) {
  25542. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25543. });
  25544. /**
  25545. * This method is like `_.union` except that it accepts `iteratee` which is
  25546. * invoked for each element of each `arrays` to generate the criterion by
  25547. * which uniqueness is computed. Result values are chosen from the first
  25548. * array in which the value occurs. The iteratee is invoked with one argument:
  25549. * (value).
  25550. *
  25551. * @static
  25552. * @memberOf _
  25553. * @since 4.0.0
  25554. * @category Array
  25555. * @param {...Array} [arrays] The arrays to inspect.
  25556. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25557. * @returns {Array} Returns the new array of combined values.
  25558. * @example
  25559. *
  25560. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25561. * // => [2.1, 1.2]
  25562. *
  25563. * // The `_.property` iteratee shorthand.
  25564. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25565. * // => [{ 'x': 1 }, { 'x': 2 }]
  25566. */
  25567. var unionBy = baseRest(function(arrays) {
  25568. var iteratee = last(arrays);
  25569. if (isArrayLikeObject(iteratee)) {
  25570. iteratee = undefined;
  25571. }
  25572. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25573. });
  25574. /**
  25575. * This method is like `_.union` except that it accepts `comparator` which
  25576. * is invoked to compare elements of `arrays`. Result values are chosen from
  25577. * the first array in which the value occurs. The comparator is invoked
  25578. * with two arguments: (arrVal, othVal).
  25579. *
  25580. * @static
  25581. * @memberOf _
  25582. * @since 4.0.0
  25583. * @category Array
  25584. * @param {...Array} [arrays] The arrays to inspect.
  25585. * @param {Function} [comparator] The comparator invoked per element.
  25586. * @returns {Array} Returns the new array of combined values.
  25587. * @example
  25588. *
  25589. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25590. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25591. *
  25592. * _.unionWith(objects, others, _.isEqual);
  25593. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25594. */
  25595. var unionWith = baseRest(function(arrays) {
  25596. var comparator = last(arrays);
  25597. comparator = typeof comparator == 'function' ? comparator : undefined;
  25598. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25599. });
  25600. /**
  25601. * Creates a duplicate-free version of an array, using
  25602. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25603. * for equality comparisons, in which only the first occurrence of each element
  25604. * is kept. The order of result values is determined by the order they occur
  25605. * in the array.
  25606. *
  25607. * @static
  25608. * @memberOf _
  25609. * @since 0.1.0
  25610. * @category Array
  25611. * @param {Array} array The array to inspect.
  25612. * @returns {Array} Returns the new duplicate free array.
  25613. * @example
  25614. *
  25615. * _.uniq([2, 1, 2]);
  25616. * // => [2, 1]
  25617. */
  25618. function uniq(array) {
  25619. return (array && array.length) ? baseUniq(array) : [];
  25620. }
  25621. /**
  25622. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25623. * invoked for each element in `array` to generate the criterion by which
  25624. * uniqueness is computed. The order of result values is determined by the
  25625. * order they occur in the array. The iteratee is invoked with one argument:
  25626. * (value).
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 4.0.0
  25631. * @category Array
  25632. * @param {Array} array The array to inspect.
  25633. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25634. * @returns {Array} Returns the new duplicate free array.
  25635. * @example
  25636. *
  25637. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25638. * // => [2.1, 1.2]
  25639. *
  25640. * // The `_.property` iteratee shorthand.
  25641. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25642. * // => [{ 'x': 1 }, { 'x': 2 }]
  25643. */
  25644. function uniqBy(array, iteratee) {
  25645. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25646. }
  25647. /**
  25648. * This method is like `_.uniq` except that it accepts `comparator` which
  25649. * is invoked to compare elements of `array`. The order of result values is
  25650. * determined by the order they occur in the array.The comparator is invoked
  25651. * with two arguments: (arrVal, othVal).
  25652. *
  25653. * @static
  25654. * @memberOf _
  25655. * @since 4.0.0
  25656. * @category Array
  25657. * @param {Array} array The array to inspect.
  25658. * @param {Function} [comparator] The comparator invoked per element.
  25659. * @returns {Array} Returns the new duplicate free array.
  25660. * @example
  25661. *
  25662. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25663. *
  25664. * _.uniqWith(objects, _.isEqual);
  25665. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25666. */
  25667. function uniqWith(array, comparator) {
  25668. comparator = typeof comparator == 'function' ? comparator : undefined;
  25669. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25670. }
  25671. /**
  25672. * This method is like `_.zip` except that it accepts an array of grouped
  25673. * elements and creates an array regrouping the elements to their pre-zip
  25674. * configuration.
  25675. *
  25676. * @static
  25677. * @memberOf _
  25678. * @since 1.2.0
  25679. * @category Array
  25680. * @param {Array} array The array of grouped elements to process.
  25681. * @returns {Array} Returns the new array of regrouped elements.
  25682. * @example
  25683. *
  25684. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25685. * // => [['a', 1, true], ['b', 2, false]]
  25686. *
  25687. * _.unzip(zipped);
  25688. * // => [['a', 'b'], [1, 2], [true, false]]
  25689. */
  25690. function unzip(array) {
  25691. if (!(array && array.length)) {
  25692. return [];
  25693. }
  25694. var length = 0;
  25695. array = arrayFilter(array, function(group) {
  25696. if (isArrayLikeObject(group)) {
  25697. length = nativeMax(group.length, length);
  25698. return true;
  25699. }
  25700. });
  25701. return baseTimes(length, function(index) {
  25702. return arrayMap(array, baseProperty(index));
  25703. });
  25704. }
  25705. /**
  25706. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25707. * how regrouped values should be combined. The iteratee is invoked with the
  25708. * elements of each group: (...group).
  25709. *
  25710. * @static
  25711. * @memberOf _
  25712. * @since 3.8.0
  25713. * @category Array
  25714. * @param {Array} array The array of grouped elements to process.
  25715. * @param {Function} [iteratee=_.identity] The function to combine
  25716. * regrouped values.
  25717. * @returns {Array} Returns the new array of regrouped elements.
  25718. * @example
  25719. *
  25720. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25721. * // => [[1, 10, 100], [2, 20, 200]]
  25722. *
  25723. * _.unzipWith(zipped, _.add);
  25724. * // => [3, 30, 300]
  25725. */
  25726. function unzipWith(array, iteratee) {
  25727. if (!(array && array.length)) {
  25728. return [];
  25729. }
  25730. var result = unzip(array);
  25731. if (iteratee == null) {
  25732. return result;
  25733. }
  25734. return arrayMap(result, function(group) {
  25735. return apply(iteratee, undefined, group);
  25736. });
  25737. }
  25738. /**
  25739. * Creates an array excluding all given values using
  25740. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25741. * for equality comparisons.
  25742. *
  25743. * **Note:** Unlike `_.pull`, this method returns a new array.
  25744. *
  25745. * @static
  25746. * @memberOf _
  25747. * @since 0.1.0
  25748. * @category Array
  25749. * @param {Array} array The array to inspect.
  25750. * @param {...*} [values] The values to exclude.
  25751. * @returns {Array} Returns the new array of filtered values.
  25752. * @see _.difference, _.xor
  25753. * @example
  25754. *
  25755. * _.without([2, 1, 2, 3], 1, 2);
  25756. * // => [3]
  25757. */
  25758. var without = baseRest(function(array, values) {
  25759. return isArrayLikeObject(array)
  25760. ? baseDifference(array, values)
  25761. : [];
  25762. });
  25763. /**
  25764. * Creates an array of unique values that is the
  25765. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25766. * of the given arrays. The order of result values is determined by the order
  25767. * they occur in the arrays.
  25768. *
  25769. * @static
  25770. * @memberOf _
  25771. * @since 2.4.0
  25772. * @category Array
  25773. * @param {...Array} [arrays] The arrays to inspect.
  25774. * @returns {Array} Returns the new array of filtered values.
  25775. * @see _.difference, _.without
  25776. * @example
  25777. *
  25778. * _.xor([2, 1], [2, 3]);
  25779. * // => [1, 3]
  25780. */
  25781. var xor = baseRest(function(arrays) {
  25782. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25783. });
  25784. /**
  25785. * This method is like `_.xor` except that it accepts `iteratee` which is
  25786. * invoked for each element of each `arrays` to generate the criterion by
  25787. * which by which they're compared. The order of result values is determined
  25788. * by the order they occur in the arrays. The iteratee is invoked with one
  25789. * argument: (value).
  25790. *
  25791. * @static
  25792. * @memberOf _
  25793. * @since 4.0.0
  25794. * @category Array
  25795. * @param {...Array} [arrays] The arrays to inspect.
  25796. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25797. * @returns {Array} Returns the new array of filtered values.
  25798. * @example
  25799. *
  25800. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25801. * // => [1.2, 3.4]
  25802. *
  25803. * // The `_.property` iteratee shorthand.
  25804. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25805. * // => [{ 'x': 2 }]
  25806. */
  25807. var xorBy = baseRest(function(arrays) {
  25808. var iteratee = last(arrays);
  25809. if (isArrayLikeObject(iteratee)) {
  25810. iteratee = undefined;
  25811. }
  25812. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25813. });
  25814. /**
  25815. * This method is like `_.xor` except that it accepts `comparator` which is
  25816. * invoked to compare elements of `arrays`. The order of result values is
  25817. * determined by the order they occur in the arrays. The comparator is invoked
  25818. * with two arguments: (arrVal, othVal).
  25819. *
  25820. * @static
  25821. * @memberOf _
  25822. * @since 4.0.0
  25823. * @category Array
  25824. * @param {...Array} [arrays] The arrays to inspect.
  25825. * @param {Function} [comparator] The comparator invoked per element.
  25826. * @returns {Array} Returns the new array of filtered values.
  25827. * @example
  25828. *
  25829. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25830. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25831. *
  25832. * _.xorWith(objects, others, _.isEqual);
  25833. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25834. */
  25835. var xorWith = baseRest(function(arrays) {
  25836. var comparator = last(arrays);
  25837. comparator = typeof comparator == 'function' ? comparator : undefined;
  25838. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25839. });
  25840. /**
  25841. * Creates an array of grouped elements, the first of which contains the
  25842. * first elements of the given arrays, the second of which contains the
  25843. * second elements of the given arrays, and so on.
  25844. *
  25845. * @static
  25846. * @memberOf _
  25847. * @since 0.1.0
  25848. * @category Array
  25849. * @param {...Array} [arrays] The arrays to process.
  25850. * @returns {Array} Returns the new array of grouped elements.
  25851. * @example
  25852. *
  25853. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25854. * // => [['a', 1, true], ['b', 2, false]]
  25855. */
  25856. var zip = baseRest(unzip);
  25857. /**
  25858. * This method is like `_.fromPairs` except that it accepts two arrays,
  25859. * one of property identifiers and one of corresponding values.
  25860. *
  25861. * @static
  25862. * @memberOf _
  25863. * @since 0.4.0
  25864. * @category Array
  25865. * @param {Array} [props=[]] The property identifiers.
  25866. * @param {Array} [values=[]] The property values.
  25867. * @returns {Object} Returns the new object.
  25868. * @example
  25869. *
  25870. * _.zipObject(['a', 'b'], [1, 2]);
  25871. * // => { 'a': 1, 'b': 2 }
  25872. */
  25873. function zipObject(props, values) {
  25874. return baseZipObject(props || [], values || [], assignValue);
  25875. }
  25876. /**
  25877. * This method is like `_.zipObject` except that it supports property paths.
  25878. *
  25879. * @static
  25880. * @memberOf _
  25881. * @since 4.1.0
  25882. * @category Array
  25883. * @param {Array} [props=[]] The property identifiers.
  25884. * @param {Array} [values=[]] The property values.
  25885. * @returns {Object} Returns the new object.
  25886. * @example
  25887. *
  25888. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25889. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25890. */
  25891. function zipObjectDeep(props, values) {
  25892. return baseZipObject(props || [], values || [], baseSet);
  25893. }
  25894. /**
  25895. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25896. * how grouped values should be combined. The iteratee is invoked with the
  25897. * elements of each group: (...group).
  25898. *
  25899. * @static
  25900. * @memberOf _
  25901. * @since 3.8.0
  25902. * @category Array
  25903. * @param {...Array} [arrays] The arrays to process.
  25904. * @param {Function} [iteratee=_.identity] The function to combine
  25905. * grouped values.
  25906. * @returns {Array} Returns the new array of grouped elements.
  25907. * @example
  25908. *
  25909. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25910. * return a + b + c;
  25911. * });
  25912. * // => [111, 222]
  25913. */
  25914. var zipWith = baseRest(function(arrays) {
  25915. var length = arrays.length,
  25916. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25917. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25918. return unzipWith(arrays, iteratee);
  25919. });
  25920. /*------------------------------------------------------------------------*/
  25921. /**
  25922. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25923. * chain sequences enabled. The result of such sequences must be unwrapped
  25924. * with `_#value`.
  25925. *
  25926. * @static
  25927. * @memberOf _
  25928. * @since 1.3.0
  25929. * @category Seq
  25930. * @param {*} value The value to wrap.
  25931. * @returns {Object} Returns the new `lodash` wrapper instance.
  25932. * @example
  25933. *
  25934. * var users = [
  25935. * { 'user': 'barney', 'age': 36 },
  25936. * { 'user': 'fred', 'age': 40 },
  25937. * { 'user': 'pebbles', 'age': 1 }
  25938. * ];
  25939. *
  25940. * var youngest = _
  25941. * .chain(users)
  25942. * .sortBy('age')
  25943. * .map(function(o) {
  25944. * return o.user + ' is ' + o.age;
  25945. * })
  25946. * .head()
  25947. * .value();
  25948. * // => 'pebbles is 1'
  25949. */
  25950. function chain(value) {
  25951. var result = lodash(value);
  25952. result.__chain__ = true;
  25953. return result;
  25954. }
  25955. /**
  25956. * This method invokes `interceptor` and returns `value`. The interceptor
  25957. * is invoked with one argument; (value). The purpose of this method is to
  25958. * "tap into" a method chain sequence in order to modify intermediate results.
  25959. *
  25960. * @static
  25961. * @memberOf _
  25962. * @since 0.1.0
  25963. * @category Seq
  25964. * @param {*} value The value to provide to `interceptor`.
  25965. * @param {Function} interceptor The function to invoke.
  25966. * @returns {*} Returns `value`.
  25967. * @example
  25968. *
  25969. * _([1, 2, 3])
  25970. * .tap(function(array) {
  25971. * // Mutate input array.
  25972. * array.pop();
  25973. * })
  25974. * .reverse()
  25975. * .value();
  25976. * // => [2, 1]
  25977. */
  25978. function tap(value, interceptor) {
  25979. interceptor(value);
  25980. return value;
  25981. }
  25982. /**
  25983. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25984. * The purpose of this method is to "pass thru" values replacing intermediate
  25985. * results in a method chain sequence.
  25986. *
  25987. * @static
  25988. * @memberOf _
  25989. * @since 3.0.0
  25990. * @category Seq
  25991. * @param {*} value The value to provide to `interceptor`.
  25992. * @param {Function} interceptor The function to invoke.
  25993. * @returns {*} Returns the result of `interceptor`.
  25994. * @example
  25995. *
  25996. * _(' abc ')
  25997. * .chain()
  25998. * .trim()
  25999. * .thru(function(value) {
  26000. * return [value];
  26001. * })
  26002. * .value();
  26003. * // => ['abc']
  26004. */
  26005. function thru(value, interceptor) {
  26006. return interceptor(value);
  26007. }
  26008. /**
  26009. * This method is the wrapper version of `_.at`.
  26010. *
  26011. * @name at
  26012. * @memberOf _
  26013. * @since 1.0.0
  26014. * @category Seq
  26015. * @param {...(string|string[])} [paths] The property paths to pick.
  26016. * @returns {Object} Returns the new `lodash` wrapper instance.
  26017. * @example
  26018. *
  26019. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26020. *
  26021. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26022. * // => [3, 4]
  26023. */
  26024. var wrapperAt = flatRest(function(paths) {
  26025. var length = paths.length,
  26026. start = length ? paths[0] : 0,
  26027. value = this.__wrapped__,
  26028. interceptor = function(object) { return baseAt(object, paths); };
  26029. if (length > 1 || this.__actions__.length ||
  26030. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26031. return this.thru(interceptor);
  26032. }
  26033. value = value.slice(start, +start + (length ? 1 : 0));
  26034. value.__actions__.push({
  26035. 'func': thru,
  26036. 'args': [interceptor],
  26037. 'thisArg': undefined
  26038. });
  26039. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26040. if (length && !array.length) {
  26041. array.push(undefined);
  26042. }
  26043. return array;
  26044. });
  26045. });
  26046. /**
  26047. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26048. *
  26049. * @name chain
  26050. * @memberOf _
  26051. * @since 0.1.0
  26052. * @category Seq
  26053. * @returns {Object} Returns the new `lodash` wrapper instance.
  26054. * @example
  26055. *
  26056. * var users = [
  26057. * { 'user': 'barney', 'age': 36 },
  26058. * { 'user': 'fred', 'age': 40 }
  26059. * ];
  26060. *
  26061. * // A sequence without explicit chaining.
  26062. * _(users).head();
  26063. * // => { 'user': 'barney', 'age': 36 }
  26064. *
  26065. * // A sequence with explicit chaining.
  26066. * _(users)
  26067. * .chain()
  26068. * .head()
  26069. * .pick('user')
  26070. * .value();
  26071. * // => { 'user': 'barney' }
  26072. */
  26073. function wrapperChain() {
  26074. return chain(this);
  26075. }
  26076. /**
  26077. * Executes the chain sequence and returns the wrapped result.
  26078. *
  26079. * @name commit
  26080. * @memberOf _
  26081. * @since 3.2.0
  26082. * @category Seq
  26083. * @returns {Object} Returns the new `lodash` wrapper instance.
  26084. * @example
  26085. *
  26086. * var array = [1, 2];
  26087. * var wrapped = _(array).push(3);
  26088. *
  26089. * console.log(array);
  26090. * // => [1, 2]
  26091. *
  26092. * wrapped = wrapped.commit();
  26093. * console.log(array);
  26094. * // => [1, 2, 3]
  26095. *
  26096. * wrapped.last();
  26097. * // => 3
  26098. *
  26099. * console.log(array);
  26100. * // => [1, 2, 3]
  26101. */
  26102. function wrapperCommit() {
  26103. return new LodashWrapper(this.value(), this.__chain__);
  26104. }
  26105. /**
  26106. * Gets the next value on a wrapped object following the
  26107. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26108. *
  26109. * @name next
  26110. * @memberOf _
  26111. * @since 4.0.0
  26112. * @category Seq
  26113. * @returns {Object} Returns the next iterator value.
  26114. * @example
  26115. *
  26116. * var wrapped = _([1, 2]);
  26117. *
  26118. * wrapped.next();
  26119. * // => { 'done': false, 'value': 1 }
  26120. *
  26121. * wrapped.next();
  26122. * // => { 'done': false, 'value': 2 }
  26123. *
  26124. * wrapped.next();
  26125. * // => { 'done': true, 'value': undefined }
  26126. */
  26127. function wrapperNext() {
  26128. if (this.__values__ === undefined) {
  26129. this.__values__ = toArray(this.value());
  26130. }
  26131. var done = this.__index__ >= this.__values__.length,
  26132. value = done ? undefined : this.__values__[this.__index__++];
  26133. return { 'done': done, 'value': value };
  26134. }
  26135. /**
  26136. * Enables the wrapper to be iterable.
  26137. *
  26138. * @name Symbol.iterator
  26139. * @memberOf _
  26140. * @since 4.0.0
  26141. * @category Seq
  26142. * @returns {Object} Returns the wrapper object.
  26143. * @example
  26144. *
  26145. * var wrapped = _([1, 2]);
  26146. *
  26147. * wrapped[Symbol.iterator]() === wrapped;
  26148. * // => true
  26149. *
  26150. * Array.from(wrapped);
  26151. * // => [1, 2]
  26152. */
  26153. function wrapperToIterator() {
  26154. return this;
  26155. }
  26156. /**
  26157. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26158. *
  26159. * @name plant
  26160. * @memberOf _
  26161. * @since 3.2.0
  26162. * @category Seq
  26163. * @param {*} value The value to plant.
  26164. * @returns {Object} Returns the new `lodash` wrapper instance.
  26165. * @example
  26166. *
  26167. * function square(n) {
  26168. * return n * n;
  26169. * }
  26170. *
  26171. * var wrapped = _([1, 2]).map(square);
  26172. * var other = wrapped.plant([3, 4]);
  26173. *
  26174. * other.value();
  26175. * // => [9, 16]
  26176. *
  26177. * wrapped.value();
  26178. * // => [1, 4]
  26179. */
  26180. function wrapperPlant(value) {
  26181. var result,
  26182. parent = this;
  26183. while (parent instanceof baseLodash) {
  26184. var clone = wrapperClone(parent);
  26185. clone.__index__ = 0;
  26186. clone.__values__ = undefined;
  26187. if (result) {
  26188. previous.__wrapped__ = clone;
  26189. } else {
  26190. result = clone;
  26191. }
  26192. var previous = clone;
  26193. parent = parent.__wrapped__;
  26194. }
  26195. previous.__wrapped__ = value;
  26196. return result;
  26197. }
  26198. /**
  26199. * This method is the wrapper version of `_.reverse`.
  26200. *
  26201. * **Note:** This method mutates the wrapped array.
  26202. *
  26203. * @name reverse
  26204. * @memberOf _
  26205. * @since 0.1.0
  26206. * @category Seq
  26207. * @returns {Object} Returns the new `lodash` wrapper instance.
  26208. * @example
  26209. *
  26210. * var array = [1, 2, 3];
  26211. *
  26212. * _(array).reverse().value()
  26213. * // => [3, 2, 1]
  26214. *
  26215. * console.log(array);
  26216. * // => [3, 2, 1]
  26217. */
  26218. function wrapperReverse() {
  26219. var value = this.__wrapped__;
  26220. if (value instanceof LazyWrapper) {
  26221. var wrapped = value;
  26222. if (this.__actions__.length) {
  26223. wrapped = new LazyWrapper(this);
  26224. }
  26225. wrapped = wrapped.reverse();
  26226. wrapped.__actions__.push({
  26227. 'func': thru,
  26228. 'args': [reverse],
  26229. 'thisArg': undefined
  26230. });
  26231. return new LodashWrapper(wrapped, this.__chain__);
  26232. }
  26233. return this.thru(reverse);
  26234. }
  26235. /**
  26236. * Executes the chain sequence to resolve the unwrapped value.
  26237. *
  26238. * @name value
  26239. * @memberOf _
  26240. * @since 0.1.0
  26241. * @alias toJSON, valueOf
  26242. * @category Seq
  26243. * @returns {*} Returns the resolved unwrapped value.
  26244. * @example
  26245. *
  26246. * _([1, 2, 3]).value();
  26247. * // => [1, 2, 3]
  26248. */
  26249. function wrapperValue() {
  26250. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26251. }
  26252. /*------------------------------------------------------------------------*/
  26253. /**
  26254. * Creates an object composed of keys generated from the results of running
  26255. * each element of `collection` thru `iteratee`. The corresponding value of
  26256. * each key is the number of times the key was returned by `iteratee`. The
  26257. * iteratee is invoked with one argument: (value).
  26258. *
  26259. * @static
  26260. * @memberOf _
  26261. * @since 0.5.0
  26262. * @category Collection
  26263. * @param {Array|Object} collection The collection to iterate over.
  26264. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26265. * @returns {Object} Returns the composed aggregate object.
  26266. * @example
  26267. *
  26268. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26269. * // => { '4': 1, '6': 2 }
  26270. *
  26271. * // The `_.property` iteratee shorthand.
  26272. * _.countBy(['one', 'two', 'three'], 'length');
  26273. * // => { '3': 2, '5': 1 }
  26274. */
  26275. var countBy = createAggregator(function(result, value, key) {
  26276. if (hasOwnProperty.call(result, key)) {
  26277. ++result[key];
  26278. } else {
  26279. baseAssignValue(result, key, 1);
  26280. }
  26281. });
  26282. /**
  26283. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26284. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26285. * invoked with three arguments: (value, index|key, collection).
  26286. *
  26287. * **Note:** This method returns `true` for
  26288. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26289. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26290. * elements of empty collections.
  26291. *
  26292. * @static
  26293. * @memberOf _
  26294. * @since 0.1.0
  26295. * @category Collection
  26296. * @param {Array|Object} collection The collection to iterate over.
  26297. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26298. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26299. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26300. * else `false`.
  26301. * @example
  26302. *
  26303. * _.every([true, 1, null, 'yes'], Boolean);
  26304. * // => false
  26305. *
  26306. * var users = [
  26307. * { 'user': 'barney', 'age': 36, 'active': false },
  26308. * { 'user': 'fred', 'age': 40, 'active': false }
  26309. * ];
  26310. *
  26311. * // The `_.matches` iteratee shorthand.
  26312. * _.every(users, { 'user': 'barney', 'active': false });
  26313. * // => false
  26314. *
  26315. * // The `_.matchesProperty` iteratee shorthand.
  26316. * _.every(users, ['active', false]);
  26317. * // => true
  26318. *
  26319. * // The `_.property` iteratee shorthand.
  26320. * _.every(users, 'active');
  26321. * // => false
  26322. */
  26323. function every(collection, predicate, guard) {
  26324. var func = isArray(collection) ? arrayEvery : baseEvery;
  26325. if (guard && isIterateeCall(collection, predicate, guard)) {
  26326. predicate = undefined;
  26327. }
  26328. return func(collection, getIteratee(predicate, 3));
  26329. }
  26330. /**
  26331. * Iterates over elements of `collection`, returning an array of all elements
  26332. * `predicate` returns truthy for. The predicate is invoked with three
  26333. * arguments: (value, index|key, collection).
  26334. *
  26335. * **Note:** Unlike `_.remove`, this method returns a new array.
  26336. *
  26337. * @static
  26338. * @memberOf _
  26339. * @since 0.1.0
  26340. * @category Collection
  26341. * @param {Array|Object} collection The collection to iterate over.
  26342. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26343. * @returns {Array} Returns the new filtered array.
  26344. * @see _.reject
  26345. * @example
  26346. *
  26347. * var users = [
  26348. * { 'user': 'barney', 'age': 36, 'active': true },
  26349. * { 'user': 'fred', 'age': 40, 'active': false }
  26350. * ];
  26351. *
  26352. * _.filter(users, function(o) { return !o.active; });
  26353. * // => objects for ['fred']
  26354. *
  26355. * // The `_.matches` iteratee shorthand.
  26356. * _.filter(users, { 'age': 36, 'active': true });
  26357. * // => objects for ['barney']
  26358. *
  26359. * // The `_.matchesProperty` iteratee shorthand.
  26360. * _.filter(users, ['active', false]);
  26361. * // => objects for ['fred']
  26362. *
  26363. * // The `_.property` iteratee shorthand.
  26364. * _.filter(users, 'active');
  26365. * // => objects for ['barney']
  26366. */
  26367. function filter(collection, predicate) {
  26368. var func = isArray(collection) ? arrayFilter : baseFilter;
  26369. return func(collection, getIteratee(predicate, 3));
  26370. }
  26371. /**
  26372. * Iterates over elements of `collection`, returning the first element
  26373. * `predicate` returns truthy for. The predicate is invoked with three
  26374. * arguments: (value, index|key, collection).
  26375. *
  26376. * @static
  26377. * @memberOf _
  26378. * @since 0.1.0
  26379. * @category Collection
  26380. * @param {Array|Object} collection The collection to inspect.
  26381. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26382. * @param {number} [fromIndex=0] The index to search from.
  26383. * @returns {*} Returns the matched element, else `undefined`.
  26384. * @example
  26385. *
  26386. * var users = [
  26387. * { 'user': 'barney', 'age': 36, 'active': true },
  26388. * { 'user': 'fred', 'age': 40, 'active': false },
  26389. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26390. * ];
  26391. *
  26392. * _.find(users, function(o) { return o.age < 40; });
  26393. * // => object for 'barney'
  26394. *
  26395. * // The `_.matches` iteratee shorthand.
  26396. * _.find(users, { 'age': 1, 'active': true });
  26397. * // => object for 'pebbles'
  26398. *
  26399. * // The `_.matchesProperty` iteratee shorthand.
  26400. * _.find(users, ['active', false]);
  26401. * // => object for 'fred'
  26402. *
  26403. * // The `_.property` iteratee shorthand.
  26404. * _.find(users, 'active');
  26405. * // => object for 'barney'
  26406. */
  26407. var find = createFind(findIndex);
  26408. /**
  26409. * This method is like `_.find` except that it iterates over elements of
  26410. * `collection` from right to left.
  26411. *
  26412. * @static
  26413. * @memberOf _
  26414. * @since 2.0.0
  26415. * @category Collection
  26416. * @param {Array|Object} collection The collection to inspect.
  26417. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26418. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26419. * @returns {*} Returns the matched element, else `undefined`.
  26420. * @example
  26421. *
  26422. * _.findLast([1, 2, 3, 4], function(n) {
  26423. * return n % 2 == 1;
  26424. * });
  26425. * // => 3
  26426. */
  26427. var findLast = createFind(findLastIndex);
  26428. /**
  26429. * Creates a flattened array of values by running each element in `collection`
  26430. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26431. * with three arguments: (value, index|key, collection).
  26432. *
  26433. * @static
  26434. * @memberOf _
  26435. * @since 4.0.0
  26436. * @category Collection
  26437. * @param {Array|Object} collection The collection to iterate over.
  26438. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26439. * @returns {Array} Returns the new flattened array.
  26440. * @example
  26441. *
  26442. * function duplicate(n) {
  26443. * return [n, n];
  26444. * }
  26445. *
  26446. * _.flatMap([1, 2], duplicate);
  26447. * // => [1, 1, 2, 2]
  26448. */
  26449. function flatMap(collection, iteratee) {
  26450. return baseFlatten(map(collection, iteratee), 1);
  26451. }
  26452. /**
  26453. * This method is like `_.flatMap` except that it recursively flattens the
  26454. * mapped results.
  26455. *
  26456. * @static
  26457. * @memberOf _
  26458. * @since 4.7.0
  26459. * @category Collection
  26460. * @param {Array|Object} collection The collection to iterate over.
  26461. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26462. * @returns {Array} Returns the new flattened array.
  26463. * @example
  26464. *
  26465. * function duplicate(n) {
  26466. * return [[[n, n]]];
  26467. * }
  26468. *
  26469. * _.flatMapDeep([1, 2], duplicate);
  26470. * // => [1, 1, 2, 2]
  26471. */
  26472. function flatMapDeep(collection, iteratee) {
  26473. return baseFlatten(map(collection, iteratee), INFINITY);
  26474. }
  26475. /**
  26476. * This method is like `_.flatMap` except that it recursively flattens the
  26477. * mapped results up to `depth` times.
  26478. *
  26479. * @static
  26480. * @memberOf _
  26481. * @since 4.7.0
  26482. * @category Collection
  26483. * @param {Array|Object} collection The collection to iterate over.
  26484. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26485. * @param {number} [depth=1] The maximum recursion depth.
  26486. * @returns {Array} Returns the new flattened array.
  26487. * @example
  26488. *
  26489. * function duplicate(n) {
  26490. * return [[[n, n]]];
  26491. * }
  26492. *
  26493. * _.flatMapDepth([1, 2], duplicate, 2);
  26494. * // => [[1, 1], [2, 2]]
  26495. */
  26496. function flatMapDepth(collection, iteratee, depth) {
  26497. depth = depth === undefined ? 1 : toInteger(depth);
  26498. return baseFlatten(map(collection, iteratee), depth);
  26499. }
  26500. /**
  26501. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26502. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26503. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26504. *
  26505. * **Note:** As with other "Collections" methods, objects with a "length"
  26506. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26507. * or `_.forOwn` for object iteration.
  26508. *
  26509. * @static
  26510. * @memberOf _
  26511. * @since 0.1.0
  26512. * @alias each
  26513. * @category Collection
  26514. * @param {Array|Object} collection The collection to iterate over.
  26515. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26516. * @returns {Array|Object} Returns `collection`.
  26517. * @see _.forEachRight
  26518. * @example
  26519. *
  26520. * _.forEach([1, 2], function(value) {
  26521. * console.log(value);
  26522. * });
  26523. * // => Logs `1` then `2`.
  26524. *
  26525. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26526. * console.log(key);
  26527. * });
  26528. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26529. */
  26530. function forEach(collection, iteratee) {
  26531. var func = isArray(collection) ? arrayEach : baseEach;
  26532. return func(collection, getIteratee(iteratee, 3));
  26533. }
  26534. /**
  26535. * This method is like `_.forEach` except that it iterates over elements of
  26536. * `collection` from right to left.
  26537. *
  26538. * @static
  26539. * @memberOf _
  26540. * @since 2.0.0
  26541. * @alias eachRight
  26542. * @category Collection
  26543. * @param {Array|Object} collection The collection to iterate over.
  26544. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26545. * @returns {Array|Object} Returns `collection`.
  26546. * @see _.forEach
  26547. * @example
  26548. *
  26549. * _.forEachRight([1, 2], function(value) {
  26550. * console.log(value);
  26551. * });
  26552. * // => Logs `2` then `1`.
  26553. */
  26554. function forEachRight(collection, iteratee) {
  26555. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26556. return func(collection, getIteratee(iteratee, 3));
  26557. }
  26558. /**
  26559. * Creates an object composed of keys generated from the results of running
  26560. * each element of `collection` thru `iteratee`. The order of grouped values
  26561. * is determined by the order they occur in `collection`. The corresponding
  26562. * value of each key is an array of elements responsible for generating the
  26563. * key. The iteratee is invoked with one argument: (value).
  26564. *
  26565. * @static
  26566. * @memberOf _
  26567. * @since 0.1.0
  26568. * @category Collection
  26569. * @param {Array|Object} collection The collection to iterate over.
  26570. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26571. * @returns {Object} Returns the composed aggregate object.
  26572. * @example
  26573. *
  26574. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26575. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26576. *
  26577. * // The `_.property` iteratee shorthand.
  26578. * _.groupBy(['one', 'two', 'three'], 'length');
  26579. * // => { '3': ['one', 'two'], '5': ['three'] }
  26580. */
  26581. var groupBy = createAggregator(function(result, value, key) {
  26582. if (hasOwnProperty.call(result, key)) {
  26583. result[key].push(value);
  26584. } else {
  26585. baseAssignValue(result, key, [value]);
  26586. }
  26587. });
  26588. /**
  26589. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26590. * checked for a substring of `value`, otherwise
  26591. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26592. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26593. * the offset from the end of `collection`.
  26594. *
  26595. * @static
  26596. * @memberOf _
  26597. * @since 0.1.0
  26598. * @category Collection
  26599. * @param {Array|Object|string} collection The collection to inspect.
  26600. * @param {*} value The value to search for.
  26601. * @param {number} [fromIndex=0] The index to search from.
  26602. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26603. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26604. * @example
  26605. *
  26606. * _.includes([1, 2, 3], 1);
  26607. * // => true
  26608. *
  26609. * _.includes([1, 2, 3], 1, 2);
  26610. * // => false
  26611. *
  26612. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26613. * // => true
  26614. *
  26615. * _.includes('abcd', 'bc');
  26616. * // => true
  26617. */
  26618. function includes(collection, value, fromIndex, guard) {
  26619. collection = isArrayLike(collection) ? collection : values(collection);
  26620. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26621. var length = collection.length;
  26622. if (fromIndex < 0) {
  26623. fromIndex = nativeMax(length + fromIndex, 0);
  26624. }
  26625. return isString(collection)
  26626. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26627. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26628. }
  26629. /**
  26630. * Invokes the method at `path` of each element in `collection`, returning
  26631. * an array of the results of each invoked method. Any additional arguments
  26632. * are provided to each invoked method. If `path` is a function, it's invoked
  26633. * for, and `this` bound to, each element in `collection`.
  26634. *
  26635. * @static
  26636. * @memberOf _
  26637. * @since 4.0.0
  26638. * @category Collection
  26639. * @param {Array|Object} collection The collection to iterate over.
  26640. * @param {Array|Function|string} path The path of the method to invoke or
  26641. * the function invoked per iteration.
  26642. * @param {...*} [args] The arguments to invoke each method with.
  26643. * @returns {Array} Returns the array of results.
  26644. * @example
  26645. *
  26646. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26647. * // => [[1, 5, 7], [1, 2, 3]]
  26648. *
  26649. * _.invokeMap([123, 456], String.prototype.split, '');
  26650. * // => [['1', '2', '3'], ['4', '5', '6']]
  26651. */
  26652. var invokeMap = baseRest(function(collection, path, args) {
  26653. var index = -1,
  26654. isFunc = typeof path == 'function',
  26655. result = isArrayLike(collection) ? Array(collection.length) : [];
  26656. baseEach(collection, function(value) {
  26657. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26658. });
  26659. return result;
  26660. });
  26661. /**
  26662. * Creates an object composed of keys generated from the results of running
  26663. * each element of `collection` thru `iteratee`. The corresponding value of
  26664. * each key is the last element responsible for generating the key. The
  26665. * iteratee is invoked with one argument: (value).
  26666. *
  26667. * @static
  26668. * @memberOf _
  26669. * @since 4.0.0
  26670. * @category Collection
  26671. * @param {Array|Object} collection The collection to iterate over.
  26672. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26673. * @returns {Object} Returns the composed aggregate object.
  26674. * @example
  26675. *
  26676. * var array = [
  26677. * { 'dir': 'left', 'code': 97 },
  26678. * { 'dir': 'right', 'code': 100 }
  26679. * ];
  26680. *
  26681. * _.keyBy(array, function(o) {
  26682. * return String.fromCharCode(o.code);
  26683. * });
  26684. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26685. *
  26686. * _.keyBy(array, 'dir');
  26687. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26688. */
  26689. var keyBy = createAggregator(function(result, value, key) {
  26690. baseAssignValue(result, key, value);
  26691. });
  26692. /**
  26693. * Creates an array of values by running each element in `collection` thru
  26694. * `iteratee`. The iteratee is invoked with three arguments:
  26695. * (value, index|key, collection).
  26696. *
  26697. * Many lodash methods are guarded to work as iteratees for methods like
  26698. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26699. *
  26700. * The guarded methods are:
  26701. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26702. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26703. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26704. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26705. *
  26706. * @static
  26707. * @memberOf _
  26708. * @since 0.1.0
  26709. * @category Collection
  26710. * @param {Array|Object} collection The collection to iterate over.
  26711. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26712. * @returns {Array} Returns the new mapped array.
  26713. * @example
  26714. *
  26715. * function square(n) {
  26716. * return n * n;
  26717. * }
  26718. *
  26719. * _.map([4, 8], square);
  26720. * // => [16, 64]
  26721. *
  26722. * _.map({ 'a': 4, 'b': 8 }, square);
  26723. * // => [16, 64] (iteration order is not guaranteed)
  26724. *
  26725. * var users = [
  26726. * { 'user': 'barney' },
  26727. * { 'user': 'fred' }
  26728. * ];
  26729. *
  26730. * // The `_.property` iteratee shorthand.
  26731. * _.map(users, 'user');
  26732. * // => ['barney', 'fred']
  26733. */
  26734. function map(collection, iteratee) {
  26735. var func = isArray(collection) ? arrayMap : baseMap;
  26736. return func(collection, getIteratee(iteratee, 3));
  26737. }
  26738. /**
  26739. * This method is like `_.sortBy` except that it allows specifying the sort
  26740. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26741. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26742. * descending or "asc" for ascending sort order of corresponding values.
  26743. *
  26744. * @static
  26745. * @memberOf _
  26746. * @since 4.0.0
  26747. * @category Collection
  26748. * @param {Array|Object} collection The collection to iterate over.
  26749. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26750. * The iteratees to sort by.
  26751. * @param {string[]} [orders] The sort orders of `iteratees`.
  26752. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26753. * @returns {Array} Returns the new sorted array.
  26754. * @example
  26755. *
  26756. * var users = [
  26757. * { 'user': 'fred', 'age': 48 },
  26758. * { 'user': 'barney', 'age': 34 },
  26759. * { 'user': 'fred', 'age': 40 },
  26760. * { 'user': 'barney', 'age': 36 }
  26761. * ];
  26762. *
  26763. * // Sort by `user` in ascending order and by `age` in descending order.
  26764. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26765. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26766. */
  26767. function orderBy(collection, iteratees, orders, guard) {
  26768. if (collection == null) {
  26769. return [];
  26770. }
  26771. if (!isArray(iteratees)) {
  26772. iteratees = iteratees == null ? [] : [iteratees];
  26773. }
  26774. orders = guard ? undefined : orders;
  26775. if (!isArray(orders)) {
  26776. orders = orders == null ? [] : [orders];
  26777. }
  26778. return baseOrderBy(collection, iteratees, orders);
  26779. }
  26780. /**
  26781. * Creates an array of elements split into two groups, the first of which
  26782. * contains elements `predicate` returns truthy for, the second of which
  26783. * contains elements `predicate` returns falsey for. The predicate is
  26784. * invoked with one argument: (value).
  26785. *
  26786. * @static
  26787. * @memberOf _
  26788. * @since 3.0.0
  26789. * @category Collection
  26790. * @param {Array|Object} collection The collection to iterate over.
  26791. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26792. * @returns {Array} Returns the array of grouped elements.
  26793. * @example
  26794. *
  26795. * var users = [
  26796. * { 'user': 'barney', 'age': 36, 'active': false },
  26797. * { 'user': 'fred', 'age': 40, 'active': true },
  26798. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26799. * ];
  26800. *
  26801. * _.partition(users, function(o) { return o.active; });
  26802. * // => objects for [['fred'], ['barney', 'pebbles']]
  26803. *
  26804. * // The `_.matches` iteratee shorthand.
  26805. * _.partition(users, { 'age': 1, 'active': false });
  26806. * // => objects for [['pebbles'], ['barney', 'fred']]
  26807. *
  26808. * // The `_.matchesProperty` iteratee shorthand.
  26809. * _.partition(users, ['active', false]);
  26810. * // => objects for [['barney', 'pebbles'], ['fred']]
  26811. *
  26812. * // The `_.property` iteratee shorthand.
  26813. * _.partition(users, 'active');
  26814. * // => objects for [['fred'], ['barney', 'pebbles']]
  26815. */
  26816. var partition = createAggregator(function(result, value, key) {
  26817. result[key ? 0 : 1].push(value);
  26818. }, function() { return [[], []]; });
  26819. /**
  26820. * Reduces `collection` to a value which is the accumulated result of running
  26821. * each element in `collection` thru `iteratee`, where each successive
  26822. * invocation is supplied the return value of the previous. If `accumulator`
  26823. * is not given, the first element of `collection` is used as the initial
  26824. * value. The iteratee is invoked with four arguments:
  26825. * (accumulator, value, index|key, collection).
  26826. *
  26827. * Many lodash methods are guarded to work as iteratees for methods like
  26828. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26829. *
  26830. * The guarded methods are:
  26831. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26832. * and `sortBy`
  26833. *
  26834. * @static
  26835. * @memberOf _
  26836. * @since 0.1.0
  26837. * @category Collection
  26838. * @param {Array|Object} collection The collection to iterate over.
  26839. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26840. * @param {*} [accumulator] The initial value.
  26841. * @returns {*} Returns the accumulated value.
  26842. * @see _.reduceRight
  26843. * @example
  26844. *
  26845. * _.reduce([1, 2], function(sum, n) {
  26846. * return sum + n;
  26847. * }, 0);
  26848. * // => 3
  26849. *
  26850. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26851. * (result[value] || (result[value] = [])).push(key);
  26852. * return result;
  26853. * }, {});
  26854. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26855. */
  26856. function reduce(collection, iteratee, accumulator) {
  26857. var func = isArray(collection) ? arrayReduce : baseReduce,
  26858. initAccum = arguments.length < 3;
  26859. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26860. }
  26861. /**
  26862. * This method is like `_.reduce` except that it iterates over elements of
  26863. * `collection` from right to left.
  26864. *
  26865. * @static
  26866. * @memberOf _
  26867. * @since 0.1.0
  26868. * @category Collection
  26869. * @param {Array|Object} collection The collection to iterate over.
  26870. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26871. * @param {*} [accumulator] The initial value.
  26872. * @returns {*} Returns the accumulated value.
  26873. * @see _.reduce
  26874. * @example
  26875. *
  26876. * var array = [[0, 1], [2, 3], [4, 5]];
  26877. *
  26878. * _.reduceRight(array, function(flattened, other) {
  26879. * return flattened.concat(other);
  26880. * }, []);
  26881. * // => [4, 5, 2, 3, 0, 1]
  26882. */
  26883. function reduceRight(collection, iteratee, accumulator) {
  26884. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26885. initAccum = arguments.length < 3;
  26886. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26887. }
  26888. /**
  26889. * The opposite of `_.filter`; this method returns the elements of `collection`
  26890. * that `predicate` does **not** return truthy for.
  26891. *
  26892. * @static
  26893. * @memberOf _
  26894. * @since 0.1.0
  26895. * @category Collection
  26896. * @param {Array|Object} collection The collection to iterate over.
  26897. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26898. * @returns {Array} Returns the new filtered array.
  26899. * @see _.filter
  26900. * @example
  26901. *
  26902. * var users = [
  26903. * { 'user': 'barney', 'age': 36, 'active': false },
  26904. * { 'user': 'fred', 'age': 40, 'active': true }
  26905. * ];
  26906. *
  26907. * _.reject(users, function(o) { return !o.active; });
  26908. * // => objects for ['fred']
  26909. *
  26910. * // The `_.matches` iteratee shorthand.
  26911. * _.reject(users, { 'age': 40, 'active': true });
  26912. * // => objects for ['barney']
  26913. *
  26914. * // The `_.matchesProperty` iteratee shorthand.
  26915. * _.reject(users, ['active', false]);
  26916. * // => objects for ['fred']
  26917. *
  26918. * // The `_.property` iteratee shorthand.
  26919. * _.reject(users, 'active');
  26920. * // => objects for ['barney']
  26921. */
  26922. function reject(collection, predicate) {
  26923. var func = isArray(collection) ? arrayFilter : baseFilter;
  26924. return func(collection, negate(getIteratee(predicate, 3)));
  26925. }
  26926. /**
  26927. * Gets a random element from `collection`.
  26928. *
  26929. * @static
  26930. * @memberOf _
  26931. * @since 2.0.0
  26932. * @category Collection
  26933. * @param {Array|Object} collection The collection to sample.
  26934. * @returns {*} Returns the random element.
  26935. * @example
  26936. *
  26937. * _.sample([1, 2, 3, 4]);
  26938. * // => 2
  26939. */
  26940. function sample(collection) {
  26941. var func = isArray(collection) ? arraySample : baseSample;
  26942. return func(collection);
  26943. }
  26944. /**
  26945. * Gets `n` random elements at unique keys from `collection` up to the
  26946. * size of `collection`.
  26947. *
  26948. * @static
  26949. * @memberOf _
  26950. * @since 4.0.0
  26951. * @category Collection
  26952. * @param {Array|Object} collection The collection to sample.
  26953. * @param {number} [n=1] The number of elements to sample.
  26954. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26955. * @returns {Array} Returns the random elements.
  26956. * @example
  26957. *
  26958. * _.sampleSize([1, 2, 3], 2);
  26959. * // => [3, 1]
  26960. *
  26961. * _.sampleSize([1, 2, 3], 4);
  26962. * // => [2, 3, 1]
  26963. */
  26964. function sampleSize(collection, n, guard) {
  26965. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26966. n = 1;
  26967. } else {
  26968. n = toInteger(n);
  26969. }
  26970. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26971. return func(collection, n);
  26972. }
  26973. /**
  26974. * Creates an array of shuffled values, using a version of the
  26975. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26976. *
  26977. * @static
  26978. * @memberOf _
  26979. * @since 0.1.0
  26980. * @category Collection
  26981. * @param {Array|Object} collection The collection to shuffle.
  26982. * @returns {Array} Returns the new shuffled array.
  26983. * @example
  26984. *
  26985. * _.shuffle([1, 2, 3, 4]);
  26986. * // => [4, 1, 3, 2]
  26987. */
  26988. function shuffle(collection) {
  26989. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26990. return func(collection);
  26991. }
  26992. /**
  26993. * Gets the size of `collection` by returning its length for array-like
  26994. * values or the number of own enumerable string keyed properties for objects.
  26995. *
  26996. * @static
  26997. * @memberOf _
  26998. * @since 0.1.0
  26999. * @category Collection
  27000. * @param {Array|Object|string} collection The collection to inspect.
  27001. * @returns {number} Returns the collection size.
  27002. * @example
  27003. *
  27004. * _.size([1, 2, 3]);
  27005. * // => 3
  27006. *
  27007. * _.size({ 'a': 1, 'b': 2 });
  27008. * // => 2
  27009. *
  27010. * _.size('pebbles');
  27011. * // => 7
  27012. */
  27013. function size(collection) {
  27014. if (collection == null) {
  27015. return 0;
  27016. }
  27017. if (isArrayLike(collection)) {
  27018. return isString(collection) ? stringSize(collection) : collection.length;
  27019. }
  27020. var tag = getTag(collection);
  27021. if (tag == mapTag || tag == setTag) {
  27022. return collection.size;
  27023. }
  27024. return baseKeys(collection).length;
  27025. }
  27026. /**
  27027. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27028. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27029. * invoked with three arguments: (value, index|key, collection).
  27030. *
  27031. * @static
  27032. * @memberOf _
  27033. * @since 0.1.0
  27034. * @category Collection
  27035. * @param {Array|Object} collection The collection to iterate over.
  27036. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27037. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27038. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27039. * else `false`.
  27040. * @example
  27041. *
  27042. * _.some([null, 0, 'yes', false], Boolean);
  27043. * // => true
  27044. *
  27045. * var users = [
  27046. * { 'user': 'barney', 'active': true },
  27047. * { 'user': 'fred', 'active': false }
  27048. * ];
  27049. *
  27050. * // The `_.matches` iteratee shorthand.
  27051. * _.some(users, { 'user': 'barney', 'active': false });
  27052. * // => false
  27053. *
  27054. * // The `_.matchesProperty` iteratee shorthand.
  27055. * _.some(users, ['active', false]);
  27056. * // => true
  27057. *
  27058. * // The `_.property` iteratee shorthand.
  27059. * _.some(users, 'active');
  27060. * // => true
  27061. */
  27062. function some(collection, predicate, guard) {
  27063. var func = isArray(collection) ? arraySome : baseSome;
  27064. if (guard && isIterateeCall(collection, predicate, guard)) {
  27065. predicate = undefined;
  27066. }
  27067. return func(collection, getIteratee(predicate, 3));
  27068. }
  27069. /**
  27070. * Creates an array of elements, sorted in ascending order by the results of
  27071. * running each element in a collection thru each iteratee. This method
  27072. * performs a stable sort, that is, it preserves the original sort order of
  27073. * equal elements. The iteratees are invoked with one argument: (value).
  27074. *
  27075. * @static
  27076. * @memberOf _
  27077. * @since 0.1.0
  27078. * @category Collection
  27079. * @param {Array|Object} collection The collection to iterate over.
  27080. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27081. * The iteratees to sort by.
  27082. * @returns {Array} Returns the new sorted array.
  27083. * @example
  27084. *
  27085. * var users = [
  27086. * { 'user': 'fred', 'age': 48 },
  27087. * { 'user': 'barney', 'age': 36 },
  27088. * { 'user': 'fred', 'age': 40 },
  27089. * { 'user': 'barney', 'age': 34 }
  27090. * ];
  27091. *
  27092. * _.sortBy(users, [function(o) { return o.user; }]);
  27093. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27094. *
  27095. * _.sortBy(users, ['user', 'age']);
  27096. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27097. */
  27098. var sortBy = baseRest(function(collection, iteratees) {
  27099. if (collection == null) {
  27100. return [];
  27101. }
  27102. var length = iteratees.length;
  27103. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27104. iteratees = [];
  27105. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27106. iteratees = [iteratees[0]];
  27107. }
  27108. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27109. });
  27110. /*------------------------------------------------------------------------*/
  27111. /**
  27112. * Gets the timestamp of the number of milliseconds that have elapsed since
  27113. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27114. *
  27115. * @static
  27116. * @memberOf _
  27117. * @since 2.4.0
  27118. * @category Date
  27119. * @returns {number} Returns the timestamp.
  27120. * @example
  27121. *
  27122. * _.defer(function(stamp) {
  27123. * console.log(_.now() - stamp);
  27124. * }, _.now());
  27125. * // => Logs the number of milliseconds it took for the deferred invocation.
  27126. */
  27127. var now = ctxNow || function() {
  27128. return root.Date.now();
  27129. };
  27130. /*------------------------------------------------------------------------*/
  27131. /**
  27132. * The opposite of `_.before`; this method creates a function that invokes
  27133. * `func` once it's called `n` or more times.
  27134. *
  27135. * @static
  27136. * @memberOf _
  27137. * @since 0.1.0
  27138. * @category Function
  27139. * @param {number} n The number of calls before `func` is invoked.
  27140. * @param {Function} func The function to restrict.
  27141. * @returns {Function} Returns the new restricted function.
  27142. * @example
  27143. *
  27144. * var saves = ['profile', 'settings'];
  27145. *
  27146. * var done = _.after(saves.length, function() {
  27147. * console.log('done saving!');
  27148. * });
  27149. *
  27150. * _.forEach(saves, function(type) {
  27151. * asyncSave({ 'type': type, 'complete': done });
  27152. * });
  27153. * // => Logs 'done saving!' after the two async saves have completed.
  27154. */
  27155. function after(n, func) {
  27156. if (typeof func != 'function') {
  27157. throw new TypeError(FUNC_ERROR_TEXT);
  27158. }
  27159. n = toInteger(n);
  27160. return function() {
  27161. if (--n < 1) {
  27162. return func.apply(this, arguments);
  27163. }
  27164. };
  27165. }
  27166. /**
  27167. * Creates a function that invokes `func`, with up to `n` arguments,
  27168. * ignoring any additional arguments.
  27169. *
  27170. * @static
  27171. * @memberOf _
  27172. * @since 3.0.0
  27173. * @category Function
  27174. * @param {Function} func The function to cap arguments for.
  27175. * @param {number} [n=func.length] The arity cap.
  27176. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27177. * @returns {Function} Returns the new capped function.
  27178. * @example
  27179. *
  27180. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27181. * // => [6, 8, 10]
  27182. */
  27183. function ary(func, n, guard) {
  27184. n = guard ? undefined : n;
  27185. n = (func && n == null) ? func.length : n;
  27186. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27187. }
  27188. /**
  27189. * Creates a function that invokes `func`, with the `this` binding and arguments
  27190. * of the created function, while it's called less than `n` times. Subsequent
  27191. * calls to the created function return the result of the last `func` invocation.
  27192. *
  27193. * @static
  27194. * @memberOf _
  27195. * @since 3.0.0
  27196. * @category Function
  27197. * @param {number} n The number of calls at which `func` is no longer invoked.
  27198. * @param {Function} func The function to restrict.
  27199. * @returns {Function} Returns the new restricted function.
  27200. * @example
  27201. *
  27202. * jQuery(element).on('click', _.before(5, addContactToList));
  27203. * // => Allows adding up to 4 contacts to the list.
  27204. */
  27205. function before(n, func) {
  27206. var result;
  27207. if (typeof func != 'function') {
  27208. throw new TypeError(FUNC_ERROR_TEXT);
  27209. }
  27210. n = toInteger(n);
  27211. return function() {
  27212. if (--n > 0) {
  27213. result = func.apply(this, arguments);
  27214. }
  27215. if (n <= 1) {
  27216. func = undefined;
  27217. }
  27218. return result;
  27219. };
  27220. }
  27221. /**
  27222. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27223. * and `partials` prepended to the arguments it receives.
  27224. *
  27225. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27226. * may be used as a placeholder for partially applied arguments.
  27227. *
  27228. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27229. * property of bound functions.
  27230. *
  27231. * @static
  27232. * @memberOf _
  27233. * @since 0.1.0
  27234. * @category Function
  27235. * @param {Function} func The function to bind.
  27236. * @param {*} thisArg The `this` binding of `func`.
  27237. * @param {...*} [partials] The arguments to be partially applied.
  27238. * @returns {Function} Returns the new bound function.
  27239. * @example
  27240. *
  27241. * function greet(greeting, punctuation) {
  27242. * return greeting + ' ' + this.user + punctuation;
  27243. * }
  27244. *
  27245. * var object = { 'user': 'fred' };
  27246. *
  27247. * var bound = _.bind(greet, object, 'hi');
  27248. * bound('!');
  27249. * // => 'hi fred!'
  27250. *
  27251. * // Bound with placeholders.
  27252. * var bound = _.bind(greet, object, _, '!');
  27253. * bound('hi');
  27254. * // => 'hi fred!'
  27255. */
  27256. var bind = baseRest(function(func, thisArg, partials) {
  27257. var bitmask = WRAP_BIND_FLAG;
  27258. if (partials.length) {
  27259. var holders = replaceHolders(partials, getHolder(bind));
  27260. bitmask |= WRAP_PARTIAL_FLAG;
  27261. }
  27262. return createWrap(func, bitmask, thisArg, partials, holders);
  27263. });
  27264. /**
  27265. * Creates a function that invokes the method at `object[key]` with `partials`
  27266. * prepended to the arguments it receives.
  27267. *
  27268. * This method differs from `_.bind` by allowing bound functions to reference
  27269. * methods that may be redefined or don't yet exist. See
  27270. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27271. * for more details.
  27272. *
  27273. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27274. * builds, may be used as a placeholder for partially applied arguments.
  27275. *
  27276. * @static
  27277. * @memberOf _
  27278. * @since 0.10.0
  27279. * @category Function
  27280. * @param {Object} object The object to invoke the method on.
  27281. * @param {string} key The key of the method.
  27282. * @param {...*} [partials] The arguments to be partially applied.
  27283. * @returns {Function} Returns the new bound function.
  27284. * @example
  27285. *
  27286. * var object = {
  27287. * 'user': 'fred',
  27288. * 'greet': function(greeting, punctuation) {
  27289. * return greeting + ' ' + this.user + punctuation;
  27290. * }
  27291. * };
  27292. *
  27293. * var bound = _.bindKey(object, 'greet', 'hi');
  27294. * bound('!');
  27295. * // => 'hi fred!'
  27296. *
  27297. * object.greet = function(greeting, punctuation) {
  27298. * return greeting + 'ya ' + this.user + punctuation;
  27299. * };
  27300. *
  27301. * bound('!');
  27302. * // => 'hiya fred!'
  27303. *
  27304. * // Bound with placeholders.
  27305. * var bound = _.bindKey(object, 'greet', _, '!');
  27306. * bound('hi');
  27307. * // => 'hiya fred!'
  27308. */
  27309. var bindKey = baseRest(function(object, key, partials) {
  27310. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27311. if (partials.length) {
  27312. var holders = replaceHolders(partials, getHolder(bindKey));
  27313. bitmask |= WRAP_PARTIAL_FLAG;
  27314. }
  27315. return createWrap(key, bitmask, object, partials, holders);
  27316. });
  27317. /**
  27318. * Creates a function that accepts arguments of `func` and either invokes
  27319. * `func` returning its result, if at least `arity` number of arguments have
  27320. * been provided, or returns a function that accepts the remaining `func`
  27321. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27322. * is not sufficient.
  27323. *
  27324. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27325. * may be used as a placeholder for provided arguments.
  27326. *
  27327. * **Note:** This method doesn't set the "length" property of curried functions.
  27328. *
  27329. * @static
  27330. * @memberOf _
  27331. * @since 2.0.0
  27332. * @category Function
  27333. * @param {Function} func The function to curry.
  27334. * @param {number} [arity=func.length] The arity of `func`.
  27335. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27336. * @returns {Function} Returns the new curried function.
  27337. * @example
  27338. *
  27339. * var abc = function(a, b, c) {
  27340. * return [a, b, c];
  27341. * };
  27342. *
  27343. * var curried = _.curry(abc);
  27344. *
  27345. * curried(1)(2)(3);
  27346. * // => [1, 2, 3]
  27347. *
  27348. * curried(1, 2)(3);
  27349. * // => [1, 2, 3]
  27350. *
  27351. * curried(1, 2, 3);
  27352. * // => [1, 2, 3]
  27353. *
  27354. * // Curried with placeholders.
  27355. * curried(1)(_, 3)(2);
  27356. * // => [1, 2, 3]
  27357. */
  27358. function curry(func, arity, guard) {
  27359. arity = guard ? undefined : arity;
  27360. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27361. result.placeholder = curry.placeholder;
  27362. return result;
  27363. }
  27364. /**
  27365. * This method is like `_.curry` except that arguments are applied to `func`
  27366. * in the manner of `_.partialRight` instead of `_.partial`.
  27367. *
  27368. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27369. * builds, may be used as a placeholder for provided arguments.
  27370. *
  27371. * **Note:** This method doesn't set the "length" property of curried functions.
  27372. *
  27373. * @static
  27374. * @memberOf _
  27375. * @since 3.0.0
  27376. * @category Function
  27377. * @param {Function} func The function to curry.
  27378. * @param {number} [arity=func.length] The arity of `func`.
  27379. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27380. * @returns {Function} Returns the new curried function.
  27381. * @example
  27382. *
  27383. * var abc = function(a, b, c) {
  27384. * return [a, b, c];
  27385. * };
  27386. *
  27387. * var curried = _.curryRight(abc);
  27388. *
  27389. * curried(3)(2)(1);
  27390. * // => [1, 2, 3]
  27391. *
  27392. * curried(2, 3)(1);
  27393. * // => [1, 2, 3]
  27394. *
  27395. * curried(1, 2, 3);
  27396. * // => [1, 2, 3]
  27397. *
  27398. * // Curried with placeholders.
  27399. * curried(3)(1, _)(2);
  27400. * // => [1, 2, 3]
  27401. */
  27402. function curryRight(func, arity, guard) {
  27403. arity = guard ? undefined : arity;
  27404. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27405. result.placeholder = curryRight.placeholder;
  27406. return result;
  27407. }
  27408. /**
  27409. * Creates a debounced function that delays invoking `func` until after `wait`
  27410. * milliseconds have elapsed since the last time the debounced function was
  27411. * invoked. The debounced function comes with a `cancel` method to cancel
  27412. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27413. * Provide `options` to indicate whether `func` should be invoked on the
  27414. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27415. * with the last arguments provided to the debounced function. Subsequent
  27416. * calls to the debounced function return the result of the last `func`
  27417. * invocation.
  27418. *
  27419. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27420. * invoked on the trailing edge of the timeout only if the debounced function
  27421. * is invoked more than once during the `wait` timeout.
  27422. *
  27423. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27424. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27425. *
  27426. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27427. * for details over the differences between `_.debounce` and `_.throttle`.
  27428. *
  27429. * @static
  27430. * @memberOf _
  27431. * @since 0.1.0
  27432. * @category Function
  27433. * @param {Function} func The function to debounce.
  27434. * @param {number} [wait=0] The number of milliseconds to delay.
  27435. * @param {Object} [options={}] The options object.
  27436. * @param {boolean} [options.leading=false]
  27437. * Specify invoking on the leading edge of the timeout.
  27438. * @param {number} [options.maxWait]
  27439. * The maximum time `func` is allowed to be delayed before it's invoked.
  27440. * @param {boolean} [options.trailing=true]
  27441. * Specify invoking on the trailing edge of the timeout.
  27442. * @returns {Function} Returns the new debounced function.
  27443. * @example
  27444. *
  27445. * // Avoid costly calculations while the window size is in flux.
  27446. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27447. *
  27448. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27449. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27450. * 'leading': true,
  27451. * 'trailing': false
  27452. * }));
  27453. *
  27454. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27455. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27456. * var source = new EventSource('/stream');
  27457. * jQuery(source).on('message', debounced);
  27458. *
  27459. * // Cancel the trailing debounced invocation.
  27460. * jQuery(window).on('popstate', debounced.cancel);
  27461. */
  27462. function debounce(func, wait, options) {
  27463. var lastArgs,
  27464. lastThis,
  27465. maxWait,
  27466. result,
  27467. timerId,
  27468. lastCallTime,
  27469. lastInvokeTime = 0,
  27470. leading = false,
  27471. maxing = false,
  27472. trailing = true;
  27473. if (typeof func != 'function') {
  27474. throw new TypeError(FUNC_ERROR_TEXT);
  27475. }
  27476. wait = toNumber(wait) || 0;
  27477. if (isObject(options)) {
  27478. leading = !!options.leading;
  27479. maxing = 'maxWait' in options;
  27480. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27481. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27482. }
  27483. function invokeFunc(time) {
  27484. var args = lastArgs,
  27485. thisArg = lastThis;
  27486. lastArgs = lastThis = undefined;
  27487. lastInvokeTime = time;
  27488. result = func.apply(thisArg, args);
  27489. return result;
  27490. }
  27491. function leadingEdge(time) {
  27492. // Reset any `maxWait` timer.
  27493. lastInvokeTime = time;
  27494. // Start the timer for the trailing edge.
  27495. timerId = setTimeout(timerExpired, wait);
  27496. // Invoke the leading edge.
  27497. return leading ? invokeFunc(time) : result;
  27498. }
  27499. function remainingWait(time) {
  27500. var timeSinceLastCall = time - lastCallTime,
  27501. timeSinceLastInvoke = time - lastInvokeTime,
  27502. timeWaiting = wait - timeSinceLastCall;
  27503. return maxing
  27504. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27505. : timeWaiting;
  27506. }
  27507. function shouldInvoke(time) {
  27508. var timeSinceLastCall = time - lastCallTime,
  27509. timeSinceLastInvoke = time - lastInvokeTime;
  27510. // Either this is the first call, activity has stopped and we're at the
  27511. // trailing edge, the system time has gone backwards and we're treating
  27512. // it as the trailing edge, or we've hit the `maxWait` limit.
  27513. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27514. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27515. }
  27516. function timerExpired() {
  27517. var time = now();
  27518. if (shouldInvoke(time)) {
  27519. return trailingEdge(time);
  27520. }
  27521. // Restart the timer.
  27522. timerId = setTimeout(timerExpired, remainingWait(time));
  27523. }
  27524. function trailingEdge(time) {
  27525. timerId = undefined;
  27526. // Only invoke if we have `lastArgs` which means `func` has been
  27527. // debounced at least once.
  27528. if (trailing && lastArgs) {
  27529. return invokeFunc(time);
  27530. }
  27531. lastArgs = lastThis = undefined;
  27532. return result;
  27533. }
  27534. function cancel() {
  27535. if (timerId !== undefined) {
  27536. clearTimeout(timerId);
  27537. }
  27538. lastInvokeTime = 0;
  27539. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27540. }
  27541. function flush() {
  27542. return timerId === undefined ? result : trailingEdge(now());
  27543. }
  27544. function debounced() {
  27545. var time = now(),
  27546. isInvoking = shouldInvoke(time);
  27547. lastArgs = arguments;
  27548. lastThis = this;
  27549. lastCallTime = time;
  27550. if (isInvoking) {
  27551. if (timerId === undefined) {
  27552. return leadingEdge(lastCallTime);
  27553. }
  27554. if (maxing) {
  27555. // Handle invocations in a tight loop.
  27556. clearTimeout(timerId);
  27557. timerId = setTimeout(timerExpired, wait);
  27558. return invokeFunc(lastCallTime);
  27559. }
  27560. }
  27561. if (timerId === undefined) {
  27562. timerId = setTimeout(timerExpired, wait);
  27563. }
  27564. return result;
  27565. }
  27566. debounced.cancel = cancel;
  27567. debounced.flush = flush;
  27568. return debounced;
  27569. }
  27570. /**
  27571. * Defers invoking the `func` until the current call stack has cleared. Any
  27572. * additional arguments are provided to `func` when it's invoked.
  27573. *
  27574. * @static
  27575. * @memberOf _
  27576. * @since 0.1.0
  27577. * @category Function
  27578. * @param {Function} func The function to defer.
  27579. * @param {...*} [args] The arguments to invoke `func` with.
  27580. * @returns {number} Returns the timer id.
  27581. * @example
  27582. *
  27583. * _.defer(function(text) {
  27584. * console.log(text);
  27585. * }, 'deferred');
  27586. * // => Logs 'deferred' after one millisecond.
  27587. */
  27588. var defer = baseRest(function(func, args) {
  27589. return baseDelay(func, 1, args);
  27590. });
  27591. /**
  27592. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27593. * provided to `func` when it's invoked.
  27594. *
  27595. * @static
  27596. * @memberOf _
  27597. * @since 0.1.0
  27598. * @category Function
  27599. * @param {Function} func The function to delay.
  27600. * @param {number} wait The number of milliseconds to delay invocation.
  27601. * @param {...*} [args] The arguments to invoke `func` with.
  27602. * @returns {number} Returns the timer id.
  27603. * @example
  27604. *
  27605. * _.delay(function(text) {
  27606. * console.log(text);
  27607. * }, 1000, 'later');
  27608. * // => Logs 'later' after one second.
  27609. */
  27610. var delay = baseRest(function(func, wait, args) {
  27611. return baseDelay(func, toNumber(wait) || 0, args);
  27612. });
  27613. /**
  27614. * Creates a function that invokes `func` with arguments reversed.
  27615. *
  27616. * @static
  27617. * @memberOf _
  27618. * @since 4.0.0
  27619. * @category Function
  27620. * @param {Function} func The function to flip arguments for.
  27621. * @returns {Function} Returns the new flipped function.
  27622. * @example
  27623. *
  27624. * var flipped = _.flip(function() {
  27625. * return _.toArray(arguments);
  27626. * });
  27627. *
  27628. * flipped('a', 'b', 'c', 'd');
  27629. * // => ['d', 'c', 'b', 'a']
  27630. */
  27631. function flip(func) {
  27632. return createWrap(func, WRAP_FLIP_FLAG);
  27633. }
  27634. /**
  27635. * Creates a function that memoizes the result of `func`. If `resolver` is
  27636. * provided, it determines the cache key for storing the result based on the
  27637. * arguments provided to the memoized function. By default, the first argument
  27638. * provided to the memoized function is used as the map cache key. The `func`
  27639. * is invoked with the `this` binding of the memoized function.
  27640. *
  27641. * **Note:** The cache is exposed as the `cache` property on the memoized
  27642. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27643. * constructor with one whose instances implement the
  27644. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27645. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27646. *
  27647. * @static
  27648. * @memberOf _
  27649. * @since 0.1.0
  27650. * @category Function
  27651. * @param {Function} func The function to have its output memoized.
  27652. * @param {Function} [resolver] The function to resolve the cache key.
  27653. * @returns {Function} Returns the new memoized function.
  27654. * @example
  27655. *
  27656. * var object = { 'a': 1, 'b': 2 };
  27657. * var other = { 'c': 3, 'd': 4 };
  27658. *
  27659. * var values = _.memoize(_.values);
  27660. * values(object);
  27661. * // => [1, 2]
  27662. *
  27663. * values(other);
  27664. * // => [3, 4]
  27665. *
  27666. * object.a = 2;
  27667. * values(object);
  27668. * // => [1, 2]
  27669. *
  27670. * // Modify the result cache.
  27671. * values.cache.set(object, ['a', 'b']);
  27672. * values(object);
  27673. * // => ['a', 'b']
  27674. *
  27675. * // Replace `_.memoize.Cache`.
  27676. * _.memoize.Cache = WeakMap;
  27677. */
  27678. function memoize(func, resolver) {
  27679. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27680. throw new TypeError(FUNC_ERROR_TEXT);
  27681. }
  27682. var memoized = function() {
  27683. var args = arguments,
  27684. key = resolver ? resolver.apply(this, args) : args[0],
  27685. cache = memoized.cache;
  27686. if (cache.has(key)) {
  27687. return cache.get(key);
  27688. }
  27689. var result = func.apply(this, args);
  27690. memoized.cache = cache.set(key, result) || cache;
  27691. return result;
  27692. };
  27693. memoized.cache = new (memoize.Cache || MapCache);
  27694. return memoized;
  27695. }
  27696. // Expose `MapCache`.
  27697. memoize.Cache = MapCache;
  27698. /**
  27699. * Creates a function that negates the result of the predicate `func`. The
  27700. * `func` predicate is invoked with the `this` binding and arguments of the
  27701. * created function.
  27702. *
  27703. * @static
  27704. * @memberOf _
  27705. * @since 3.0.0
  27706. * @category Function
  27707. * @param {Function} predicate The predicate to negate.
  27708. * @returns {Function} Returns the new negated function.
  27709. * @example
  27710. *
  27711. * function isEven(n) {
  27712. * return n % 2 == 0;
  27713. * }
  27714. *
  27715. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27716. * // => [1, 3, 5]
  27717. */
  27718. function negate(predicate) {
  27719. if (typeof predicate != 'function') {
  27720. throw new TypeError(FUNC_ERROR_TEXT);
  27721. }
  27722. return function() {
  27723. var args = arguments;
  27724. switch (args.length) {
  27725. case 0: return !predicate.call(this);
  27726. case 1: return !predicate.call(this, args[0]);
  27727. case 2: return !predicate.call(this, args[0], args[1]);
  27728. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27729. }
  27730. return !predicate.apply(this, args);
  27731. };
  27732. }
  27733. /**
  27734. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27735. * to the function return the value of the first invocation. The `func` is
  27736. * invoked with the `this` binding and arguments of the created function.
  27737. *
  27738. * @static
  27739. * @memberOf _
  27740. * @since 0.1.0
  27741. * @category Function
  27742. * @param {Function} func The function to restrict.
  27743. * @returns {Function} Returns the new restricted function.
  27744. * @example
  27745. *
  27746. * var initialize = _.once(createApplication);
  27747. * initialize();
  27748. * initialize();
  27749. * // => `createApplication` is invoked once
  27750. */
  27751. function once(func) {
  27752. return before(2, func);
  27753. }
  27754. /**
  27755. * Creates a function that invokes `func` with its arguments transformed.
  27756. *
  27757. * @static
  27758. * @since 4.0.0
  27759. * @memberOf _
  27760. * @category Function
  27761. * @param {Function} func The function to wrap.
  27762. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27763. * The argument transforms.
  27764. * @returns {Function} Returns the new function.
  27765. * @example
  27766. *
  27767. * function doubled(n) {
  27768. * return n * 2;
  27769. * }
  27770. *
  27771. * function square(n) {
  27772. * return n * n;
  27773. * }
  27774. *
  27775. * var func = _.overArgs(function(x, y) {
  27776. * return [x, y];
  27777. * }, [square, doubled]);
  27778. *
  27779. * func(9, 3);
  27780. * // => [81, 6]
  27781. *
  27782. * func(10, 5);
  27783. * // => [100, 10]
  27784. */
  27785. var overArgs = castRest(function(func, transforms) {
  27786. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27787. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27788. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27789. var funcsLength = transforms.length;
  27790. return baseRest(function(args) {
  27791. var index = -1,
  27792. length = nativeMin(args.length, funcsLength);
  27793. while (++index < length) {
  27794. args[index] = transforms[index].call(this, args[index]);
  27795. }
  27796. return apply(func, this, args);
  27797. });
  27798. });
  27799. /**
  27800. * Creates a function that invokes `func` with `partials` prepended to the
  27801. * arguments it receives. This method is like `_.bind` except it does **not**
  27802. * alter the `this` binding.
  27803. *
  27804. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27805. * builds, may be used as a placeholder for partially applied arguments.
  27806. *
  27807. * **Note:** This method doesn't set the "length" property of partially
  27808. * applied functions.
  27809. *
  27810. * @static
  27811. * @memberOf _
  27812. * @since 0.2.0
  27813. * @category Function
  27814. * @param {Function} func The function to partially apply arguments to.
  27815. * @param {...*} [partials] The arguments to be partially applied.
  27816. * @returns {Function} Returns the new partially applied function.
  27817. * @example
  27818. *
  27819. * function greet(greeting, name) {
  27820. * return greeting + ' ' + name;
  27821. * }
  27822. *
  27823. * var sayHelloTo = _.partial(greet, 'hello');
  27824. * sayHelloTo('fred');
  27825. * // => 'hello fred'
  27826. *
  27827. * // Partially applied with placeholders.
  27828. * var greetFred = _.partial(greet, _, 'fred');
  27829. * greetFred('hi');
  27830. * // => 'hi fred'
  27831. */
  27832. var partial = baseRest(function(func, partials) {
  27833. var holders = replaceHolders(partials, getHolder(partial));
  27834. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27835. });
  27836. /**
  27837. * This method is like `_.partial` except that partially applied arguments
  27838. * are appended to the arguments it receives.
  27839. *
  27840. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27841. * builds, may be used as a placeholder for partially applied arguments.
  27842. *
  27843. * **Note:** This method doesn't set the "length" property of partially
  27844. * applied functions.
  27845. *
  27846. * @static
  27847. * @memberOf _
  27848. * @since 1.0.0
  27849. * @category Function
  27850. * @param {Function} func The function to partially apply arguments to.
  27851. * @param {...*} [partials] The arguments to be partially applied.
  27852. * @returns {Function} Returns the new partially applied function.
  27853. * @example
  27854. *
  27855. * function greet(greeting, name) {
  27856. * return greeting + ' ' + name;
  27857. * }
  27858. *
  27859. * var greetFred = _.partialRight(greet, 'fred');
  27860. * greetFred('hi');
  27861. * // => 'hi fred'
  27862. *
  27863. * // Partially applied with placeholders.
  27864. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27865. * sayHelloTo('fred');
  27866. * // => 'hello fred'
  27867. */
  27868. var partialRight = baseRest(function(func, partials) {
  27869. var holders = replaceHolders(partials, getHolder(partialRight));
  27870. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27871. });
  27872. /**
  27873. * Creates a function that invokes `func` with arguments arranged according
  27874. * to the specified `indexes` where the argument value at the first index is
  27875. * provided as the first argument, the argument value at the second index is
  27876. * provided as the second argument, and so on.
  27877. *
  27878. * @static
  27879. * @memberOf _
  27880. * @since 3.0.0
  27881. * @category Function
  27882. * @param {Function} func The function to rearrange arguments for.
  27883. * @param {...(number|number[])} indexes The arranged argument indexes.
  27884. * @returns {Function} Returns the new function.
  27885. * @example
  27886. *
  27887. * var rearged = _.rearg(function(a, b, c) {
  27888. * return [a, b, c];
  27889. * }, [2, 0, 1]);
  27890. *
  27891. * rearged('b', 'c', 'a')
  27892. * // => ['a', 'b', 'c']
  27893. */
  27894. var rearg = flatRest(function(func, indexes) {
  27895. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27896. });
  27897. /**
  27898. * Creates a function that invokes `func` with the `this` binding of the
  27899. * created function and arguments from `start` and beyond provided as
  27900. * an array.
  27901. *
  27902. * **Note:** This method is based on the
  27903. * [rest parameter](https://mdn.io/rest_parameters).
  27904. *
  27905. * @static
  27906. * @memberOf _
  27907. * @since 4.0.0
  27908. * @category Function
  27909. * @param {Function} func The function to apply a rest parameter to.
  27910. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27911. * @returns {Function} Returns the new function.
  27912. * @example
  27913. *
  27914. * var say = _.rest(function(what, names) {
  27915. * return what + ' ' + _.initial(names).join(', ') +
  27916. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27917. * });
  27918. *
  27919. * say('hello', 'fred', 'barney', 'pebbles');
  27920. * // => 'hello fred, barney, & pebbles'
  27921. */
  27922. function rest(func, start) {
  27923. if (typeof func != 'function') {
  27924. throw new TypeError(FUNC_ERROR_TEXT);
  27925. }
  27926. start = start === undefined ? start : toInteger(start);
  27927. return baseRest(func, start);
  27928. }
  27929. /**
  27930. * Creates a function that invokes `func` with the `this` binding of the
  27931. * create function and an array of arguments much like
  27932. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27933. *
  27934. * **Note:** This method is based on the
  27935. * [spread operator](https://mdn.io/spread_operator).
  27936. *
  27937. * @static
  27938. * @memberOf _
  27939. * @since 3.2.0
  27940. * @category Function
  27941. * @param {Function} func The function to spread arguments over.
  27942. * @param {number} [start=0] The start position of the spread.
  27943. * @returns {Function} Returns the new function.
  27944. * @example
  27945. *
  27946. * var say = _.spread(function(who, what) {
  27947. * return who + ' says ' + what;
  27948. * });
  27949. *
  27950. * say(['fred', 'hello']);
  27951. * // => 'fred says hello'
  27952. *
  27953. * var numbers = Promise.all([
  27954. * Promise.resolve(40),
  27955. * Promise.resolve(36)
  27956. * ]);
  27957. *
  27958. * numbers.then(_.spread(function(x, y) {
  27959. * return x + y;
  27960. * }));
  27961. * // => a Promise of 76
  27962. */
  27963. function spread(func, start) {
  27964. if (typeof func != 'function') {
  27965. throw new TypeError(FUNC_ERROR_TEXT);
  27966. }
  27967. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27968. return baseRest(function(args) {
  27969. var array = args[start],
  27970. otherArgs = castSlice(args, 0, start);
  27971. if (array) {
  27972. arrayPush(otherArgs, array);
  27973. }
  27974. return apply(func, this, otherArgs);
  27975. });
  27976. }
  27977. /**
  27978. * Creates a throttled function that only invokes `func` at most once per
  27979. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27980. * method to cancel delayed `func` invocations and a `flush` method to
  27981. * immediately invoke them. Provide `options` to indicate whether `func`
  27982. * should be invoked on the leading and/or trailing edge of the `wait`
  27983. * timeout. The `func` is invoked with the last arguments provided to the
  27984. * throttled function. Subsequent calls to the throttled function return the
  27985. * result of the last `func` invocation.
  27986. *
  27987. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27988. * invoked on the trailing edge of the timeout only if the throttled function
  27989. * is invoked more than once during the `wait` timeout.
  27990. *
  27991. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27992. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27993. *
  27994. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27995. * for details over the differences between `_.throttle` and `_.debounce`.
  27996. *
  27997. * @static
  27998. * @memberOf _
  27999. * @since 0.1.0
  28000. * @category Function
  28001. * @param {Function} func The function to throttle.
  28002. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28003. * @param {Object} [options={}] The options object.
  28004. * @param {boolean} [options.leading=true]
  28005. * Specify invoking on the leading edge of the timeout.
  28006. * @param {boolean} [options.trailing=true]
  28007. * Specify invoking on the trailing edge of the timeout.
  28008. * @returns {Function} Returns the new throttled function.
  28009. * @example
  28010. *
  28011. * // Avoid excessively updating the position while scrolling.
  28012. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28013. *
  28014. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28015. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28016. * jQuery(element).on('click', throttled);
  28017. *
  28018. * // Cancel the trailing throttled invocation.
  28019. * jQuery(window).on('popstate', throttled.cancel);
  28020. */
  28021. function throttle(func, wait, options) {
  28022. var leading = true,
  28023. trailing = true;
  28024. if (typeof func != 'function') {
  28025. throw new TypeError(FUNC_ERROR_TEXT);
  28026. }
  28027. if (isObject(options)) {
  28028. leading = 'leading' in options ? !!options.leading : leading;
  28029. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28030. }
  28031. return debounce(func, wait, {
  28032. 'leading': leading,
  28033. 'maxWait': wait,
  28034. 'trailing': trailing
  28035. });
  28036. }
  28037. /**
  28038. * Creates a function that accepts up to one argument, ignoring any
  28039. * additional arguments.
  28040. *
  28041. * @static
  28042. * @memberOf _
  28043. * @since 4.0.0
  28044. * @category Function
  28045. * @param {Function} func The function to cap arguments for.
  28046. * @returns {Function} Returns the new capped function.
  28047. * @example
  28048. *
  28049. * _.map(['6', '8', '10'], _.unary(parseInt));
  28050. * // => [6, 8, 10]
  28051. */
  28052. function unary(func) {
  28053. return ary(func, 1);
  28054. }
  28055. /**
  28056. * Creates a function that provides `value` to `wrapper` as its first
  28057. * argument. Any additional arguments provided to the function are appended
  28058. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28059. * binding of the created function.
  28060. *
  28061. * @static
  28062. * @memberOf _
  28063. * @since 0.1.0
  28064. * @category Function
  28065. * @param {*} value The value to wrap.
  28066. * @param {Function} [wrapper=identity] The wrapper function.
  28067. * @returns {Function} Returns the new function.
  28068. * @example
  28069. *
  28070. * var p = _.wrap(_.escape, function(func, text) {
  28071. * return '<p>' + func(text) + '</p>';
  28072. * });
  28073. *
  28074. * p('fred, barney, & pebbles');
  28075. * // => '<p>fred, barney, &amp; pebbles</p>'
  28076. */
  28077. function wrap(value, wrapper) {
  28078. return partial(castFunction(wrapper), value);
  28079. }
  28080. /*------------------------------------------------------------------------*/
  28081. /**
  28082. * Casts `value` as an array if it's not one.
  28083. *
  28084. * @static
  28085. * @memberOf _
  28086. * @since 4.4.0
  28087. * @category Lang
  28088. * @param {*} value The value to inspect.
  28089. * @returns {Array} Returns the cast array.
  28090. * @example
  28091. *
  28092. * _.castArray(1);
  28093. * // => [1]
  28094. *
  28095. * _.castArray({ 'a': 1 });
  28096. * // => [{ 'a': 1 }]
  28097. *
  28098. * _.castArray('abc');
  28099. * // => ['abc']
  28100. *
  28101. * _.castArray(null);
  28102. * // => [null]
  28103. *
  28104. * _.castArray(undefined);
  28105. * // => [undefined]
  28106. *
  28107. * _.castArray();
  28108. * // => []
  28109. *
  28110. * var array = [1, 2, 3];
  28111. * console.log(_.castArray(array) === array);
  28112. * // => true
  28113. */
  28114. function castArray() {
  28115. if (!arguments.length) {
  28116. return [];
  28117. }
  28118. var value = arguments[0];
  28119. return isArray(value) ? value : [value];
  28120. }
  28121. /**
  28122. * Creates a shallow clone of `value`.
  28123. *
  28124. * **Note:** This method is loosely based on the
  28125. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28126. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28127. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28128. * arrays. The own enumerable properties of `arguments` objects are cloned
  28129. * as plain objects. An empty object is returned for uncloneable values such
  28130. * as error objects, functions, DOM nodes, and WeakMaps.
  28131. *
  28132. * @static
  28133. * @memberOf _
  28134. * @since 0.1.0
  28135. * @category Lang
  28136. * @param {*} value The value to clone.
  28137. * @returns {*} Returns the cloned value.
  28138. * @see _.cloneDeep
  28139. * @example
  28140. *
  28141. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28142. *
  28143. * var shallow = _.clone(objects);
  28144. * console.log(shallow[0] === objects[0]);
  28145. * // => true
  28146. */
  28147. function clone(value) {
  28148. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28149. }
  28150. /**
  28151. * This method is like `_.clone` except that it accepts `customizer` which
  28152. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28153. * cloning is handled by the method instead. The `customizer` is invoked with
  28154. * up to four arguments; (value [, index|key, object, stack]).
  28155. *
  28156. * @static
  28157. * @memberOf _
  28158. * @since 4.0.0
  28159. * @category Lang
  28160. * @param {*} value The value to clone.
  28161. * @param {Function} [customizer] The function to customize cloning.
  28162. * @returns {*} Returns the cloned value.
  28163. * @see _.cloneDeepWith
  28164. * @example
  28165. *
  28166. * function customizer(value) {
  28167. * if (_.isElement(value)) {
  28168. * return value.cloneNode(false);
  28169. * }
  28170. * }
  28171. *
  28172. * var el = _.cloneWith(document.body, customizer);
  28173. *
  28174. * console.log(el === document.body);
  28175. * // => false
  28176. * console.log(el.nodeName);
  28177. * // => 'BODY'
  28178. * console.log(el.childNodes.length);
  28179. * // => 0
  28180. */
  28181. function cloneWith(value, customizer) {
  28182. customizer = typeof customizer == 'function' ? customizer : undefined;
  28183. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28184. }
  28185. /**
  28186. * This method is like `_.clone` except that it recursively clones `value`.
  28187. *
  28188. * @static
  28189. * @memberOf _
  28190. * @since 1.0.0
  28191. * @category Lang
  28192. * @param {*} value The value to recursively clone.
  28193. * @returns {*} Returns the deep cloned value.
  28194. * @see _.clone
  28195. * @example
  28196. *
  28197. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28198. *
  28199. * var deep = _.cloneDeep(objects);
  28200. * console.log(deep[0] === objects[0]);
  28201. * // => false
  28202. */
  28203. function cloneDeep(value) {
  28204. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28205. }
  28206. /**
  28207. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28208. *
  28209. * @static
  28210. * @memberOf _
  28211. * @since 4.0.0
  28212. * @category Lang
  28213. * @param {*} value The value to recursively clone.
  28214. * @param {Function} [customizer] The function to customize cloning.
  28215. * @returns {*} Returns the deep cloned value.
  28216. * @see _.cloneWith
  28217. * @example
  28218. *
  28219. * function customizer(value) {
  28220. * if (_.isElement(value)) {
  28221. * return value.cloneNode(true);
  28222. * }
  28223. * }
  28224. *
  28225. * var el = _.cloneDeepWith(document.body, customizer);
  28226. *
  28227. * console.log(el === document.body);
  28228. * // => false
  28229. * console.log(el.nodeName);
  28230. * // => 'BODY'
  28231. * console.log(el.childNodes.length);
  28232. * // => 20
  28233. */
  28234. function cloneDeepWith(value, customizer) {
  28235. customizer = typeof customizer == 'function' ? customizer : undefined;
  28236. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28237. }
  28238. /**
  28239. * Checks if `object` conforms to `source` by invoking the predicate
  28240. * properties of `source` with the corresponding property values of `object`.
  28241. *
  28242. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28243. * partially applied.
  28244. *
  28245. * @static
  28246. * @memberOf _
  28247. * @since 4.14.0
  28248. * @category Lang
  28249. * @param {Object} object The object to inspect.
  28250. * @param {Object} source The object of property predicates to conform to.
  28251. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28252. * @example
  28253. *
  28254. * var object = { 'a': 1, 'b': 2 };
  28255. *
  28256. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28257. * // => true
  28258. *
  28259. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28260. * // => false
  28261. */
  28262. function conformsTo(object, source) {
  28263. return source == null || baseConformsTo(object, source, keys(source));
  28264. }
  28265. /**
  28266. * Performs a
  28267. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28268. * comparison between two values to determine if they are equivalent.
  28269. *
  28270. * @static
  28271. * @memberOf _
  28272. * @since 4.0.0
  28273. * @category Lang
  28274. * @param {*} value The value to compare.
  28275. * @param {*} other The other value to compare.
  28276. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28277. * @example
  28278. *
  28279. * var object = { 'a': 1 };
  28280. * var other = { 'a': 1 };
  28281. *
  28282. * _.eq(object, object);
  28283. * // => true
  28284. *
  28285. * _.eq(object, other);
  28286. * // => false
  28287. *
  28288. * _.eq('a', 'a');
  28289. * // => true
  28290. *
  28291. * _.eq('a', Object('a'));
  28292. * // => false
  28293. *
  28294. * _.eq(NaN, NaN);
  28295. * // => true
  28296. */
  28297. function eq(value, other) {
  28298. return value === other || (value !== value && other !== other);
  28299. }
  28300. /**
  28301. * Checks if `value` is greater than `other`.
  28302. *
  28303. * @static
  28304. * @memberOf _
  28305. * @since 3.9.0
  28306. * @category Lang
  28307. * @param {*} value The value to compare.
  28308. * @param {*} other The other value to compare.
  28309. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28310. * else `false`.
  28311. * @see _.lt
  28312. * @example
  28313. *
  28314. * _.gt(3, 1);
  28315. * // => true
  28316. *
  28317. * _.gt(3, 3);
  28318. * // => false
  28319. *
  28320. * _.gt(1, 3);
  28321. * // => false
  28322. */
  28323. var gt = createRelationalOperation(baseGt);
  28324. /**
  28325. * Checks if `value` is greater than or equal to `other`.
  28326. *
  28327. * @static
  28328. * @memberOf _
  28329. * @since 3.9.0
  28330. * @category Lang
  28331. * @param {*} value The value to compare.
  28332. * @param {*} other The other value to compare.
  28333. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28334. * `other`, else `false`.
  28335. * @see _.lte
  28336. * @example
  28337. *
  28338. * _.gte(3, 1);
  28339. * // => true
  28340. *
  28341. * _.gte(3, 3);
  28342. * // => true
  28343. *
  28344. * _.gte(1, 3);
  28345. * // => false
  28346. */
  28347. var gte = createRelationalOperation(function(value, other) {
  28348. return value >= other;
  28349. });
  28350. /**
  28351. * Checks if `value` is likely an `arguments` object.
  28352. *
  28353. * @static
  28354. * @memberOf _
  28355. * @since 0.1.0
  28356. * @category Lang
  28357. * @param {*} value The value to check.
  28358. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28359. * else `false`.
  28360. * @example
  28361. *
  28362. * _.isArguments(function() { return arguments; }());
  28363. * // => true
  28364. *
  28365. * _.isArguments([1, 2, 3]);
  28366. * // => false
  28367. */
  28368. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28369. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28370. !propertyIsEnumerable.call(value, 'callee');
  28371. };
  28372. /**
  28373. * Checks if `value` is classified as an `Array` object.
  28374. *
  28375. * @static
  28376. * @memberOf _
  28377. * @since 0.1.0
  28378. * @category Lang
  28379. * @param {*} value The value to check.
  28380. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28381. * @example
  28382. *
  28383. * _.isArray([1, 2, 3]);
  28384. * // => true
  28385. *
  28386. * _.isArray(document.body.children);
  28387. * // => false
  28388. *
  28389. * _.isArray('abc');
  28390. * // => false
  28391. *
  28392. * _.isArray(_.noop);
  28393. * // => false
  28394. */
  28395. var isArray = Array.isArray;
  28396. /**
  28397. * Checks if `value` is classified as an `ArrayBuffer` object.
  28398. *
  28399. * @static
  28400. * @memberOf _
  28401. * @since 4.3.0
  28402. * @category Lang
  28403. * @param {*} value The value to check.
  28404. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28405. * @example
  28406. *
  28407. * _.isArrayBuffer(new ArrayBuffer(2));
  28408. * // => true
  28409. *
  28410. * _.isArrayBuffer(new Array(2));
  28411. * // => false
  28412. */
  28413. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28414. /**
  28415. * Checks if `value` is array-like. A value is considered array-like if it's
  28416. * not a function and has a `value.length` that's an integer greater than or
  28417. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28418. *
  28419. * @static
  28420. * @memberOf _
  28421. * @since 4.0.0
  28422. * @category Lang
  28423. * @param {*} value The value to check.
  28424. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28425. * @example
  28426. *
  28427. * _.isArrayLike([1, 2, 3]);
  28428. * // => true
  28429. *
  28430. * _.isArrayLike(document.body.children);
  28431. * // => true
  28432. *
  28433. * _.isArrayLike('abc');
  28434. * // => true
  28435. *
  28436. * _.isArrayLike(_.noop);
  28437. * // => false
  28438. */
  28439. function isArrayLike(value) {
  28440. return value != null && isLength(value.length) && !isFunction(value);
  28441. }
  28442. /**
  28443. * This method is like `_.isArrayLike` except that it also checks if `value`
  28444. * is an object.
  28445. *
  28446. * @static
  28447. * @memberOf _
  28448. * @since 4.0.0
  28449. * @category Lang
  28450. * @param {*} value The value to check.
  28451. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28452. * else `false`.
  28453. * @example
  28454. *
  28455. * _.isArrayLikeObject([1, 2, 3]);
  28456. * // => true
  28457. *
  28458. * _.isArrayLikeObject(document.body.children);
  28459. * // => true
  28460. *
  28461. * _.isArrayLikeObject('abc');
  28462. * // => false
  28463. *
  28464. * _.isArrayLikeObject(_.noop);
  28465. * // => false
  28466. */
  28467. function isArrayLikeObject(value) {
  28468. return isObjectLike(value) && isArrayLike(value);
  28469. }
  28470. /**
  28471. * Checks if `value` is classified as a boolean primitive or object.
  28472. *
  28473. * @static
  28474. * @memberOf _
  28475. * @since 0.1.0
  28476. * @category Lang
  28477. * @param {*} value The value to check.
  28478. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28479. * @example
  28480. *
  28481. * _.isBoolean(false);
  28482. * // => true
  28483. *
  28484. * _.isBoolean(null);
  28485. * // => false
  28486. */
  28487. function isBoolean(value) {
  28488. return value === true || value === false ||
  28489. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28490. }
  28491. /**
  28492. * Checks if `value` is a buffer.
  28493. *
  28494. * @static
  28495. * @memberOf _
  28496. * @since 4.3.0
  28497. * @category Lang
  28498. * @param {*} value The value to check.
  28499. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28500. * @example
  28501. *
  28502. * _.isBuffer(new Buffer(2));
  28503. * // => true
  28504. *
  28505. * _.isBuffer(new Uint8Array(2));
  28506. * // => false
  28507. */
  28508. var isBuffer = nativeIsBuffer || stubFalse;
  28509. /**
  28510. * Checks if `value` is classified as a `Date` object.
  28511. *
  28512. * @static
  28513. * @memberOf _
  28514. * @since 0.1.0
  28515. * @category Lang
  28516. * @param {*} value The value to check.
  28517. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28518. * @example
  28519. *
  28520. * _.isDate(new Date);
  28521. * // => true
  28522. *
  28523. * _.isDate('Mon April 23 2012');
  28524. * // => false
  28525. */
  28526. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28527. /**
  28528. * Checks if `value` is likely a DOM element.
  28529. *
  28530. * @static
  28531. * @memberOf _
  28532. * @since 0.1.0
  28533. * @category Lang
  28534. * @param {*} value The value to check.
  28535. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28536. * @example
  28537. *
  28538. * _.isElement(document.body);
  28539. * // => true
  28540. *
  28541. * _.isElement('<body>');
  28542. * // => false
  28543. */
  28544. function isElement(value) {
  28545. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28546. }
  28547. /**
  28548. * Checks if `value` is an empty object, collection, map, or set.
  28549. *
  28550. * Objects are considered empty if they have no own enumerable string keyed
  28551. * properties.
  28552. *
  28553. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28554. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28555. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28556. *
  28557. * @static
  28558. * @memberOf _
  28559. * @since 0.1.0
  28560. * @category Lang
  28561. * @param {*} value The value to check.
  28562. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28563. * @example
  28564. *
  28565. * _.isEmpty(null);
  28566. * // => true
  28567. *
  28568. * _.isEmpty(true);
  28569. * // => true
  28570. *
  28571. * _.isEmpty(1);
  28572. * // => true
  28573. *
  28574. * _.isEmpty([1, 2, 3]);
  28575. * // => false
  28576. *
  28577. * _.isEmpty({ 'a': 1 });
  28578. * // => false
  28579. */
  28580. function isEmpty(value) {
  28581. if (value == null) {
  28582. return true;
  28583. }
  28584. if (isArrayLike(value) &&
  28585. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28586. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28587. return !value.length;
  28588. }
  28589. var tag = getTag(value);
  28590. if (tag == mapTag || tag == setTag) {
  28591. return !value.size;
  28592. }
  28593. if (isPrototype(value)) {
  28594. return !baseKeys(value).length;
  28595. }
  28596. for (var key in value) {
  28597. if (hasOwnProperty.call(value, key)) {
  28598. return false;
  28599. }
  28600. }
  28601. return true;
  28602. }
  28603. /**
  28604. * Performs a deep comparison between two values to determine if they are
  28605. * equivalent.
  28606. *
  28607. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28608. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28609. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28610. * by their own, not inherited, enumerable properties. Functions and DOM
  28611. * nodes are compared by strict equality, i.e. `===`.
  28612. *
  28613. * @static
  28614. * @memberOf _
  28615. * @since 0.1.0
  28616. * @category Lang
  28617. * @param {*} value The value to compare.
  28618. * @param {*} other The other value to compare.
  28619. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28620. * @example
  28621. *
  28622. * var object = { 'a': 1 };
  28623. * var other = { 'a': 1 };
  28624. *
  28625. * _.isEqual(object, other);
  28626. * // => true
  28627. *
  28628. * object === other;
  28629. * // => false
  28630. */
  28631. function isEqual(value, other) {
  28632. return baseIsEqual(value, other);
  28633. }
  28634. /**
  28635. * This method is like `_.isEqual` except that it accepts `customizer` which
  28636. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28637. * are handled by the method instead. The `customizer` is invoked with up to
  28638. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28639. *
  28640. * @static
  28641. * @memberOf _
  28642. * @since 4.0.0
  28643. * @category Lang
  28644. * @param {*} value The value to compare.
  28645. * @param {*} other The other value to compare.
  28646. * @param {Function} [customizer] The function to customize comparisons.
  28647. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28648. * @example
  28649. *
  28650. * function isGreeting(value) {
  28651. * return /^h(?:i|ello)$/.test(value);
  28652. * }
  28653. *
  28654. * function customizer(objValue, othValue) {
  28655. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28656. * return true;
  28657. * }
  28658. * }
  28659. *
  28660. * var array = ['hello', 'goodbye'];
  28661. * var other = ['hi', 'goodbye'];
  28662. *
  28663. * _.isEqualWith(array, other, customizer);
  28664. * // => true
  28665. */
  28666. function isEqualWith(value, other, customizer) {
  28667. customizer = typeof customizer == 'function' ? customizer : undefined;
  28668. var result = customizer ? customizer(value, other) : undefined;
  28669. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28670. }
  28671. /**
  28672. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28673. * `SyntaxError`, `TypeError`, or `URIError` object.
  28674. *
  28675. * @static
  28676. * @memberOf _
  28677. * @since 3.0.0
  28678. * @category Lang
  28679. * @param {*} value The value to check.
  28680. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28681. * @example
  28682. *
  28683. * _.isError(new Error);
  28684. * // => true
  28685. *
  28686. * _.isError(Error);
  28687. * // => false
  28688. */
  28689. function isError(value) {
  28690. if (!isObjectLike(value)) {
  28691. return false;
  28692. }
  28693. var tag = baseGetTag(value);
  28694. return tag == errorTag || tag == domExcTag ||
  28695. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28696. }
  28697. /**
  28698. * Checks if `value` is a finite primitive number.
  28699. *
  28700. * **Note:** This method is based on
  28701. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  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 finite number, else `false`.
  28709. * @example
  28710. *
  28711. * _.isFinite(3);
  28712. * // => true
  28713. *
  28714. * _.isFinite(Number.MIN_VALUE);
  28715. * // => true
  28716. *
  28717. * _.isFinite(Infinity);
  28718. * // => false
  28719. *
  28720. * _.isFinite('3');
  28721. * // => false
  28722. */
  28723. function isFinite(value) {
  28724. return typeof value == 'number' && nativeIsFinite(value);
  28725. }
  28726. /**
  28727. * Checks if `value` is classified as a `Function` object.
  28728. *
  28729. * @static
  28730. * @memberOf _
  28731. * @since 0.1.0
  28732. * @category Lang
  28733. * @param {*} value The value to check.
  28734. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28735. * @example
  28736. *
  28737. * _.isFunction(_);
  28738. * // => true
  28739. *
  28740. * _.isFunction(/abc/);
  28741. * // => false
  28742. */
  28743. function isFunction(value) {
  28744. if (!isObject(value)) {
  28745. return false;
  28746. }
  28747. // The use of `Object#toString` avoids issues with the `typeof` operator
  28748. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28749. var tag = baseGetTag(value);
  28750. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28751. }
  28752. /**
  28753. * Checks if `value` is an integer.
  28754. *
  28755. * **Note:** This method is based on
  28756. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28757. *
  28758. * @static
  28759. * @memberOf _
  28760. * @since 4.0.0
  28761. * @category Lang
  28762. * @param {*} value The value to check.
  28763. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28764. * @example
  28765. *
  28766. * _.isInteger(3);
  28767. * // => true
  28768. *
  28769. * _.isInteger(Number.MIN_VALUE);
  28770. * // => false
  28771. *
  28772. * _.isInteger(Infinity);
  28773. * // => false
  28774. *
  28775. * _.isInteger('3');
  28776. * // => false
  28777. */
  28778. function isInteger(value) {
  28779. return typeof value == 'number' && value == toInteger(value);
  28780. }
  28781. /**
  28782. * Checks if `value` is a valid array-like length.
  28783. *
  28784. * **Note:** This method is loosely based on
  28785. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28786. *
  28787. * @static
  28788. * @memberOf _
  28789. * @since 4.0.0
  28790. * @category Lang
  28791. * @param {*} value The value to check.
  28792. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28793. * @example
  28794. *
  28795. * _.isLength(3);
  28796. * // => true
  28797. *
  28798. * _.isLength(Number.MIN_VALUE);
  28799. * // => false
  28800. *
  28801. * _.isLength(Infinity);
  28802. * // => false
  28803. *
  28804. * _.isLength('3');
  28805. * // => false
  28806. */
  28807. function isLength(value) {
  28808. return typeof value == 'number' &&
  28809. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28810. }
  28811. /**
  28812. * Checks if `value` is the
  28813. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28814. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28815. *
  28816. * @static
  28817. * @memberOf _
  28818. * @since 0.1.0
  28819. * @category Lang
  28820. * @param {*} value The value to check.
  28821. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28822. * @example
  28823. *
  28824. * _.isObject({});
  28825. * // => true
  28826. *
  28827. * _.isObject([1, 2, 3]);
  28828. * // => true
  28829. *
  28830. * _.isObject(_.noop);
  28831. * // => true
  28832. *
  28833. * _.isObject(null);
  28834. * // => false
  28835. */
  28836. function isObject(value) {
  28837. var type = typeof value;
  28838. return value != null && (type == 'object' || type == 'function');
  28839. }
  28840. /**
  28841. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28842. * and has a `typeof` result of "object".
  28843. *
  28844. * @static
  28845. * @memberOf _
  28846. * @since 4.0.0
  28847. * @category Lang
  28848. * @param {*} value The value to check.
  28849. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28850. * @example
  28851. *
  28852. * _.isObjectLike({});
  28853. * // => true
  28854. *
  28855. * _.isObjectLike([1, 2, 3]);
  28856. * // => true
  28857. *
  28858. * _.isObjectLike(_.noop);
  28859. * // => false
  28860. *
  28861. * _.isObjectLike(null);
  28862. * // => false
  28863. */
  28864. function isObjectLike(value) {
  28865. return value != null && typeof value == 'object';
  28866. }
  28867. /**
  28868. * Checks if `value` is classified as a `Map` object.
  28869. *
  28870. * @static
  28871. * @memberOf _
  28872. * @since 4.3.0
  28873. * @category Lang
  28874. * @param {*} value The value to check.
  28875. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28876. * @example
  28877. *
  28878. * _.isMap(new Map);
  28879. * // => true
  28880. *
  28881. * _.isMap(new WeakMap);
  28882. * // => false
  28883. */
  28884. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28885. /**
  28886. * Performs a partial deep comparison between `object` and `source` to
  28887. * determine if `object` contains equivalent property values.
  28888. *
  28889. * **Note:** This method is equivalent to `_.matches` when `source` is
  28890. * partially applied.
  28891. *
  28892. * Partial comparisons will match empty array and empty object `source`
  28893. * values against any array or object value, respectively. See `_.isEqual`
  28894. * for a list of supported value comparisons.
  28895. *
  28896. * @static
  28897. * @memberOf _
  28898. * @since 3.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. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28903. * @example
  28904. *
  28905. * var object = { 'a': 1, 'b': 2 };
  28906. *
  28907. * _.isMatch(object, { 'b': 2 });
  28908. * // => true
  28909. *
  28910. * _.isMatch(object, { 'b': 1 });
  28911. * // => false
  28912. */
  28913. function isMatch(object, source) {
  28914. return object === source || baseIsMatch(object, source, getMatchData(source));
  28915. }
  28916. /**
  28917. * This method is like `_.isMatch` except that it accepts `customizer` which
  28918. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28919. * are handled by the method instead. The `customizer` is invoked with five
  28920. * arguments: (objValue, srcValue, index|key, object, source).
  28921. *
  28922. * @static
  28923. * @memberOf _
  28924. * @since 4.0.0
  28925. * @category Lang
  28926. * @param {Object} object The object to inspect.
  28927. * @param {Object} source The object of property values to match.
  28928. * @param {Function} [customizer] The function to customize comparisons.
  28929. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28930. * @example
  28931. *
  28932. * function isGreeting(value) {
  28933. * return /^h(?:i|ello)$/.test(value);
  28934. * }
  28935. *
  28936. * function customizer(objValue, srcValue) {
  28937. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28938. * return true;
  28939. * }
  28940. * }
  28941. *
  28942. * var object = { 'greeting': 'hello' };
  28943. * var source = { 'greeting': 'hi' };
  28944. *
  28945. * _.isMatchWith(object, source, customizer);
  28946. * // => true
  28947. */
  28948. function isMatchWith(object, source, customizer) {
  28949. customizer = typeof customizer == 'function' ? customizer : undefined;
  28950. return baseIsMatch(object, source, getMatchData(source), customizer);
  28951. }
  28952. /**
  28953. * Checks if `value` is `NaN`.
  28954. *
  28955. * **Note:** This method is based on
  28956. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28957. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28958. * `undefined` and other non-number values.
  28959. *
  28960. * @static
  28961. * @memberOf _
  28962. * @since 0.1.0
  28963. * @category Lang
  28964. * @param {*} value The value to check.
  28965. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28966. * @example
  28967. *
  28968. * _.isNaN(NaN);
  28969. * // => true
  28970. *
  28971. * _.isNaN(new Number(NaN));
  28972. * // => true
  28973. *
  28974. * isNaN(undefined);
  28975. * // => true
  28976. *
  28977. * _.isNaN(undefined);
  28978. * // => false
  28979. */
  28980. function isNaN(value) {
  28981. // An `NaN` primitive is the only value that is not equal to itself.
  28982. // Perform the `toStringTag` check first to avoid errors with some
  28983. // ActiveX objects in IE.
  28984. return isNumber(value) && value != +value;
  28985. }
  28986. /**
  28987. * Checks if `value` is a pristine native function.
  28988. *
  28989. * **Note:** This method can't reliably detect native functions in the presence
  28990. * of the core-js package because core-js circumvents this kind of detection.
  28991. * Despite multiple requests, the core-js maintainer has made it clear: any
  28992. * attempt to fix the detection will be obstructed. As a result, we're left
  28993. * with little choice but to throw an error. Unfortunately, this also affects
  28994. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  28995. * which rely on core-js.
  28996. *
  28997. * @static
  28998. * @memberOf _
  28999. * @since 3.0.0
  29000. * @category Lang
  29001. * @param {*} value The value to check.
  29002. * @returns {boolean} Returns `true` if `value` is a native function,
  29003. * else `false`.
  29004. * @example
  29005. *
  29006. * _.isNative(Array.prototype.push);
  29007. * // => true
  29008. *
  29009. * _.isNative(_);
  29010. * // => false
  29011. */
  29012. function isNative(value) {
  29013. if (isMaskable(value)) {
  29014. throw new Error(CORE_ERROR_TEXT);
  29015. }
  29016. return baseIsNative(value);
  29017. }
  29018. /**
  29019. * Checks if `value` is `null`.
  29020. *
  29021. * @static
  29022. * @memberOf _
  29023. * @since 0.1.0
  29024. * @category Lang
  29025. * @param {*} value The value to check.
  29026. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29027. * @example
  29028. *
  29029. * _.isNull(null);
  29030. * // => true
  29031. *
  29032. * _.isNull(void 0);
  29033. * // => false
  29034. */
  29035. function isNull(value) {
  29036. return value === null;
  29037. }
  29038. /**
  29039. * Checks if `value` is `null` or `undefined`.
  29040. *
  29041. * @static
  29042. * @memberOf _
  29043. * @since 4.0.0
  29044. * @category Lang
  29045. * @param {*} value The value to check.
  29046. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29047. * @example
  29048. *
  29049. * _.isNil(null);
  29050. * // => true
  29051. *
  29052. * _.isNil(void 0);
  29053. * // => true
  29054. *
  29055. * _.isNil(NaN);
  29056. * // => false
  29057. */
  29058. function isNil(value) {
  29059. return value == null;
  29060. }
  29061. /**
  29062. * Checks if `value` is classified as a `Number` primitive or object.
  29063. *
  29064. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29065. * classified as numbers, use the `_.isFinite` method.
  29066. *
  29067. * @static
  29068. * @memberOf _
  29069. * @since 0.1.0
  29070. * @category Lang
  29071. * @param {*} value The value to check.
  29072. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29073. * @example
  29074. *
  29075. * _.isNumber(3);
  29076. * // => true
  29077. *
  29078. * _.isNumber(Number.MIN_VALUE);
  29079. * // => true
  29080. *
  29081. * _.isNumber(Infinity);
  29082. * // => true
  29083. *
  29084. * _.isNumber('3');
  29085. * // => false
  29086. */
  29087. function isNumber(value) {
  29088. return typeof value == 'number' ||
  29089. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29090. }
  29091. /**
  29092. * Checks if `value` is a plain object, that is, an object created by the
  29093. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29094. *
  29095. * @static
  29096. * @memberOf _
  29097. * @since 0.8.0
  29098. * @category Lang
  29099. * @param {*} value The value to check.
  29100. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29101. * @example
  29102. *
  29103. * function Foo() {
  29104. * this.a = 1;
  29105. * }
  29106. *
  29107. * _.isPlainObject(new Foo);
  29108. * // => false
  29109. *
  29110. * _.isPlainObject([1, 2, 3]);
  29111. * // => false
  29112. *
  29113. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29114. * // => true
  29115. *
  29116. * _.isPlainObject(Object.create(null));
  29117. * // => true
  29118. */
  29119. function isPlainObject(value) {
  29120. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29121. return false;
  29122. }
  29123. var proto = getPrototype(value);
  29124. if (proto === null) {
  29125. return true;
  29126. }
  29127. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29128. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29129. funcToString.call(Ctor) == objectCtorString;
  29130. }
  29131. /**
  29132. * Checks if `value` is classified as a `RegExp` object.
  29133. *
  29134. * @static
  29135. * @memberOf _
  29136. * @since 0.1.0
  29137. * @category Lang
  29138. * @param {*} value The value to check.
  29139. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29140. * @example
  29141. *
  29142. * _.isRegExp(/abc/);
  29143. * // => true
  29144. *
  29145. * _.isRegExp('/abc/');
  29146. * // => false
  29147. */
  29148. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29149. /**
  29150. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29151. * double precision number which isn't the result of a rounded unsafe integer.
  29152. *
  29153. * **Note:** This method is based on
  29154. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29155. *
  29156. * @static
  29157. * @memberOf _
  29158. * @since 4.0.0
  29159. * @category Lang
  29160. * @param {*} value The value to check.
  29161. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29162. * @example
  29163. *
  29164. * _.isSafeInteger(3);
  29165. * // => true
  29166. *
  29167. * _.isSafeInteger(Number.MIN_VALUE);
  29168. * // => false
  29169. *
  29170. * _.isSafeInteger(Infinity);
  29171. * // => false
  29172. *
  29173. * _.isSafeInteger('3');
  29174. * // => false
  29175. */
  29176. function isSafeInteger(value) {
  29177. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29178. }
  29179. /**
  29180. * Checks if `value` is classified as a `Set` object.
  29181. *
  29182. * @static
  29183. * @memberOf _
  29184. * @since 4.3.0
  29185. * @category Lang
  29186. * @param {*} value The value to check.
  29187. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29188. * @example
  29189. *
  29190. * _.isSet(new Set);
  29191. * // => true
  29192. *
  29193. * _.isSet(new WeakSet);
  29194. * // => false
  29195. */
  29196. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29197. /**
  29198. * Checks if `value` is classified as a `String` primitive or object.
  29199. *
  29200. * @static
  29201. * @since 0.1.0
  29202. * @memberOf _
  29203. * @category Lang
  29204. * @param {*} value The value to check.
  29205. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29206. * @example
  29207. *
  29208. * _.isString('abc');
  29209. * // => true
  29210. *
  29211. * _.isString(1);
  29212. * // => false
  29213. */
  29214. function isString(value) {
  29215. return typeof value == 'string' ||
  29216. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29217. }
  29218. /**
  29219. * Checks if `value` is classified as a `Symbol` primitive or object.
  29220. *
  29221. * @static
  29222. * @memberOf _
  29223. * @since 4.0.0
  29224. * @category Lang
  29225. * @param {*} value The value to check.
  29226. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29227. * @example
  29228. *
  29229. * _.isSymbol(Symbol.iterator);
  29230. * // => true
  29231. *
  29232. * _.isSymbol('abc');
  29233. * // => false
  29234. */
  29235. function isSymbol(value) {
  29236. return typeof value == 'symbol' ||
  29237. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29238. }
  29239. /**
  29240. * Checks if `value` is classified as a typed array.
  29241. *
  29242. * @static
  29243. * @memberOf _
  29244. * @since 3.0.0
  29245. * @category Lang
  29246. * @param {*} value The value to check.
  29247. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29248. * @example
  29249. *
  29250. * _.isTypedArray(new Uint8Array);
  29251. * // => true
  29252. *
  29253. * _.isTypedArray([]);
  29254. * // => false
  29255. */
  29256. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29257. /**
  29258. * Checks if `value` is `undefined`.
  29259. *
  29260. * @static
  29261. * @since 0.1.0
  29262. * @memberOf _
  29263. * @category Lang
  29264. * @param {*} value The value to check.
  29265. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29266. * @example
  29267. *
  29268. * _.isUndefined(void 0);
  29269. * // => true
  29270. *
  29271. * _.isUndefined(null);
  29272. * // => false
  29273. */
  29274. function isUndefined(value) {
  29275. return value === undefined;
  29276. }
  29277. /**
  29278. * Checks if `value` is classified as a `WeakMap` object.
  29279. *
  29280. * @static
  29281. * @memberOf _
  29282. * @since 4.3.0
  29283. * @category Lang
  29284. * @param {*} value The value to check.
  29285. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29286. * @example
  29287. *
  29288. * _.isWeakMap(new WeakMap);
  29289. * // => true
  29290. *
  29291. * _.isWeakMap(new Map);
  29292. * // => false
  29293. */
  29294. function isWeakMap(value) {
  29295. return isObjectLike(value) && getTag(value) == weakMapTag;
  29296. }
  29297. /**
  29298. * Checks if `value` is classified as a `WeakSet` object.
  29299. *
  29300. * @static
  29301. * @memberOf _
  29302. * @since 4.3.0
  29303. * @category Lang
  29304. * @param {*} value The value to check.
  29305. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29306. * @example
  29307. *
  29308. * _.isWeakSet(new WeakSet);
  29309. * // => true
  29310. *
  29311. * _.isWeakSet(new Set);
  29312. * // => false
  29313. */
  29314. function isWeakSet(value) {
  29315. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29316. }
  29317. /**
  29318. * Checks if `value` is less than `other`.
  29319. *
  29320. * @static
  29321. * @memberOf _
  29322. * @since 3.9.0
  29323. * @category Lang
  29324. * @param {*} value The value to compare.
  29325. * @param {*} other The other value to compare.
  29326. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29327. * else `false`.
  29328. * @see _.gt
  29329. * @example
  29330. *
  29331. * _.lt(1, 3);
  29332. * // => true
  29333. *
  29334. * _.lt(3, 3);
  29335. * // => false
  29336. *
  29337. * _.lt(3, 1);
  29338. * // => false
  29339. */
  29340. var lt = createRelationalOperation(baseLt);
  29341. /**
  29342. * Checks if `value` is less than or equal to `other`.
  29343. *
  29344. * @static
  29345. * @memberOf _
  29346. * @since 3.9.0
  29347. * @category Lang
  29348. * @param {*} value The value to compare.
  29349. * @param {*} other The other value to compare.
  29350. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29351. * `other`, else `false`.
  29352. * @see _.gte
  29353. * @example
  29354. *
  29355. * _.lte(1, 3);
  29356. * // => true
  29357. *
  29358. * _.lte(3, 3);
  29359. * // => true
  29360. *
  29361. * _.lte(3, 1);
  29362. * // => false
  29363. */
  29364. var lte = createRelationalOperation(function(value, other) {
  29365. return value <= other;
  29366. });
  29367. /**
  29368. * Converts `value` to an array.
  29369. *
  29370. * @static
  29371. * @since 0.1.0
  29372. * @memberOf _
  29373. * @category Lang
  29374. * @param {*} value The value to convert.
  29375. * @returns {Array} Returns the converted array.
  29376. * @example
  29377. *
  29378. * _.toArray({ 'a': 1, 'b': 2 });
  29379. * // => [1, 2]
  29380. *
  29381. * _.toArray('abc');
  29382. * // => ['a', 'b', 'c']
  29383. *
  29384. * _.toArray(1);
  29385. * // => []
  29386. *
  29387. * _.toArray(null);
  29388. * // => []
  29389. */
  29390. function toArray(value) {
  29391. if (!value) {
  29392. return [];
  29393. }
  29394. if (isArrayLike(value)) {
  29395. return isString(value) ? stringToArray(value) : copyArray(value);
  29396. }
  29397. if (symIterator && value[symIterator]) {
  29398. return iteratorToArray(value[symIterator]());
  29399. }
  29400. var tag = getTag(value),
  29401. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29402. return func(value);
  29403. }
  29404. /**
  29405. * Converts `value` to a finite number.
  29406. *
  29407. * @static
  29408. * @memberOf _
  29409. * @since 4.12.0
  29410. * @category Lang
  29411. * @param {*} value The value to convert.
  29412. * @returns {number} Returns the converted number.
  29413. * @example
  29414. *
  29415. * _.toFinite(3.2);
  29416. * // => 3.2
  29417. *
  29418. * _.toFinite(Number.MIN_VALUE);
  29419. * // => 5e-324
  29420. *
  29421. * _.toFinite(Infinity);
  29422. * // => 1.7976931348623157e+308
  29423. *
  29424. * _.toFinite('3.2');
  29425. * // => 3.2
  29426. */
  29427. function toFinite(value) {
  29428. if (!value) {
  29429. return value === 0 ? value : 0;
  29430. }
  29431. value = toNumber(value);
  29432. if (value === INFINITY || value === -INFINITY) {
  29433. var sign = (value < 0 ? -1 : 1);
  29434. return sign * MAX_INTEGER;
  29435. }
  29436. return value === value ? value : 0;
  29437. }
  29438. /**
  29439. * Converts `value` to an integer.
  29440. *
  29441. * **Note:** This method is loosely based on
  29442. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29443. *
  29444. * @static
  29445. * @memberOf _
  29446. * @since 4.0.0
  29447. * @category Lang
  29448. * @param {*} value The value to convert.
  29449. * @returns {number} Returns the converted integer.
  29450. * @example
  29451. *
  29452. * _.toInteger(3.2);
  29453. * // => 3
  29454. *
  29455. * _.toInteger(Number.MIN_VALUE);
  29456. * // => 0
  29457. *
  29458. * _.toInteger(Infinity);
  29459. * // => 1.7976931348623157e+308
  29460. *
  29461. * _.toInteger('3.2');
  29462. * // => 3
  29463. */
  29464. function toInteger(value) {
  29465. var result = toFinite(value),
  29466. remainder = result % 1;
  29467. return result === result ? (remainder ? result - remainder : result) : 0;
  29468. }
  29469. /**
  29470. * Converts `value` to an integer suitable for use as the length of an
  29471. * array-like object.
  29472. *
  29473. * **Note:** This method is based on
  29474. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29475. *
  29476. * @static
  29477. * @memberOf _
  29478. * @since 4.0.0
  29479. * @category Lang
  29480. * @param {*} value The value to convert.
  29481. * @returns {number} Returns the converted integer.
  29482. * @example
  29483. *
  29484. * _.toLength(3.2);
  29485. * // => 3
  29486. *
  29487. * _.toLength(Number.MIN_VALUE);
  29488. * // => 0
  29489. *
  29490. * _.toLength(Infinity);
  29491. * // => 4294967295
  29492. *
  29493. * _.toLength('3.2');
  29494. * // => 3
  29495. */
  29496. function toLength(value) {
  29497. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29498. }
  29499. /**
  29500. * Converts `value` to a number.
  29501. *
  29502. * @static
  29503. * @memberOf _
  29504. * @since 4.0.0
  29505. * @category Lang
  29506. * @param {*} value The value to process.
  29507. * @returns {number} Returns the number.
  29508. * @example
  29509. *
  29510. * _.toNumber(3.2);
  29511. * // => 3.2
  29512. *
  29513. * _.toNumber(Number.MIN_VALUE);
  29514. * // => 5e-324
  29515. *
  29516. * _.toNumber(Infinity);
  29517. * // => Infinity
  29518. *
  29519. * _.toNumber('3.2');
  29520. * // => 3.2
  29521. */
  29522. function toNumber(value) {
  29523. if (typeof value == 'number') {
  29524. return value;
  29525. }
  29526. if (isSymbol(value)) {
  29527. return NAN;
  29528. }
  29529. if (isObject(value)) {
  29530. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29531. value = isObject(other) ? (other + '') : other;
  29532. }
  29533. if (typeof value != 'string') {
  29534. return value === 0 ? value : +value;
  29535. }
  29536. value = value.replace(reTrim, '');
  29537. var isBinary = reIsBinary.test(value);
  29538. return (isBinary || reIsOctal.test(value))
  29539. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29540. : (reIsBadHex.test(value) ? NAN : +value);
  29541. }
  29542. /**
  29543. * Converts `value` to a plain object flattening inherited enumerable string
  29544. * keyed properties of `value` to own properties of the plain object.
  29545. *
  29546. * @static
  29547. * @memberOf _
  29548. * @since 3.0.0
  29549. * @category Lang
  29550. * @param {*} value The value to convert.
  29551. * @returns {Object} Returns the converted plain object.
  29552. * @example
  29553. *
  29554. * function Foo() {
  29555. * this.b = 2;
  29556. * }
  29557. *
  29558. * Foo.prototype.c = 3;
  29559. *
  29560. * _.assign({ 'a': 1 }, new Foo);
  29561. * // => { 'a': 1, 'b': 2 }
  29562. *
  29563. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29564. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29565. */
  29566. function toPlainObject(value) {
  29567. return copyObject(value, keysIn(value));
  29568. }
  29569. /**
  29570. * Converts `value` to a safe integer. A safe integer can be compared and
  29571. * represented correctly.
  29572. *
  29573. * @static
  29574. * @memberOf _
  29575. * @since 4.0.0
  29576. * @category Lang
  29577. * @param {*} value The value to convert.
  29578. * @returns {number} Returns the converted integer.
  29579. * @example
  29580. *
  29581. * _.toSafeInteger(3.2);
  29582. * // => 3
  29583. *
  29584. * _.toSafeInteger(Number.MIN_VALUE);
  29585. * // => 0
  29586. *
  29587. * _.toSafeInteger(Infinity);
  29588. * // => 9007199254740991
  29589. *
  29590. * _.toSafeInteger('3.2');
  29591. * // => 3
  29592. */
  29593. function toSafeInteger(value) {
  29594. return value
  29595. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29596. : (value === 0 ? value : 0);
  29597. }
  29598. /**
  29599. * Converts `value` to a string. An empty string is returned for `null`
  29600. * and `undefined` values. The sign of `-0` is preserved.
  29601. *
  29602. * @static
  29603. * @memberOf _
  29604. * @since 4.0.0
  29605. * @category Lang
  29606. * @param {*} value The value to convert.
  29607. * @returns {string} Returns the converted string.
  29608. * @example
  29609. *
  29610. * _.toString(null);
  29611. * // => ''
  29612. *
  29613. * _.toString(-0);
  29614. * // => '-0'
  29615. *
  29616. * _.toString([1, 2, 3]);
  29617. * // => '1,2,3'
  29618. */
  29619. function toString(value) {
  29620. return value == null ? '' : baseToString(value);
  29621. }
  29622. /*------------------------------------------------------------------------*/
  29623. /**
  29624. * Assigns own enumerable string keyed properties of source objects to the
  29625. * destination object. Source objects are applied from left to right.
  29626. * Subsequent sources overwrite property assignments of previous sources.
  29627. *
  29628. * **Note:** This method mutates `object` and is loosely based on
  29629. * [`Object.assign`](https://mdn.io/Object/assign).
  29630. *
  29631. * @static
  29632. * @memberOf _
  29633. * @since 0.10.0
  29634. * @category Object
  29635. * @param {Object} object The destination object.
  29636. * @param {...Object} [sources] The source objects.
  29637. * @returns {Object} Returns `object`.
  29638. * @see _.assignIn
  29639. * @example
  29640. *
  29641. * function Foo() {
  29642. * this.a = 1;
  29643. * }
  29644. *
  29645. * function Bar() {
  29646. * this.c = 3;
  29647. * }
  29648. *
  29649. * Foo.prototype.b = 2;
  29650. * Bar.prototype.d = 4;
  29651. *
  29652. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29653. * // => { 'a': 1, 'c': 3 }
  29654. */
  29655. var assign = createAssigner(function(object, source) {
  29656. if (isPrototype(source) || isArrayLike(source)) {
  29657. copyObject(source, keys(source), object);
  29658. return;
  29659. }
  29660. for (var key in source) {
  29661. if (hasOwnProperty.call(source, key)) {
  29662. assignValue(object, key, source[key]);
  29663. }
  29664. }
  29665. });
  29666. /**
  29667. * This method is like `_.assign` except that it iterates over own and
  29668. * inherited source properties.
  29669. *
  29670. * **Note:** This method mutates `object`.
  29671. *
  29672. * @static
  29673. * @memberOf _
  29674. * @since 4.0.0
  29675. * @alias extend
  29676. * @category Object
  29677. * @param {Object} object The destination object.
  29678. * @param {...Object} [sources] The source objects.
  29679. * @returns {Object} Returns `object`.
  29680. * @see _.assign
  29681. * @example
  29682. *
  29683. * function Foo() {
  29684. * this.a = 1;
  29685. * }
  29686. *
  29687. * function Bar() {
  29688. * this.c = 3;
  29689. * }
  29690. *
  29691. * Foo.prototype.b = 2;
  29692. * Bar.prototype.d = 4;
  29693. *
  29694. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29695. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29696. */
  29697. var assignIn = createAssigner(function(object, source) {
  29698. copyObject(source, keysIn(source), object);
  29699. });
  29700. /**
  29701. * This method is like `_.assignIn` except that it accepts `customizer`
  29702. * which is invoked to produce the assigned values. If `customizer` returns
  29703. * `undefined`, assignment is handled by the method instead. The `customizer`
  29704. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29705. *
  29706. * **Note:** This method mutates `object`.
  29707. *
  29708. * @static
  29709. * @memberOf _
  29710. * @since 4.0.0
  29711. * @alias extendWith
  29712. * @category Object
  29713. * @param {Object} object The destination object.
  29714. * @param {...Object} sources The source objects.
  29715. * @param {Function} [customizer] The function to customize assigned values.
  29716. * @returns {Object} Returns `object`.
  29717. * @see _.assignWith
  29718. * @example
  29719. *
  29720. * function customizer(objValue, srcValue) {
  29721. * return _.isUndefined(objValue) ? srcValue : objValue;
  29722. * }
  29723. *
  29724. * var defaults = _.partialRight(_.assignInWith, customizer);
  29725. *
  29726. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29727. * // => { 'a': 1, 'b': 2 }
  29728. */
  29729. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29730. copyObject(source, keysIn(source), object, customizer);
  29731. });
  29732. /**
  29733. * This method is like `_.assign` except that it accepts `customizer`
  29734. * which is invoked to produce the assigned values. If `customizer` returns
  29735. * `undefined`, assignment is handled by the method instead. The `customizer`
  29736. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29737. *
  29738. * **Note:** This method mutates `object`.
  29739. *
  29740. * @static
  29741. * @memberOf _
  29742. * @since 4.0.0
  29743. * @category Object
  29744. * @param {Object} object The destination object.
  29745. * @param {...Object} sources The source objects.
  29746. * @param {Function} [customizer] The function to customize assigned values.
  29747. * @returns {Object} Returns `object`.
  29748. * @see _.assignInWith
  29749. * @example
  29750. *
  29751. * function customizer(objValue, srcValue) {
  29752. * return _.isUndefined(objValue) ? srcValue : objValue;
  29753. * }
  29754. *
  29755. * var defaults = _.partialRight(_.assignWith, customizer);
  29756. *
  29757. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29758. * // => { 'a': 1, 'b': 2 }
  29759. */
  29760. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29761. copyObject(source, keys(source), object, customizer);
  29762. });
  29763. /**
  29764. * Creates an array of values corresponding to `paths` of `object`.
  29765. *
  29766. * @static
  29767. * @memberOf _
  29768. * @since 1.0.0
  29769. * @category Object
  29770. * @param {Object} object The object to iterate over.
  29771. * @param {...(string|string[])} [paths] The property paths to pick.
  29772. * @returns {Array} Returns the picked values.
  29773. * @example
  29774. *
  29775. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29776. *
  29777. * _.at(object, ['a[0].b.c', 'a[1]']);
  29778. * // => [3, 4]
  29779. */
  29780. var at = flatRest(baseAt);
  29781. /**
  29782. * Creates an object that inherits from the `prototype` object. If a
  29783. * `properties` object is given, its own enumerable string keyed properties
  29784. * are assigned to the created object.
  29785. *
  29786. * @static
  29787. * @memberOf _
  29788. * @since 2.3.0
  29789. * @category Object
  29790. * @param {Object} prototype The object to inherit from.
  29791. * @param {Object} [properties] The properties to assign to the object.
  29792. * @returns {Object} Returns the new object.
  29793. * @example
  29794. *
  29795. * function Shape() {
  29796. * this.x = 0;
  29797. * this.y = 0;
  29798. * }
  29799. *
  29800. * function Circle() {
  29801. * Shape.call(this);
  29802. * }
  29803. *
  29804. * Circle.prototype = _.create(Shape.prototype, {
  29805. * 'constructor': Circle
  29806. * });
  29807. *
  29808. * var circle = new Circle;
  29809. * circle instanceof Circle;
  29810. * // => true
  29811. *
  29812. * circle instanceof Shape;
  29813. * // => true
  29814. */
  29815. function create(prototype, properties) {
  29816. var result = baseCreate(prototype);
  29817. return properties == null ? result : baseAssign(result, properties);
  29818. }
  29819. /**
  29820. * Assigns own and inherited enumerable string keyed properties of source
  29821. * objects to the destination object for all destination properties that
  29822. * resolve to `undefined`. Source objects are applied from left to right.
  29823. * Once a property is set, additional values of the same property are ignored.
  29824. *
  29825. * **Note:** This method mutates `object`.
  29826. *
  29827. * @static
  29828. * @since 0.1.0
  29829. * @memberOf _
  29830. * @category Object
  29831. * @param {Object} object The destination object.
  29832. * @param {...Object} [sources] The source objects.
  29833. * @returns {Object} Returns `object`.
  29834. * @see _.defaultsDeep
  29835. * @example
  29836. *
  29837. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29838. * // => { 'a': 1, 'b': 2 }
  29839. */
  29840. var defaults = baseRest(function(object, sources) {
  29841. object = Object(object);
  29842. var index = -1;
  29843. var length = sources.length;
  29844. var guard = length > 2 ? sources[2] : undefined;
  29845. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29846. length = 1;
  29847. }
  29848. while (++index < length) {
  29849. var source = sources[index];
  29850. var props = keysIn(source);
  29851. var propsIndex = -1;
  29852. var propsLength = props.length;
  29853. while (++propsIndex < propsLength) {
  29854. var key = props[propsIndex];
  29855. var value = object[key];
  29856. if (value === undefined ||
  29857. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29858. object[key] = source[key];
  29859. }
  29860. }
  29861. }
  29862. return object;
  29863. });
  29864. /**
  29865. * This method is like `_.defaults` except that it recursively assigns
  29866. * default properties.
  29867. *
  29868. * **Note:** This method mutates `object`.
  29869. *
  29870. * @static
  29871. * @memberOf _
  29872. * @since 3.10.0
  29873. * @category Object
  29874. * @param {Object} object The destination object.
  29875. * @param {...Object} [sources] The source objects.
  29876. * @returns {Object} Returns `object`.
  29877. * @see _.defaults
  29878. * @example
  29879. *
  29880. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29881. * // => { 'a': { 'b': 2, 'c': 3 } }
  29882. */
  29883. var defaultsDeep = baseRest(function(args) {
  29884. args.push(undefined, customDefaultsMerge);
  29885. return apply(mergeWith, undefined, args);
  29886. });
  29887. /**
  29888. * This method is like `_.find` except that it returns the key of the first
  29889. * element `predicate` returns truthy for instead of the element itself.
  29890. *
  29891. * @static
  29892. * @memberOf _
  29893. * @since 1.1.0
  29894. * @category Object
  29895. * @param {Object} object The object to inspect.
  29896. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29897. * @returns {string|undefined} Returns the key of the matched element,
  29898. * else `undefined`.
  29899. * @example
  29900. *
  29901. * var users = {
  29902. * 'barney': { 'age': 36, 'active': true },
  29903. * 'fred': { 'age': 40, 'active': false },
  29904. * 'pebbles': { 'age': 1, 'active': true }
  29905. * };
  29906. *
  29907. * _.findKey(users, function(o) { return o.age < 40; });
  29908. * // => 'barney' (iteration order is not guaranteed)
  29909. *
  29910. * // The `_.matches` iteratee shorthand.
  29911. * _.findKey(users, { 'age': 1, 'active': true });
  29912. * // => 'pebbles'
  29913. *
  29914. * // The `_.matchesProperty` iteratee shorthand.
  29915. * _.findKey(users, ['active', false]);
  29916. * // => 'fred'
  29917. *
  29918. * // The `_.property` iteratee shorthand.
  29919. * _.findKey(users, 'active');
  29920. * // => 'barney'
  29921. */
  29922. function findKey(object, predicate) {
  29923. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29924. }
  29925. /**
  29926. * This method is like `_.findKey` except that it iterates over elements of
  29927. * a collection in the opposite order.
  29928. *
  29929. * @static
  29930. * @memberOf _
  29931. * @since 2.0.0
  29932. * @category Object
  29933. * @param {Object} object The object to inspect.
  29934. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29935. * @returns {string|undefined} Returns the key of the matched element,
  29936. * else `undefined`.
  29937. * @example
  29938. *
  29939. * var users = {
  29940. * 'barney': { 'age': 36, 'active': true },
  29941. * 'fred': { 'age': 40, 'active': false },
  29942. * 'pebbles': { 'age': 1, 'active': true }
  29943. * };
  29944. *
  29945. * _.findLastKey(users, function(o) { return o.age < 40; });
  29946. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29947. *
  29948. * // The `_.matches` iteratee shorthand.
  29949. * _.findLastKey(users, { 'age': 36, 'active': true });
  29950. * // => 'barney'
  29951. *
  29952. * // The `_.matchesProperty` iteratee shorthand.
  29953. * _.findLastKey(users, ['active', false]);
  29954. * // => 'fred'
  29955. *
  29956. * // The `_.property` iteratee shorthand.
  29957. * _.findLastKey(users, 'active');
  29958. * // => 'pebbles'
  29959. */
  29960. function findLastKey(object, predicate) {
  29961. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29962. }
  29963. /**
  29964. * Iterates over own and inherited enumerable string keyed properties of an
  29965. * object and invokes `iteratee` for each property. The iteratee is invoked
  29966. * with three arguments: (value, key, object). Iteratee functions may exit
  29967. * iteration early by explicitly returning `false`.
  29968. *
  29969. * @static
  29970. * @memberOf _
  29971. * @since 0.3.0
  29972. * @category Object
  29973. * @param {Object} object The object to iterate over.
  29974. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29975. * @returns {Object} Returns `object`.
  29976. * @see _.forInRight
  29977. * @example
  29978. *
  29979. * function Foo() {
  29980. * this.a = 1;
  29981. * this.b = 2;
  29982. * }
  29983. *
  29984. * Foo.prototype.c = 3;
  29985. *
  29986. * _.forIn(new Foo, function(value, key) {
  29987. * console.log(key);
  29988. * });
  29989. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29990. */
  29991. function forIn(object, iteratee) {
  29992. return object == null
  29993. ? object
  29994. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  29995. }
  29996. /**
  29997. * This method is like `_.forIn` except that it iterates over properties of
  29998. * `object` in the opposite order.
  29999. *
  30000. * @static
  30001. * @memberOf _
  30002. * @since 2.0.0
  30003. * @category Object
  30004. * @param {Object} object The object to iterate over.
  30005. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30006. * @returns {Object} Returns `object`.
  30007. * @see _.forIn
  30008. * @example
  30009. *
  30010. * function Foo() {
  30011. * this.a = 1;
  30012. * this.b = 2;
  30013. * }
  30014. *
  30015. * Foo.prototype.c = 3;
  30016. *
  30017. * _.forInRight(new Foo, function(value, key) {
  30018. * console.log(key);
  30019. * });
  30020. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30021. */
  30022. function forInRight(object, iteratee) {
  30023. return object == null
  30024. ? object
  30025. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30026. }
  30027. /**
  30028. * Iterates over own enumerable string keyed properties of an object and
  30029. * invokes `iteratee` for each property. The iteratee is invoked with three
  30030. * arguments: (value, key, object). Iteratee functions may exit iteration
  30031. * early by explicitly returning `false`.
  30032. *
  30033. * @static
  30034. * @memberOf _
  30035. * @since 0.3.0
  30036. * @category Object
  30037. * @param {Object} object The object to iterate over.
  30038. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30039. * @returns {Object} Returns `object`.
  30040. * @see _.forOwnRight
  30041. * @example
  30042. *
  30043. * function Foo() {
  30044. * this.a = 1;
  30045. * this.b = 2;
  30046. * }
  30047. *
  30048. * Foo.prototype.c = 3;
  30049. *
  30050. * _.forOwn(new Foo, function(value, key) {
  30051. * console.log(key);
  30052. * });
  30053. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30054. */
  30055. function forOwn(object, iteratee) {
  30056. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30057. }
  30058. /**
  30059. * This method is like `_.forOwn` except that it iterates over properties of
  30060. * `object` in the opposite order.
  30061. *
  30062. * @static
  30063. * @memberOf _
  30064. * @since 2.0.0
  30065. * @category Object
  30066. * @param {Object} object The object to iterate over.
  30067. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30068. * @returns {Object} Returns `object`.
  30069. * @see _.forOwn
  30070. * @example
  30071. *
  30072. * function Foo() {
  30073. * this.a = 1;
  30074. * this.b = 2;
  30075. * }
  30076. *
  30077. * Foo.prototype.c = 3;
  30078. *
  30079. * _.forOwnRight(new Foo, function(value, key) {
  30080. * console.log(key);
  30081. * });
  30082. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30083. */
  30084. function forOwnRight(object, iteratee) {
  30085. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30086. }
  30087. /**
  30088. * Creates an array of function property names from own enumerable properties
  30089. * of `object`.
  30090. *
  30091. * @static
  30092. * @since 0.1.0
  30093. * @memberOf _
  30094. * @category Object
  30095. * @param {Object} object The object to inspect.
  30096. * @returns {Array} Returns the function names.
  30097. * @see _.functionsIn
  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. * _.functions(new Foo);
  30108. * // => ['a', 'b']
  30109. */
  30110. function functions(object) {
  30111. return object == null ? [] : baseFunctions(object, keys(object));
  30112. }
  30113. /**
  30114. * Creates an array of function property names from own and inherited
  30115. * enumerable properties of `object`.
  30116. *
  30117. * @static
  30118. * @memberOf _
  30119. * @since 4.0.0
  30120. * @category Object
  30121. * @param {Object} object The object to inspect.
  30122. * @returns {Array} Returns the function names.
  30123. * @see _.functions
  30124. * @example
  30125. *
  30126. * function Foo() {
  30127. * this.a = _.constant('a');
  30128. * this.b = _.constant('b');
  30129. * }
  30130. *
  30131. * Foo.prototype.c = _.constant('c');
  30132. *
  30133. * _.functionsIn(new Foo);
  30134. * // => ['a', 'b', 'c']
  30135. */
  30136. function functionsIn(object) {
  30137. return object == null ? [] : baseFunctions(object, keysIn(object));
  30138. }
  30139. /**
  30140. * Gets the value at `path` of `object`. If the resolved value is
  30141. * `undefined`, the `defaultValue` is returned in its place.
  30142. *
  30143. * @static
  30144. * @memberOf _
  30145. * @since 3.7.0
  30146. * @category Object
  30147. * @param {Object} object The object to query.
  30148. * @param {Array|string} path The path of the property to get.
  30149. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30150. * @returns {*} Returns the resolved value.
  30151. * @example
  30152. *
  30153. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30154. *
  30155. * _.get(object, 'a[0].b.c');
  30156. * // => 3
  30157. *
  30158. * _.get(object, ['a', '0', 'b', 'c']);
  30159. * // => 3
  30160. *
  30161. * _.get(object, 'a.b.c', 'default');
  30162. * // => 'default'
  30163. */
  30164. function get(object, path, defaultValue) {
  30165. var result = object == null ? undefined : baseGet(object, path);
  30166. return result === undefined ? defaultValue : result;
  30167. }
  30168. /**
  30169. * Checks if `path` is a direct property of `object`.
  30170. *
  30171. * @static
  30172. * @since 0.1.0
  30173. * @memberOf _
  30174. * @category Object
  30175. * @param {Object} object The object to query.
  30176. * @param {Array|string} path The path to check.
  30177. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30178. * @example
  30179. *
  30180. * var object = { 'a': { 'b': 2 } };
  30181. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30182. *
  30183. * _.has(object, 'a');
  30184. * // => true
  30185. *
  30186. * _.has(object, 'a.b');
  30187. * // => true
  30188. *
  30189. * _.has(object, ['a', 'b']);
  30190. * // => true
  30191. *
  30192. * _.has(other, 'a');
  30193. * // => false
  30194. */
  30195. function has(object, path) {
  30196. return object != null && hasPath(object, path, baseHas);
  30197. }
  30198. /**
  30199. * Checks if `path` is a direct or inherited property of `object`.
  30200. *
  30201. * @static
  30202. * @memberOf _
  30203. * @since 4.0.0
  30204. * @category Object
  30205. * @param {Object} object The object to query.
  30206. * @param {Array|string} path The path to check.
  30207. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30208. * @example
  30209. *
  30210. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30211. *
  30212. * _.hasIn(object, 'a');
  30213. * // => true
  30214. *
  30215. * _.hasIn(object, 'a.b');
  30216. * // => true
  30217. *
  30218. * _.hasIn(object, ['a', 'b']);
  30219. * // => true
  30220. *
  30221. * _.hasIn(object, 'b');
  30222. * // => false
  30223. */
  30224. function hasIn(object, path) {
  30225. return object != null && hasPath(object, path, baseHasIn);
  30226. }
  30227. /**
  30228. * Creates an object composed of the inverted keys and values of `object`.
  30229. * If `object` contains duplicate values, subsequent values overwrite
  30230. * property assignments of previous values.
  30231. *
  30232. * @static
  30233. * @memberOf _
  30234. * @since 0.7.0
  30235. * @category Object
  30236. * @param {Object} object The object to invert.
  30237. * @returns {Object} Returns the new inverted object.
  30238. * @example
  30239. *
  30240. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30241. *
  30242. * _.invert(object);
  30243. * // => { '1': 'c', '2': 'b' }
  30244. */
  30245. var invert = createInverter(function(result, value, key) {
  30246. if (value != null &&
  30247. typeof value.toString != 'function') {
  30248. value = nativeObjectToString.call(value);
  30249. }
  30250. result[value] = key;
  30251. }, constant(identity));
  30252. /**
  30253. * This method is like `_.invert` except that the inverted object is generated
  30254. * from the results of running each element of `object` thru `iteratee`. The
  30255. * corresponding inverted value of each inverted key is an array of keys
  30256. * responsible for generating the inverted value. The iteratee is invoked
  30257. * with one argument: (value).
  30258. *
  30259. * @static
  30260. * @memberOf _
  30261. * @since 4.1.0
  30262. * @category Object
  30263. * @param {Object} object The object to invert.
  30264. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30265. * @returns {Object} Returns the new inverted object.
  30266. * @example
  30267. *
  30268. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30269. *
  30270. * _.invertBy(object);
  30271. * // => { '1': ['a', 'c'], '2': ['b'] }
  30272. *
  30273. * _.invertBy(object, function(value) {
  30274. * return 'group' + value;
  30275. * });
  30276. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30277. */
  30278. var invertBy = createInverter(function(result, value, key) {
  30279. if (value != null &&
  30280. typeof value.toString != 'function') {
  30281. value = nativeObjectToString.call(value);
  30282. }
  30283. if (hasOwnProperty.call(result, value)) {
  30284. result[value].push(key);
  30285. } else {
  30286. result[value] = [key];
  30287. }
  30288. }, getIteratee);
  30289. /**
  30290. * Invokes the method at `path` of `object`.
  30291. *
  30292. * @static
  30293. * @memberOf _
  30294. * @since 4.0.0
  30295. * @category Object
  30296. * @param {Object} object The object to query.
  30297. * @param {Array|string} path The path of the method to invoke.
  30298. * @param {...*} [args] The arguments to invoke the method with.
  30299. * @returns {*} Returns the result of the invoked method.
  30300. * @example
  30301. *
  30302. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30303. *
  30304. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30305. * // => [2, 3]
  30306. */
  30307. var invoke = baseRest(baseInvoke);
  30308. /**
  30309. * Creates an array of the own enumerable property names of `object`.
  30310. *
  30311. * **Note:** Non-object values are coerced to objects. See the
  30312. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30313. * for more details.
  30314. *
  30315. * @static
  30316. * @since 0.1.0
  30317. * @memberOf _
  30318. * @category Object
  30319. * @param {Object} object The object to query.
  30320. * @returns {Array} Returns the array of property names.
  30321. * @example
  30322. *
  30323. * function Foo() {
  30324. * this.a = 1;
  30325. * this.b = 2;
  30326. * }
  30327. *
  30328. * Foo.prototype.c = 3;
  30329. *
  30330. * _.keys(new Foo);
  30331. * // => ['a', 'b'] (iteration order is not guaranteed)
  30332. *
  30333. * _.keys('hi');
  30334. * // => ['0', '1']
  30335. */
  30336. function keys(object) {
  30337. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30338. }
  30339. /**
  30340. * Creates an array of the own and inherited enumerable property names of `object`.
  30341. *
  30342. * **Note:** Non-object values are coerced to objects.
  30343. *
  30344. * @static
  30345. * @memberOf _
  30346. * @since 3.0.0
  30347. * @category Object
  30348. * @param {Object} object The object to query.
  30349. * @returns {Array} Returns the array of property names.
  30350. * @example
  30351. *
  30352. * function Foo() {
  30353. * this.a = 1;
  30354. * this.b = 2;
  30355. * }
  30356. *
  30357. * Foo.prototype.c = 3;
  30358. *
  30359. * _.keysIn(new Foo);
  30360. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30361. */
  30362. function keysIn(object) {
  30363. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30364. }
  30365. /**
  30366. * The opposite of `_.mapValues`; this method creates an object with the
  30367. * same values as `object` and keys generated by running each own enumerable
  30368. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30369. * with three arguments: (value, key, object).
  30370. *
  30371. * @static
  30372. * @memberOf _
  30373. * @since 3.8.0
  30374. * @category Object
  30375. * @param {Object} object The object to iterate over.
  30376. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30377. * @returns {Object} Returns the new mapped object.
  30378. * @see _.mapValues
  30379. * @example
  30380. *
  30381. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30382. * return key + value;
  30383. * });
  30384. * // => { 'a1': 1, 'b2': 2 }
  30385. */
  30386. function mapKeys(object, iteratee) {
  30387. var result = {};
  30388. iteratee = getIteratee(iteratee, 3);
  30389. baseForOwn(object, function(value, key, object) {
  30390. baseAssignValue(result, iteratee(value, key, object), value);
  30391. });
  30392. return result;
  30393. }
  30394. /**
  30395. * Creates an object with the same keys as `object` and values generated
  30396. * by running each own enumerable string keyed property of `object` thru
  30397. * `iteratee`. The iteratee is invoked with three arguments:
  30398. * (value, key, object).
  30399. *
  30400. * @static
  30401. * @memberOf _
  30402. * @since 2.4.0
  30403. * @category Object
  30404. * @param {Object} object The object to iterate over.
  30405. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30406. * @returns {Object} Returns the new mapped object.
  30407. * @see _.mapKeys
  30408. * @example
  30409. *
  30410. * var users = {
  30411. * 'fred': { 'user': 'fred', 'age': 40 },
  30412. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30413. * };
  30414. *
  30415. * _.mapValues(users, function(o) { return o.age; });
  30416. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30417. *
  30418. * // The `_.property` iteratee shorthand.
  30419. * _.mapValues(users, 'age');
  30420. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30421. */
  30422. function mapValues(object, iteratee) {
  30423. var result = {};
  30424. iteratee = getIteratee(iteratee, 3);
  30425. baseForOwn(object, function(value, key, object) {
  30426. baseAssignValue(result, key, iteratee(value, key, object));
  30427. });
  30428. return result;
  30429. }
  30430. /**
  30431. * This method is like `_.assign` except that it recursively merges own and
  30432. * inherited enumerable string keyed properties of source objects into the
  30433. * destination object. Source properties that resolve to `undefined` are
  30434. * skipped if a destination value exists. Array and plain object properties
  30435. * are merged recursively. Other objects and value types are overridden by
  30436. * assignment. Source objects are applied from left to right. Subsequent
  30437. * sources overwrite property assignments of previous sources.
  30438. *
  30439. * **Note:** This method mutates `object`.
  30440. *
  30441. * @static
  30442. * @memberOf _
  30443. * @since 0.5.0
  30444. * @category Object
  30445. * @param {Object} object The destination object.
  30446. * @param {...Object} [sources] The source objects.
  30447. * @returns {Object} Returns `object`.
  30448. * @example
  30449. *
  30450. * var object = {
  30451. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30452. * };
  30453. *
  30454. * var other = {
  30455. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30456. * };
  30457. *
  30458. * _.merge(object, other);
  30459. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30460. */
  30461. var merge = createAssigner(function(object, source, srcIndex) {
  30462. baseMerge(object, source, srcIndex);
  30463. });
  30464. /**
  30465. * This method is like `_.merge` except that it accepts `customizer` which
  30466. * is invoked to produce the merged values of the destination and source
  30467. * properties. If `customizer` returns `undefined`, merging is handled by the
  30468. * method instead. The `customizer` is invoked with six arguments:
  30469. * (objValue, srcValue, key, object, source, stack).
  30470. *
  30471. * **Note:** This method mutates `object`.
  30472. *
  30473. * @static
  30474. * @memberOf _
  30475. * @since 4.0.0
  30476. * @category Object
  30477. * @param {Object} object The destination object.
  30478. * @param {...Object} sources The source objects.
  30479. * @param {Function} customizer The function to customize assigned values.
  30480. * @returns {Object} Returns `object`.
  30481. * @example
  30482. *
  30483. * function customizer(objValue, srcValue) {
  30484. * if (_.isArray(objValue)) {
  30485. * return objValue.concat(srcValue);
  30486. * }
  30487. * }
  30488. *
  30489. * var object = { 'a': [1], 'b': [2] };
  30490. * var other = { 'a': [3], 'b': [4] };
  30491. *
  30492. * _.mergeWith(object, other, customizer);
  30493. * // => { 'a': [1, 3], 'b': [2, 4] }
  30494. */
  30495. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30496. baseMerge(object, source, srcIndex, customizer);
  30497. });
  30498. /**
  30499. * The opposite of `_.pick`; this method creates an object composed of the
  30500. * own and inherited enumerable property paths of `object` that are not omitted.
  30501. *
  30502. * **Note:** This method is considerably slower than `_.pick`.
  30503. *
  30504. * @static
  30505. * @since 0.1.0
  30506. * @memberOf _
  30507. * @category Object
  30508. * @param {Object} object The source object.
  30509. * @param {...(string|string[])} [paths] The property paths to omit.
  30510. * @returns {Object} Returns the new object.
  30511. * @example
  30512. *
  30513. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30514. *
  30515. * _.omit(object, ['a', 'c']);
  30516. * // => { 'b': '2' }
  30517. */
  30518. var omit = flatRest(function(object, paths) {
  30519. var result = {};
  30520. if (object == null) {
  30521. return result;
  30522. }
  30523. var isDeep = false;
  30524. paths = arrayMap(paths, function(path) {
  30525. path = castPath(path, object);
  30526. isDeep || (isDeep = path.length > 1);
  30527. return path;
  30528. });
  30529. copyObject(object, getAllKeysIn(object), result);
  30530. if (isDeep) {
  30531. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30532. }
  30533. var length = paths.length;
  30534. while (length--) {
  30535. baseUnset(result, paths[length]);
  30536. }
  30537. return result;
  30538. });
  30539. /**
  30540. * The opposite of `_.pickBy`; this method creates an object composed of
  30541. * the own and inherited enumerable string keyed properties of `object` that
  30542. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30543. * arguments: (value, key).
  30544. *
  30545. * @static
  30546. * @memberOf _
  30547. * @since 4.0.0
  30548. * @category Object
  30549. * @param {Object} object The source object.
  30550. * @param {Function} [predicate=_.identity] The function invoked per property.
  30551. * @returns {Object} Returns the new object.
  30552. * @example
  30553. *
  30554. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30555. *
  30556. * _.omitBy(object, _.isNumber);
  30557. * // => { 'b': '2' }
  30558. */
  30559. function omitBy(object, predicate) {
  30560. return pickBy(object, negate(getIteratee(predicate)));
  30561. }
  30562. /**
  30563. * Creates an object composed of the picked `object` properties.
  30564. *
  30565. * @static
  30566. * @since 0.1.0
  30567. * @memberOf _
  30568. * @category Object
  30569. * @param {Object} object The source object.
  30570. * @param {...(string|string[])} [paths] The property paths to pick.
  30571. * @returns {Object} Returns the new object.
  30572. * @example
  30573. *
  30574. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30575. *
  30576. * _.pick(object, ['a', 'c']);
  30577. * // => { 'a': 1, 'c': 3 }
  30578. */
  30579. var pick = flatRest(function(object, paths) {
  30580. return object == null ? {} : basePick(object, paths);
  30581. });
  30582. /**
  30583. * Creates an object composed of the `object` properties `predicate` returns
  30584. * truthy for. The predicate is invoked with two arguments: (value, key).
  30585. *
  30586. * @static
  30587. * @memberOf _
  30588. * @since 4.0.0
  30589. * @category Object
  30590. * @param {Object} object The source object.
  30591. * @param {Function} [predicate=_.identity] The function invoked per property.
  30592. * @returns {Object} Returns the new object.
  30593. * @example
  30594. *
  30595. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30596. *
  30597. * _.pickBy(object, _.isNumber);
  30598. * // => { 'a': 1, 'c': 3 }
  30599. */
  30600. function pickBy(object, predicate) {
  30601. if (object == null) {
  30602. return {};
  30603. }
  30604. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30605. return [prop];
  30606. });
  30607. predicate = getIteratee(predicate);
  30608. return basePickBy(object, props, function(value, path) {
  30609. return predicate(value, path[0]);
  30610. });
  30611. }
  30612. /**
  30613. * This method is like `_.get` except that if the resolved value is a
  30614. * function it's invoked with the `this` binding of its parent object and
  30615. * its result is returned.
  30616. *
  30617. * @static
  30618. * @since 0.1.0
  30619. * @memberOf _
  30620. * @category Object
  30621. * @param {Object} object The object to query.
  30622. * @param {Array|string} path The path of the property to resolve.
  30623. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30624. * @returns {*} Returns the resolved value.
  30625. * @example
  30626. *
  30627. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30628. *
  30629. * _.result(object, 'a[0].b.c1');
  30630. * // => 3
  30631. *
  30632. * _.result(object, 'a[0].b.c2');
  30633. * // => 4
  30634. *
  30635. * _.result(object, 'a[0].b.c3', 'default');
  30636. * // => 'default'
  30637. *
  30638. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30639. * // => 'default'
  30640. */
  30641. function result(object, path, defaultValue) {
  30642. path = castPath(path, object);
  30643. var index = -1,
  30644. length = path.length;
  30645. // Ensure the loop is entered when path is empty.
  30646. if (!length) {
  30647. length = 1;
  30648. object = undefined;
  30649. }
  30650. while (++index < length) {
  30651. var value = object == null ? undefined : object[toKey(path[index])];
  30652. if (value === undefined) {
  30653. index = length;
  30654. value = defaultValue;
  30655. }
  30656. object = isFunction(value) ? value.call(object) : value;
  30657. }
  30658. return object;
  30659. }
  30660. /**
  30661. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30662. * it's created. Arrays are created for missing index properties while objects
  30663. * are created for all other missing properties. Use `_.setWith` to customize
  30664. * `path` creation.
  30665. *
  30666. * **Note:** This method mutates `object`.
  30667. *
  30668. * @static
  30669. * @memberOf _
  30670. * @since 3.7.0
  30671. * @category Object
  30672. * @param {Object} object The object to modify.
  30673. * @param {Array|string} path The path of the property to set.
  30674. * @param {*} value The value to set.
  30675. * @returns {Object} Returns `object`.
  30676. * @example
  30677. *
  30678. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30679. *
  30680. * _.set(object, 'a[0].b.c', 4);
  30681. * console.log(object.a[0].b.c);
  30682. * // => 4
  30683. *
  30684. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30685. * console.log(object.x[0].y.z);
  30686. * // => 5
  30687. */
  30688. function set(object, path, value) {
  30689. return object == null ? object : baseSet(object, path, value);
  30690. }
  30691. /**
  30692. * This method is like `_.set` except that it accepts `customizer` which is
  30693. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30694. * path creation is handled by the method instead. The `customizer` is invoked
  30695. * with three arguments: (nsValue, key, nsObject).
  30696. *
  30697. * **Note:** This method mutates `object`.
  30698. *
  30699. * @static
  30700. * @memberOf _
  30701. * @since 4.0.0
  30702. * @category Object
  30703. * @param {Object} object The object to modify.
  30704. * @param {Array|string} path The path of the property to set.
  30705. * @param {*} value The value to set.
  30706. * @param {Function} [customizer] The function to customize assigned values.
  30707. * @returns {Object} Returns `object`.
  30708. * @example
  30709. *
  30710. * var object = {};
  30711. *
  30712. * _.setWith(object, '[0][1]', 'a', Object);
  30713. * // => { '0': { '1': 'a' } }
  30714. */
  30715. function setWith(object, path, value, customizer) {
  30716. customizer = typeof customizer == 'function' ? customizer : undefined;
  30717. return object == null ? object : baseSet(object, path, value, customizer);
  30718. }
  30719. /**
  30720. * Creates an array of own enumerable string keyed-value pairs for `object`
  30721. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30722. * entries are returned.
  30723. *
  30724. * @static
  30725. * @memberOf _
  30726. * @since 4.0.0
  30727. * @alias entries
  30728. * @category Object
  30729. * @param {Object} object The object to query.
  30730. * @returns {Array} Returns the key-value pairs.
  30731. * @example
  30732. *
  30733. * function Foo() {
  30734. * this.a = 1;
  30735. * this.b = 2;
  30736. * }
  30737. *
  30738. * Foo.prototype.c = 3;
  30739. *
  30740. * _.toPairs(new Foo);
  30741. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30742. */
  30743. var toPairs = createToPairs(keys);
  30744. /**
  30745. * Creates an array of own and inherited enumerable string keyed-value pairs
  30746. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30747. * or set, its entries are returned.
  30748. *
  30749. * @static
  30750. * @memberOf _
  30751. * @since 4.0.0
  30752. * @alias entriesIn
  30753. * @category Object
  30754. * @param {Object} object The object to query.
  30755. * @returns {Array} Returns the key-value pairs.
  30756. * @example
  30757. *
  30758. * function Foo() {
  30759. * this.a = 1;
  30760. * this.b = 2;
  30761. * }
  30762. *
  30763. * Foo.prototype.c = 3;
  30764. *
  30765. * _.toPairsIn(new Foo);
  30766. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30767. */
  30768. var toPairsIn = createToPairs(keysIn);
  30769. /**
  30770. * An alternative to `_.reduce`; this method transforms `object` to a new
  30771. * `accumulator` object which is the result of running each of its own
  30772. * enumerable string keyed properties thru `iteratee`, with each invocation
  30773. * potentially mutating the `accumulator` object. If `accumulator` is not
  30774. * provided, a new object with the same `[[Prototype]]` will be used. The
  30775. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30776. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30777. *
  30778. * @static
  30779. * @memberOf _
  30780. * @since 1.3.0
  30781. * @category Object
  30782. * @param {Object} object The object to iterate over.
  30783. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30784. * @param {*} [accumulator] The custom accumulator value.
  30785. * @returns {*} Returns the accumulated value.
  30786. * @example
  30787. *
  30788. * _.transform([2, 3, 4], function(result, n) {
  30789. * result.push(n *= n);
  30790. * return n % 2 == 0;
  30791. * }, []);
  30792. * // => [4, 9]
  30793. *
  30794. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30795. * (result[value] || (result[value] = [])).push(key);
  30796. * }, {});
  30797. * // => { '1': ['a', 'c'], '2': ['b'] }
  30798. */
  30799. function transform(object, iteratee, accumulator) {
  30800. var isArr = isArray(object),
  30801. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30802. iteratee = getIteratee(iteratee, 4);
  30803. if (accumulator == null) {
  30804. var Ctor = object && object.constructor;
  30805. if (isArrLike) {
  30806. accumulator = isArr ? new Ctor : [];
  30807. }
  30808. else if (isObject(object)) {
  30809. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30810. }
  30811. else {
  30812. accumulator = {};
  30813. }
  30814. }
  30815. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30816. return iteratee(accumulator, value, index, object);
  30817. });
  30818. return accumulator;
  30819. }
  30820. /**
  30821. * Removes the property at `path` of `object`.
  30822. *
  30823. * **Note:** This method mutates `object`.
  30824. *
  30825. * @static
  30826. * @memberOf _
  30827. * @since 4.0.0
  30828. * @category Object
  30829. * @param {Object} object The object to modify.
  30830. * @param {Array|string} path The path of the property to unset.
  30831. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30832. * @example
  30833. *
  30834. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30835. * _.unset(object, 'a[0].b.c');
  30836. * // => true
  30837. *
  30838. * console.log(object);
  30839. * // => { 'a': [{ 'b': {} }] };
  30840. *
  30841. * _.unset(object, ['a', '0', 'b', 'c']);
  30842. * // => true
  30843. *
  30844. * console.log(object);
  30845. * // => { 'a': [{ 'b': {} }] };
  30846. */
  30847. function unset(object, path) {
  30848. return object == null ? true : baseUnset(object, path);
  30849. }
  30850. /**
  30851. * This method is like `_.set` except that accepts `updater` to produce the
  30852. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30853. * is invoked with one argument: (value).
  30854. *
  30855. * **Note:** This method mutates `object`.
  30856. *
  30857. * @static
  30858. * @memberOf _
  30859. * @since 4.6.0
  30860. * @category Object
  30861. * @param {Object} object The object to modify.
  30862. * @param {Array|string} path The path of the property to set.
  30863. * @param {Function} updater The function to produce the updated value.
  30864. * @returns {Object} Returns `object`.
  30865. * @example
  30866. *
  30867. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30868. *
  30869. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30870. * console.log(object.a[0].b.c);
  30871. * // => 9
  30872. *
  30873. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30874. * console.log(object.x[0].y.z);
  30875. * // => 0
  30876. */
  30877. function update(object, path, updater) {
  30878. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30879. }
  30880. /**
  30881. * This method is like `_.update` except that it accepts `customizer` which is
  30882. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30883. * path creation is handled by the method instead. The `customizer` is invoked
  30884. * with three arguments: (nsValue, key, nsObject).
  30885. *
  30886. * **Note:** This method mutates `object`.
  30887. *
  30888. * @static
  30889. * @memberOf _
  30890. * @since 4.6.0
  30891. * @category Object
  30892. * @param {Object} object The object to modify.
  30893. * @param {Array|string} path The path of the property to set.
  30894. * @param {Function} updater The function to produce the updated value.
  30895. * @param {Function} [customizer] The function to customize assigned values.
  30896. * @returns {Object} Returns `object`.
  30897. * @example
  30898. *
  30899. * var object = {};
  30900. *
  30901. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30902. * // => { '0': { '1': 'a' } }
  30903. */
  30904. function updateWith(object, path, updater, customizer) {
  30905. customizer = typeof customizer == 'function' ? customizer : undefined;
  30906. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30907. }
  30908. /**
  30909. * Creates an array of the own enumerable string keyed property values of `object`.
  30910. *
  30911. * **Note:** Non-object values are coerced to objects.
  30912. *
  30913. * @static
  30914. * @since 0.1.0
  30915. * @memberOf _
  30916. * @category Object
  30917. * @param {Object} object The object to query.
  30918. * @returns {Array} Returns the array of property values.
  30919. * @example
  30920. *
  30921. * function Foo() {
  30922. * this.a = 1;
  30923. * this.b = 2;
  30924. * }
  30925. *
  30926. * Foo.prototype.c = 3;
  30927. *
  30928. * _.values(new Foo);
  30929. * // => [1, 2] (iteration order is not guaranteed)
  30930. *
  30931. * _.values('hi');
  30932. * // => ['h', 'i']
  30933. */
  30934. function values(object) {
  30935. return object == null ? [] : baseValues(object, keys(object));
  30936. }
  30937. /**
  30938. * Creates an array of the own and inherited enumerable string keyed property
  30939. * values of `object`.
  30940. *
  30941. * **Note:** Non-object values are coerced to objects.
  30942. *
  30943. * @static
  30944. * @memberOf _
  30945. * @since 3.0.0
  30946. * @category Object
  30947. * @param {Object} object The object to query.
  30948. * @returns {Array} Returns the array of property values.
  30949. * @example
  30950. *
  30951. * function Foo() {
  30952. * this.a = 1;
  30953. * this.b = 2;
  30954. * }
  30955. *
  30956. * Foo.prototype.c = 3;
  30957. *
  30958. * _.valuesIn(new Foo);
  30959. * // => [1, 2, 3] (iteration order is not guaranteed)
  30960. */
  30961. function valuesIn(object) {
  30962. return object == null ? [] : baseValues(object, keysIn(object));
  30963. }
  30964. /*------------------------------------------------------------------------*/
  30965. /**
  30966. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30967. *
  30968. * @static
  30969. * @memberOf _
  30970. * @since 4.0.0
  30971. * @category Number
  30972. * @param {number} number The number to clamp.
  30973. * @param {number} [lower] The lower bound.
  30974. * @param {number} upper The upper bound.
  30975. * @returns {number} Returns the clamped number.
  30976. * @example
  30977. *
  30978. * _.clamp(-10, -5, 5);
  30979. * // => -5
  30980. *
  30981. * _.clamp(10, -5, 5);
  30982. * // => 5
  30983. */
  30984. function clamp(number, lower, upper) {
  30985. if (upper === undefined) {
  30986. upper = lower;
  30987. lower = undefined;
  30988. }
  30989. if (upper !== undefined) {
  30990. upper = toNumber(upper);
  30991. upper = upper === upper ? upper : 0;
  30992. }
  30993. if (lower !== undefined) {
  30994. lower = toNumber(lower);
  30995. lower = lower === lower ? lower : 0;
  30996. }
  30997. return baseClamp(toNumber(number), lower, upper);
  30998. }
  30999. /**
  31000. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31001. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31002. * If `start` is greater than `end` the params are swapped to support
  31003. * negative ranges.
  31004. *
  31005. * @static
  31006. * @memberOf _
  31007. * @since 3.3.0
  31008. * @category Number
  31009. * @param {number} number The number to check.
  31010. * @param {number} [start=0] The start of the range.
  31011. * @param {number} end The end of the range.
  31012. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31013. * @see _.range, _.rangeRight
  31014. * @example
  31015. *
  31016. * _.inRange(3, 2, 4);
  31017. * // => true
  31018. *
  31019. * _.inRange(4, 8);
  31020. * // => true
  31021. *
  31022. * _.inRange(4, 2);
  31023. * // => false
  31024. *
  31025. * _.inRange(2, 2);
  31026. * // => false
  31027. *
  31028. * _.inRange(1.2, 2);
  31029. * // => true
  31030. *
  31031. * _.inRange(5.2, 4);
  31032. * // => false
  31033. *
  31034. * _.inRange(-3, -2, -6);
  31035. * // => true
  31036. */
  31037. function inRange(number, start, end) {
  31038. start = toFinite(start);
  31039. if (end === undefined) {
  31040. end = start;
  31041. start = 0;
  31042. } else {
  31043. end = toFinite(end);
  31044. }
  31045. number = toNumber(number);
  31046. return baseInRange(number, start, end);
  31047. }
  31048. /**
  31049. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31050. * If only one argument is provided a number between `0` and the given number
  31051. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31052. * floats, a floating-point number is returned instead of an integer.
  31053. *
  31054. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31055. * floating-point values which can produce unexpected results.
  31056. *
  31057. * @static
  31058. * @memberOf _
  31059. * @since 0.7.0
  31060. * @category Number
  31061. * @param {number} [lower=0] The lower bound.
  31062. * @param {number} [upper=1] The upper bound.
  31063. * @param {boolean} [floating] Specify returning a floating-point number.
  31064. * @returns {number} Returns the random number.
  31065. * @example
  31066. *
  31067. * _.random(0, 5);
  31068. * // => an integer between 0 and 5
  31069. *
  31070. * _.random(5);
  31071. * // => also an integer between 0 and 5
  31072. *
  31073. * _.random(5, true);
  31074. * // => a floating-point number between 0 and 5
  31075. *
  31076. * _.random(1.2, 5.2);
  31077. * // => a floating-point number between 1.2 and 5.2
  31078. */
  31079. function random(lower, upper, floating) {
  31080. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31081. upper = floating = undefined;
  31082. }
  31083. if (floating === undefined) {
  31084. if (typeof upper == 'boolean') {
  31085. floating = upper;
  31086. upper = undefined;
  31087. }
  31088. else if (typeof lower == 'boolean') {
  31089. floating = lower;
  31090. lower = undefined;
  31091. }
  31092. }
  31093. if (lower === undefined && upper === undefined) {
  31094. lower = 0;
  31095. upper = 1;
  31096. }
  31097. else {
  31098. lower = toFinite(lower);
  31099. if (upper === undefined) {
  31100. upper = lower;
  31101. lower = 0;
  31102. } else {
  31103. upper = toFinite(upper);
  31104. }
  31105. }
  31106. if (lower > upper) {
  31107. var temp = lower;
  31108. lower = upper;
  31109. upper = temp;
  31110. }
  31111. if (floating || lower % 1 || upper % 1) {
  31112. var rand = nativeRandom();
  31113. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31114. }
  31115. return baseRandom(lower, upper);
  31116. }
  31117. /*------------------------------------------------------------------------*/
  31118. /**
  31119. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31120. *
  31121. * @static
  31122. * @memberOf _
  31123. * @since 3.0.0
  31124. * @category String
  31125. * @param {string} [string=''] The string to convert.
  31126. * @returns {string} Returns the camel cased string.
  31127. * @example
  31128. *
  31129. * _.camelCase('Foo Bar');
  31130. * // => 'fooBar'
  31131. *
  31132. * _.camelCase('--foo-bar--');
  31133. * // => 'fooBar'
  31134. *
  31135. * _.camelCase('__FOO_BAR__');
  31136. * // => 'fooBar'
  31137. */
  31138. var camelCase = createCompounder(function(result, word, index) {
  31139. word = word.toLowerCase();
  31140. return result + (index ? capitalize(word) : word);
  31141. });
  31142. /**
  31143. * Converts the first character of `string` to upper case and the remaining
  31144. * to lower case.
  31145. *
  31146. * @static
  31147. * @memberOf _
  31148. * @since 3.0.0
  31149. * @category String
  31150. * @param {string} [string=''] The string to capitalize.
  31151. * @returns {string} Returns the capitalized string.
  31152. * @example
  31153. *
  31154. * _.capitalize('FRED');
  31155. * // => 'Fred'
  31156. */
  31157. function capitalize(string) {
  31158. return upperFirst(toString(string).toLowerCase());
  31159. }
  31160. /**
  31161. * Deburrs `string` by converting
  31162. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31163. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31164. * letters to basic Latin letters and removing
  31165. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31166. *
  31167. * @static
  31168. * @memberOf _
  31169. * @since 3.0.0
  31170. * @category String
  31171. * @param {string} [string=''] The string to deburr.
  31172. * @returns {string} Returns the deburred string.
  31173. * @example
  31174. *
  31175. * _.deburr('déjà vu');
  31176. * // => 'deja vu'
  31177. */
  31178. function deburr(string) {
  31179. string = toString(string);
  31180. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31181. }
  31182. /**
  31183. * Checks if `string` ends with the given target string.
  31184. *
  31185. * @static
  31186. * @memberOf _
  31187. * @since 3.0.0
  31188. * @category String
  31189. * @param {string} [string=''] The string to inspect.
  31190. * @param {string} [target] The string to search for.
  31191. * @param {number} [position=string.length] The position to search up to.
  31192. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31193. * else `false`.
  31194. * @example
  31195. *
  31196. * _.endsWith('abc', 'c');
  31197. * // => true
  31198. *
  31199. * _.endsWith('abc', 'b');
  31200. * // => false
  31201. *
  31202. * _.endsWith('abc', 'b', 2);
  31203. * // => true
  31204. */
  31205. function endsWith(string, target, position) {
  31206. string = toString(string);
  31207. target = baseToString(target);
  31208. var length = string.length;
  31209. position = position === undefined
  31210. ? length
  31211. : baseClamp(toInteger(position), 0, length);
  31212. var end = position;
  31213. position -= target.length;
  31214. return position >= 0 && string.slice(position, end) == target;
  31215. }
  31216. /**
  31217. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31218. * corresponding HTML entities.
  31219. *
  31220. * **Note:** No other characters are escaped. To escape additional
  31221. * characters use a third-party library like [_he_](https://mths.be/he).
  31222. *
  31223. * Though the ">" character is escaped for symmetry, characters like
  31224. * ">" and "/" don't need escaping in HTML and have no special meaning
  31225. * unless they're part of a tag or unquoted attribute value. See
  31226. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31227. * (under "semi-related fun fact") for more details.
  31228. *
  31229. * When working with HTML you should always
  31230. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31231. * XSS vectors.
  31232. *
  31233. * @static
  31234. * @since 0.1.0
  31235. * @memberOf _
  31236. * @category String
  31237. * @param {string} [string=''] The string to escape.
  31238. * @returns {string} Returns the escaped string.
  31239. * @example
  31240. *
  31241. * _.escape('fred, barney, & pebbles');
  31242. * // => 'fred, barney, &amp; pebbles'
  31243. */
  31244. function escape(string) {
  31245. string = toString(string);
  31246. return (string && reHasUnescapedHtml.test(string))
  31247. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31248. : string;
  31249. }
  31250. /**
  31251. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31252. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31253. *
  31254. * @static
  31255. * @memberOf _
  31256. * @since 3.0.0
  31257. * @category String
  31258. * @param {string} [string=''] The string to escape.
  31259. * @returns {string} Returns the escaped string.
  31260. * @example
  31261. *
  31262. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31263. * // => '\[lodash\]\(https://lodash\.com/\)'
  31264. */
  31265. function escapeRegExp(string) {
  31266. string = toString(string);
  31267. return (string && reHasRegExpChar.test(string))
  31268. ? string.replace(reRegExpChar, '\\$&')
  31269. : string;
  31270. }
  31271. /**
  31272. * Converts `string` to
  31273. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31274. *
  31275. * @static
  31276. * @memberOf _
  31277. * @since 3.0.0
  31278. * @category String
  31279. * @param {string} [string=''] The string to convert.
  31280. * @returns {string} Returns the kebab cased string.
  31281. * @example
  31282. *
  31283. * _.kebabCase('Foo Bar');
  31284. * // => 'foo-bar'
  31285. *
  31286. * _.kebabCase('fooBar');
  31287. * // => 'foo-bar'
  31288. *
  31289. * _.kebabCase('__FOO_BAR__');
  31290. * // => 'foo-bar'
  31291. */
  31292. var kebabCase = createCompounder(function(result, word, index) {
  31293. return result + (index ? '-' : '') + word.toLowerCase();
  31294. });
  31295. /**
  31296. * Converts `string`, as space separated words, to lower case.
  31297. *
  31298. * @static
  31299. * @memberOf _
  31300. * @since 4.0.0
  31301. * @category String
  31302. * @param {string} [string=''] The string to convert.
  31303. * @returns {string} Returns the lower cased string.
  31304. * @example
  31305. *
  31306. * _.lowerCase('--Foo-Bar--');
  31307. * // => 'foo bar'
  31308. *
  31309. * _.lowerCase('fooBar');
  31310. * // => 'foo bar'
  31311. *
  31312. * _.lowerCase('__FOO_BAR__');
  31313. * // => 'foo bar'
  31314. */
  31315. var lowerCase = createCompounder(function(result, word, index) {
  31316. return result + (index ? ' ' : '') + word.toLowerCase();
  31317. });
  31318. /**
  31319. * Converts the first character of `string` to lower case.
  31320. *
  31321. * @static
  31322. * @memberOf _
  31323. * @since 4.0.0
  31324. * @category String
  31325. * @param {string} [string=''] The string to convert.
  31326. * @returns {string} Returns the converted string.
  31327. * @example
  31328. *
  31329. * _.lowerFirst('Fred');
  31330. * // => 'fred'
  31331. *
  31332. * _.lowerFirst('FRED');
  31333. * // => 'fRED'
  31334. */
  31335. var lowerFirst = createCaseFirst('toLowerCase');
  31336. /**
  31337. * Pads `string` on the left and right sides if it's shorter than `length`.
  31338. * Padding characters are truncated if they can't be evenly divided by `length`.
  31339. *
  31340. * @static
  31341. * @memberOf _
  31342. * @since 3.0.0
  31343. * @category String
  31344. * @param {string} [string=''] The string to pad.
  31345. * @param {number} [length=0] The padding length.
  31346. * @param {string} [chars=' '] The string used as padding.
  31347. * @returns {string} Returns the padded string.
  31348. * @example
  31349. *
  31350. * _.pad('abc', 8);
  31351. * // => ' abc '
  31352. *
  31353. * _.pad('abc', 8, '_-');
  31354. * // => '_-abc_-_'
  31355. *
  31356. * _.pad('abc', 3);
  31357. * // => 'abc'
  31358. */
  31359. function pad(string, length, chars) {
  31360. string = toString(string);
  31361. length = toInteger(length);
  31362. var strLength = length ? stringSize(string) : 0;
  31363. if (!length || strLength >= length) {
  31364. return string;
  31365. }
  31366. var mid = (length - strLength) / 2;
  31367. return (
  31368. createPadding(nativeFloor(mid), chars) +
  31369. string +
  31370. createPadding(nativeCeil(mid), chars)
  31371. );
  31372. }
  31373. /**
  31374. * Pads `string` on the right side if it's shorter than `length`. Padding
  31375. * characters are truncated if they exceed `length`.
  31376. *
  31377. * @static
  31378. * @memberOf _
  31379. * @since 4.0.0
  31380. * @category String
  31381. * @param {string} [string=''] The string to pad.
  31382. * @param {number} [length=0] The padding length.
  31383. * @param {string} [chars=' '] The string used as padding.
  31384. * @returns {string} Returns the padded string.
  31385. * @example
  31386. *
  31387. * _.padEnd('abc', 6);
  31388. * // => 'abc '
  31389. *
  31390. * _.padEnd('abc', 6, '_-');
  31391. * // => 'abc_-_'
  31392. *
  31393. * _.padEnd('abc', 3);
  31394. * // => 'abc'
  31395. */
  31396. function padEnd(string, length, chars) {
  31397. string = toString(string);
  31398. length = toInteger(length);
  31399. var strLength = length ? stringSize(string) : 0;
  31400. return (length && strLength < length)
  31401. ? (string + createPadding(length - strLength, chars))
  31402. : string;
  31403. }
  31404. /**
  31405. * Pads `string` on the left side if it's shorter than `length`. Padding
  31406. * characters are truncated if they exceed `length`.
  31407. *
  31408. * @static
  31409. * @memberOf _
  31410. * @since 4.0.0
  31411. * @category String
  31412. * @param {string} [string=''] The string to pad.
  31413. * @param {number} [length=0] The padding length.
  31414. * @param {string} [chars=' '] The string used as padding.
  31415. * @returns {string} Returns the padded string.
  31416. * @example
  31417. *
  31418. * _.padStart('abc', 6);
  31419. * // => ' abc'
  31420. *
  31421. * _.padStart('abc', 6, '_-');
  31422. * // => '_-_abc'
  31423. *
  31424. * _.padStart('abc', 3);
  31425. * // => 'abc'
  31426. */
  31427. function padStart(string, length, chars) {
  31428. string = toString(string);
  31429. length = toInteger(length);
  31430. var strLength = length ? stringSize(string) : 0;
  31431. return (length && strLength < length)
  31432. ? (createPadding(length - strLength, chars) + string)
  31433. : string;
  31434. }
  31435. /**
  31436. * Converts `string` to an integer of the specified radix. If `radix` is
  31437. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31438. * hexadecimal, in which case a `radix` of `16` is used.
  31439. *
  31440. * **Note:** This method aligns with the
  31441. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31442. *
  31443. * @static
  31444. * @memberOf _
  31445. * @since 1.1.0
  31446. * @category String
  31447. * @param {string} string The string to convert.
  31448. * @param {number} [radix=10] The radix to interpret `value` by.
  31449. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31450. * @returns {number} Returns the converted integer.
  31451. * @example
  31452. *
  31453. * _.parseInt('08');
  31454. * // => 8
  31455. *
  31456. * _.map(['6', '08', '10'], _.parseInt);
  31457. * // => [6, 8, 10]
  31458. */
  31459. function parseInt(string, radix, guard) {
  31460. if (guard || radix == null) {
  31461. radix = 0;
  31462. } else if (radix) {
  31463. radix = +radix;
  31464. }
  31465. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31466. }
  31467. /**
  31468. * Repeats the given string `n` times.
  31469. *
  31470. * @static
  31471. * @memberOf _
  31472. * @since 3.0.0
  31473. * @category String
  31474. * @param {string} [string=''] The string to repeat.
  31475. * @param {number} [n=1] The number of times to repeat the string.
  31476. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31477. * @returns {string} Returns the repeated string.
  31478. * @example
  31479. *
  31480. * _.repeat('*', 3);
  31481. * // => '***'
  31482. *
  31483. * _.repeat('abc', 2);
  31484. * // => 'abcabc'
  31485. *
  31486. * _.repeat('abc', 0);
  31487. * // => ''
  31488. */
  31489. function repeat(string, n, guard) {
  31490. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31491. n = 1;
  31492. } else {
  31493. n = toInteger(n);
  31494. }
  31495. return baseRepeat(toString(string), n);
  31496. }
  31497. /**
  31498. * Replaces matches for `pattern` in `string` with `replacement`.
  31499. *
  31500. * **Note:** This method is based on
  31501. * [`String#replace`](https://mdn.io/String/replace).
  31502. *
  31503. * @static
  31504. * @memberOf _
  31505. * @since 4.0.0
  31506. * @category String
  31507. * @param {string} [string=''] The string to modify.
  31508. * @param {RegExp|string} pattern The pattern to replace.
  31509. * @param {Function|string} replacement The match replacement.
  31510. * @returns {string} Returns the modified string.
  31511. * @example
  31512. *
  31513. * _.replace('Hi Fred', 'Fred', 'Barney');
  31514. * // => 'Hi Barney'
  31515. */
  31516. function replace() {
  31517. var args = arguments,
  31518. string = toString(args[0]);
  31519. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31520. }
  31521. /**
  31522. * Converts `string` to
  31523. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31524. *
  31525. * @static
  31526. * @memberOf _
  31527. * @since 3.0.0
  31528. * @category String
  31529. * @param {string} [string=''] The string to convert.
  31530. * @returns {string} Returns the snake cased string.
  31531. * @example
  31532. *
  31533. * _.snakeCase('Foo Bar');
  31534. * // => 'foo_bar'
  31535. *
  31536. * _.snakeCase('fooBar');
  31537. * // => 'foo_bar'
  31538. *
  31539. * _.snakeCase('--FOO-BAR--');
  31540. * // => 'foo_bar'
  31541. */
  31542. var snakeCase = createCompounder(function(result, word, index) {
  31543. return result + (index ? '_' : '') + word.toLowerCase();
  31544. });
  31545. /**
  31546. * Splits `string` by `separator`.
  31547. *
  31548. * **Note:** This method is based on
  31549. * [`String#split`](https://mdn.io/String/split).
  31550. *
  31551. * @static
  31552. * @memberOf _
  31553. * @since 4.0.0
  31554. * @category String
  31555. * @param {string} [string=''] The string to split.
  31556. * @param {RegExp|string} separator The separator pattern to split by.
  31557. * @param {number} [limit] The length to truncate results to.
  31558. * @returns {Array} Returns the string segments.
  31559. * @example
  31560. *
  31561. * _.split('a-b-c', '-', 2);
  31562. * // => ['a', 'b']
  31563. */
  31564. function split(string, separator, limit) {
  31565. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31566. separator = limit = undefined;
  31567. }
  31568. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31569. if (!limit) {
  31570. return [];
  31571. }
  31572. string = toString(string);
  31573. if (string && (
  31574. typeof separator == 'string' ||
  31575. (separator != null && !isRegExp(separator))
  31576. )) {
  31577. separator = baseToString(separator);
  31578. if (!separator && hasUnicode(string)) {
  31579. return castSlice(stringToArray(string), 0, limit);
  31580. }
  31581. }
  31582. return string.split(separator, limit);
  31583. }
  31584. /**
  31585. * Converts `string` to
  31586. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31587. *
  31588. * @static
  31589. * @memberOf _
  31590. * @since 3.1.0
  31591. * @category String
  31592. * @param {string} [string=''] The string to convert.
  31593. * @returns {string} Returns the start cased string.
  31594. * @example
  31595. *
  31596. * _.startCase('--foo-bar--');
  31597. * // => 'Foo Bar'
  31598. *
  31599. * _.startCase('fooBar');
  31600. * // => 'Foo Bar'
  31601. *
  31602. * _.startCase('__FOO_BAR__');
  31603. * // => 'FOO BAR'
  31604. */
  31605. var startCase = createCompounder(function(result, word, index) {
  31606. return result + (index ? ' ' : '') + upperFirst(word);
  31607. });
  31608. /**
  31609. * Checks if `string` starts with the given target string.
  31610. *
  31611. * @static
  31612. * @memberOf _
  31613. * @since 3.0.0
  31614. * @category String
  31615. * @param {string} [string=''] The string to inspect.
  31616. * @param {string} [target] The string to search for.
  31617. * @param {number} [position=0] The position to search from.
  31618. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31619. * else `false`.
  31620. * @example
  31621. *
  31622. * _.startsWith('abc', 'a');
  31623. * // => true
  31624. *
  31625. * _.startsWith('abc', 'b');
  31626. * // => false
  31627. *
  31628. * _.startsWith('abc', 'b', 1);
  31629. * // => true
  31630. */
  31631. function startsWith(string, target, position) {
  31632. string = toString(string);
  31633. position = position == null
  31634. ? 0
  31635. : baseClamp(toInteger(position), 0, string.length);
  31636. target = baseToString(target);
  31637. return string.slice(position, position + target.length) == target;
  31638. }
  31639. /**
  31640. * Creates a compiled template function that can interpolate data properties
  31641. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31642. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31643. * properties may be accessed as free variables in the template. If a setting
  31644. * object is given, it takes precedence over `_.templateSettings` values.
  31645. *
  31646. * **Note:** In the development build `_.template` utilizes
  31647. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31648. * for easier debugging.
  31649. *
  31650. * For more information on precompiling templates see
  31651. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31652. *
  31653. * For more information on Chrome extension sandboxes see
  31654. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31655. *
  31656. * @static
  31657. * @since 0.1.0
  31658. * @memberOf _
  31659. * @category String
  31660. * @param {string} [string=''] The template string.
  31661. * @param {Object} [options={}] The options object.
  31662. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31663. * The HTML "escape" delimiter.
  31664. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31665. * The "evaluate" delimiter.
  31666. * @param {Object} [options.imports=_.templateSettings.imports]
  31667. * An object to import into the template as free variables.
  31668. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31669. * The "interpolate" delimiter.
  31670. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31671. * The sourceURL of the compiled template.
  31672. * @param {string} [options.variable='obj']
  31673. * The data object variable name.
  31674. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31675. * @returns {Function} Returns the compiled template function.
  31676. * @example
  31677. *
  31678. * // Use the "interpolate" delimiter to create a compiled template.
  31679. * var compiled = _.template('hello <%= user %>!');
  31680. * compiled({ 'user': 'fred' });
  31681. * // => 'hello fred!'
  31682. *
  31683. * // Use the HTML "escape" delimiter to escape data property values.
  31684. * var compiled = _.template('<b><%- value %></b>');
  31685. * compiled({ 'value': '<script>' });
  31686. * // => '<b>&lt;script&gt;</b>'
  31687. *
  31688. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31689. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31690. * compiled({ 'users': ['fred', 'barney'] });
  31691. * // => '<li>fred</li><li>barney</li>'
  31692. *
  31693. * // Use the internal `print` function in "evaluate" delimiters.
  31694. * var compiled = _.template('<% print("hello " + user); %>!');
  31695. * compiled({ 'user': 'barney' });
  31696. * // => 'hello barney!'
  31697. *
  31698. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31699. * // Disable support by replacing the "interpolate" delimiter.
  31700. * var compiled = _.template('hello ${ user }!');
  31701. * compiled({ 'user': 'pebbles' });
  31702. * // => 'hello pebbles!'
  31703. *
  31704. * // Use backslashes to treat delimiters as plain text.
  31705. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31706. * compiled({ 'value': 'ignored' });
  31707. * // => '<%- value %>'
  31708. *
  31709. * // Use the `imports` option to import `jQuery` as `jq`.
  31710. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31711. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31712. * compiled({ 'users': ['fred', 'barney'] });
  31713. * // => '<li>fred</li><li>barney</li>'
  31714. *
  31715. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31716. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31717. * compiled(data);
  31718. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31719. *
  31720. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31721. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31722. * compiled.source;
  31723. * // => function(data) {
  31724. * // var __t, __p = '';
  31725. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31726. * // return __p;
  31727. * // }
  31728. *
  31729. * // Use custom template delimiters.
  31730. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31731. * var compiled = _.template('hello {{ user }}!');
  31732. * compiled({ 'user': 'mustache' });
  31733. * // => 'hello mustache!'
  31734. *
  31735. * // Use the `source` property to inline compiled templates for meaningful
  31736. * // line numbers in error messages and stack traces.
  31737. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31738. * var JST = {\
  31739. * "main": ' + _.template(mainText).source + '\
  31740. * };\
  31741. * ');
  31742. */
  31743. function template(string, options, guard) {
  31744. // Based on John Resig's `tmpl` implementation
  31745. // (http://ejohn.org/blog/javascript-micro-templating/)
  31746. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31747. var settings = lodash.templateSettings;
  31748. if (guard && isIterateeCall(string, options, guard)) {
  31749. options = undefined;
  31750. }
  31751. string = toString(string);
  31752. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31753. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31754. importsKeys = keys(imports),
  31755. importsValues = baseValues(imports, importsKeys);
  31756. var isEscaping,
  31757. isEvaluating,
  31758. index = 0,
  31759. interpolate = options.interpolate || reNoMatch,
  31760. source = "__p += '";
  31761. // Compile the regexp to match each delimiter.
  31762. var reDelimiters = RegExp(
  31763. (options.escape || reNoMatch).source + '|' +
  31764. interpolate.source + '|' +
  31765. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31766. (options.evaluate || reNoMatch).source + '|$'
  31767. , 'g');
  31768. // Use a sourceURL for easier debugging.
  31769. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31770. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31771. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31772. var sourceURL = '//# sourceURL=' +
  31773. (hasOwnProperty.call(options, 'sourceURL')
  31774. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31775. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31776. ) + '\n';
  31777. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31778. interpolateValue || (interpolateValue = esTemplateValue);
  31779. // Escape characters that can't be included in string literals.
  31780. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31781. // Replace delimiters with snippets.
  31782. if (escapeValue) {
  31783. isEscaping = true;
  31784. source += "' +\n__e(" + escapeValue + ") +\n'";
  31785. }
  31786. if (evaluateValue) {
  31787. isEvaluating = true;
  31788. source += "';\n" + evaluateValue + ";\n__p += '";
  31789. }
  31790. if (interpolateValue) {
  31791. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31792. }
  31793. index = offset + match.length;
  31794. // The JS engine embedded in Adobe products needs `match` returned in
  31795. // order to produce the correct `offset` value.
  31796. return match;
  31797. });
  31798. source += "';\n";
  31799. // If `variable` is not specified wrap a with-statement around the generated
  31800. // code to add the data object to the top of the scope chain.
  31801. // Like with sourceURL, we take care to not check the option's prototype,
  31802. // as this configuration is a code injection vector.
  31803. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31804. if (!variable) {
  31805. source = 'with (obj) {\n' + source + '\n}\n';
  31806. }
  31807. // Cleanup code by stripping empty strings.
  31808. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31809. .replace(reEmptyStringMiddle, '$1')
  31810. .replace(reEmptyStringTrailing, '$1;');
  31811. // Frame code as the function body.
  31812. source = 'function(' + (variable || 'obj') + ') {\n' +
  31813. (variable
  31814. ? ''
  31815. : 'obj || (obj = {});\n'
  31816. ) +
  31817. "var __t, __p = ''" +
  31818. (isEscaping
  31819. ? ', __e = _.escape'
  31820. : ''
  31821. ) +
  31822. (isEvaluating
  31823. ? ', __j = Array.prototype.join;\n' +
  31824. "function print() { __p += __j.call(arguments, '') }\n"
  31825. : ';\n'
  31826. ) +
  31827. source +
  31828. 'return __p\n}';
  31829. var result = attempt(function() {
  31830. return Function(importsKeys, sourceURL + 'return ' + source)
  31831. .apply(undefined, importsValues);
  31832. });
  31833. // Provide the compiled function's source by its `toString` method or
  31834. // the `source` property as a convenience for inlining compiled templates.
  31835. result.source = source;
  31836. if (isError(result)) {
  31837. throw result;
  31838. }
  31839. return result;
  31840. }
  31841. /**
  31842. * Converts `string`, as a whole, to lower case just like
  31843. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31844. *
  31845. * @static
  31846. * @memberOf _
  31847. * @since 4.0.0
  31848. * @category String
  31849. * @param {string} [string=''] The string to convert.
  31850. * @returns {string} Returns the lower cased string.
  31851. * @example
  31852. *
  31853. * _.toLower('--Foo-Bar--');
  31854. * // => '--foo-bar--'
  31855. *
  31856. * _.toLower('fooBar');
  31857. * // => 'foobar'
  31858. *
  31859. * _.toLower('__FOO_BAR__');
  31860. * // => '__foo_bar__'
  31861. */
  31862. function toLower(value) {
  31863. return toString(value).toLowerCase();
  31864. }
  31865. /**
  31866. * Converts `string`, as a whole, to upper case just like
  31867. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31868. *
  31869. * @static
  31870. * @memberOf _
  31871. * @since 4.0.0
  31872. * @category String
  31873. * @param {string} [string=''] The string to convert.
  31874. * @returns {string} Returns the upper cased string.
  31875. * @example
  31876. *
  31877. * _.toUpper('--foo-bar--');
  31878. * // => '--FOO-BAR--'
  31879. *
  31880. * _.toUpper('fooBar');
  31881. * // => 'FOOBAR'
  31882. *
  31883. * _.toUpper('__foo_bar__');
  31884. * // => '__FOO_BAR__'
  31885. */
  31886. function toUpper(value) {
  31887. return toString(value).toUpperCase();
  31888. }
  31889. /**
  31890. * Removes leading and trailing whitespace or specified characters from `string`.
  31891. *
  31892. * @static
  31893. * @memberOf _
  31894. * @since 3.0.0
  31895. * @category String
  31896. * @param {string} [string=''] The string to trim.
  31897. * @param {string} [chars=whitespace] The characters to trim.
  31898. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31899. * @returns {string} Returns the trimmed string.
  31900. * @example
  31901. *
  31902. * _.trim(' abc ');
  31903. * // => 'abc'
  31904. *
  31905. * _.trim('-_-abc-_-', '_-');
  31906. * // => 'abc'
  31907. *
  31908. * _.map([' foo ', ' bar '], _.trim);
  31909. * // => ['foo', 'bar']
  31910. */
  31911. function trim(string, chars, guard) {
  31912. string = toString(string);
  31913. if (string && (guard || chars === undefined)) {
  31914. return string.replace(reTrim, '');
  31915. }
  31916. if (!string || !(chars = baseToString(chars))) {
  31917. return string;
  31918. }
  31919. var strSymbols = stringToArray(string),
  31920. chrSymbols = stringToArray(chars),
  31921. start = charsStartIndex(strSymbols, chrSymbols),
  31922. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31923. return castSlice(strSymbols, start, end).join('');
  31924. }
  31925. /**
  31926. * Removes trailing whitespace or specified characters from `string`.
  31927. *
  31928. * @static
  31929. * @memberOf _
  31930. * @since 4.0.0
  31931. * @category String
  31932. * @param {string} [string=''] The string to trim.
  31933. * @param {string} [chars=whitespace] The characters to trim.
  31934. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31935. * @returns {string} Returns the trimmed string.
  31936. * @example
  31937. *
  31938. * _.trimEnd(' abc ');
  31939. * // => ' abc'
  31940. *
  31941. * _.trimEnd('-_-abc-_-', '_-');
  31942. * // => '-_-abc'
  31943. */
  31944. function trimEnd(string, chars, guard) {
  31945. string = toString(string);
  31946. if (string && (guard || chars === undefined)) {
  31947. return string.replace(reTrimEnd, '');
  31948. }
  31949. if (!string || !(chars = baseToString(chars))) {
  31950. return string;
  31951. }
  31952. var strSymbols = stringToArray(string),
  31953. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31954. return castSlice(strSymbols, 0, end).join('');
  31955. }
  31956. /**
  31957. * Removes leading whitespace or specified characters from `string`.
  31958. *
  31959. * @static
  31960. * @memberOf _
  31961. * @since 4.0.0
  31962. * @category String
  31963. * @param {string} [string=''] The string to trim.
  31964. * @param {string} [chars=whitespace] The characters to trim.
  31965. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31966. * @returns {string} Returns the trimmed string.
  31967. * @example
  31968. *
  31969. * _.trimStart(' abc ');
  31970. * // => 'abc '
  31971. *
  31972. * _.trimStart('-_-abc-_-', '_-');
  31973. * // => 'abc-_-'
  31974. */
  31975. function trimStart(string, chars, guard) {
  31976. string = toString(string);
  31977. if (string && (guard || chars === undefined)) {
  31978. return string.replace(reTrimStart, '');
  31979. }
  31980. if (!string || !(chars = baseToString(chars))) {
  31981. return string;
  31982. }
  31983. var strSymbols = stringToArray(string),
  31984. start = charsStartIndex(strSymbols, stringToArray(chars));
  31985. return castSlice(strSymbols, start).join('');
  31986. }
  31987. /**
  31988. * Truncates `string` if it's longer than the given maximum string length.
  31989. * The last characters of the truncated string are replaced with the omission
  31990. * string which defaults to "...".
  31991. *
  31992. * @static
  31993. * @memberOf _
  31994. * @since 4.0.0
  31995. * @category String
  31996. * @param {string} [string=''] The string to truncate.
  31997. * @param {Object} [options={}] The options object.
  31998. * @param {number} [options.length=30] The maximum string length.
  31999. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32000. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32001. * @returns {string} Returns the truncated string.
  32002. * @example
  32003. *
  32004. * _.truncate('hi-diddly-ho there, neighborino');
  32005. * // => 'hi-diddly-ho there, neighbo...'
  32006. *
  32007. * _.truncate('hi-diddly-ho there, neighborino', {
  32008. * 'length': 24,
  32009. * 'separator': ' '
  32010. * });
  32011. * // => 'hi-diddly-ho there,...'
  32012. *
  32013. * _.truncate('hi-diddly-ho there, neighborino', {
  32014. * 'length': 24,
  32015. * 'separator': /,? +/
  32016. * });
  32017. * // => 'hi-diddly-ho there...'
  32018. *
  32019. * _.truncate('hi-diddly-ho there, neighborino', {
  32020. * 'omission': ' [...]'
  32021. * });
  32022. * // => 'hi-diddly-ho there, neig [...]'
  32023. */
  32024. function truncate(string, options) {
  32025. var length = DEFAULT_TRUNC_LENGTH,
  32026. omission = DEFAULT_TRUNC_OMISSION;
  32027. if (isObject(options)) {
  32028. var separator = 'separator' in options ? options.separator : separator;
  32029. length = 'length' in options ? toInteger(options.length) : length;
  32030. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32031. }
  32032. string = toString(string);
  32033. var strLength = string.length;
  32034. if (hasUnicode(string)) {
  32035. var strSymbols = stringToArray(string);
  32036. strLength = strSymbols.length;
  32037. }
  32038. if (length >= strLength) {
  32039. return string;
  32040. }
  32041. var end = length - stringSize(omission);
  32042. if (end < 1) {
  32043. return omission;
  32044. }
  32045. var result = strSymbols
  32046. ? castSlice(strSymbols, 0, end).join('')
  32047. : string.slice(0, end);
  32048. if (separator === undefined) {
  32049. return result + omission;
  32050. }
  32051. if (strSymbols) {
  32052. end += (result.length - end);
  32053. }
  32054. if (isRegExp(separator)) {
  32055. if (string.slice(end).search(separator)) {
  32056. var match,
  32057. substring = result;
  32058. if (!separator.global) {
  32059. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32060. }
  32061. separator.lastIndex = 0;
  32062. while ((match = separator.exec(substring))) {
  32063. var newEnd = match.index;
  32064. }
  32065. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32066. }
  32067. } else if (string.indexOf(baseToString(separator), end) != end) {
  32068. var index = result.lastIndexOf(separator);
  32069. if (index > -1) {
  32070. result = result.slice(0, index);
  32071. }
  32072. }
  32073. return result + omission;
  32074. }
  32075. /**
  32076. * The inverse of `_.escape`; this method converts the HTML entities
  32077. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32078. * their corresponding characters.
  32079. *
  32080. * **Note:** No other HTML entities are unescaped. To unescape additional
  32081. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32082. *
  32083. * @static
  32084. * @memberOf _
  32085. * @since 0.6.0
  32086. * @category String
  32087. * @param {string} [string=''] The string to unescape.
  32088. * @returns {string} Returns the unescaped string.
  32089. * @example
  32090. *
  32091. * _.unescape('fred, barney, &amp; pebbles');
  32092. * // => 'fred, barney, & pebbles'
  32093. */
  32094. function unescape(string) {
  32095. string = toString(string);
  32096. return (string && reHasEscapedHtml.test(string))
  32097. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32098. : string;
  32099. }
  32100. /**
  32101. * Converts `string`, as space separated words, to upper case.
  32102. *
  32103. * @static
  32104. * @memberOf _
  32105. * @since 4.0.0
  32106. * @category String
  32107. * @param {string} [string=''] The string to convert.
  32108. * @returns {string} Returns the upper cased string.
  32109. * @example
  32110. *
  32111. * _.upperCase('--foo-bar');
  32112. * // => 'FOO BAR'
  32113. *
  32114. * _.upperCase('fooBar');
  32115. * // => 'FOO BAR'
  32116. *
  32117. * _.upperCase('__foo_bar__');
  32118. * // => 'FOO BAR'
  32119. */
  32120. var upperCase = createCompounder(function(result, word, index) {
  32121. return result + (index ? ' ' : '') + word.toUpperCase();
  32122. });
  32123. /**
  32124. * Converts the first character of `string` to upper case.
  32125. *
  32126. * @static
  32127. * @memberOf _
  32128. * @since 4.0.0
  32129. * @category String
  32130. * @param {string} [string=''] The string to convert.
  32131. * @returns {string} Returns the converted string.
  32132. * @example
  32133. *
  32134. * _.upperFirst('fred');
  32135. * // => 'Fred'
  32136. *
  32137. * _.upperFirst('FRED');
  32138. * // => 'FRED'
  32139. */
  32140. var upperFirst = createCaseFirst('toUpperCase');
  32141. /**
  32142. * Splits `string` into an array of its words.
  32143. *
  32144. * @static
  32145. * @memberOf _
  32146. * @since 3.0.0
  32147. * @category String
  32148. * @param {string} [string=''] The string to inspect.
  32149. * @param {RegExp|string} [pattern] The pattern to match words.
  32150. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32151. * @returns {Array} Returns the words of `string`.
  32152. * @example
  32153. *
  32154. * _.words('fred, barney, & pebbles');
  32155. * // => ['fred', 'barney', 'pebbles']
  32156. *
  32157. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32158. * // => ['fred', 'barney', '&', 'pebbles']
  32159. */
  32160. function words(string, pattern, guard) {
  32161. string = toString(string);
  32162. pattern = guard ? undefined : pattern;
  32163. if (pattern === undefined) {
  32164. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32165. }
  32166. return string.match(pattern) || [];
  32167. }
  32168. /*------------------------------------------------------------------------*/
  32169. /**
  32170. * Attempts to invoke `func`, returning either the result or the caught error
  32171. * object. Any additional arguments are provided to `func` when it's invoked.
  32172. *
  32173. * @static
  32174. * @memberOf _
  32175. * @since 3.0.0
  32176. * @category Util
  32177. * @param {Function} func The function to attempt.
  32178. * @param {...*} [args] The arguments to invoke `func` with.
  32179. * @returns {*} Returns the `func` result or error object.
  32180. * @example
  32181. *
  32182. * // Avoid throwing errors for invalid selectors.
  32183. * var elements = _.attempt(function(selector) {
  32184. * return document.querySelectorAll(selector);
  32185. * }, '>_>');
  32186. *
  32187. * if (_.isError(elements)) {
  32188. * elements = [];
  32189. * }
  32190. */
  32191. var attempt = baseRest(function(func, args) {
  32192. try {
  32193. return apply(func, undefined, args);
  32194. } catch (e) {
  32195. return isError(e) ? e : new Error(e);
  32196. }
  32197. });
  32198. /**
  32199. * Binds methods of an object to the object itself, overwriting the existing
  32200. * method.
  32201. *
  32202. * **Note:** This method doesn't set the "length" property of bound functions.
  32203. *
  32204. * @static
  32205. * @since 0.1.0
  32206. * @memberOf _
  32207. * @category Util
  32208. * @param {Object} object The object to bind and assign the bound methods to.
  32209. * @param {...(string|string[])} methodNames The object method names to bind.
  32210. * @returns {Object} Returns `object`.
  32211. * @example
  32212. *
  32213. * var view = {
  32214. * 'label': 'docs',
  32215. * 'click': function() {
  32216. * console.log('clicked ' + this.label);
  32217. * }
  32218. * };
  32219. *
  32220. * _.bindAll(view, ['click']);
  32221. * jQuery(element).on('click', view.click);
  32222. * // => Logs 'clicked docs' when clicked.
  32223. */
  32224. var bindAll = flatRest(function(object, methodNames) {
  32225. arrayEach(methodNames, function(key) {
  32226. key = toKey(key);
  32227. baseAssignValue(object, key, bind(object[key], object));
  32228. });
  32229. return object;
  32230. });
  32231. /**
  32232. * Creates a function that iterates over `pairs` and invokes the corresponding
  32233. * function of the first predicate to return truthy. The predicate-function
  32234. * pairs are invoked with the `this` binding and arguments of the created
  32235. * function.
  32236. *
  32237. * @static
  32238. * @memberOf _
  32239. * @since 4.0.0
  32240. * @category Util
  32241. * @param {Array} pairs The predicate-function pairs.
  32242. * @returns {Function} Returns the new composite function.
  32243. * @example
  32244. *
  32245. * var func = _.cond([
  32246. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32247. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32248. * [_.stubTrue, _.constant('no match')]
  32249. * ]);
  32250. *
  32251. * func({ 'a': 1, 'b': 2 });
  32252. * // => 'matches A'
  32253. *
  32254. * func({ 'a': 0, 'b': 1 });
  32255. * // => 'matches B'
  32256. *
  32257. * func({ 'a': '1', 'b': '2' });
  32258. * // => 'no match'
  32259. */
  32260. function cond(pairs) {
  32261. var length = pairs == null ? 0 : pairs.length,
  32262. toIteratee = getIteratee();
  32263. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32264. if (typeof pair[1] != 'function') {
  32265. throw new TypeError(FUNC_ERROR_TEXT);
  32266. }
  32267. return [toIteratee(pair[0]), pair[1]];
  32268. });
  32269. return baseRest(function(args) {
  32270. var index = -1;
  32271. while (++index < length) {
  32272. var pair = pairs[index];
  32273. if (apply(pair[0], this, args)) {
  32274. return apply(pair[1], this, args);
  32275. }
  32276. }
  32277. });
  32278. }
  32279. /**
  32280. * Creates a function that invokes the predicate properties of `source` with
  32281. * the corresponding property values of a given object, returning `true` if
  32282. * all predicates return truthy, else `false`.
  32283. *
  32284. * **Note:** The created function is equivalent to `_.conformsTo` with
  32285. * `source` partially applied.
  32286. *
  32287. * @static
  32288. * @memberOf _
  32289. * @since 4.0.0
  32290. * @category Util
  32291. * @param {Object} source The object of property predicates to conform to.
  32292. * @returns {Function} Returns the new spec function.
  32293. * @example
  32294. *
  32295. * var objects = [
  32296. * { 'a': 2, 'b': 1 },
  32297. * { 'a': 1, 'b': 2 }
  32298. * ];
  32299. *
  32300. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32301. * // => [{ 'a': 1, 'b': 2 }]
  32302. */
  32303. function conforms(source) {
  32304. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32305. }
  32306. /**
  32307. * Creates a function that returns `value`.
  32308. *
  32309. * @static
  32310. * @memberOf _
  32311. * @since 2.4.0
  32312. * @category Util
  32313. * @param {*} value The value to return from the new function.
  32314. * @returns {Function} Returns the new constant function.
  32315. * @example
  32316. *
  32317. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32318. *
  32319. * console.log(objects);
  32320. * // => [{ 'a': 1 }, { 'a': 1 }]
  32321. *
  32322. * console.log(objects[0] === objects[1]);
  32323. * // => true
  32324. */
  32325. function constant(value) {
  32326. return function() {
  32327. return value;
  32328. };
  32329. }
  32330. /**
  32331. * Checks `value` to determine whether a default value should be returned in
  32332. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32333. * or `undefined`.
  32334. *
  32335. * @static
  32336. * @memberOf _
  32337. * @since 4.14.0
  32338. * @category Util
  32339. * @param {*} value The value to check.
  32340. * @param {*} defaultValue The default value.
  32341. * @returns {*} Returns the resolved value.
  32342. * @example
  32343. *
  32344. * _.defaultTo(1, 10);
  32345. * // => 1
  32346. *
  32347. * _.defaultTo(undefined, 10);
  32348. * // => 10
  32349. */
  32350. function defaultTo(value, defaultValue) {
  32351. return (value == null || value !== value) ? defaultValue : value;
  32352. }
  32353. /**
  32354. * Creates a function that returns the result of invoking the given functions
  32355. * with the `this` binding of the created function, where each successive
  32356. * invocation is supplied the return value of the previous.
  32357. *
  32358. * @static
  32359. * @memberOf _
  32360. * @since 3.0.0
  32361. * @category Util
  32362. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32363. * @returns {Function} Returns the new composite function.
  32364. * @see _.flowRight
  32365. * @example
  32366. *
  32367. * function square(n) {
  32368. * return n * n;
  32369. * }
  32370. *
  32371. * var addSquare = _.flow([_.add, square]);
  32372. * addSquare(1, 2);
  32373. * // => 9
  32374. */
  32375. var flow = createFlow();
  32376. /**
  32377. * This method is like `_.flow` except that it creates a function that
  32378. * invokes the given functions from right to left.
  32379. *
  32380. * @static
  32381. * @since 3.0.0
  32382. * @memberOf _
  32383. * @category Util
  32384. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32385. * @returns {Function} Returns the new composite function.
  32386. * @see _.flow
  32387. * @example
  32388. *
  32389. * function square(n) {
  32390. * return n * n;
  32391. * }
  32392. *
  32393. * var addSquare = _.flowRight([square, _.add]);
  32394. * addSquare(1, 2);
  32395. * // => 9
  32396. */
  32397. var flowRight = createFlow(true);
  32398. /**
  32399. * This method returns the first argument it receives.
  32400. *
  32401. * @static
  32402. * @since 0.1.0
  32403. * @memberOf _
  32404. * @category Util
  32405. * @param {*} value Any value.
  32406. * @returns {*} Returns `value`.
  32407. * @example
  32408. *
  32409. * var object = { 'a': 1 };
  32410. *
  32411. * console.log(_.identity(object) === object);
  32412. * // => true
  32413. */
  32414. function identity(value) {
  32415. return value;
  32416. }
  32417. /**
  32418. * Creates a function that invokes `func` with the arguments of the created
  32419. * function. If `func` is a property name, the created function returns the
  32420. * property value for a given element. If `func` is an array or object, the
  32421. * created function returns `true` for elements that contain the equivalent
  32422. * source properties, otherwise it returns `false`.
  32423. *
  32424. * @static
  32425. * @since 4.0.0
  32426. * @memberOf _
  32427. * @category Util
  32428. * @param {*} [func=_.identity] The value to convert to a callback.
  32429. * @returns {Function} Returns the callback.
  32430. * @example
  32431. *
  32432. * var users = [
  32433. * { 'user': 'barney', 'age': 36, 'active': true },
  32434. * { 'user': 'fred', 'age': 40, 'active': false }
  32435. * ];
  32436. *
  32437. * // The `_.matches` iteratee shorthand.
  32438. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32439. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32440. *
  32441. * // The `_.matchesProperty` iteratee shorthand.
  32442. * _.filter(users, _.iteratee(['user', 'fred']));
  32443. * // => [{ 'user': 'fred', 'age': 40 }]
  32444. *
  32445. * // The `_.property` iteratee shorthand.
  32446. * _.map(users, _.iteratee('user'));
  32447. * // => ['barney', 'fred']
  32448. *
  32449. * // Create custom iteratee shorthands.
  32450. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32451. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32452. * return func.test(string);
  32453. * };
  32454. * });
  32455. *
  32456. * _.filter(['abc', 'def'], /ef/);
  32457. * // => ['def']
  32458. */
  32459. function iteratee(func) {
  32460. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32461. }
  32462. /**
  32463. * Creates a function that performs a partial deep comparison between a given
  32464. * object and `source`, returning `true` if the given object has equivalent
  32465. * property values, else `false`.
  32466. *
  32467. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32468. * partially applied.
  32469. *
  32470. * Partial comparisons will match empty array and empty object `source`
  32471. * values against any array or object value, respectively. See `_.isEqual`
  32472. * for a list of supported value comparisons.
  32473. *
  32474. * @static
  32475. * @memberOf _
  32476. * @since 3.0.0
  32477. * @category Util
  32478. * @param {Object} source The object of property values to match.
  32479. * @returns {Function} Returns the new spec function.
  32480. * @example
  32481. *
  32482. * var objects = [
  32483. * { 'a': 1, 'b': 2, 'c': 3 },
  32484. * { 'a': 4, 'b': 5, 'c': 6 }
  32485. * ];
  32486. *
  32487. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32488. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32489. */
  32490. function matches(source) {
  32491. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32492. }
  32493. /**
  32494. * Creates a function that performs a partial deep comparison between the
  32495. * value at `path` of a given object to `srcValue`, returning `true` if the
  32496. * object value is equivalent, else `false`.
  32497. *
  32498. * **Note:** Partial comparisons will match empty array and empty object
  32499. * `srcValue` values against any array or object value, respectively. See
  32500. * `_.isEqual` for a list of supported value comparisons.
  32501. *
  32502. * @static
  32503. * @memberOf _
  32504. * @since 3.2.0
  32505. * @category Util
  32506. * @param {Array|string} path The path of the property to get.
  32507. * @param {*} srcValue The value to match.
  32508. * @returns {Function} Returns the new spec function.
  32509. * @example
  32510. *
  32511. * var objects = [
  32512. * { 'a': 1, 'b': 2, 'c': 3 },
  32513. * { 'a': 4, 'b': 5, 'c': 6 }
  32514. * ];
  32515. *
  32516. * _.find(objects, _.matchesProperty('a', 4));
  32517. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32518. */
  32519. function matchesProperty(path, srcValue) {
  32520. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32521. }
  32522. /**
  32523. * Creates a function that invokes the method at `path` of a given object.
  32524. * Any additional arguments are provided to the invoked method.
  32525. *
  32526. * @static
  32527. * @memberOf _
  32528. * @since 3.7.0
  32529. * @category Util
  32530. * @param {Array|string} path The path of the method to invoke.
  32531. * @param {...*} [args] The arguments to invoke the method with.
  32532. * @returns {Function} Returns the new invoker function.
  32533. * @example
  32534. *
  32535. * var objects = [
  32536. * { 'a': { 'b': _.constant(2) } },
  32537. * { 'a': { 'b': _.constant(1) } }
  32538. * ];
  32539. *
  32540. * _.map(objects, _.method('a.b'));
  32541. * // => [2, 1]
  32542. *
  32543. * _.map(objects, _.method(['a', 'b']));
  32544. * // => [2, 1]
  32545. */
  32546. var method = baseRest(function(path, args) {
  32547. return function(object) {
  32548. return baseInvoke(object, path, args);
  32549. };
  32550. });
  32551. /**
  32552. * The opposite of `_.method`; this method creates a function that invokes
  32553. * the method at a given path of `object`. Any additional arguments are
  32554. * provided to the invoked method.
  32555. *
  32556. * @static
  32557. * @memberOf _
  32558. * @since 3.7.0
  32559. * @category Util
  32560. * @param {Object} object The object to query.
  32561. * @param {...*} [args] The arguments to invoke the method with.
  32562. * @returns {Function} Returns the new invoker function.
  32563. * @example
  32564. *
  32565. * var array = _.times(3, _.constant),
  32566. * object = { 'a': array, 'b': array, 'c': array };
  32567. *
  32568. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32569. * // => [2, 0]
  32570. *
  32571. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32572. * // => [2, 0]
  32573. */
  32574. var methodOf = baseRest(function(object, args) {
  32575. return function(path) {
  32576. return baseInvoke(object, path, args);
  32577. };
  32578. });
  32579. /**
  32580. * Adds all own enumerable string keyed function properties of a source
  32581. * object to the destination object. If `object` is a function, then methods
  32582. * are added to its prototype as well.
  32583. *
  32584. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32585. * avoid conflicts caused by modifying the original.
  32586. *
  32587. * @static
  32588. * @since 0.1.0
  32589. * @memberOf _
  32590. * @category Util
  32591. * @param {Function|Object} [object=lodash] The destination object.
  32592. * @param {Object} source The object of functions to add.
  32593. * @param {Object} [options={}] The options object.
  32594. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32595. * @returns {Function|Object} Returns `object`.
  32596. * @example
  32597. *
  32598. * function vowels(string) {
  32599. * return _.filter(string, function(v) {
  32600. * return /[aeiou]/i.test(v);
  32601. * });
  32602. * }
  32603. *
  32604. * _.mixin({ 'vowels': vowels });
  32605. * _.vowels('fred');
  32606. * // => ['e']
  32607. *
  32608. * _('fred').vowels().value();
  32609. * // => ['e']
  32610. *
  32611. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32612. * _('fred').vowels();
  32613. * // => ['e']
  32614. */
  32615. function mixin(object, source, options) {
  32616. var props = keys(source),
  32617. methodNames = baseFunctions(source, props);
  32618. if (options == null &&
  32619. !(isObject(source) && (methodNames.length || !props.length))) {
  32620. options = source;
  32621. source = object;
  32622. object = this;
  32623. methodNames = baseFunctions(source, keys(source));
  32624. }
  32625. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32626. isFunc = isFunction(object);
  32627. arrayEach(methodNames, function(methodName) {
  32628. var func = source[methodName];
  32629. object[methodName] = func;
  32630. if (isFunc) {
  32631. object.prototype[methodName] = function() {
  32632. var chainAll = this.__chain__;
  32633. if (chain || chainAll) {
  32634. var result = object(this.__wrapped__),
  32635. actions = result.__actions__ = copyArray(this.__actions__);
  32636. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32637. result.__chain__ = chainAll;
  32638. return result;
  32639. }
  32640. return func.apply(object, arrayPush([this.value()], arguments));
  32641. };
  32642. }
  32643. });
  32644. return object;
  32645. }
  32646. /**
  32647. * Reverts the `_` variable to its previous value and returns a reference to
  32648. * the `lodash` function.
  32649. *
  32650. * @static
  32651. * @since 0.1.0
  32652. * @memberOf _
  32653. * @category Util
  32654. * @returns {Function} Returns the `lodash` function.
  32655. * @example
  32656. *
  32657. * var lodash = _.noConflict();
  32658. */
  32659. function noConflict() {
  32660. if (root._ === this) {
  32661. root._ = oldDash;
  32662. }
  32663. return this;
  32664. }
  32665. /**
  32666. * This method returns `undefined`.
  32667. *
  32668. * @static
  32669. * @memberOf _
  32670. * @since 2.3.0
  32671. * @category Util
  32672. * @example
  32673. *
  32674. * _.times(2, _.noop);
  32675. * // => [undefined, undefined]
  32676. */
  32677. function noop() {
  32678. // No operation performed.
  32679. }
  32680. /**
  32681. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32682. * the nth argument from the end is returned.
  32683. *
  32684. * @static
  32685. * @memberOf _
  32686. * @since 4.0.0
  32687. * @category Util
  32688. * @param {number} [n=0] The index of the argument to return.
  32689. * @returns {Function} Returns the new pass-thru function.
  32690. * @example
  32691. *
  32692. * var func = _.nthArg(1);
  32693. * func('a', 'b', 'c', 'd');
  32694. * // => 'b'
  32695. *
  32696. * var func = _.nthArg(-2);
  32697. * func('a', 'b', 'c', 'd');
  32698. * // => 'c'
  32699. */
  32700. function nthArg(n) {
  32701. n = toInteger(n);
  32702. return baseRest(function(args) {
  32703. return baseNth(args, n);
  32704. });
  32705. }
  32706. /**
  32707. * Creates a function that invokes `iteratees` with the arguments it receives
  32708. * and returns their results.
  32709. *
  32710. * @static
  32711. * @memberOf _
  32712. * @since 4.0.0
  32713. * @category Util
  32714. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32715. * The iteratees to invoke.
  32716. * @returns {Function} Returns the new function.
  32717. * @example
  32718. *
  32719. * var func = _.over([Math.max, Math.min]);
  32720. *
  32721. * func(1, 2, 3, 4);
  32722. * // => [4, 1]
  32723. */
  32724. var over = createOver(arrayMap);
  32725. /**
  32726. * Creates a function that checks if **all** of the `predicates` return
  32727. * truthy when invoked with the arguments it receives.
  32728. *
  32729. * @static
  32730. * @memberOf _
  32731. * @since 4.0.0
  32732. * @category Util
  32733. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32734. * The predicates to check.
  32735. * @returns {Function} Returns the new function.
  32736. * @example
  32737. *
  32738. * var func = _.overEvery([Boolean, isFinite]);
  32739. *
  32740. * func('1');
  32741. * // => true
  32742. *
  32743. * func(null);
  32744. * // => false
  32745. *
  32746. * func(NaN);
  32747. * // => false
  32748. */
  32749. var overEvery = createOver(arrayEvery);
  32750. /**
  32751. * Creates a function that checks if **any** of the `predicates` return
  32752. * truthy when invoked with the arguments it receives.
  32753. *
  32754. * @static
  32755. * @memberOf _
  32756. * @since 4.0.0
  32757. * @category Util
  32758. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32759. * The predicates to check.
  32760. * @returns {Function} Returns the new function.
  32761. * @example
  32762. *
  32763. * var func = _.overSome([Boolean, isFinite]);
  32764. *
  32765. * func('1');
  32766. * // => true
  32767. *
  32768. * func(null);
  32769. * // => true
  32770. *
  32771. * func(NaN);
  32772. * // => false
  32773. */
  32774. var overSome = createOver(arraySome);
  32775. /**
  32776. * Creates a function that returns the value at `path` of a given object.
  32777. *
  32778. * @static
  32779. * @memberOf _
  32780. * @since 2.4.0
  32781. * @category Util
  32782. * @param {Array|string} path The path of the property to get.
  32783. * @returns {Function} Returns the new accessor function.
  32784. * @example
  32785. *
  32786. * var objects = [
  32787. * { 'a': { 'b': 2 } },
  32788. * { 'a': { 'b': 1 } }
  32789. * ];
  32790. *
  32791. * _.map(objects, _.property('a.b'));
  32792. * // => [2, 1]
  32793. *
  32794. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32795. * // => [1, 2]
  32796. */
  32797. function property(path) {
  32798. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32799. }
  32800. /**
  32801. * The opposite of `_.property`; this method creates a function that returns
  32802. * the value at a given path of `object`.
  32803. *
  32804. * @static
  32805. * @memberOf _
  32806. * @since 3.0.0
  32807. * @category Util
  32808. * @param {Object} object The object to query.
  32809. * @returns {Function} Returns the new accessor function.
  32810. * @example
  32811. *
  32812. * var array = [0, 1, 2],
  32813. * object = { 'a': array, 'b': array, 'c': array };
  32814. *
  32815. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32816. * // => [2, 0]
  32817. *
  32818. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32819. * // => [2, 0]
  32820. */
  32821. function propertyOf(object) {
  32822. return function(path) {
  32823. return object == null ? undefined : baseGet(object, path);
  32824. };
  32825. }
  32826. /**
  32827. * Creates an array of numbers (positive and/or negative) progressing from
  32828. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32829. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32830. * it's set to `start` with `start` then set to `0`.
  32831. *
  32832. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32833. * floating-point values which can produce unexpected results.
  32834. *
  32835. * @static
  32836. * @since 0.1.0
  32837. * @memberOf _
  32838. * @category Util
  32839. * @param {number} [start=0] The start of the range.
  32840. * @param {number} end The end of the range.
  32841. * @param {number} [step=1] The value to increment or decrement by.
  32842. * @returns {Array} Returns the range of numbers.
  32843. * @see _.inRange, _.rangeRight
  32844. * @example
  32845. *
  32846. * _.range(4);
  32847. * // => [0, 1, 2, 3]
  32848. *
  32849. * _.range(-4);
  32850. * // => [0, -1, -2, -3]
  32851. *
  32852. * _.range(1, 5);
  32853. * // => [1, 2, 3, 4]
  32854. *
  32855. * _.range(0, 20, 5);
  32856. * // => [0, 5, 10, 15]
  32857. *
  32858. * _.range(0, -4, -1);
  32859. * // => [0, -1, -2, -3]
  32860. *
  32861. * _.range(1, 4, 0);
  32862. * // => [1, 1, 1]
  32863. *
  32864. * _.range(0);
  32865. * // => []
  32866. */
  32867. var range = createRange();
  32868. /**
  32869. * This method is like `_.range` except that it populates values in
  32870. * descending order.
  32871. *
  32872. * @static
  32873. * @memberOf _
  32874. * @since 4.0.0
  32875. * @category Util
  32876. * @param {number} [start=0] The start of the range.
  32877. * @param {number} end The end of the range.
  32878. * @param {number} [step=1] The value to increment or decrement by.
  32879. * @returns {Array} Returns the range of numbers.
  32880. * @see _.inRange, _.range
  32881. * @example
  32882. *
  32883. * _.rangeRight(4);
  32884. * // => [3, 2, 1, 0]
  32885. *
  32886. * _.rangeRight(-4);
  32887. * // => [-3, -2, -1, 0]
  32888. *
  32889. * _.rangeRight(1, 5);
  32890. * // => [4, 3, 2, 1]
  32891. *
  32892. * _.rangeRight(0, 20, 5);
  32893. * // => [15, 10, 5, 0]
  32894. *
  32895. * _.rangeRight(0, -4, -1);
  32896. * // => [-3, -2, -1, 0]
  32897. *
  32898. * _.rangeRight(1, 4, 0);
  32899. * // => [1, 1, 1]
  32900. *
  32901. * _.rangeRight(0);
  32902. * // => []
  32903. */
  32904. var rangeRight = createRange(true);
  32905. /**
  32906. * This method returns a new empty array.
  32907. *
  32908. * @static
  32909. * @memberOf _
  32910. * @since 4.13.0
  32911. * @category Util
  32912. * @returns {Array} Returns the new empty array.
  32913. * @example
  32914. *
  32915. * var arrays = _.times(2, _.stubArray);
  32916. *
  32917. * console.log(arrays);
  32918. * // => [[], []]
  32919. *
  32920. * console.log(arrays[0] === arrays[1]);
  32921. * // => false
  32922. */
  32923. function stubArray() {
  32924. return [];
  32925. }
  32926. /**
  32927. * This method returns `false`.
  32928. *
  32929. * @static
  32930. * @memberOf _
  32931. * @since 4.13.0
  32932. * @category Util
  32933. * @returns {boolean} Returns `false`.
  32934. * @example
  32935. *
  32936. * _.times(2, _.stubFalse);
  32937. * // => [false, false]
  32938. */
  32939. function stubFalse() {
  32940. return false;
  32941. }
  32942. /**
  32943. * This method returns a new empty object.
  32944. *
  32945. * @static
  32946. * @memberOf _
  32947. * @since 4.13.0
  32948. * @category Util
  32949. * @returns {Object} Returns the new empty object.
  32950. * @example
  32951. *
  32952. * var objects = _.times(2, _.stubObject);
  32953. *
  32954. * console.log(objects);
  32955. * // => [{}, {}]
  32956. *
  32957. * console.log(objects[0] === objects[1]);
  32958. * // => false
  32959. */
  32960. function stubObject() {
  32961. return {};
  32962. }
  32963. /**
  32964. * This method returns an empty string.
  32965. *
  32966. * @static
  32967. * @memberOf _
  32968. * @since 4.13.0
  32969. * @category Util
  32970. * @returns {string} Returns the empty string.
  32971. * @example
  32972. *
  32973. * _.times(2, _.stubString);
  32974. * // => ['', '']
  32975. */
  32976. function stubString() {
  32977. return '';
  32978. }
  32979. /**
  32980. * This method returns `true`.
  32981. *
  32982. * @static
  32983. * @memberOf _
  32984. * @since 4.13.0
  32985. * @category Util
  32986. * @returns {boolean} Returns `true`.
  32987. * @example
  32988. *
  32989. * _.times(2, _.stubTrue);
  32990. * // => [true, true]
  32991. */
  32992. function stubTrue() {
  32993. return true;
  32994. }
  32995. /**
  32996. * Invokes the iteratee `n` times, returning an array of the results of
  32997. * each invocation. The iteratee is invoked with one argument; (index).
  32998. *
  32999. * @static
  33000. * @since 0.1.0
  33001. * @memberOf _
  33002. * @category Util
  33003. * @param {number} n The number of times to invoke `iteratee`.
  33004. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33005. * @returns {Array} Returns the array of results.
  33006. * @example
  33007. *
  33008. * _.times(3, String);
  33009. * // => ['0', '1', '2']
  33010. *
  33011. * _.times(4, _.constant(0));
  33012. * // => [0, 0, 0, 0]
  33013. */
  33014. function times(n, iteratee) {
  33015. n = toInteger(n);
  33016. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33017. return [];
  33018. }
  33019. var index = MAX_ARRAY_LENGTH,
  33020. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33021. iteratee = getIteratee(iteratee);
  33022. n -= MAX_ARRAY_LENGTH;
  33023. var result = baseTimes(length, iteratee);
  33024. while (++index < n) {
  33025. iteratee(index);
  33026. }
  33027. return result;
  33028. }
  33029. /**
  33030. * Converts `value` to a property path array.
  33031. *
  33032. * @static
  33033. * @memberOf _
  33034. * @since 4.0.0
  33035. * @category Util
  33036. * @param {*} value The value to convert.
  33037. * @returns {Array} Returns the new property path array.
  33038. * @example
  33039. *
  33040. * _.toPath('a.b.c');
  33041. * // => ['a', 'b', 'c']
  33042. *
  33043. * _.toPath('a[0].b.c');
  33044. * // => ['a', '0', 'b', 'c']
  33045. */
  33046. function toPath(value) {
  33047. if (isArray(value)) {
  33048. return arrayMap(value, toKey);
  33049. }
  33050. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33051. }
  33052. /**
  33053. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33054. *
  33055. * @static
  33056. * @since 0.1.0
  33057. * @memberOf _
  33058. * @category Util
  33059. * @param {string} [prefix=''] The value to prefix the ID with.
  33060. * @returns {string} Returns the unique ID.
  33061. * @example
  33062. *
  33063. * _.uniqueId('contact_');
  33064. * // => 'contact_104'
  33065. *
  33066. * _.uniqueId();
  33067. * // => '105'
  33068. */
  33069. function uniqueId(prefix) {
  33070. var id = ++idCounter;
  33071. return toString(prefix) + id;
  33072. }
  33073. /*------------------------------------------------------------------------*/
  33074. /**
  33075. * Adds two numbers.
  33076. *
  33077. * @static
  33078. * @memberOf _
  33079. * @since 3.4.0
  33080. * @category Math
  33081. * @param {number} augend The first number in an addition.
  33082. * @param {number} addend The second number in an addition.
  33083. * @returns {number} Returns the total.
  33084. * @example
  33085. *
  33086. * _.add(6, 4);
  33087. * // => 10
  33088. */
  33089. var add = createMathOperation(function(augend, addend) {
  33090. return augend + addend;
  33091. }, 0);
  33092. /**
  33093. * Computes `number` rounded up to `precision`.
  33094. *
  33095. * @static
  33096. * @memberOf _
  33097. * @since 3.10.0
  33098. * @category Math
  33099. * @param {number} number The number to round up.
  33100. * @param {number} [precision=0] The precision to round up to.
  33101. * @returns {number} Returns the rounded up number.
  33102. * @example
  33103. *
  33104. * _.ceil(4.006);
  33105. * // => 5
  33106. *
  33107. * _.ceil(6.004, 2);
  33108. * // => 6.01
  33109. *
  33110. * _.ceil(6040, -2);
  33111. * // => 6100
  33112. */
  33113. var ceil = createRound('ceil');
  33114. /**
  33115. * Divide two numbers.
  33116. *
  33117. * @static
  33118. * @memberOf _
  33119. * @since 4.7.0
  33120. * @category Math
  33121. * @param {number} dividend The first number in a division.
  33122. * @param {number} divisor The second number in a division.
  33123. * @returns {number} Returns the quotient.
  33124. * @example
  33125. *
  33126. * _.divide(6, 4);
  33127. * // => 1.5
  33128. */
  33129. var divide = createMathOperation(function(dividend, divisor) {
  33130. return dividend / divisor;
  33131. }, 1);
  33132. /**
  33133. * Computes `number` rounded down to `precision`.
  33134. *
  33135. * @static
  33136. * @memberOf _
  33137. * @since 3.10.0
  33138. * @category Math
  33139. * @param {number} number The number to round down.
  33140. * @param {number} [precision=0] The precision to round down to.
  33141. * @returns {number} Returns the rounded down number.
  33142. * @example
  33143. *
  33144. * _.floor(4.006);
  33145. * // => 4
  33146. *
  33147. * _.floor(0.046, 2);
  33148. * // => 0.04
  33149. *
  33150. * _.floor(4060, -2);
  33151. * // => 4000
  33152. */
  33153. var floor = createRound('floor');
  33154. /**
  33155. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33156. * `undefined` is returned.
  33157. *
  33158. * @static
  33159. * @since 0.1.0
  33160. * @memberOf _
  33161. * @category Math
  33162. * @param {Array} array The array to iterate over.
  33163. * @returns {*} Returns the maximum value.
  33164. * @example
  33165. *
  33166. * _.max([4, 2, 8, 6]);
  33167. * // => 8
  33168. *
  33169. * _.max([]);
  33170. * // => undefined
  33171. */
  33172. function max(array) {
  33173. return (array && array.length)
  33174. ? baseExtremum(array, identity, baseGt)
  33175. : undefined;
  33176. }
  33177. /**
  33178. * This method is like `_.max` except that it accepts `iteratee` which is
  33179. * invoked for each element in `array` to generate the criterion by which
  33180. * the value is ranked. The iteratee is invoked with one argument: (value).
  33181. *
  33182. * @static
  33183. * @memberOf _
  33184. * @since 4.0.0
  33185. * @category Math
  33186. * @param {Array} array The array to iterate over.
  33187. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33188. * @returns {*} Returns the maximum value.
  33189. * @example
  33190. *
  33191. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33192. *
  33193. * _.maxBy(objects, function(o) { return o.n; });
  33194. * // => { 'n': 2 }
  33195. *
  33196. * // The `_.property` iteratee shorthand.
  33197. * _.maxBy(objects, 'n');
  33198. * // => { 'n': 2 }
  33199. */
  33200. function maxBy(array, iteratee) {
  33201. return (array && array.length)
  33202. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33203. : undefined;
  33204. }
  33205. /**
  33206. * Computes the mean of the values in `array`.
  33207. *
  33208. * @static
  33209. * @memberOf _
  33210. * @since 4.0.0
  33211. * @category Math
  33212. * @param {Array} array The array to iterate over.
  33213. * @returns {number} Returns the mean.
  33214. * @example
  33215. *
  33216. * _.mean([4, 2, 8, 6]);
  33217. * // => 5
  33218. */
  33219. function mean(array) {
  33220. return baseMean(array, identity);
  33221. }
  33222. /**
  33223. * This method is like `_.mean` except that it accepts `iteratee` which is
  33224. * invoked for each element in `array` to generate the value to be averaged.
  33225. * The iteratee is invoked with one argument: (value).
  33226. *
  33227. * @static
  33228. * @memberOf _
  33229. * @since 4.7.0
  33230. * @category Math
  33231. * @param {Array} array The array to iterate over.
  33232. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33233. * @returns {number} Returns the mean.
  33234. * @example
  33235. *
  33236. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33237. *
  33238. * _.meanBy(objects, function(o) { return o.n; });
  33239. * // => 5
  33240. *
  33241. * // The `_.property` iteratee shorthand.
  33242. * _.meanBy(objects, 'n');
  33243. * // => 5
  33244. */
  33245. function meanBy(array, iteratee) {
  33246. return baseMean(array, getIteratee(iteratee, 2));
  33247. }
  33248. /**
  33249. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33250. * `undefined` is returned.
  33251. *
  33252. * @static
  33253. * @since 0.1.0
  33254. * @memberOf _
  33255. * @category Math
  33256. * @param {Array} array The array to iterate over.
  33257. * @returns {*} Returns the minimum value.
  33258. * @example
  33259. *
  33260. * _.min([4, 2, 8, 6]);
  33261. * // => 2
  33262. *
  33263. * _.min([]);
  33264. * // => undefined
  33265. */
  33266. function min(array) {
  33267. return (array && array.length)
  33268. ? baseExtremum(array, identity, baseLt)
  33269. : undefined;
  33270. }
  33271. /**
  33272. * This method is like `_.min` except that it accepts `iteratee` which is
  33273. * invoked for each element in `array` to generate the criterion by which
  33274. * the value is ranked. The iteratee is invoked with one argument: (value).
  33275. *
  33276. * @static
  33277. * @memberOf _
  33278. * @since 4.0.0
  33279. * @category Math
  33280. * @param {Array} array The array to iterate over.
  33281. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33282. * @returns {*} Returns the minimum value.
  33283. * @example
  33284. *
  33285. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33286. *
  33287. * _.minBy(objects, function(o) { return o.n; });
  33288. * // => { 'n': 1 }
  33289. *
  33290. * // The `_.property` iteratee shorthand.
  33291. * _.minBy(objects, 'n');
  33292. * // => { 'n': 1 }
  33293. */
  33294. function minBy(array, iteratee) {
  33295. return (array && array.length)
  33296. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33297. : undefined;
  33298. }
  33299. /**
  33300. * Multiply two numbers.
  33301. *
  33302. * @static
  33303. * @memberOf _
  33304. * @since 4.7.0
  33305. * @category Math
  33306. * @param {number} multiplier The first number in a multiplication.
  33307. * @param {number} multiplicand The second number in a multiplication.
  33308. * @returns {number} Returns the product.
  33309. * @example
  33310. *
  33311. * _.multiply(6, 4);
  33312. * // => 24
  33313. */
  33314. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33315. return multiplier * multiplicand;
  33316. }, 1);
  33317. /**
  33318. * Computes `number` rounded to `precision`.
  33319. *
  33320. * @static
  33321. * @memberOf _
  33322. * @since 3.10.0
  33323. * @category Math
  33324. * @param {number} number The number to round.
  33325. * @param {number} [precision=0] The precision to round to.
  33326. * @returns {number} Returns the rounded number.
  33327. * @example
  33328. *
  33329. * _.round(4.006);
  33330. * // => 4
  33331. *
  33332. * _.round(4.006, 2);
  33333. * // => 4.01
  33334. *
  33335. * _.round(4060, -2);
  33336. * // => 4100
  33337. */
  33338. var round = createRound('round');
  33339. /**
  33340. * Subtract two numbers.
  33341. *
  33342. * @static
  33343. * @memberOf _
  33344. * @since 4.0.0
  33345. * @category Math
  33346. * @param {number} minuend The first number in a subtraction.
  33347. * @param {number} subtrahend The second number in a subtraction.
  33348. * @returns {number} Returns the difference.
  33349. * @example
  33350. *
  33351. * _.subtract(6, 4);
  33352. * // => 2
  33353. */
  33354. var subtract = createMathOperation(function(minuend, subtrahend) {
  33355. return minuend - subtrahend;
  33356. }, 0);
  33357. /**
  33358. * Computes the sum of the values in `array`.
  33359. *
  33360. * @static
  33361. * @memberOf _
  33362. * @since 3.4.0
  33363. * @category Math
  33364. * @param {Array} array The array to iterate over.
  33365. * @returns {number} Returns the sum.
  33366. * @example
  33367. *
  33368. * _.sum([4, 2, 8, 6]);
  33369. * // => 20
  33370. */
  33371. function sum(array) {
  33372. return (array && array.length)
  33373. ? baseSum(array, identity)
  33374. : 0;
  33375. }
  33376. /**
  33377. * This method is like `_.sum` except that it accepts `iteratee` which is
  33378. * invoked for each element in `array` to generate the value to be summed.
  33379. * The iteratee is invoked with one argument: (value).
  33380. *
  33381. * @static
  33382. * @memberOf _
  33383. * @since 4.0.0
  33384. * @category Math
  33385. * @param {Array} array The array to iterate over.
  33386. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33387. * @returns {number} Returns the sum.
  33388. * @example
  33389. *
  33390. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33391. *
  33392. * _.sumBy(objects, function(o) { return o.n; });
  33393. * // => 20
  33394. *
  33395. * // The `_.property` iteratee shorthand.
  33396. * _.sumBy(objects, 'n');
  33397. * // => 20
  33398. */
  33399. function sumBy(array, iteratee) {
  33400. return (array && array.length)
  33401. ? baseSum(array, getIteratee(iteratee, 2))
  33402. : 0;
  33403. }
  33404. /*------------------------------------------------------------------------*/
  33405. // Add methods that return wrapped values in chain sequences.
  33406. lodash.after = after;
  33407. lodash.ary = ary;
  33408. lodash.assign = assign;
  33409. lodash.assignIn = assignIn;
  33410. lodash.assignInWith = assignInWith;
  33411. lodash.assignWith = assignWith;
  33412. lodash.at = at;
  33413. lodash.before = before;
  33414. lodash.bind = bind;
  33415. lodash.bindAll = bindAll;
  33416. lodash.bindKey = bindKey;
  33417. lodash.castArray = castArray;
  33418. lodash.chain = chain;
  33419. lodash.chunk = chunk;
  33420. lodash.compact = compact;
  33421. lodash.concat = concat;
  33422. lodash.cond = cond;
  33423. lodash.conforms = conforms;
  33424. lodash.constant = constant;
  33425. lodash.countBy = countBy;
  33426. lodash.create = create;
  33427. lodash.curry = curry;
  33428. lodash.curryRight = curryRight;
  33429. lodash.debounce = debounce;
  33430. lodash.defaults = defaults;
  33431. lodash.defaultsDeep = defaultsDeep;
  33432. lodash.defer = defer;
  33433. lodash.delay = delay;
  33434. lodash.difference = difference;
  33435. lodash.differenceBy = differenceBy;
  33436. lodash.differenceWith = differenceWith;
  33437. lodash.drop = drop;
  33438. lodash.dropRight = dropRight;
  33439. lodash.dropRightWhile = dropRightWhile;
  33440. lodash.dropWhile = dropWhile;
  33441. lodash.fill = fill;
  33442. lodash.filter = filter;
  33443. lodash.flatMap = flatMap;
  33444. lodash.flatMapDeep = flatMapDeep;
  33445. lodash.flatMapDepth = flatMapDepth;
  33446. lodash.flatten = flatten;
  33447. lodash.flattenDeep = flattenDeep;
  33448. lodash.flattenDepth = flattenDepth;
  33449. lodash.flip = flip;
  33450. lodash.flow = flow;
  33451. lodash.flowRight = flowRight;
  33452. lodash.fromPairs = fromPairs;
  33453. lodash.functions = functions;
  33454. lodash.functionsIn = functionsIn;
  33455. lodash.groupBy = groupBy;
  33456. lodash.initial = initial;
  33457. lodash.intersection = intersection;
  33458. lodash.intersectionBy = intersectionBy;
  33459. lodash.intersectionWith = intersectionWith;
  33460. lodash.invert = invert;
  33461. lodash.invertBy = invertBy;
  33462. lodash.invokeMap = invokeMap;
  33463. lodash.iteratee = iteratee;
  33464. lodash.keyBy = keyBy;
  33465. lodash.keys = keys;
  33466. lodash.keysIn = keysIn;
  33467. lodash.map = map;
  33468. lodash.mapKeys = mapKeys;
  33469. lodash.mapValues = mapValues;
  33470. lodash.matches = matches;
  33471. lodash.matchesProperty = matchesProperty;
  33472. lodash.memoize = memoize;
  33473. lodash.merge = merge;
  33474. lodash.mergeWith = mergeWith;
  33475. lodash.method = method;
  33476. lodash.methodOf = methodOf;
  33477. lodash.mixin = mixin;
  33478. lodash.negate = negate;
  33479. lodash.nthArg = nthArg;
  33480. lodash.omit = omit;
  33481. lodash.omitBy = omitBy;
  33482. lodash.once = once;
  33483. lodash.orderBy = orderBy;
  33484. lodash.over = over;
  33485. lodash.overArgs = overArgs;
  33486. lodash.overEvery = overEvery;
  33487. lodash.overSome = overSome;
  33488. lodash.partial = partial;
  33489. lodash.partialRight = partialRight;
  33490. lodash.partition = partition;
  33491. lodash.pick = pick;
  33492. lodash.pickBy = pickBy;
  33493. lodash.property = property;
  33494. lodash.propertyOf = propertyOf;
  33495. lodash.pull = pull;
  33496. lodash.pullAll = pullAll;
  33497. lodash.pullAllBy = pullAllBy;
  33498. lodash.pullAllWith = pullAllWith;
  33499. lodash.pullAt = pullAt;
  33500. lodash.range = range;
  33501. lodash.rangeRight = rangeRight;
  33502. lodash.rearg = rearg;
  33503. lodash.reject = reject;
  33504. lodash.remove = remove;
  33505. lodash.rest = rest;
  33506. lodash.reverse = reverse;
  33507. lodash.sampleSize = sampleSize;
  33508. lodash.set = set;
  33509. lodash.setWith = setWith;
  33510. lodash.shuffle = shuffle;
  33511. lodash.slice = slice;
  33512. lodash.sortBy = sortBy;
  33513. lodash.sortedUniq = sortedUniq;
  33514. lodash.sortedUniqBy = sortedUniqBy;
  33515. lodash.split = split;
  33516. lodash.spread = spread;
  33517. lodash.tail = tail;
  33518. lodash.take = take;
  33519. lodash.takeRight = takeRight;
  33520. lodash.takeRightWhile = takeRightWhile;
  33521. lodash.takeWhile = takeWhile;
  33522. lodash.tap = tap;
  33523. lodash.throttle = throttle;
  33524. lodash.thru = thru;
  33525. lodash.toArray = toArray;
  33526. lodash.toPairs = toPairs;
  33527. lodash.toPairsIn = toPairsIn;
  33528. lodash.toPath = toPath;
  33529. lodash.toPlainObject = toPlainObject;
  33530. lodash.transform = transform;
  33531. lodash.unary = unary;
  33532. lodash.union = union;
  33533. lodash.unionBy = unionBy;
  33534. lodash.unionWith = unionWith;
  33535. lodash.uniq = uniq;
  33536. lodash.uniqBy = uniqBy;
  33537. lodash.uniqWith = uniqWith;
  33538. lodash.unset = unset;
  33539. lodash.unzip = unzip;
  33540. lodash.unzipWith = unzipWith;
  33541. lodash.update = update;
  33542. lodash.updateWith = updateWith;
  33543. lodash.values = values;
  33544. lodash.valuesIn = valuesIn;
  33545. lodash.without = without;
  33546. lodash.words = words;
  33547. lodash.wrap = wrap;
  33548. lodash.xor = xor;
  33549. lodash.xorBy = xorBy;
  33550. lodash.xorWith = xorWith;
  33551. lodash.zip = zip;
  33552. lodash.zipObject = zipObject;
  33553. lodash.zipObjectDeep = zipObjectDeep;
  33554. lodash.zipWith = zipWith;
  33555. // Add aliases.
  33556. lodash.entries = toPairs;
  33557. lodash.entriesIn = toPairsIn;
  33558. lodash.extend = assignIn;
  33559. lodash.extendWith = assignInWith;
  33560. // Add methods to `lodash.prototype`.
  33561. mixin(lodash, lodash);
  33562. /*------------------------------------------------------------------------*/
  33563. // Add methods that return unwrapped values in chain sequences.
  33564. lodash.add = add;
  33565. lodash.attempt = attempt;
  33566. lodash.camelCase = camelCase;
  33567. lodash.capitalize = capitalize;
  33568. lodash.ceil = ceil;
  33569. lodash.clamp = clamp;
  33570. lodash.clone = clone;
  33571. lodash.cloneDeep = cloneDeep;
  33572. lodash.cloneDeepWith = cloneDeepWith;
  33573. lodash.cloneWith = cloneWith;
  33574. lodash.conformsTo = conformsTo;
  33575. lodash.deburr = deburr;
  33576. lodash.defaultTo = defaultTo;
  33577. lodash.divide = divide;
  33578. lodash.endsWith = endsWith;
  33579. lodash.eq = eq;
  33580. lodash.escape = escape;
  33581. lodash.escapeRegExp = escapeRegExp;
  33582. lodash.every = every;
  33583. lodash.find = find;
  33584. lodash.findIndex = findIndex;
  33585. lodash.findKey = findKey;
  33586. lodash.findLast = findLast;
  33587. lodash.findLastIndex = findLastIndex;
  33588. lodash.findLastKey = findLastKey;
  33589. lodash.floor = floor;
  33590. lodash.forEach = forEach;
  33591. lodash.forEachRight = forEachRight;
  33592. lodash.forIn = forIn;
  33593. lodash.forInRight = forInRight;
  33594. lodash.forOwn = forOwn;
  33595. lodash.forOwnRight = forOwnRight;
  33596. lodash.get = get;
  33597. lodash.gt = gt;
  33598. lodash.gte = gte;
  33599. lodash.has = has;
  33600. lodash.hasIn = hasIn;
  33601. lodash.head = head;
  33602. lodash.identity = identity;
  33603. lodash.includes = includes;
  33604. lodash.indexOf = indexOf;
  33605. lodash.inRange = inRange;
  33606. lodash.invoke = invoke;
  33607. lodash.isArguments = isArguments;
  33608. lodash.isArray = isArray;
  33609. lodash.isArrayBuffer = isArrayBuffer;
  33610. lodash.isArrayLike = isArrayLike;
  33611. lodash.isArrayLikeObject = isArrayLikeObject;
  33612. lodash.isBoolean = isBoolean;
  33613. lodash.isBuffer = isBuffer;
  33614. lodash.isDate = isDate;
  33615. lodash.isElement = isElement;
  33616. lodash.isEmpty = isEmpty;
  33617. lodash.isEqual = isEqual;
  33618. lodash.isEqualWith = isEqualWith;
  33619. lodash.isError = isError;
  33620. lodash.isFinite = isFinite;
  33621. lodash.isFunction = isFunction;
  33622. lodash.isInteger = isInteger;
  33623. lodash.isLength = isLength;
  33624. lodash.isMap = isMap;
  33625. lodash.isMatch = isMatch;
  33626. lodash.isMatchWith = isMatchWith;
  33627. lodash.isNaN = isNaN;
  33628. lodash.isNative = isNative;
  33629. lodash.isNil = isNil;
  33630. lodash.isNull = isNull;
  33631. lodash.isNumber = isNumber;
  33632. lodash.isObject = isObject;
  33633. lodash.isObjectLike = isObjectLike;
  33634. lodash.isPlainObject = isPlainObject;
  33635. lodash.isRegExp = isRegExp;
  33636. lodash.isSafeInteger = isSafeInteger;
  33637. lodash.isSet = isSet;
  33638. lodash.isString = isString;
  33639. lodash.isSymbol = isSymbol;
  33640. lodash.isTypedArray = isTypedArray;
  33641. lodash.isUndefined = isUndefined;
  33642. lodash.isWeakMap = isWeakMap;
  33643. lodash.isWeakSet = isWeakSet;
  33644. lodash.join = join;
  33645. lodash.kebabCase = kebabCase;
  33646. lodash.last = last;
  33647. lodash.lastIndexOf = lastIndexOf;
  33648. lodash.lowerCase = lowerCase;
  33649. lodash.lowerFirst = lowerFirst;
  33650. lodash.lt = lt;
  33651. lodash.lte = lte;
  33652. lodash.max = max;
  33653. lodash.maxBy = maxBy;
  33654. lodash.mean = mean;
  33655. lodash.meanBy = meanBy;
  33656. lodash.min = min;
  33657. lodash.minBy = minBy;
  33658. lodash.stubArray = stubArray;
  33659. lodash.stubFalse = stubFalse;
  33660. lodash.stubObject = stubObject;
  33661. lodash.stubString = stubString;
  33662. lodash.stubTrue = stubTrue;
  33663. lodash.multiply = multiply;
  33664. lodash.nth = nth;
  33665. lodash.noConflict = noConflict;
  33666. lodash.noop = noop;
  33667. lodash.now = now;
  33668. lodash.pad = pad;
  33669. lodash.padEnd = padEnd;
  33670. lodash.padStart = padStart;
  33671. lodash.parseInt = parseInt;
  33672. lodash.random = random;
  33673. lodash.reduce = reduce;
  33674. lodash.reduceRight = reduceRight;
  33675. lodash.repeat = repeat;
  33676. lodash.replace = replace;
  33677. lodash.result = result;
  33678. lodash.round = round;
  33679. lodash.runInContext = runInContext;
  33680. lodash.sample = sample;
  33681. lodash.size = size;
  33682. lodash.snakeCase = snakeCase;
  33683. lodash.some = some;
  33684. lodash.sortedIndex = sortedIndex;
  33685. lodash.sortedIndexBy = sortedIndexBy;
  33686. lodash.sortedIndexOf = sortedIndexOf;
  33687. lodash.sortedLastIndex = sortedLastIndex;
  33688. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33689. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33690. lodash.startCase = startCase;
  33691. lodash.startsWith = startsWith;
  33692. lodash.subtract = subtract;
  33693. lodash.sum = sum;
  33694. lodash.sumBy = sumBy;
  33695. lodash.template = template;
  33696. lodash.times = times;
  33697. lodash.toFinite = toFinite;
  33698. lodash.toInteger = toInteger;
  33699. lodash.toLength = toLength;
  33700. lodash.toLower = toLower;
  33701. lodash.toNumber = toNumber;
  33702. lodash.toSafeInteger = toSafeInteger;
  33703. lodash.toString = toString;
  33704. lodash.toUpper = toUpper;
  33705. lodash.trim = trim;
  33706. lodash.trimEnd = trimEnd;
  33707. lodash.trimStart = trimStart;
  33708. lodash.truncate = truncate;
  33709. lodash.unescape = unescape;
  33710. lodash.uniqueId = uniqueId;
  33711. lodash.upperCase = upperCase;
  33712. lodash.upperFirst = upperFirst;
  33713. // Add aliases.
  33714. lodash.each = forEach;
  33715. lodash.eachRight = forEachRight;
  33716. lodash.first = head;
  33717. mixin(lodash, (function() {
  33718. var source = {};
  33719. baseForOwn(lodash, function(func, methodName) {
  33720. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33721. source[methodName] = func;
  33722. }
  33723. });
  33724. return source;
  33725. }()), { 'chain': false });
  33726. /*------------------------------------------------------------------------*/
  33727. /**
  33728. * The semantic version number.
  33729. *
  33730. * @static
  33731. * @memberOf _
  33732. * @type {string}
  33733. */
  33734. lodash.VERSION = VERSION;
  33735. // Assign default placeholders.
  33736. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33737. lodash[methodName].placeholder = lodash;
  33738. });
  33739. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33740. arrayEach(['drop', 'take'], function(methodName, index) {
  33741. LazyWrapper.prototype[methodName] = function(n) {
  33742. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33743. var result = (this.__filtered__ && !index)
  33744. ? new LazyWrapper(this)
  33745. : this.clone();
  33746. if (result.__filtered__) {
  33747. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33748. } else {
  33749. result.__views__.push({
  33750. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33751. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33752. });
  33753. }
  33754. return result;
  33755. };
  33756. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33757. return this.reverse()[methodName](n).reverse();
  33758. };
  33759. });
  33760. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33761. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33762. var type = index + 1,
  33763. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33764. LazyWrapper.prototype[methodName] = function(iteratee) {
  33765. var result = this.clone();
  33766. result.__iteratees__.push({
  33767. 'iteratee': getIteratee(iteratee, 3),
  33768. 'type': type
  33769. });
  33770. result.__filtered__ = result.__filtered__ || isFilter;
  33771. return result;
  33772. };
  33773. });
  33774. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33775. arrayEach(['head', 'last'], function(methodName, index) {
  33776. var takeName = 'take' + (index ? 'Right' : '');
  33777. LazyWrapper.prototype[methodName] = function() {
  33778. return this[takeName](1).value()[0];
  33779. };
  33780. });
  33781. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33782. arrayEach(['initial', 'tail'], function(methodName, index) {
  33783. var dropName = 'drop' + (index ? '' : 'Right');
  33784. LazyWrapper.prototype[methodName] = function() {
  33785. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33786. };
  33787. });
  33788. LazyWrapper.prototype.compact = function() {
  33789. return this.filter(identity);
  33790. };
  33791. LazyWrapper.prototype.find = function(predicate) {
  33792. return this.filter(predicate).head();
  33793. };
  33794. LazyWrapper.prototype.findLast = function(predicate) {
  33795. return this.reverse().find(predicate);
  33796. };
  33797. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33798. if (typeof path == 'function') {
  33799. return new LazyWrapper(this);
  33800. }
  33801. return this.map(function(value) {
  33802. return baseInvoke(value, path, args);
  33803. });
  33804. });
  33805. LazyWrapper.prototype.reject = function(predicate) {
  33806. return this.filter(negate(getIteratee(predicate)));
  33807. };
  33808. LazyWrapper.prototype.slice = function(start, end) {
  33809. start = toInteger(start);
  33810. var result = this;
  33811. if (result.__filtered__ && (start > 0 || end < 0)) {
  33812. return new LazyWrapper(result);
  33813. }
  33814. if (start < 0) {
  33815. result = result.takeRight(-start);
  33816. } else if (start) {
  33817. result = result.drop(start);
  33818. }
  33819. if (end !== undefined) {
  33820. end = toInteger(end);
  33821. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33822. }
  33823. return result;
  33824. };
  33825. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33826. return this.reverse().takeWhile(predicate).reverse();
  33827. };
  33828. LazyWrapper.prototype.toArray = function() {
  33829. return this.take(MAX_ARRAY_LENGTH);
  33830. };
  33831. // Add `LazyWrapper` methods to `lodash.prototype`.
  33832. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33833. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33834. isTaker = /^(?:head|last)$/.test(methodName),
  33835. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33836. retUnwrapped = isTaker || /^find/.test(methodName);
  33837. if (!lodashFunc) {
  33838. return;
  33839. }
  33840. lodash.prototype[methodName] = function() {
  33841. var value = this.__wrapped__,
  33842. args = isTaker ? [1] : arguments,
  33843. isLazy = value instanceof LazyWrapper,
  33844. iteratee = args[0],
  33845. useLazy = isLazy || isArray(value);
  33846. var interceptor = function(value) {
  33847. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33848. return (isTaker && chainAll) ? result[0] : result;
  33849. };
  33850. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33851. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33852. isLazy = useLazy = false;
  33853. }
  33854. var chainAll = this.__chain__,
  33855. isHybrid = !!this.__actions__.length,
  33856. isUnwrapped = retUnwrapped && !chainAll,
  33857. onlyLazy = isLazy && !isHybrid;
  33858. if (!retUnwrapped && useLazy) {
  33859. value = onlyLazy ? value : new LazyWrapper(this);
  33860. var result = func.apply(value, args);
  33861. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33862. return new LodashWrapper(result, chainAll);
  33863. }
  33864. if (isUnwrapped && onlyLazy) {
  33865. return func.apply(this, args);
  33866. }
  33867. result = this.thru(interceptor);
  33868. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33869. };
  33870. });
  33871. // Add `Array` methods to `lodash.prototype`.
  33872. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33873. var func = arrayProto[methodName],
  33874. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33875. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33876. lodash.prototype[methodName] = function() {
  33877. var args = arguments;
  33878. if (retUnwrapped && !this.__chain__) {
  33879. var value = this.value();
  33880. return func.apply(isArray(value) ? value : [], args);
  33881. }
  33882. return this[chainName](function(value) {
  33883. return func.apply(isArray(value) ? value : [], args);
  33884. });
  33885. };
  33886. });
  33887. // Map minified method names to their real names.
  33888. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33889. var lodashFunc = lodash[methodName];
  33890. if (lodashFunc) {
  33891. var key = lodashFunc.name + '';
  33892. if (!hasOwnProperty.call(realNames, key)) {
  33893. realNames[key] = [];
  33894. }
  33895. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33896. }
  33897. });
  33898. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33899. 'name': 'wrapper',
  33900. 'func': undefined
  33901. }];
  33902. // Add methods to `LazyWrapper`.
  33903. LazyWrapper.prototype.clone = lazyClone;
  33904. LazyWrapper.prototype.reverse = lazyReverse;
  33905. LazyWrapper.prototype.value = lazyValue;
  33906. // Add chain sequence methods to the `lodash` wrapper.
  33907. lodash.prototype.at = wrapperAt;
  33908. lodash.prototype.chain = wrapperChain;
  33909. lodash.prototype.commit = wrapperCommit;
  33910. lodash.prototype.next = wrapperNext;
  33911. lodash.prototype.plant = wrapperPlant;
  33912. lodash.prototype.reverse = wrapperReverse;
  33913. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33914. // Add lazy aliases.
  33915. lodash.prototype.first = lodash.prototype.head;
  33916. if (symIterator) {
  33917. lodash.prototype[symIterator] = wrapperToIterator;
  33918. }
  33919. return lodash;
  33920. });
  33921. /*--------------------------------------------------------------------------*/
  33922. // Export lodash.
  33923. var _ = runInContext();
  33924. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33925. if (true) {
  33926. // Expose Lodash on the global object to prevent errors when Lodash is
  33927. // loaded by a script tag in the presence of an AMD loader.
  33928. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33929. // Use `_.noConflict` to remove Lodash from the global object.
  33930. root._ = _;
  33931. // Define as an anonymous module so, through path mapping, it can be
  33932. // referenced as the "underscore" module.
  33933. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33934. return _;
  33935. }).call(exports, __webpack_require__, exports, module),
  33936. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33937. }
  33938. // Check for `exports` after `define` in case a build optimizer adds it.
  33939. else {}
  33940. }.call(this));
  33941. /* 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)))
  33942. /***/ }),
  33943. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33944. /*!***************************************************!*\
  33945. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33946. \***************************************************/
  33947. /*! exports provided: default */
  33948. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33949. "use strict";
  33950. __webpack_require__.r(__webpack_exports__);
  33951. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33952. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33953. * @version 1.16.1
  33954. * @license
  33955. * Copyright (c) 2016 Federico Zivolo and contributors
  33956. *
  33957. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33958. * of this software and associated documentation files (the "Software"), to deal
  33959. * in the Software without restriction, including without limitation the rights
  33960. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33961. * copies of the Software, and to permit persons to whom the Software is
  33962. * furnished to do so, subject to the following conditions:
  33963. *
  33964. * The above copyright notice and this permission notice shall be included in all
  33965. * copies or substantial portions of the Software.
  33966. *
  33967. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33968. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33969. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33970. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33971. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33972. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33973. * SOFTWARE.
  33974. */
  33975. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33976. var timeoutDuration = function () {
  33977. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33978. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33979. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33980. return 1;
  33981. }
  33982. }
  33983. return 0;
  33984. }();
  33985. function microtaskDebounce(fn) {
  33986. var called = false;
  33987. return function () {
  33988. if (called) {
  33989. return;
  33990. }
  33991. called = true;
  33992. window.Promise.resolve().then(function () {
  33993. called = false;
  33994. fn();
  33995. });
  33996. };
  33997. }
  33998. function taskDebounce(fn) {
  33999. var scheduled = false;
  34000. return function () {
  34001. if (!scheduled) {
  34002. scheduled = true;
  34003. setTimeout(function () {
  34004. scheduled = false;
  34005. fn();
  34006. }, timeoutDuration);
  34007. }
  34008. };
  34009. }
  34010. var supportsMicroTasks = isBrowser && window.Promise;
  34011. /**
  34012. * Create a debounced version of a method, that's asynchronously deferred
  34013. * but called in the minimum time possible.
  34014. *
  34015. * @method
  34016. * @memberof Popper.Utils
  34017. * @argument {Function} fn
  34018. * @returns {Function}
  34019. */
  34020. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34021. /**
  34022. * Check if the given variable is a function
  34023. * @method
  34024. * @memberof Popper.Utils
  34025. * @argument {Any} functionToCheck - variable to check
  34026. * @returns {Boolean} answer to: is a function?
  34027. */
  34028. function isFunction(functionToCheck) {
  34029. var getType = {};
  34030. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34031. }
  34032. /**
  34033. * Get CSS computed property of the given element
  34034. * @method
  34035. * @memberof Popper.Utils
  34036. * @argument {Eement} element
  34037. * @argument {String} property
  34038. */
  34039. function getStyleComputedProperty(element, property) {
  34040. if (element.nodeType !== 1) {
  34041. return [];
  34042. }
  34043. // NOTE: 1 DOM access here
  34044. var window = element.ownerDocument.defaultView;
  34045. var css = window.getComputedStyle(element, null);
  34046. return property ? css[property] : css;
  34047. }
  34048. /**
  34049. * Returns the parentNode or the host of the element
  34050. * @method
  34051. * @memberof Popper.Utils
  34052. * @argument {Element} element
  34053. * @returns {Element} parent
  34054. */
  34055. function getParentNode(element) {
  34056. if (element.nodeName === 'HTML') {
  34057. return element;
  34058. }
  34059. return element.parentNode || element.host;
  34060. }
  34061. /**
  34062. * Returns the scrolling parent of the given element
  34063. * @method
  34064. * @memberof Popper.Utils
  34065. * @argument {Element} element
  34066. * @returns {Element} scroll parent
  34067. */
  34068. function getScrollParent(element) {
  34069. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34070. if (!element) {
  34071. return document.body;
  34072. }
  34073. switch (element.nodeName) {
  34074. case 'HTML':
  34075. case 'BODY':
  34076. return element.ownerDocument.body;
  34077. case '#document':
  34078. return element.body;
  34079. }
  34080. // Firefox want us to check `-x` and `-y` variations as well
  34081. var _getStyleComputedProp = getStyleComputedProperty(element),
  34082. overflow = _getStyleComputedProp.overflow,
  34083. overflowX = _getStyleComputedProp.overflowX,
  34084. overflowY = _getStyleComputedProp.overflowY;
  34085. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34086. return element;
  34087. }
  34088. return getScrollParent(getParentNode(element));
  34089. }
  34090. /**
  34091. * Returns the reference node of the reference object, or the reference object itself.
  34092. * @method
  34093. * @memberof Popper.Utils
  34094. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34095. * @returns {Element} parent
  34096. */
  34097. function getReferenceNode(reference) {
  34098. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34099. }
  34100. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34101. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34102. /**
  34103. * Determines if the browser is Internet Explorer
  34104. * @method
  34105. * @memberof Popper.Utils
  34106. * @param {Number} version to check
  34107. * @returns {Boolean} isIE
  34108. */
  34109. function isIE(version) {
  34110. if (version === 11) {
  34111. return isIE11;
  34112. }
  34113. if (version === 10) {
  34114. return isIE10;
  34115. }
  34116. return isIE11 || isIE10;
  34117. }
  34118. /**
  34119. * Returns the offset parent of the given element
  34120. * @method
  34121. * @memberof Popper.Utils
  34122. * @argument {Element} element
  34123. * @returns {Element} offset parent
  34124. */
  34125. function getOffsetParent(element) {
  34126. if (!element) {
  34127. return document.documentElement;
  34128. }
  34129. var noOffsetParent = isIE(10) ? document.body : null;
  34130. // NOTE: 1 DOM access here
  34131. var offsetParent = element.offsetParent || null;
  34132. // Skip hidden elements which don't have an offsetParent
  34133. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34134. offsetParent = (element = element.nextElementSibling).offsetParent;
  34135. }
  34136. var nodeName = offsetParent && offsetParent.nodeName;
  34137. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34138. return element ? element.ownerDocument.documentElement : document.documentElement;
  34139. }
  34140. // .offsetParent will return the closest TH, TD or TABLE in case
  34141. // no offsetParent is present, I hate this job...
  34142. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34143. return getOffsetParent(offsetParent);
  34144. }
  34145. return offsetParent;
  34146. }
  34147. function isOffsetContainer(element) {
  34148. var nodeName = element.nodeName;
  34149. if (nodeName === 'BODY') {
  34150. return false;
  34151. }
  34152. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34153. }
  34154. /**
  34155. * Finds the root node (document, shadowDOM root) of the given element
  34156. * @method
  34157. * @memberof Popper.Utils
  34158. * @argument {Element} node
  34159. * @returns {Element} root node
  34160. */
  34161. function getRoot(node) {
  34162. if (node.parentNode !== null) {
  34163. return getRoot(node.parentNode);
  34164. }
  34165. return node;
  34166. }
  34167. /**
  34168. * Finds the offset parent common to the two provided nodes
  34169. * @method
  34170. * @memberof Popper.Utils
  34171. * @argument {Element} element1
  34172. * @argument {Element} element2
  34173. * @returns {Element} common offset parent
  34174. */
  34175. function findCommonOffsetParent(element1, element2) {
  34176. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34177. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34178. return document.documentElement;
  34179. }
  34180. // Here we make sure to give as "start" the element that comes first in the DOM
  34181. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34182. var start = order ? element1 : element2;
  34183. var end = order ? element2 : element1;
  34184. // Get common ancestor container
  34185. var range = document.createRange();
  34186. range.setStart(start, 0);
  34187. range.setEnd(end, 0);
  34188. var commonAncestorContainer = range.commonAncestorContainer;
  34189. // Both nodes are inside #document
  34190. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34191. if (isOffsetContainer(commonAncestorContainer)) {
  34192. return commonAncestorContainer;
  34193. }
  34194. return getOffsetParent(commonAncestorContainer);
  34195. }
  34196. // one of the nodes is inside shadowDOM, find which one
  34197. var element1root = getRoot(element1);
  34198. if (element1root.host) {
  34199. return findCommonOffsetParent(element1root.host, element2);
  34200. } else {
  34201. return findCommonOffsetParent(element1, getRoot(element2).host);
  34202. }
  34203. }
  34204. /**
  34205. * Gets the scroll value of the given element in the given side (top and left)
  34206. * @method
  34207. * @memberof Popper.Utils
  34208. * @argument {Element} element
  34209. * @argument {String} side `top` or `left`
  34210. * @returns {number} amount of scrolled pixels
  34211. */
  34212. function getScroll(element) {
  34213. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34214. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34215. var nodeName = element.nodeName;
  34216. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34217. var html = element.ownerDocument.documentElement;
  34218. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34219. return scrollingElement[upperSide];
  34220. }
  34221. return element[upperSide];
  34222. }
  34223. /*
  34224. * Sum or subtract the element scroll values (left and top) from a given rect object
  34225. * @method
  34226. * @memberof Popper.Utils
  34227. * @param {Object} rect - Rect object you want to change
  34228. * @param {HTMLElement} element - The element from the function reads the scroll values
  34229. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34230. * @return {Object} rect - The modifier rect object
  34231. */
  34232. function includeScroll(rect, element) {
  34233. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34234. var scrollTop = getScroll(element, 'top');
  34235. var scrollLeft = getScroll(element, 'left');
  34236. var modifier = subtract ? -1 : 1;
  34237. rect.top += scrollTop * modifier;
  34238. rect.bottom += scrollTop * modifier;
  34239. rect.left += scrollLeft * modifier;
  34240. rect.right += scrollLeft * modifier;
  34241. return rect;
  34242. }
  34243. /*
  34244. * Helper to detect borders of a given element
  34245. * @method
  34246. * @memberof Popper.Utils
  34247. * @param {CSSStyleDeclaration} styles
  34248. * Result of `getStyleComputedProperty` on the given element
  34249. * @param {String} axis - `x` or `y`
  34250. * @return {number} borders - The borders size of the given axis
  34251. */
  34252. function getBordersSize(styles, axis) {
  34253. var sideA = axis === 'x' ? 'Left' : 'Top';
  34254. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34255. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34256. }
  34257. function getSize(axis, body, html, computedStyle) {
  34258. 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);
  34259. }
  34260. function getWindowSizes(document) {
  34261. var body = document.body;
  34262. var html = document.documentElement;
  34263. var computedStyle = isIE(10) && getComputedStyle(html);
  34264. return {
  34265. height: getSize('Height', body, html, computedStyle),
  34266. width: getSize('Width', body, html, computedStyle)
  34267. };
  34268. }
  34269. var classCallCheck = function (instance, Constructor) {
  34270. if (!(instance instanceof Constructor)) {
  34271. throw new TypeError("Cannot call a class as a function");
  34272. }
  34273. };
  34274. var createClass = function () {
  34275. function defineProperties(target, props) {
  34276. for (var i = 0; i < props.length; i++) {
  34277. var descriptor = props[i];
  34278. descriptor.enumerable = descriptor.enumerable || false;
  34279. descriptor.configurable = true;
  34280. if ("value" in descriptor) descriptor.writable = true;
  34281. Object.defineProperty(target, descriptor.key, descriptor);
  34282. }
  34283. }
  34284. return function (Constructor, protoProps, staticProps) {
  34285. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34286. if (staticProps) defineProperties(Constructor, staticProps);
  34287. return Constructor;
  34288. };
  34289. }();
  34290. var defineProperty = function (obj, key, value) {
  34291. if (key in obj) {
  34292. Object.defineProperty(obj, key, {
  34293. value: value,
  34294. enumerable: true,
  34295. configurable: true,
  34296. writable: true
  34297. });
  34298. } else {
  34299. obj[key] = value;
  34300. }
  34301. return obj;
  34302. };
  34303. var _extends = Object.assign || function (target) {
  34304. for (var i = 1; i < arguments.length; i++) {
  34305. var source = arguments[i];
  34306. for (var key in source) {
  34307. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34308. target[key] = source[key];
  34309. }
  34310. }
  34311. }
  34312. return target;
  34313. };
  34314. /**
  34315. * Given element offsets, generate an output similar to getBoundingClientRect
  34316. * @method
  34317. * @memberof Popper.Utils
  34318. * @argument {Object} offsets
  34319. * @returns {Object} ClientRect like output
  34320. */
  34321. function getClientRect(offsets) {
  34322. return _extends({}, offsets, {
  34323. right: offsets.left + offsets.width,
  34324. bottom: offsets.top + offsets.height
  34325. });
  34326. }
  34327. /**
  34328. * Get bounding client rect of given element
  34329. * @method
  34330. * @memberof Popper.Utils
  34331. * @param {HTMLElement} element
  34332. * @return {Object} client rect
  34333. */
  34334. function getBoundingClientRect(element) {
  34335. var rect = {};
  34336. // IE10 10 FIX: Please, don't ask, the element isn't
  34337. // considered in DOM in some circumstances...
  34338. // This isn't reproducible in IE10 compatibility mode of IE11
  34339. try {
  34340. if (isIE(10)) {
  34341. rect = element.getBoundingClientRect();
  34342. var scrollTop = getScroll(element, 'top');
  34343. var scrollLeft = getScroll(element, 'left');
  34344. rect.top += scrollTop;
  34345. rect.left += scrollLeft;
  34346. rect.bottom += scrollTop;
  34347. rect.right += scrollLeft;
  34348. } else {
  34349. rect = element.getBoundingClientRect();
  34350. }
  34351. } catch (e) {}
  34352. var result = {
  34353. left: rect.left,
  34354. top: rect.top,
  34355. width: rect.right - rect.left,
  34356. height: rect.bottom - rect.top
  34357. };
  34358. // subtract scrollbar size from sizes
  34359. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34360. var width = sizes.width || element.clientWidth || result.width;
  34361. var height = sizes.height || element.clientHeight || result.height;
  34362. var horizScrollbar = element.offsetWidth - width;
  34363. var vertScrollbar = element.offsetHeight - height;
  34364. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34365. // we make this check conditional for performance reasons
  34366. if (horizScrollbar || vertScrollbar) {
  34367. var styles = getStyleComputedProperty(element);
  34368. horizScrollbar -= getBordersSize(styles, 'x');
  34369. vertScrollbar -= getBordersSize(styles, 'y');
  34370. result.width -= horizScrollbar;
  34371. result.height -= vertScrollbar;
  34372. }
  34373. return getClientRect(result);
  34374. }
  34375. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34376. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34377. var isIE10 = isIE(10);
  34378. var isHTML = parent.nodeName === 'HTML';
  34379. var childrenRect = getBoundingClientRect(children);
  34380. var parentRect = getBoundingClientRect(parent);
  34381. var scrollParent = getScrollParent(children);
  34382. var styles = getStyleComputedProperty(parent);
  34383. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34384. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34385. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34386. if (fixedPosition && isHTML) {
  34387. parentRect.top = Math.max(parentRect.top, 0);
  34388. parentRect.left = Math.max(parentRect.left, 0);
  34389. }
  34390. var offsets = getClientRect({
  34391. top: childrenRect.top - parentRect.top - borderTopWidth,
  34392. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34393. width: childrenRect.width,
  34394. height: childrenRect.height
  34395. });
  34396. offsets.marginTop = 0;
  34397. offsets.marginLeft = 0;
  34398. // Subtract margins of documentElement in case it's being used as parent
  34399. // we do this only on HTML because it's the only element that behaves
  34400. // differently when margins are applied to it. The margins are included in
  34401. // the box of the documentElement, in the other cases not.
  34402. if (!isIE10 && isHTML) {
  34403. var marginTop = parseFloat(styles.marginTop);
  34404. var marginLeft = parseFloat(styles.marginLeft);
  34405. offsets.top -= borderTopWidth - marginTop;
  34406. offsets.bottom -= borderTopWidth - marginTop;
  34407. offsets.left -= borderLeftWidth - marginLeft;
  34408. offsets.right -= borderLeftWidth - marginLeft;
  34409. // Attach marginTop and marginLeft because in some circumstances we may need them
  34410. offsets.marginTop = marginTop;
  34411. offsets.marginLeft = marginLeft;
  34412. }
  34413. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34414. offsets = includeScroll(offsets, parent);
  34415. }
  34416. return offsets;
  34417. }
  34418. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34419. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34420. var html = element.ownerDocument.documentElement;
  34421. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34422. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34423. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34424. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34425. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34426. var offset = {
  34427. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34428. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34429. width: width,
  34430. height: height
  34431. };
  34432. return getClientRect(offset);
  34433. }
  34434. /**
  34435. * Check if the given element is fixed or is inside a fixed parent
  34436. * @method
  34437. * @memberof Popper.Utils
  34438. * @argument {Element} element
  34439. * @argument {Element} customContainer
  34440. * @returns {Boolean} answer to "isFixed?"
  34441. */
  34442. function isFixed(element) {
  34443. var nodeName = element.nodeName;
  34444. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34445. return false;
  34446. }
  34447. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34448. return true;
  34449. }
  34450. var parentNode = getParentNode(element);
  34451. if (!parentNode) {
  34452. return false;
  34453. }
  34454. return isFixed(parentNode);
  34455. }
  34456. /**
  34457. * Finds the first parent of an element that has a transformed property defined
  34458. * @method
  34459. * @memberof Popper.Utils
  34460. * @argument {Element} element
  34461. * @returns {Element} first transformed parent or documentElement
  34462. */
  34463. function getFixedPositionOffsetParent(element) {
  34464. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34465. if (!element || !element.parentElement || isIE()) {
  34466. return document.documentElement;
  34467. }
  34468. var el = element.parentElement;
  34469. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34470. el = el.parentElement;
  34471. }
  34472. return el || document.documentElement;
  34473. }
  34474. /**
  34475. * Computed the boundaries limits and return them
  34476. * @method
  34477. * @memberof Popper.Utils
  34478. * @param {HTMLElement} popper
  34479. * @param {HTMLElement} reference
  34480. * @param {number} padding
  34481. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34482. * @param {Boolean} fixedPosition - Is in fixed position mode
  34483. * @returns {Object} Coordinates of the boundaries
  34484. */
  34485. function getBoundaries(popper, reference, padding, boundariesElement) {
  34486. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34487. // NOTE: 1 DOM access here
  34488. var boundaries = { top: 0, left: 0 };
  34489. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34490. // Handle viewport case
  34491. if (boundariesElement === 'viewport') {
  34492. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34493. } else {
  34494. // Handle other cases based on DOM element used as boundaries
  34495. var boundariesNode = void 0;
  34496. if (boundariesElement === 'scrollParent') {
  34497. boundariesNode = getScrollParent(getParentNode(reference));
  34498. if (boundariesNode.nodeName === 'BODY') {
  34499. boundariesNode = popper.ownerDocument.documentElement;
  34500. }
  34501. } else if (boundariesElement === 'window') {
  34502. boundariesNode = popper.ownerDocument.documentElement;
  34503. } else {
  34504. boundariesNode = boundariesElement;
  34505. }
  34506. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34507. // In case of HTML, we need a different computation
  34508. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34509. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34510. height = _getWindowSizes.height,
  34511. width = _getWindowSizes.width;
  34512. boundaries.top += offsets.top - offsets.marginTop;
  34513. boundaries.bottom = height + offsets.top;
  34514. boundaries.left += offsets.left - offsets.marginLeft;
  34515. boundaries.right = width + offsets.left;
  34516. } else {
  34517. // for all the other DOM elements, this one is good
  34518. boundaries = offsets;
  34519. }
  34520. }
  34521. // Add paddings
  34522. padding = padding || 0;
  34523. var isPaddingNumber = typeof padding === 'number';
  34524. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34525. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34526. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34527. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34528. return boundaries;
  34529. }
  34530. function getArea(_ref) {
  34531. var width = _ref.width,
  34532. height = _ref.height;
  34533. return width * height;
  34534. }
  34535. /**
  34536. * Utility used to transform the `auto` placement to the placement with more
  34537. * available space.
  34538. * @method
  34539. * @memberof Popper.Utils
  34540. * @argument {Object} data - The data object generated by update method
  34541. * @argument {Object} options - Modifiers configuration and options
  34542. * @returns {Object} The data object, properly modified
  34543. */
  34544. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34545. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34546. if (placement.indexOf('auto') === -1) {
  34547. return placement;
  34548. }
  34549. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34550. var rects = {
  34551. top: {
  34552. width: boundaries.width,
  34553. height: refRect.top - boundaries.top
  34554. },
  34555. right: {
  34556. width: boundaries.right - refRect.right,
  34557. height: boundaries.height
  34558. },
  34559. bottom: {
  34560. width: boundaries.width,
  34561. height: boundaries.bottom - refRect.bottom
  34562. },
  34563. left: {
  34564. width: refRect.left - boundaries.left,
  34565. height: boundaries.height
  34566. }
  34567. };
  34568. var sortedAreas = Object.keys(rects).map(function (key) {
  34569. return _extends({
  34570. key: key
  34571. }, rects[key], {
  34572. area: getArea(rects[key])
  34573. });
  34574. }).sort(function (a, b) {
  34575. return b.area - a.area;
  34576. });
  34577. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34578. var width = _ref2.width,
  34579. height = _ref2.height;
  34580. return width >= popper.clientWidth && height >= popper.clientHeight;
  34581. });
  34582. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34583. var variation = placement.split('-')[1];
  34584. return computedPlacement + (variation ? '-' + variation : '');
  34585. }
  34586. /**
  34587. * Get offsets to the reference element
  34588. * @method
  34589. * @memberof Popper.Utils
  34590. * @param {Object} state
  34591. * @param {Element} popper - the popper element
  34592. * @param {Element} reference - the reference element (the popper will be relative to this)
  34593. * @param {Element} fixedPosition - is in fixed position mode
  34594. * @returns {Object} An object containing the offsets which will be applied to the popper
  34595. */
  34596. function getReferenceOffsets(state, popper, reference) {
  34597. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34598. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34599. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34600. }
  34601. /**
  34602. * Get the outer sizes of the given element (offset size + margins)
  34603. * @method
  34604. * @memberof Popper.Utils
  34605. * @argument {Element} element
  34606. * @returns {Object} object containing width and height properties
  34607. */
  34608. function getOuterSizes(element) {
  34609. var window = element.ownerDocument.defaultView;
  34610. var styles = window.getComputedStyle(element);
  34611. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34612. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34613. var result = {
  34614. width: element.offsetWidth + y,
  34615. height: element.offsetHeight + x
  34616. };
  34617. return result;
  34618. }
  34619. /**
  34620. * Get the opposite placement of the given one
  34621. * @method
  34622. * @memberof Popper.Utils
  34623. * @argument {String} placement
  34624. * @returns {String} flipped placement
  34625. */
  34626. function getOppositePlacement(placement) {
  34627. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34628. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34629. return hash[matched];
  34630. });
  34631. }
  34632. /**
  34633. * Get offsets to the popper
  34634. * @method
  34635. * @memberof Popper.Utils
  34636. * @param {Object} position - CSS position the Popper will get applied
  34637. * @param {HTMLElement} popper - the popper element
  34638. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34639. * @param {String} placement - one of the valid placement options
  34640. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34641. */
  34642. function getPopperOffsets(popper, referenceOffsets, placement) {
  34643. placement = placement.split('-')[0];
  34644. // Get popper node sizes
  34645. var popperRect = getOuterSizes(popper);
  34646. // Add position, width and height to our offsets object
  34647. var popperOffsets = {
  34648. width: popperRect.width,
  34649. height: popperRect.height
  34650. };
  34651. // depending by the popper placement we have to compute its offsets slightly differently
  34652. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34653. var mainSide = isHoriz ? 'top' : 'left';
  34654. var secondarySide = isHoriz ? 'left' : 'top';
  34655. var measurement = isHoriz ? 'height' : 'width';
  34656. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34657. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34658. if (placement === secondarySide) {
  34659. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34660. } else {
  34661. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34662. }
  34663. return popperOffsets;
  34664. }
  34665. /**
  34666. * Mimics the `find` method of Array
  34667. * @method
  34668. * @memberof Popper.Utils
  34669. * @argument {Array} arr
  34670. * @argument prop
  34671. * @argument value
  34672. * @returns index or -1
  34673. */
  34674. function find(arr, check) {
  34675. // use native find if supported
  34676. if (Array.prototype.find) {
  34677. return arr.find(check);
  34678. }
  34679. // use `filter` to obtain the same behavior of `find`
  34680. return arr.filter(check)[0];
  34681. }
  34682. /**
  34683. * Return the index of the matching object
  34684. * @method
  34685. * @memberof Popper.Utils
  34686. * @argument {Array} arr
  34687. * @argument prop
  34688. * @argument value
  34689. * @returns index or -1
  34690. */
  34691. function findIndex(arr, prop, value) {
  34692. // use native findIndex if supported
  34693. if (Array.prototype.findIndex) {
  34694. return arr.findIndex(function (cur) {
  34695. return cur[prop] === value;
  34696. });
  34697. }
  34698. // use `find` + `indexOf` if `findIndex` isn't supported
  34699. var match = find(arr, function (obj) {
  34700. return obj[prop] === value;
  34701. });
  34702. return arr.indexOf(match);
  34703. }
  34704. /**
  34705. * Loop trough the list of modifiers and run them in order,
  34706. * each of them will then edit the data object.
  34707. * @method
  34708. * @memberof Popper.Utils
  34709. * @param {dataObject} data
  34710. * @param {Array} modifiers
  34711. * @param {String} ends - Optional modifier name used as stopper
  34712. * @returns {dataObject}
  34713. */
  34714. function runModifiers(modifiers, data, ends) {
  34715. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34716. modifiersToRun.forEach(function (modifier) {
  34717. if (modifier['function']) {
  34718. // eslint-disable-line dot-notation
  34719. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34720. }
  34721. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34722. if (modifier.enabled && isFunction(fn)) {
  34723. // Add properties to offsets to make them a complete clientRect object
  34724. // we do this before each modifier to make sure the previous one doesn't
  34725. // mess with these values
  34726. data.offsets.popper = getClientRect(data.offsets.popper);
  34727. data.offsets.reference = getClientRect(data.offsets.reference);
  34728. data = fn(data, modifier);
  34729. }
  34730. });
  34731. return data;
  34732. }
  34733. /**
  34734. * Updates the position of the popper, computing the new offsets and applying
  34735. * the new style.<br />
  34736. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34737. * @method
  34738. * @memberof Popper
  34739. */
  34740. function update() {
  34741. // if popper is destroyed, don't perform any further update
  34742. if (this.state.isDestroyed) {
  34743. return;
  34744. }
  34745. var data = {
  34746. instance: this,
  34747. styles: {},
  34748. arrowStyles: {},
  34749. attributes: {},
  34750. flipped: false,
  34751. offsets: {}
  34752. };
  34753. // compute reference element offsets
  34754. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34755. // compute auto placement, store placement inside the data object,
  34756. // modifiers will be able to edit `placement` if needed
  34757. // and refer to originalPlacement to know the original value
  34758. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34759. // store the computed placement inside `originalPlacement`
  34760. data.originalPlacement = data.placement;
  34761. data.positionFixed = this.options.positionFixed;
  34762. // compute the popper offsets
  34763. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34764. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34765. // run the modifiers
  34766. data = runModifiers(this.modifiers, data);
  34767. // the first `update` will call `onCreate` callback
  34768. // the other ones will call `onUpdate` callback
  34769. if (!this.state.isCreated) {
  34770. this.state.isCreated = true;
  34771. this.options.onCreate(data);
  34772. } else {
  34773. this.options.onUpdate(data);
  34774. }
  34775. }
  34776. /**
  34777. * Helper used to know if the given modifier is enabled.
  34778. * @method
  34779. * @memberof Popper.Utils
  34780. * @returns {Boolean}
  34781. */
  34782. function isModifierEnabled(modifiers, modifierName) {
  34783. return modifiers.some(function (_ref) {
  34784. var name = _ref.name,
  34785. enabled = _ref.enabled;
  34786. return enabled && name === modifierName;
  34787. });
  34788. }
  34789. /**
  34790. * Get the prefixed supported property name
  34791. * @method
  34792. * @memberof Popper.Utils
  34793. * @argument {String} property (camelCase)
  34794. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34795. */
  34796. function getSupportedPropertyName(property) {
  34797. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34798. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34799. for (var i = 0; i < prefixes.length; i++) {
  34800. var prefix = prefixes[i];
  34801. var toCheck = prefix ? '' + prefix + upperProp : property;
  34802. if (typeof document.body.style[toCheck] !== 'undefined') {
  34803. return toCheck;
  34804. }
  34805. }
  34806. return null;
  34807. }
  34808. /**
  34809. * Destroys the popper.
  34810. * @method
  34811. * @memberof Popper
  34812. */
  34813. function destroy() {
  34814. this.state.isDestroyed = true;
  34815. // touch DOM only if `applyStyle` modifier is enabled
  34816. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34817. this.popper.removeAttribute('x-placement');
  34818. this.popper.style.position = '';
  34819. this.popper.style.top = '';
  34820. this.popper.style.left = '';
  34821. this.popper.style.right = '';
  34822. this.popper.style.bottom = '';
  34823. this.popper.style.willChange = '';
  34824. this.popper.style[getSupportedPropertyName('transform')] = '';
  34825. }
  34826. this.disableEventListeners();
  34827. // remove the popper if user explicitly asked for the deletion on destroy
  34828. // do not use `remove` because IE11 doesn't support it
  34829. if (this.options.removeOnDestroy) {
  34830. this.popper.parentNode.removeChild(this.popper);
  34831. }
  34832. return this;
  34833. }
  34834. /**
  34835. * Get the window associated with the element
  34836. * @argument {Element} element
  34837. * @returns {Window}
  34838. */
  34839. function getWindow(element) {
  34840. var ownerDocument = element.ownerDocument;
  34841. return ownerDocument ? ownerDocument.defaultView : window;
  34842. }
  34843. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34844. var isBody = scrollParent.nodeName === 'BODY';
  34845. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34846. target.addEventListener(event, callback, { passive: true });
  34847. if (!isBody) {
  34848. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34849. }
  34850. scrollParents.push(target);
  34851. }
  34852. /**
  34853. * Setup needed event listeners used to update the popper position
  34854. * @method
  34855. * @memberof Popper.Utils
  34856. * @private
  34857. */
  34858. function setupEventListeners(reference, options, state, updateBound) {
  34859. // Resize event listener on window
  34860. state.updateBound = updateBound;
  34861. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34862. // Scroll event listener on scroll parents
  34863. var scrollElement = getScrollParent(reference);
  34864. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34865. state.scrollElement = scrollElement;
  34866. state.eventsEnabled = true;
  34867. return state;
  34868. }
  34869. /**
  34870. * It will add resize/scroll events and start recalculating
  34871. * position of the popper element when they are triggered.
  34872. * @method
  34873. * @memberof Popper
  34874. */
  34875. function enableEventListeners() {
  34876. if (!this.state.eventsEnabled) {
  34877. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34878. }
  34879. }
  34880. /**
  34881. * Remove event listeners used to update the popper position
  34882. * @method
  34883. * @memberof Popper.Utils
  34884. * @private
  34885. */
  34886. function removeEventListeners(reference, state) {
  34887. // Remove resize event listener on window
  34888. getWindow(reference).removeEventListener('resize', state.updateBound);
  34889. // Remove scroll event listener on scroll parents
  34890. state.scrollParents.forEach(function (target) {
  34891. target.removeEventListener('scroll', state.updateBound);
  34892. });
  34893. // Reset state
  34894. state.updateBound = null;
  34895. state.scrollParents = [];
  34896. state.scrollElement = null;
  34897. state.eventsEnabled = false;
  34898. return state;
  34899. }
  34900. /**
  34901. * It will remove resize/scroll events and won't recalculate popper position
  34902. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34903. * unless you call `update` method manually.
  34904. * @method
  34905. * @memberof Popper
  34906. */
  34907. function disableEventListeners() {
  34908. if (this.state.eventsEnabled) {
  34909. cancelAnimationFrame(this.scheduleUpdate);
  34910. this.state = removeEventListeners(this.reference, this.state);
  34911. }
  34912. }
  34913. /**
  34914. * Tells if a given input is a number
  34915. * @method
  34916. * @memberof Popper.Utils
  34917. * @param {*} input to check
  34918. * @return {Boolean}
  34919. */
  34920. function isNumeric(n) {
  34921. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34922. }
  34923. /**
  34924. * Set the style to the given popper
  34925. * @method
  34926. * @memberof Popper.Utils
  34927. * @argument {Element} element - Element to apply the style to
  34928. * @argument {Object} styles
  34929. * Object with a list of properties and values which will be applied to the element
  34930. */
  34931. function setStyles(element, styles) {
  34932. Object.keys(styles).forEach(function (prop) {
  34933. var unit = '';
  34934. // add unit if the value is numeric and is one of the following
  34935. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34936. unit = 'px';
  34937. }
  34938. element.style[prop] = styles[prop] + unit;
  34939. });
  34940. }
  34941. /**
  34942. * Set the attributes to the given popper
  34943. * @method
  34944. * @memberof Popper.Utils
  34945. * @argument {Element} element - Element to apply the attributes to
  34946. * @argument {Object} styles
  34947. * Object with a list of properties and values which will be applied to the element
  34948. */
  34949. function setAttributes(element, attributes) {
  34950. Object.keys(attributes).forEach(function (prop) {
  34951. var value = attributes[prop];
  34952. if (value !== false) {
  34953. element.setAttribute(prop, attributes[prop]);
  34954. } else {
  34955. element.removeAttribute(prop);
  34956. }
  34957. });
  34958. }
  34959. /**
  34960. * @function
  34961. * @memberof Modifiers
  34962. * @argument {Object} data - The data object generated by `update` method
  34963. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34964. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34965. * @argument {Object} options - Modifiers configuration and options
  34966. * @returns {Object} The same data object
  34967. */
  34968. function applyStyle(data) {
  34969. // any property present in `data.styles` will be applied to the popper,
  34970. // in this way we can make the 3rd party modifiers add custom styles to it
  34971. // Be aware, modifiers could override the properties defined in the previous
  34972. // lines of this modifier!
  34973. setStyles(data.instance.popper, data.styles);
  34974. // any property present in `data.attributes` will be applied to the popper,
  34975. // they will be set as HTML attributes of the element
  34976. setAttributes(data.instance.popper, data.attributes);
  34977. // if arrowElement is defined and arrowStyles has some properties
  34978. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34979. setStyles(data.arrowElement, data.arrowStyles);
  34980. }
  34981. return data;
  34982. }
  34983. /**
  34984. * Set the x-placement attribute before everything else because it could be used
  34985. * to add margins to the popper margins needs to be calculated to get the
  34986. * correct popper offsets.
  34987. * @method
  34988. * @memberof Popper.modifiers
  34989. * @param {HTMLElement} reference - The reference element used to position the popper
  34990. * @param {HTMLElement} popper - The HTML element used as popper
  34991. * @param {Object} options - Popper.js options
  34992. */
  34993. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  34994. // compute reference element offsets
  34995. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  34996. // compute auto placement, store placement inside the data object,
  34997. // modifiers will be able to edit `placement` if needed
  34998. // and refer to originalPlacement to know the original value
  34999. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35000. popper.setAttribute('x-placement', placement);
  35001. // Apply `position` to popper before anything else because
  35002. // without the position applied we can't guarantee correct computations
  35003. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35004. return options;
  35005. }
  35006. /**
  35007. * @function
  35008. * @memberof Popper.Utils
  35009. * @argument {Object} data - The data object generated by `update` method
  35010. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35011. * @returns {Object} The popper's position offsets rounded
  35012. *
  35013. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35014. * good as it can be within reason.
  35015. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35016. *
  35017. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35018. * as well on High DPI screens).
  35019. *
  35020. * Firefox prefers no rounding for positioning and does not have blurriness on
  35021. * high DPI screens.
  35022. *
  35023. * Only horizontal placement and left/right values need to be considered.
  35024. */
  35025. function getRoundedOffsets(data, shouldRound) {
  35026. var _data$offsets = data.offsets,
  35027. popper = _data$offsets.popper,
  35028. reference = _data$offsets.reference;
  35029. var round = Math.round,
  35030. floor = Math.floor;
  35031. var noRound = function noRound(v) {
  35032. return v;
  35033. };
  35034. var referenceWidth = round(reference.width);
  35035. var popperWidth = round(popper.width);
  35036. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35037. var isVariation = data.placement.indexOf('-') !== -1;
  35038. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35039. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35040. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35041. var verticalToInteger = !shouldRound ? noRound : round;
  35042. return {
  35043. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35044. top: verticalToInteger(popper.top),
  35045. bottom: verticalToInteger(popper.bottom),
  35046. right: horizontalToInteger(popper.right)
  35047. };
  35048. }
  35049. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35050. /**
  35051. * @function
  35052. * @memberof Modifiers
  35053. * @argument {Object} data - The data object generated by `update` method
  35054. * @argument {Object} options - Modifiers configuration and options
  35055. * @returns {Object} The data object, properly modified
  35056. */
  35057. function computeStyle(data, options) {
  35058. var x = options.x,
  35059. y = options.y;
  35060. var popper = data.offsets.popper;
  35061. // Remove this legacy support in Popper.js v2
  35062. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35063. return modifier.name === 'applyStyle';
  35064. }).gpuAcceleration;
  35065. if (legacyGpuAccelerationOption !== undefined) {
  35066. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35067. }
  35068. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35069. var offsetParent = getOffsetParent(data.instance.popper);
  35070. var offsetParentRect = getBoundingClientRect(offsetParent);
  35071. // Styles
  35072. var styles = {
  35073. position: popper.position
  35074. };
  35075. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35076. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35077. var sideB = y === 'right' ? 'left' : 'right';
  35078. // if gpuAcceleration is set to `true` and transform is supported,
  35079. // we use `translate3d` to apply the position to the popper we
  35080. // automatically use the supported prefixed version if needed
  35081. var prefixedProperty = getSupportedPropertyName('transform');
  35082. // now, let's make a step back and look at this code closely (wtf?)
  35083. // If the content of the popper grows once it's been positioned, it
  35084. // may happen that the popper gets misplaced because of the new content
  35085. // overflowing its reference element
  35086. // To avoid this problem, we provide two options (x and y), which allow
  35087. // the consumer to define the offset origin.
  35088. // If we position a popper on top of a reference element, we can set
  35089. // `x` to `top` to make the popper grow towards its top instead of
  35090. // its bottom.
  35091. var left = void 0,
  35092. top = void 0;
  35093. if (sideA === 'bottom') {
  35094. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35095. // and not the bottom of the html element
  35096. if (offsetParent.nodeName === 'HTML') {
  35097. top = -offsetParent.clientHeight + offsets.bottom;
  35098. } else {
  35099. top = -offsetParentRect.height + offsets.bottom;
  35100. }
  35101. } else {
  35102. top = offsets.top;
  35103. }
  35104. if (sideB === 'right') {
  35105. if (offsetParent.nodeName === 'HTML') {
  35106. left = -offsetParent.clientWidth + offsets.right;
  35107. } else {
  35108. left = -offsetParentRect.width + offsets.right;
  35109. }
  35110. } else {
  35111. left = offsets.left;
  35112. }
  35113. if (gpuAcceleration && prefixedProperty) {
  35114. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35115. styles[sideA] = 0;
  35116. styles[sideB] = 0;
  35117. styles.willChange = 'transform';
  35118. } else {
  35119. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35120. var invertTop = sideA === 'bottom' ? -1 : 1;
  35121. var invertLeft = sideB === 'right' ? -1 : 1;
  35122. styles[sideA] = top * invertTop;
  35123. styles[sideB] = left * invertLeft;
  35124. styles.willChange = sideA + ', ' + sideB;
  35125. }
  35126. // Attributes
  35127. var attributes = {
  35128. 'x-placement': data.placement
  35129. };
  35130. // Update `data` attributes, styles and arrowStyles
  35131. data.attributes = _extends({}, attributes, data.attributes);
  35132. data.styles = _extends({}, styles, data.styles);
  35133. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35134. return data;
  35135. }
  35136. /**
  35137. * Helper used to know if the given modifier depends from another one.<br />
  35138. * It checks if the needed modifier is listed and enabled.
  35139. * @method
  35140. * @memberof Popper.Utils
  35141. * @param {Array} modifiers - list of modifiers
  35142. * @param {String} requestingName - name of requesting modifier
  35143. * @param {String} requestedName - name of requested modifier
  35144. * @returns {Boolean}
  35145. */
  35146. function isModifierRequired(modifiers, requestingName, requestedName) {
  35147. var requesting = find(modifiers, function (_ref) {
  35148. var name = _ref.name;
  35149. return name === requestingName;
  35150. });
  35151. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35152. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35153. });
  35154. if (!isRequired) {
  35155. var _requesting = '`' + requestingName + '`';
  35156. var requested = '`' + requestedName + '`';
  35157. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35158. }
  35159. return isRequired;
  35160. }
  35161. /**
  35162. * @function
  35163. * @memberof Modifiers
  35164. * @argument {Object} data - The data object generated by update method
  35165. * @argument {Object} options - Modifiers configuration and options
  35166. * @returns {Object} The data object, properly modified
  35167. */
  35168. function arrow(data, options) {
  35169. var _data$offsets$arrow;
  35170. // arrow depends on keepTogether in order to work
  35171. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35172. return data;
  35173. }
  35174. var arrowElement = options.element;
  35175. // if arrowElement is a string, suppose it's a CSS selector
  35176. if (typeof arrowElement === 'string') {
  35177. arrowElement = data.instance.popper.querySelector(arrowElement);
  35178. // if arrowElement is not found, don't run the modifier
  35179. if (!arrowElement) {
  35180. return data;
  35181. }
  35182. } else {
  35183. // if the arrowElement isn't a query selector we must check that the
  35184. // provided DOM node is child of its popper node
  35185. if (!data.instance.popper.contains(arrowElement)) {
  35186. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35187. return data;
  35188. }
  35189. }
  35190. var placement = data.placement.split('-')[0];
  35191. var _data$offsets = data.offsets,
  35192. popper = _data$offsets.popper,
  35193. reference = _data$offsets.reference;
  35194. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35195. var len = isVertical ? 'height' : 'width';
  35196. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35197. var side = sideCapitalized.toLowerCase();
  35198. var altSide = isVertical ? 'left' : 'top';
  35199. var opSide = isVertical ? 'bottom' : 'right';
  35200. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35201. //
  35202. // extends keepTogether behavior making sure the popper and its
  35203. // reference have enough pixels in conjunction
  35204. //
  35205. // top/left side
  35206. if (reference[opSide] - arrowElementSize < popper[side]) {
  35207. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35208. }
  35209. // bottom/right side
  35210. if (reference[side] + arrowElementSize > popper[opSide]) {
  35211. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35212. }
  35213. data.offsets.popper = getClientRect(data.offsets.popper);
  35214. // compute center of the popper
  35215. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35216. // Compute the sideValue using the updated popper offsets
  35217. // take popper margin in account because we don't have this info available
  35218. var css = getStyleComputedProperty(data.instance.popper);
  35219. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35220. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35221. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35222. // prevent arrowElement from being placed not contiguously to its popper
  35223. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35224. data.arrowElement = arrowElement;
  35225. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35226. return data;
  35227. }
  35228. /**
  35229. * Get the opposite placement variation of the given one
  35230. * @method
  35231. * @memberof Popper.Utils
  35232. * @argument {String} placement variation
  35233. * @returns {String} flipped placement variation
  35234. */
  35235. function getOppositeVariation(variation) {
  35236. if (variation === 'end') {
  35237. return 'start';
  35238. } else if (variation === 'start') {
  35239. return 'end';
  35240. }
  35241. return variation;
  35242. }
  35243. /**
  35244. * List of accepted placements to use as values of the `placement` option.<br />
  35245. * Valid placements are:
  35246. * - `auto`
  35247. * - `top`
  35248. * - `right`
  35249. * - `bottom`
  35250. * - `left`
  35251. *
  35252. * Each placement can have a variation from this list:
  35253. * - `-start`
  35254. * - `-end`
  35255. *
  35256. * Variations are interpreted easily if you think of them as the left to right
  35257. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35258. * is right.<br />
  35259. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35260. *
  35261. * Some valid examples are:
  35262. * - `top-end` (on top of reference, right aligned)
  35263. * - `right-start` (on right of reference, top aligned)
  35264. * - `bottom` (on bottom, centered)
  35265. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35266. *
  35267. * @static
  35268. * @type {Array}
  35269. * @enum {String}
  35270. * @readonly
  35271. * @method placements
  35272. * @memberof Popper
  35273. */
  35274. 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'];
  35275. // Get rid of `auto` `auto-start` and `auto-end`
  35276. var validPlacements = placements.slice(3);
  35277. /**
  35278. * Given an initial placement, returns all the subsequent placements
  35279. * clockwise (or counter-clockwise).
  35280. *
  35281. * @method
  35282. * @memberof Popper.Utils
  35283. * @argument {String} placement - A valid placement (it accepts variations)
  35284. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35285. * @returns {Array} placements including their variations
  35286. */
  35287. function clockwise(placement) {
  35288. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35289. var index = validPlacements.indexOf(placement);
  35290. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35291. return counter ? arr.reverse() : arr;
  35292. }
  35293. var BEHAVIORS = {
  35294. FLIP: 'flip',
  35295. CLOCKWISE: 'clockwise',
  35296. COUNTERCLOCKWISE: 'counterclockwise'
  35297. };
  35298. /**
  35299. * @function
  35300. * @memberof Modifiers
  35301. * @argument {Object} data - The data object generated by update method
  35302. * @argument {Object} options - Modifiers configuration and options
  35303. * @returns {Object} The data object, properly modified
  35304. */
  35305. function flip(data, options) {
  35306. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35307. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35308. return data;
  35309. }
  35310. if (data.flipped && data.placement === data.originalPlacement) {
  35311. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35312. return data;
  35313. }
  35314. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35315. var placement = data.placement.split('-')[0];
  35316. var placementOpposite = getOppositePlacement(placement);
  35317. var variation = data.placement.split('-')[1] || '';
  35318. var flipOrder = [];
  35319. switch (options.behavior) {
  35320. case BEHAVIORS.FLIP:
  35321. flipOrder = [placement, placementOpposite];
  35322. break;
  35323. case BEHAVIORS.CLOCKWISE:
  35324. flipOrder = clockwise(placement);
  35325. break;
  35326. case BEHAVIORS.COUNTERCLOCKWISE:
  35327. flipOrder = clockwise(placement, true);
  35328. break;
  35329. default:
  35330. flipOrder = options.behavior;
  35331. }
  35332. flipOrder.forEach(function (step, index) {
  35333. if (placement !== step || flipOrder.length === index + 1) {
  35334. return data;
  35335. }
  35336. placement = data.placement.split('-')[0];
  35337. placementOpposite = getOppositePlacement(placement);
  35338. var popperOffsets = data.offsets.popper;
  35339. var refOffsets = data.offsets.reference;
  35340. // using floor because the reference offsets may contain decimals we are not going to consider here
  35341. var floor = Math.floor;
  35342. 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);
  35343. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35344. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35345. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35346. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35347. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35348. // flip the variation if required
  35349. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35350. // flips variation if reference element overflows boundaries
  35351. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35352. // flips variation if popper content overflows boundaries
  35353. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35354. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35355. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35356. // this boolean to detect any flip loop
  35357. data.flipped = true;
  35358. if (overlapsRef || overflowsBoundaries) {
  35359. placement = flipOrder[index + 1];
  35360. }
  35361. if (flippedVariation) {
  35362. variation = getOppositeVariation(variation);
  35363. }
  35364. data.placement = placement + (variation ? '-' + variation : '');
  35365. // this object contains `position`, we want to preserve it along with
  35366. // any additional property we may add in the future
  35367. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35368. data = runModifiers(data.instance.modifiers, data, 'flip');
  35369. }
  35370. });
  35371. return data;
  35372. }
  35373. /**
  35374. * @function
  35375. * @memberof Modifiers
  35376. * @argument {Object} data - The data object generated by update method
  35377. * @argument {Object} options - Modifiers configuration and options
  35378. * @returns {Object} The data object, properly modified
  35379. */
  35380. function keepTogether(data) {
  35381. var _data$offsets = data.offsets,
  35382. popper = _data$offsets.popper,
  35383. reference = _data$offsets.reference;
  35384. var placement = data.placement.split('-')[0];
  35385. var floor = Math.floor;
  35386. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35387. var side = isVertical ? 'right' : 'bottom';
  35388. var opSide = isVertical ? 'left' : 'top';
  35389. var measurement = isVertical ? 'width' : 'height';
  35390. if (popper[side] < floor(reference[opSide])) {
  35391. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35392. }
  35393. if (popper[opSide] > floor(reference[side])) {
  35394. data.offsets.popper[opSide] = floor(reference[side]);
  35395. }
  35396. return data;
  35397. }
  35398. /**
  35399. * Converts a string containing value + unit into a px value number
  35400. * @function
  35401. * @memberof {modifiers~offset}
  35402. * @private
  35403. * @argument {String} str - Value + unit string
  35404. * @argument {String} measurement - `height` or `width`
  35405. * @argument {Object} popperOffsets
  35406. * @argument {Object} referenceOffsets
  35407. * @returns {Number|String}
  35408. * Value in pixels, or original string if no values were extracted
  35409. */
  35410. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35411. // separate value from unit
  35412. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35413. var value = +split[1];
  35414. var unit = split[2];
  35415. // If it's not a number it's an operator, I guess
  35416. if (!value) {
  35417. return str;
  35418. }
  35419. if (unit.indexOf('%') === 0) {
  35420. var element = void 0;
  35421. switch (unit) {
  35422. case '%p':
  35423. element = popperOffsets;
  35424. break;
  35425. case '%':
  35426. case '%r':
  35427. default:
  35428. element = referenceOffsets;
  35429. }
  35430. var rect = getClientRect(element);
  35431. return rect[measurement] / 100 * value;
  35432. } else if (unit === 'vh' || unit === 'vw') {
  35433. // if is a vh or vw, we calculate the size based on the viewport
  35434. var size = void 0;
  35435. if (unit === 'vh') {
  35436. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35437. } else {
  35438. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35439. }
  35440. return size / 100 * value;
  35441. } else {
  35442. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35443. // if is an implicit unit, it's px, and we return just the value
  35444. return value;
  35445. }
  35446. }
  35447. /**
  35448. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35449. * @function
  35450. * @memberof {modifiers~offset}
  35451. * @private
  35452. * @argument {String} offset
  35453. * @argument {Object} popperOffsets
  35454. * @argument {Object} referenceOffsets
  35455. * @argument {String} basePlacement
  35456. * @returns {Array} a two cells array with x and y offsets in numbers
  35457. */
  35458. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35459. var offsets = [0, 0];
  35460. // Use height if placement is left or right and index is 0 otherwise use width
  35461. // in this way the first offset will use an axis and the second one
  35462. // will use the other one
  35463. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35464. // Split the offset string to obtain a list of values and operands
  35465. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35466. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35467. return frag.trim();
  35468. });
  35469. // Detect if the offset string contains a pair of values or a single one
  35470. // they could be separated by comma or space
  35471. var divider = fragments.indexOf(find(fragments, function (frag) {
  35472. return frag.search(/,|\s/) !== -1;
  35473. }));
  35474. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35475. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35476. }
  35477. // If divider is found, we divide the list of values and operands to divide
  35478. // them by ofset X and Y.
  35479. var splitRegex = /\s*,\s*|\s+/;
  35480. 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];
  35481. // Convert the values with units to absolute pixels to allow our computations
  35482. ops = ops.map(function (op, index) {
  35483. // Most of the units rely on the orientation of the popper
  35484. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35485. var mergeWithPrevious = false;
  35486. return op
  35487. // This aggregates any `+` or `-` sign that aren't considered operators
  35488. // e.g.: 10 + +5 => [10, +, +5]
  35489. .reduce(function (a, b) {
  35490. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35491. a[a.length - 1] = b;
  35492. mergeWithPrevious = true;
  35493. return a;
  35494. } else if (mergeWithPrevious) {
  35495. a[a.length - 1] += b;
  35496. mergeWithPrevious = false;
  35497. return a;
  35498. } else {
  35499. return a.concat(b);
  35500. }
  35501. }, [])
  35502. // Here we convert the string values into number values (in px)
  35503. .map(function (str) {
  35504. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35505. });
  35506. });
  35507. // Loop trough the offsets arrays and execute the operations
  35508. ops.forEach(function (op, index) {
  35509. op.forEach(function (frag, index2) {
  35510. if (isNumeric(frag)) {
  35511. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35512. }
  35513. });
  35514. });
  35515. return offsets;
  35516. }
  35517. /**
  35518. * @function
  35519. * @memberof Modifiers
  35520. * @argument {Object} data - The data object generated by update method
  35521. * @argument {Object} options - Modifiers configuration and options
  35522. * @argument {Number|String} options.offset=0
  35523. * The offset value as described in the modifier description
  35524. * @returns {Object} The data object, properly modified
  35525. */
  35526. function offset(data, _ref) {
  35527. var offset = _ref.offset;
  35528. var placement = data.placement,
  35529. _data$offsets = data.offsets,
  35530. popper = _data$offsets.popper,
  35531. reference = _data$offsets.reference;
  35532. var basePlacement = placement.split('-')[0];
  35533. var offsets = void 0;
  35534. if (isNumeric(+offset)) {
  35535. offsets = [+offset, 0];
  35536. } else {
  35537. offsets = parseOffset(offset, popper, reference, basePlacement);
  35538. }
  35539. if (basePlacement === 'left') {
  35540. popper.top += offsets[0];
  35541. popper.left -= offsets[1];
  35542. } else if (basePlacement === 'right') {
  35543. popper.top += offsets[0];
  35544. popper.left += offsets[1];
  35545. } else if (basePlacement === 'top') {
  35546. popper.left += offsets[0];
  35547. popper.top -= offsets[1];
  35548. } else if (basePlacement === 'bottom') {
  35549. popper.left += offsets[0];
  35550. popper.top += offsets[1];
  35551. }
  35552. data.popper = popper;
  35553. return data;
  35554. }
  35555. /**
  35556. * @function
  35557. * @memberof Modifiers
  35558. * @argument {Object} data - The data object generated by `update` method
  35559. * @argument {Object} options - Modifiers configuration and options
  35560. * @returns {Object} The data object, properly modified
  35561. */
  35562. function preventOverflow(data, options) {
  35563. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35564. // If offsetParent is the reference element, we really want to
  35565. // go one step up and use the next offsetParent as reference to
  35566. // avoid to make this modifier completely useless and look like broken
  35567. if (data.instance.reference === boundariesElement) {
  35568. boundariesElement = getOffsetParent(boundariesElement);
  35569. }
  35570. // NOTE: DOM access here
  35571. // resets the popper's position so that the document size can be calculated excluding
  35572. // the size of the popper element itself
  35573. var transformProp = getSupportedPropertyName('transform');
  35574. var popperStyles = data.instance.popper.style; // assignment to help minification
  35575. var top = popperStyles.top,
  35576. left = popperStyles.left,
  35577. transform = popperStyles[transformProp];
  35578. popperStyles.top = '';
  35579. popperStyles.left = '';
  35580. popperStyles[transformProp] = '';
  35581. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35582. // NOTE: DOM access here
  35583. // restores the original style properties after the offsets have been computed
  35584. popperStyles.top = top;
  35585. popperStyles.left = left;
  35586. popperStyles[transformProp] = transform;
  35587. options.boundaries = boundaries;
  35588. var order = options.priority;
  35589. var popper = data.offsets.popper;
  35590. var check = {
  35591. primary: function primary(placement) {
  35592. var value = popper[placement];
  35593. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35594. value = Math.max(popper[placement], boundaries[placement]);
  35595. }
  35596. return defineProperty({}, placement, value);
  35597. },
  35598. secondary: function secondary(placement) {
  35599. var mainSide = placement === 'right' ? 'left' : 'top';
  35600. var value = popper[mainSide];
  35601. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35602. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35603. }
  35604. return defineProperty({}, mainSide, value);
  35605. }
  35606. };
  35607. order.forEach(function (placement) {
  35608. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35609. popper = _extends({}, popper, check[side](placement));
  35610. });
  35611. data.offsets.popper = popper;
  35612. return data;
  35613. }
  35614. /**
  35615. * @function
  35616. * @memberof Modifiers
  35617. * @argument {Object} data - The data object generated by `update` method
  35618. * @argument {Object} options - Modifiers configuration and options
  35619. * @returns {Object} The data object, properly modified
  35620. */
  35621. function shift(data) {
  35622. var placement = data.placement;
  35623. var basePlacement = placement.split('-')[0];
  35624. var shiftvariation = placement.split('-')[1];
  35625. // if shift shiftvariation is specified, run the modifier
  35626. if (shiftvariation) {
  35627. var _data$offsets = data.offsets,
  35628. reference = _data$offsets.reference,
  35629. popper = _data$offsets.popper;
  35630. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35631. var side = isVertical ? 'left' : 'top';
  35632. var measurement = isVertical ? 'width' : 'height';
  35633. var shiftOffsets = {
  35634. start: defineProperty({}, side, reference[side]),
  35635. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35636. };
  35637. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35638. }
  35639. return data;
  35640. }
  35641. /**
  35642. * @function
  35643. * @memberof Modifiers
  35644. * @argument {Object} data - The data object generated by update method
  35645. * @argument {Object} options - Modifiers configuration and options
  35646. * @returns {Object} The data object, properly modified
  35647. */
  35648. function hide(data) {
  35649. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35650. return data;
  35651. }
  35652. var refRect = data.offsets.reference;
  35653. var bound = find(data.instance.modifiers, function (modifier) {
  35654. return modifier.name === 'preventOverflow';
  35655. }).boundaries;
  35656. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35657. // Avoid unnecessary DOM access if visibility hasn't changed
  35658. if (data.hide === true) {
  35659. return data;
  35660. }
  35661. data.hide = true;
  35662. data.attributes['x-out-of-boundaries'] = '';
  35663. } else {
  35664. // Avoid unnecessary DOM access if visibility hasn't changed
  35665. if (data.hide === false) {
  35666. return data;
  35667. }
  35668. data.hide = false;
  35669. data.attributes['x-out-of-boundaries'] = false;
  35670. }
  35671. return data;
  35672. }
  35673. /**
  35674. * @function
  35675. * @memberof Modifiers
  35676. * @argument {Object} data - The data object generated by `update` method
  35677. * @argument {Object} options - Modifiers configuration and options
  35678. * @returns {Object} The data object, properly modified
  35679. */
  35680. function inner(data) {
  35681. var placement = data.placement;
  35682. var basePlacement = placement.split('-')[0];
  35683. var _data$offsets = data.offsets,
  35684. popper = _data$offsets.popper,
  35685. reference = _data$offsets.reference;
  35686. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35687. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35688. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35689. data.placement = getOppositePlacement(placement);
  35690. data.offsets.popper = getClientRect(popper);
  35691. return data;
  35692. }
  35693. /**
  35694. * Modifier function, each modifier can have a function of this type assigned
  35695. * to its `fn` property.<br />
  35696. * These functions will be called on each update, this means that you must
  35697. * make sure they are performant enough to avoid performance bottlenecks.
  35698. *
  35699. * @function ModifierFn
  35700. * @argument {dataObject} data - The data object generated by `update` method
  35701. * @argument {Object} options - Modifiers configuration and options
  35702. * @returns {dataObject} The data object, properly modified
  35703. */
  35704. /**
  35705. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35706. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35707. * needed by the library.
  35708. *
  35709. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35710. * All the other properties are configurations that could be tweaked.
  35711. * @namespace modifiers
  35712. */
  35713. var modifiers = {
  35714. /**
  35715. * Modifier used to shift the popper on the start or end of its reference
  35716. * element.<br />
  35717. * It will read the variation of the `placement` property.<br />
  35718. * It can be one either `-end` or `-start`.
  35719. * @memberof modifiers
  35720. * @inner
  35721. */
  35722. shift: {
  35723. /** @prop {number} order=100 - Index used to define the order of execution */
  35724. order: 100,
  35725. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35726. enabled: true,
  35727. /** @prop {ModifierFn} */
  35728. fn: shift
  35729. },
  35730. /**
  35731. * The `offset` modifier can shift your popper on both its axis.
  35732. *
  35733. * It accepts the following units:
  35734. * - `px` or unit-less, interpreted as pixels
  35735. * - `%` or `%r`, percentage relative to the length of the reference element
  35736. * - `%p`, percentage relative to the length of the popper element
  35737. * - `vw`, CSS viewport width unit
  35738. * - `vh`, CSS viewport height unit
  35739. *
  35740. * For length is intended the main axis relative to the placement of the popper.<br />
  35741. * This means that if the placement is `top` or `bottom`, the length will be the
  35742. * `width`. In case of `left` or `right`, it will be the `height`.
  35743. *
  35744. * You can provide a single value (as `Number` or `String`), or a pair of values
  35745. * as `String` divided by a comma or one (or more) white spaces.<br />
  35746. * The latter is a deprecated method because it leads to confusion and will be
  35747. * removed in v2.<br />
  35748. * Additionally, it accepts additions and subtractions between different units.
  35749. * Note that multiplications and divisions aren't supported.
  35750. *
  35751. * Valid examples are:
  35752. * ```
  35753. * 10
  35754. * '10%'
  35755. * '10, 10'
  35756. * '10%, 10'
  35757. * '10 + 10%'
  35758. * '10 - 5vh + 3%'
  35759. * '-10px + 5vh, 5px - 6%'
  35760. * ```
  35761. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35762. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35763. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35764. *
  35765. * @memberof modifiers
  35766. * @inner
  35767. */
  35768. offset: {
  35769. /** @prop {number} order=200 - Index used to define the order of execution */
  35770. order: 200,
  35771. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35772. enabled: true,
  35773. /** @prop {ModifierFn} */
  35774. fn: offset,
  35775. /** @prop {Number|String} offset=0
  35776. * The offset value as described in the modifier description
  35777. */
  35778. offset: 0
  35779. },
  35780. /**
  35781. * Modifier used to prevent the popper from being positioned outside the boundary.
  35782. *
  35783. * A scenario exists where the reference itself is not within the boundaries.<br />
  35784. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35785. * In this case we need to decide whether the popper should either:
  35786. *
  35787. * - detach from the reference and remain "trapped" in the boundaries, or
  35788. * - if it should ignore the boundary and "escape with its reference"
  35789. *
  35790. * When `escapeWithReference` is set to`true` and reference is completely
  35791. * outside its boundaries, the popper will overflow (or completely leave)
  35792. * the boundaries in order to remain attached to the edge of the reference.
  35793. *
  35794. * @memberof modifiers
  35795. * @inner
  35796. */
  35797. preventOverflow: {
  35798. /** @prop {number} order=300 - Index used to define the order of execution */
  35799. order: 300,
  35800. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35801. enabled: true,
  35802. /** @prop {ModifierFn} */
  35803. fn: preventOverflow,
  35804. /**
  35805. * @prop {Array} [priority=['left','right','top','bottom']]
  35806. * Popper will try to prevent overflow following these priorities by default,
  35807. * then, it could overflow on the left and on top of the `boundariesElement`
  35808. */
  35809. priority: ['left', 'right', 'top', 'bottom'],
  35810. /**
  35811. * @prop {number} padding=5
  35812. * Amount of pixel used to define a minimum distance between the boundaries
  35813. * and the popper. This makes sure the popper always has a little padding
  35814. * between the edges of its container
  35815. */
  35816. padding: 5,
  35817. /**
  35818. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35819. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35820. * `viewport` or any DOM element.
  35821. */
  35822. boundariesElement: 'scrollParent'
  35823. },
  35824. /**
  35825. * Modifier used to make sure the reference and its popper stay near each other
  35826. * without leaving any gap between the two. Especially useful when the arrow is
  35827. * enabled and you want to ensure that it points to its reference element.
  35828. * It cares only about the first axis. You can still have poppers with margin
  35829. * between the popper and its reference element.
  35830. * @memberof modifiers
  35831. * @inner
  35832. */
  35833. keepTogether: {
  35834. /** @prop {number} order=400 - Index used to define the order of execution */
  35835. order: 400,
  35836. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35837. enabled: true,
  35838. /** @prop {ModifierFn} */
  35839. fn: keepTogether
  35840. },
  35841. /**
  35842. * This modifier is used to move the `arrowElement` of the popper to make
  35843. * sure it is positioned between the reference element and its popper element.
  35844. * It will read the outer size of the `arrowElement` node to detect how many
  35845. * pixels of conjunction are needed.
  35846. *
  35847. * It has no effect if no `arrowElement` is provided.
  35848. * @memberof modifiers
  35849. * @inner
  35850. */
  35851. arrow: {
  35852. /** @prop {number} order=500 - Index used to define the order of execution */
  35853. order: 500,
  35854. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35855. enabled: true,
  35856. /** @prop {ModifierFn} */
  35857. fn: arrow,
  35858. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35859. element: '[x-arrow]'
  35860. },
  35861. /**
  35862. * Modifier used to flip the popper's placement when it starts to overlap its
  35863. * reference element.
  35864. *
  35865. * Requires the `preventOverflow` modifier before it in order to work.
  35866. *
  35867. * **NOTE:** this modifier will interrupt the current update cycle and will
  35868. * restart it if it detects the need to flip the placement.
  35869. * @memberof modifiers
  35870. * @inner
  35871. */
  35872. flip: {
  35873. /** @prop {number} order=600 - Index used to define the order of execution */
  35874. order: 600,
  35875. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35876. enabled: true,
  35877. /** @prop {ModifierFn} */
  35878. fn: flip,
  35879. /**
  35880. * @prop {String|Array} behavior='flip'
  35881. * The behavior used to change the popper's placement. It can be one of
  35882. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35883. * placements (with optional variations)
  35884. */
  35885. behavior: 'flip',
  35886. /**
  35887. * @prop {number} padding=5
  35888. * The popper will flip if it hits the edges of the `boundariesElement`
  35889. */
  35890. padding: 5,
  35891. /**
  35892. * @prop {String|HTMLElement} boundariesElement='viewport'
  35893. * The element which will define the boundaries of the popper position.
  35894. * The popper will never be placed outside of the defined boundaries
  35895. * (except if `keepTogether` is enabled)
  35896. */
  35897. boundariesElement: 'viewport',
  35898. /**
  35899. * @prop {Boolean} flipVariations=false
  35900. * The popper will switch placement variation between `-start` and `-end` when
  35901. * the reference element overlaps its boundaries.
  35902. *
  35903. * The original placement should have a set variation.
  35904. */
  35905. flipVariations: false,
  35906. /**
  35907. * @prop {Boolean} flipVariationsByContent=false
  35908. * The popper will switch placement variation between `-start` and `-end` when
  35909. * the popper element overlaps its reference boundaries.
  35910. *
  35911. * The original placement should have a set variation.
  35912. */
  35913. flipVariationsByContent: false
  35914. },
  35915. /**
  35916. * Modifier used to make the popper flow toward the inner of the reference element.
  35917. * By default, when this modifier is disabled, the popper will be placed outside
  35918. * the reference element.
  35919. * @memberof modifiers
  35920. * @inner
  35921. */
  35922. inner: {
  35923. /** @prop {number} order=700 - Index used to define the order of execution */
  35924. order: 700,
  35925. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35926. enabled: false,
  35927. /** @prop {ModifierFn} */
  35928. fn: inner
  35929. },
  35930. /**
  35931. * Modifier used to hide the popper when its reference element is outside of the
  35932. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35933. * be used to hide with a CSS selector the popper when its reference is
  35934. * out of boundaries.
  35935. *
  35936. * Requires the `preventOverflow` modifier before it in order to work.
  35937. * @memberof modifiers
  35938. * @inner
  35939. */
  35940. hide: {
  35941. /** @prop {number} order=800 - Index used to define the order of execution */
  35942. order: 800,
  35943. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35944. enabled: true,
  35945. /** @prop {ModifierFn} */
  35946. fn: hide
  35947. },
  35948. /**
  35949. * Computes the style that will be applied to the popper element to gets
  35950. * properly positioned.
  35951. *
  35952. * Note that this modifier will not touch the DOM, it just prepares the styles
  35953. * so that `applyStyle` modifier can apply it. This separation is useful
  35954. * in case you need to replace `applyStyle` with a custom implementation.
  35955. *
  35956. * This modifier has `850` as `order` value to maintain backward compatibility
  35957. * with previous versions of Popper.js. Expect the modifiers ordering method
  35958. * to change in future major versions of the library.
  35959. *
  35960. * @memberof modifiers
  35961. * @inner
  35962. */
  35963. computeStyle: {
  35964. /** @prop {number} order=850 - Index used to define the order of execution */
  35965. order: 850,
  35966. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35967. enabled: true,
  35968. /** @prop {ModifierFn} */
  35969. fn: computeStyle,
  35970. /**
  35971. * @prop {Boolean} gpuAcceleration=true
  35972. * If true, it uses the CSS 3D transformation to position the popper.
  35973. * Otherwise, it will use the `top` and `left` properties
  35974. */
  35975. gpuAcceleration: true,
  35976. /**
  35977. * @prop {string} [x='bottom']
  35978. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35979. * Change this if your popper should grow in a direction different from `bottom`
  35980. */
  35981. x: 'bottom',
  35982. /**
  35983. * @prop {string} [x='left']
  35984. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35985. * Change this if your popper should grow in a direction different from `right`
  35986. */
  35987. y: 'right'
  35988. },
  35989. /**
  35990. * Applies the computed styles to the popper element.
  35991. *
  35992. * All the DOM manipulations are limited to this modifier. This is useful in case
  35993. * you want to integrate Popper.js inside a framework or view library and you
  35994. * want to delegate all the DOM manipulations to it.
  35995. *
  35996. * Note that if you disable this modifier, you must make sure the popper element
  35997. * has its position set to `absolute` before Popper.js can do its work!
  35998. *
  35999. * Just disable this modifier and define your own to achieve the desired effect.
  36000. *
  36001. * @memberof modifiers
  36002. * @inner
  36003. */
  36004. applyStyle: {
  36005. /** @prop {number} order=900 - Index used to define the order of execution */
  36006. order: 900,
  36007. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36008. enabled: true,
  36009. /** @prop {ModifierFn} */
  36010. fn: applyStyle,
  36011. /** @prop {Function} */
  36012. onLoad: applyStyleOnLoad,
  36013. /**
  36014. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36015. * @prop {Boolean} gpuAcceleration=true
  36016. * If true, it uses the CSS 3D transformation to position the popper.
  36017. * Otherwise, it will use the `top` and `left` properties
  36018. */
  36019. gpuAcceleration: undefined
  36020. }
  36021. };
  36022. /**
  36023. * The `dataObject` is an object containing all the information used by Popper.js.
  36024. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36025. * @name dataObject
  36026. * @property {Object} data.instance The Popper.js instance
  36027. * @property {String} data.placement Placement applied to popper
  36028. * @property {String} data.originalPlacement Placement originally defined on init
  36029. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36030. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36031. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36032. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36033. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36034. * @property {Object} data.boundaries Offsets of the popper boundaries
  36035. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36036. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36037. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36038. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36039. */
  36040. /**
  36041. * Default options provided to Popper.js constructor.<br />
  36042. * These can be overridden using the `options` argument of Popper.js.<br />
  36043. * To override an option, simply pass an object with the same
  36044. * structure of the `options` object, as the 3rd argument. For example:
  36045. * ```
  36046. * new Popper(ref, pop, {
  36047. * modifiers: {
  36048. * preventOverflow: { enabled: false }
  36049. * }
  36050. * })
  36051. * ```
  36052. * @type {Object}
  36053. * @static
  36054. * @memberof Popper
  36055. */
  36056. var Defaults = {
  36057. /**
  36058. * Popper's placement.
  36059. * @prop {Popper.placements} placement='bottom'
  36060. */
  36061. placement: 'bottom',
  36062. /**
  36063. * Set this to true if you want popper to position it self in 'fixed' mode
  36064. * @prop {Boolean} positionFixed=false
  36065. */
  36066. positionFixed: false,
  36067. /**
  36068. * Whether events (resize, scroll) are initially enabled.
  36069. * @prop {Boolean} eventsEnabled=true
  36070. */
  36071. eventsEnabled: true,
  36072. /**
  36073. * Set to true if you want to automatically remove the popper when
  36074. * you call the `destroy` method.
  36075. * @prop {Boolean} removeOnDestroy=false
  36076. */
  36077. removeOnDestroy: false,
  36078. /**
  36079. * Callback called when the popper is created.<br />
  36080. * By default, it is set to no-op.<br />
  36081. * Access Popper.js instance with `data.instance`.
  36082. * @prop {onCreate}
  36083. */
  36084. onCreate: function onCreate() {},
  36085. /**
  36086. * Callback called when the popper is updated. This callback is not called
  36087. * on the initialization/creation of the popper, but only on subsequent
  36088. * updates.<br />
  36089. * By default, it is set to no-op.<br />
  36090. * Access Popper.js instance with `data.instance`.
  36091. * @prop {onUpdate}
  36092. */
  36093. onUpdate: function onUpdate() {},
  36094. /**
  36095. * List of modifiers used to modify the offsets before they are applied to the popper.
  36096. * They provide most of the functionalities of Popper.js.
  36097. * @prop {modifiers}
  36098. */
  36099. modifiers: modifiers
  36100. };
  36101. /**
  36102. * @callback onCreate
  36103. * @param {dataObject} data
  36104. */
  36105. /**
  36106. * @callback onUpdate
  36107. * @param {dataObject} data
  36108. */
  36109. // Utils
  36110. // Methods
  36111. var Popper = function () {
  36112. /**
  36113. * Creates a new Popper.js instance.
  36114. * @class Popper
  36115. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36116. * @param {Element} popper - The HTML / XML element used as the popper
  36117. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36118. * @return {Object} instance - The generated Popper.js instance
  36119. */
  36120. function Popper(reference, popper) {
  36121. var _this = this;
  36122. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36123. classCallCheck(this, Popper);
  36124. this.scheduleUpdate = function () {
  36125. return requestAnimationFrame(_this.update);
  36126. };
  36127. // make update() debounced, so that it only runs at most once-per-tick
  36128. this.update = debounce(this.update.bind(this));
  36129. // with {} we create a new object with the options inside it
  36130. this.options = _extends({}, Popper.Defaults, options);
  36131. // init state
  36132. this.state = {
  36133. isDestroyed: false,
  36134. isCreated: false,
  36135. scrollParents: []
  36136. };
  36137. // get reference and popper elements (allow jQuery wrappers)
  36138. this.reference = reference && reference.jquery ? reference[0] : reference;
  36139. this.popper = popper && popper.jquery ? popper[0] : popper;
  36140. // Deep merge modifiers options
  36141. this.options.modifiers = {};
  36142. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36143. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36144. });
  36145. // Refactoring modifiers' list (Object => Array)
  36146. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36147. return _extends({
  36148. name: name
  36149. }, _this.options.modifiers[name]);
  36150. })
  36151. // sort the modifiers by order
  36152. .sort(function (a, b) {
  36153. return a.order - b.order;
  36154. });
  36155. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36156. // such code is executed in the same order of its modifier
  36157. // they could add new properties to their options configuration
  36158. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36159. this.modifiers.forEach(function (modifierOptions) {
  36160. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36161. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36162. }
  36163. });
  36164. // fire the first update to position the popper in the right place
  36165. this.update();
  36166. var eventsEnabled = this.options.eventsEnabled;
  36167. if (eventsEnabled) {
  36168. // setup event listeners, they will take care of update the position in specific situations
  36169. this.enableEventListeners();
  36170. }
  36171. this.state.eventsEnabled = eventsEnabled;
  36172. }
  36173. // We can't use class properties because they don't get listed in the
  36174. // class prototype and break stuff like Sinon stubs
  36175. createClass(Popper, [{
  36176. key: 'update',
  36177. value: function update$$1() {
  36178. return update.call(this);
  36179. }
  36180. }, {
  36181. key: 'destroy',
  36182. value: function destroy$$1() {
  36183. return destroy.call(this);
  36184. }
  36185. }, {
  36186. key: 'enableEventListeners',
  36187. value: function enableEventListeners$$1() {
  36188. return enableEventListeners.call(this);
  36189. }
  36190. }, {
  36191. key: 'disableEventListeners',
  36192. value: function disableEventListeners$$1() {
  36193. return disableEventListeners.call(this);
  36194. }
  36195. /**
  36196. * Schedules an update. It will run on the next UI update available.
  36197. * @method scheduleUpdate
  36198. * @memberof Popper
  36199. */
  36200. /**
  36201. * Collection of utilities useful when writing custom modifiers.
  36202. * Starting from version 1.7, this method is available only if you
  36203. * include `popper-utils.js` before `popper.js`.
  36204. *
  36205. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36206. * and will be removed in v2! Use the PopperUtils module directly instead.
  36207. * Due to the high instability of the methods contained in Utils, we can't
  36208. * guarantee them to follow semver. Use them at your own risk!
  36209. * @static
  36210. * @private
  36211. * @type {Object}
  36212. * @deprecated since version 1.8
  36213. * @member Utils
  36214. * @memberof Popper
  36215. */
  36216. }]);
  36217. return Popper;
  36218. }();
  36219. /**
  36220. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36221. * and lets you use it as replacement of a real DOM node.<br />
  36222. * You can use this method to position a popper relatively to a set of coordinates
  36223. * in case you don't have a DOM node to use as reference.
  36224. *
  36225. * ```
  36226. * new Popper(referenceObject, popperNode);
  36227. * ```
  36228. *
  36229. * NB: This feature isn't supported in Internet Explorer 10.
  36230. * @name referenceObject
  36231. * @property {Function} data.getBoundingClientRect
  36232. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36233. * @property {number} data.clientWidth
  36234. * An ES6 getter that will return the width of the virtual reference element.
  36235. * @property {number} data.clientHeight
  36236. * An ES6 getter that will return the height of the virtual reference element.
  36237. */
  36238. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36239. Popper.placements = placements;
  36240. Popper.Defaults = Defaults;
  36241. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36242. //# sourceMappingURL=popper.js.map
  36243. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36244. /***/ }),
  36245. /***/ "./node_modules/process/browser.js":
  36246. /*!*****************************************!*\
  36247. !*** ./node_modules/process/browser.js ***!
  36248. \*****************************************/
  36249. /*! no static exports found */
  36250. /***/ (function(module, exports) {
  36251. // shim for using process in browser
  36252. var process = module.exports = {};
  36253. // cached from whatever global is present so that test runners that stub it
  36254. // don't break things. But we need to wrap it in a try catch in case it is
  36255. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36256. // function because try/catches deoptimize in certain engines.
  36257. var cachedSetTimeout;
  36258. var cachedClearTimeout;
  36259. function defaultSetTimout() {
  36260. throw new Error('setTimeout has not been defined');
  36261. }
  36262. function defaultClearTimeout () {
  36263. throw new Error('clearTimeout has not been defined');
  36264. }
  36265. (function () {
  36266. try {
  36267. if (typeof setTimeout === 'function') {
  36268. cachedSetTimeout = setTimeout;
  36269. } else {
  36270. cachedSetTimeout = defaultSetTimout;
  36271. }
  36272. } catch (e) {
  36273. cachedSetTimeout = defaultSetTimout;
  36274. }
  36275. try {
  36276. if (typeof clearTimeout === 'function') {
  36277. cachedClearTimeout = clearTimeout;
  36278. } else {
  36279. cachedClearTimeout = defaultClearTimeout;
  36280. }
  36281. } catch (e) {
  36282. cachedClearTimeout = defaultClearTimeout;
  36283. }
  36284. } ())
  36285. function runTimeout(fun) {
  36286. if (cachedSetTimeout === setTimeout) {
  36287. //normal enviroments in sane situations
  36288. return setTimeout(fun, 0);
  36289. }
  36290. // if setTimeout wasn't available but was latter defined
  36291. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36292. cachedSetTimeout = setTimeout;
  36293. return setTimeout(fun, 0);
  36294. }
  36295. try {
  36296. // when when somebody has screwed with setTimeout but no I.E. maddness
  36297. return cachedSetTimeout(fun, 0);
  36298. } catch(e){
  36299. try {
  36300. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36301. return cachedSetTimeout.call(null, fun, 0);
  36302. } catch(e){
  36303. // 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
  36304. return cachedSetTimeout.call(this, fun, 0);
  36305. }
  36306. }
  36307. }
  36308. function runClearTimeout(marker) {
  36309. if (cachedClearTimeout === clearTimeout) {
  36310. //normal enviroments in sane situations
  36311. return clearTimeout(marker);
  36312. }
  36313. // if clearTimeout wasn't available but was latter defined
  36314. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36315. cachedClearTimeout = clearTimeout;
  36316. return clearTimeout(marker);
  36317. }
  36318. try {
  36319. // when when somebody has screwed with setTimeout but no I.E. maddness
  36320. return cachedClearTimeout(marker);
  36321. } catch (e){
  36322. try {
  36323. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36324. return cachedClearTimeout.call(null, marker);
  36325. } catch (e){
  36326. // 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.
  36327. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36328. return cachedClearTimeout.call(this, marker);
  36329. }
  36330. }
  36331. }
  36332. var queue = [];
  36333. var draining = false;
  36334. var currentQueue;
  36335. var queueIndex = -1;
  36336. function cleanUpNextTick() {
  36337. if (!draining || !currentQueue) {
  36338. return;
  36339. }
  36340. draining = false;
  36341. if (currentQueue.length) {
  36342. queue = currentQueue.concat(queue);
  36343. } else {
  36344. queueIndex = -1;
  36345. }
  36346. if (queue.length) {
  36347. drainQueue();
  36348. }
  36349. }
  36350. function drainQueue() {
  36351. if (draining) {
  36352. return;
  36353. }
  36354. var timeout = runTimeout(cleanUpNextTick);
  36355. draining = true;
  36356. var len = queue.length;
  36357. while(len) {
  36358. currentQueue = queue;
  36359. queue = [];
  36360. while (++queueIndex < len) {
  36361. if (currentQueue) {
  36362. currentQueue[queueIndex].run();
  36363. }
  36364. }
  36365. queueIndex = -1;
  36366. len = queue.length;
  36367. }
  36368. currentQueue = null;
  36369. draining = false;
  36370. runClearTimeout(timeout);
  36371. }
  36372. process.nextTick = function (fun) {
  36373. var args = new Array(arguments.length - 1);
  36374. if (arguments.length > 1) {
  36375. for (var i = 1; i < arguments.length; i++) {
  36376. args[i - 1] = arguments[i];
  36377. }
  36378. }
  36379. queue.push(new Item(fun, args));
  36380. if (queue.length === 1 && !draining) {
  36381. runTimeout(drainQueue);
  36382. }
  36383. };
  36384. // v8 likes predictible objects
  36385. function Item(fun, array) {
  36386. this.fun = fun;
  36387. this.array = array;
  36388. }
  36389. Item.prototype.run = function () {
  36390. this.fun.apply(null, this.array);
  36391. };
  36392. process.title = 'browser';
  36393. process.browser = true;
  36394. process.env = {};
  36395. process.argv = [];
  36396. process.version = ''; // empty string to avoid regexp issues
  36397. process.versions = {};
  36398. function noop() {}
  36399. process.on = noop;
  36400. process.addListener = noop;
  36401. process.once = noop;
  36402. process.off = noop;
  36403. process.removeListener = noop;
  36404. process.removeAllListeners = noop;
  36405. process.emit = noop;
  36406. process.prependListener = noop;
  36407. process.prependOnceListener = noop;
  36408. process.listeners = function (name) { return [] }
  36409. process.binding = function (name) {
  36410. throw new Error('process.binding is not supported');
  36411. };
  36412. process.cwd = function () { return '/' };
  36413. process.chdir = function (dir) {
  36414. throw new Error('process.chdir is not supported');
  36415. };
  36416. process.umask = function() { return 0; };
  36417. /***/ }),
  36418. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36419. /*!***************************************************!*\
  36420. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36421. \***************************************************/
  36422. /*! no static exports found */
  36423. /***/ (function(module, exports, __webpack_require__) {
  36424. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36425. * Pusher JavaScript Library v5.0.3
  36426. * https://pusher.com/
  36427. *
  36428. * Copyright 2017, Pusher
  36429. * Released under the MIT licence.
  36430. */
  36431. (function webpackUniversalModuleDefinition(root, factory) {
  36432. if(true)
  36433. module.exports = factory();
  36434. else {}
  36435. })(window, function() {
  36436. return /******/ (function(modules) { // webpackBootstrap
  36437. /******/ // The module cache
  36438. /******/ var installedModules = {};
  36439. /******/
  36440. /******/ // The require function
  36441. /******/ function __webpack_require__(moduleId) {
  36442. /******/
  36443. /******/ // Check if module is in cache
  36444. /******/ if(installedModules[moduleId]) {
  36445. /******/ return installedModules[moduleId].exports;
  36446. /******/ }
  36447. /******/ // Create a new module (and put it into the cache)
  36448. /******/ var module = installedModules[moduleId] = {
  36449. /******/ i: moduleId,
  36450. /******/ l: false,
  36451. /******/ exports: {}
  36452. /******/ };
  36453. /******/
  36454. /******/ // Execute the module function
  36455. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36456. /******/
  36457. /******/ // Flag the module as loaded
  36458. /******/ module.l = true;
  36459. /******/
  36460. /******/ // Return the exports of the module
  36461. /******/ return module.exports;
  36462. /******/ }
  36463. /******/
  36464. /******/
  36465. /******/ // expose the modules object (__webpack_modules__)
  36466. /******/ __webpack_require__.m = modules;
  36467. /******/
  36468. /******/ // expose the module cache
  36469. /******/ __webpack_require__.c = installedModules;
  36470. /******/
  36471. /******/ // define getter function for harmony exports
  36472. /******/ __webpack_require__.d = function(exports, name, getter) {
  36473. /******/ if(!__webpack_require__.o(exports, name)) {
  36474. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36475. /******/ }
  36476. /******/ };
  36477. /******/
  36478. /******/ // define __esModule on exports
  36479. /******/ __webpack_require__.r = function(exports) {
  36480. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36481. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36482. /******/ }
  36483. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36484. /******/ };
  36485. /******/
  36486. /******/ // create a fake namespace object
  36487. /******/ // mode & 1: value is a module id, require it
  36488. /******/ // mode & 2: merge all properties of value into the ns
  36489. /******/ // mode & 4: return value when already ns object
  36490. /******/ // mode & 8|1: behave like require
  36491. /******/ __webpack_require__.t = function(value, mode) {
  36492. /******/ if(mode & 1) value = __webpack_require__(value);
  36493. /******/ if(mode & 8) return value;
  36494. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36495. /******/ var ns = Object.create(null);
  36496. /******/ __webpack_require__.r(ns);
  36497. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36498. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36499. /******/ return ns;
  36500. /******/ };
  36501. /******/
  36502. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36503. /******/ __webpack_require__.n = function(module) {
  36504. /******/ var getter = module && module.__esModule ?
  36505. /******/ function getDefault() { return module['default']; } :
  36506. /******/ function getModuleExports() { return module; };
  36507. /******/ __webpack_require__.d(getter, 'a', getter);
  36508. /******/ return getter;
  36509. /******/ };
  36510. /******/
  36511. /******/ // Object.prototype.hasOwnProperty.call
  36512. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36513. /******/
  36514. /******/ // __webpack_public_path__
  36515. /******/ __webpack_require__.p = "";
  36516. /******/
  36517. /******/
  36518. /******/ // Load entry module and return exports
  36519. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36520. /******/ })
  36521. /************************************************************************/
  36522. /******/ ([
  36523. /* 0 */
  36524. /***/ (function(module, exports, __webpack_require__) {
  36525. (function(nacl) {
  36526. 'use strict';
  36527. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36528. // Public domain.
  36529. //
  36530. // Implementation derived from TweetNaCl version 20140427.
  36531. // See for details: http://tweetnacl.cr.yp.to/
  36532. var gf = function(init) {
  36533. var i, r = new Float64Array(16);
  36534. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36535. return r;
  36536. };
  36537. // Pluggable, initialized in high-level API below.
  36538. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36539. var _0 = new Uint8Array(16);
  36540. var _9 = new Uint8Array(32); _9[0] = 9;
  36541. var gf0 = gf(),
  36542. gf1 = gf([1]),
  36543. _121665 = gf([0xdb41, 1]),
  36544. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36545. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36546. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36547. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36548. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36549. function ts64(x, i, h, l) {
  36550. x[i] = (h >> 24) & 0xff;
  36551. x[i+1] = (h >> 16) & 0xff;
  36552. x[i+2] = (h >> 8) & 0xff;
  36553. x[i+3] = h & 0xff;
  36554. x[i+4] = (l >> 24) & 0xff;
  36555. x[i+5] = (l >> 16) & 0xff;
  36556. x[i+6] = (l >> 8) & 0xff;
  36557. x[i+7] = l & 0xff;
  36558. }
  36559. function vn(x, xi, y, yi, n) {
  36560. var i,d = 0;
  36561. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36562. return (1 & ((d - 1) >>> 8)) - 1;
  36563. }
  36564. function crypto_verify_16(x, xi, y, yi) {
  36565. return vn(x,xi,y,yi,16);
  36566. }
  36567. function crypto_verify_32(x, xi, y, yi) {
  36568. return vn(x,xi,y,yi,32);
  36569. }
  36570. function core_salsa20(o, p, k, c) {
  36571. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36572. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36573. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36574. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36575. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36576. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36577. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36578. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36579. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36580. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36581. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36582. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36583. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36584. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36585. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36586. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36587. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36588. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36589. x15 = j15, u;
  36590. for (var i = 0; i < 20; i += 2) {
  36591. u = x0 + x12 | 0;
  36592. x4 ^= u<<7 | u>>>(32-7);
  36593. u = x4 + x0 | 0;
  36594. x8 ^= u<<9 | u>>>(32-9);
  36595. u = x8 + x4 | 0;
  36596. x12 ^= u<<13 | u>>>(32-13);
  36597. u = x12 + x8 | 0;
  36598. x0 ^= u<<18 | u>>>(32-18);
  36599. u = x5 + x1 | 0;
  36600. x9 ^= u<<7 | u>>>(32-7);
  36601. u = x9 + x5 | 0;
  36602. x13 ^= u<<9 | u>>>(32-9);
  36603. u = x13 + x9 | 0;
  36604. x1 ^= u<<13 | u>>>(32-13);
  36605. u = x1 + x13 | 0;
  36606. x5 ^= u<<18 | u>>>(32-18);
  36607. u = x10 + x6 | 0;
  36608. x14 ^= u<<7 | u>>>(32-7);
  36609. u = x14 + x10 | 0;
  36610. x2 ^= u<<9 | u>>>(32-9);
  36611. u = x2 + x14 | 0;
  36612. x6 ^= u<<13 | u>>>(32-13);
  36613. u = x6 + x2 | 0;
  36614. x10 ^= u<<18 | u>>>(32-18);
  36615. u = x15 + x11 | 0;
  36616. x3 ^= u<<7 | u>>>(32-7);
  36617. u = x3 + x15 | 0;
  36618. x7 ^= u<<9 | u>>>(32-9);
  36619. u = x7 + x3 | 0;
  36620. x11 ^= u<<13 | u>>>(32-13);
  36621. u = x11 + x7 | 0;
  36622. x15 ^= u<<18 | u>>>(32-18);
  36623. u = x0 + x3 | 0;
  36624. x1 ^= u<<7 | u>>>(32-7);
  36625. u = x1 + x0 | 0;
  36626. x2 ^= u<<9 | u>>>(32-9);
  36627. u = x2 + x1 | 0;
  36628. x3 ^= u<<13 | u>>>(32-13);
  36629. u = x3 + x2 | 0;
  36630. x0 ^= u<<18 | u>>>(32-18);
  36631. u = x5 + x4 | 0;
  36632. x6 ^= u<<7 | u>>>(32-7);
  36633. u = x6 + x5 | 0;
  36634. x7 ^= u<<9 | u>>>(32-9);
  36635. u = x7 + x6 | 0;
  36636. x4 ^= u<<13 | u>>>(32-13);
  36637. u = x4 + x7 | 0;
  36638. x5 ^= u<<18 | u>>>(32-18);
  36639. u = x10 + x9 | 0;
  36640. x11 ^= u<<7 | u>>>(32-7);
  36641. u = x11 + x10 | 0;
  36642. x8 ^= u<<9 | u>>>(32-9);
  36643. u = x8 + x11 | 0;
  36644. x9 ^= u<<13 | u>>>(32-13);
  36645. u = x9 + x8 | 0;
  36646. x10 ^= u<<18 | u>>>(32-18);
  36647. u = x15 + x14 | 0;
  36648. x12 ^= u<<7 | u>>>(32-7);
  36649. u = x12 + x15 | 0;
  36650. x13 ^= u<<9 | u>>>(32-9);
  36651. u = x13 + x12 | 0;
  36652. x14 ^= u<<13 | u>>>(32-13);
  36653. u = x14 + x13 | 0;
  36654. x15 ^= u<<18 | u>>>(32-18);
  36655. }
  36656. x0 = x0 + j0 | 0;
  36657. x1 = x1 + j1 | 0;
  36658. x2 = x2 + j2 | 0;
  36659. x3 = x3 + j3 | 0;
  36660. x4 = x4 + j4 | 0;
  36661. x5 = x5 + j5 | 0;
  36662. x6 = x6 + j6 | 0;
  36663. x7 = x7 + j7 | 0;
  36664. x8 = x8 + j8 | 0;
  36665. x9 = x9 + j9 | 0;
  36666. x10 = x10 + j10 | 0;
  36667. x11 = x11 + j11 | 0;
  36668. x12 = x12 + j12 | 0;
  36669. x13 = x13 + j13 | 0;
  36670. x14 = x14 + j14 | 0;
  36671. x15 = x15 + j15 | 0;
  36672. o[ 0] = x0 >>> 0 & 0xff;
  36673. o[ 1] = x0 >>> 8 & 0xff;
  36674. o[ 2] = x0 >>> 16 & 0xff;
  36675. o[ 3] = x0 >>> 24 & 0xff;
  36676. o[ 4] = x1 >>> 0 & 0xff;
  36677. o[ 5] = x1 >>> 8 & 0xff;
  36678. o[ 6] = x1 >>> 16 & 0xff;
  36679. o[ 7] = x1 >>> 24 & 0xff;
  36680. o[ 8] = x2 >>> 0 & 0xff;
  36681. o[ 9] = x2 >>> 8 & 0xff;
  36682. o[10] = x2 >>> 16 & 0xff;
  36683. o[11] = x2 >>> 24 & 0xff;
  36684. o[12] = x3 >>> 0 & 0xff;
  36685. o[13] = x3 >>> 8 & 0xff;
  36686. o[14] = x3 >>> 16 & 0xff;
  36687. o[15] = x3 >>> 24 & 0xff;
  36688. o[16] = x4 >>> 0 & 0xff;
  36689. o[17] = x4 >>> 8 & 0xff;
  36690. o[18] = x4 >>> 16 & 0xff;
  36691. o[19] = x4 >>> 24 & 0xff;
  36692. o[20] = x5 >>> 0 & 0xff;
  36693. o[21] = x5 >>> 8 & 0xff;
  36694. o[22] = x5 >>> 16 & 0xff;
  36695. o[23] = x5 >>> 24 & 0xff;
  36696. o[24] = x6 >>> 0 & 0xff;
  36697. o[25] = x6 >>> 8 & 0xff;
  36698. o[26] = x6 >>> 16 & 0xff;
  36699. o[27] = x6 >>> 24 & 0xff;
  36700. o[28] = x7 >>> 0 & 0xff;
  36701. o[29] = x7 >>> 8 & 0xff;
  36702. o[30] = x7 >>> 16 & 0xff;
  36703. o[31] = x7 >>> 24 & 0xff;
  36704. o[32] = x8 >>> 0 & 0xff;
  36705. o[33] = x8 >>> 8 & 0xff;
  36706. o[34] = x8 >>> 16 & 0xff;
  36707. o[35] = x8 >>> 24 & 0xff;
  36708. o[36] = x9 >>> 0 & 0xff;
  36709. o[37] = x9 >>> 8 & 0xff;
  36710. o[38] = x9 >>> 16 & 0xff;
  36711. o[39] = x9 >>> 24 & 0xff;
  36712. o[40] = x10 >>> 0 & 0xff;
  36713. o[41] = x10 >>> 8 & 0xff;
  36714. o[42] = x10 >>> 16 & 0xff;
  36715. o[43] = x10 >>> 24 & 0xff;
  36716. o[44] = x11 >>> 0 & 0xff;
  36717. o[45] = x11 >>> 8 & 0xff;
  36718. o[46] = x11 >>> 16 & 0xff;
  36719. o[47] = x11 >>> 24 & 0xff;
  36720. o[48] = x12 >>> 0 & 0xff;
  36721. o[49] = x12 >>> 8 & 0xff;
  36722. o[50] = x12 >>> 16 & 0xff;
  36723. o[51] = x12 >>> 24 & 0xff;
  36724. o[52] = x13 >>> 0 & 0xff;
  36725. o[53] = x13 >>> 8 & 0xff;
  36726. o[54] = x13 >>> 16 & 0xff;
  36727. o[55] = x13 >>> 24 & 0xff;
  36728. o[56] = x14 >>> 0 & 0xff;
  36729. o[57] = x14 >>> 8 & 0xff;
  36730. o[58] = x14 >>> 16 & 0xff;
  36731. o[59] = x14 >>> 24 & 0xff;
  36732. o[60] = x15 >>> 0 & 0xff;
  36733. o[61] = x15 >>> 8 & 0xff;
  36734. o[62] = x15 >>> 16 & 0xff;
  36735. o[63] = x15 >>> 24 & 0xff;
  36736. }
  36737. function core_hsalsa20(o,p,k,c) {
  36738. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36739. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36740. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36741. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36742. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36743. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36744. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36745. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36746. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36747. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36748. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36749. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36750. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36751. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36752. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36753. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36754. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36755. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36756. x15 = j15, u;
  36757. for (var i = 0; i < 20; i += 2) {
  36758. u = x0 + x12 | 0;
  36759. x4 ^= u<<7 | u>>>(32-7);
  36760. u = x4 + x0 | 0;
  36761. x8 ^= u<<9 | u>>>(32-9);
  36762. u = x8 + x4 | 0;
  36763. x12 ^= u<<13 | u>>>(32-13);
  36764. u = x12 + x8 | 0;
  36765. x0 ^= u<<18 | u>>>(32-18);
  36766. u = x5 + x1 | 0;
  36767. x9 ^= u<<7 | u>>>(32-7);
  36768. u = x9 + x5 | 0;
  36769. x13 ^= u<<9 | u>>>(32-9);
  36770. u = x13 + x9 | 0;
  36771. x1 ^= u<<13 | u>>>(32-13);
  36772. u = x1 + x13 | 0;
  36773. x5 ^= u<<18 | u>>>(32-18);
  36774. u = x10 + x6 | 0;
  36775. x14 ^= u<<7 | u>>>(32-7);
  36776. u = x14 + x10 | 0;
  36777. x2 ^= u<<9 | u>>>(32-9);
  36778. u = x2 + x14 | 0;
  36779. x6 ^= u<<13 | u>>>(32-13);
  36780. u = x6 + x2 | 0;
  36781. x10 ^= u<<18 | u>>>(32-18);
  36782. u = x15 + x11 | 0;
  36783. x3 ^= u<<7 | u>>>(32-7);
  36784. u = x3 + x15 | 0;
  36785. x7 ^= u<<9 | u>>>(32-9);
  36786. u = x7 + x3 | 0;
  36787. x11 ^= u<<13 | u>>>(32-13);
  36788. u = x11 + x7 | 0;
  36789. x15 ^= u<<18 | u>>>(32-18);
  36790. u = x0 + x3 | 0;
  36791. x1 ^= u<<7 | u>>>(32-7);
  36792. u = x1 + x0 | 0;
  36793. x2 ^= u<<9 | u>>>(32-9);
  36794. u = x2 + x1 | 0;
  36795. x3 ^= u<<13 | u>>>(32-13);
  36796. u = x3 + x2 | 0;
  36797. x0 ^= u<<18 | u>>>(32-18);
  36798. u = x5 + x4 | 0;
  36799. x6 ^= u<<7 | u>>>(32-7);
  36800. u = x6 + x5 | 0;
  36801. x7 ^= u<<9 | u>>>(32-9);
  36802. u = x7 + x6 | 0;
  36803. x4 ^= u<<13 | u>>>(32-13);
  36804. u = x4 + x7 | 0;
  36805. x5 ^= u<<18 | u>>>(32-18);
  36806. u = x10 + x9 | 0;
  36807. x11 ^= u<<7 | u>>>(32-7);
  36808. u = x11 + x10 | 0;
  36809. x8 ^= u<<9 | u>>>(32-9);
  36810. u = x8 + x11 | 0;
  36811. x9 ^= u<<13 | u>>>(32-13);
  36812. u = x9 + x8 | 0;
  36813. x10 ^= u<<18 | u>>>(32-18);
  36814. u = x15 + x14 | 0;
  36815. x12 ^= u<<7 | u>>>(32-7);
  36816. u = x12 + x15 | 0;
  36817. x13 ^= u<<9 | u>>>(32-9);
  36818. u = x13 + x12 | 0;
  36819. x14 ^= u<<13 | u>>>(32-13);
  36820. u = x14 + x13 | 0;
  36821. x15 ^= u<<18 | u>>>(32-18);
  36822. }
  36823. o[ 0] = x0 >>> 0 & 0xff;
  36824. o[ 1] = x0 >>> 8 & 0xff;
  36825. o[ 2] = x0 >>> 16 & 0xff;
  36826. o[ 3] = x0 >>> 24 & 0xff;
  36827. o[ 4] = x5 >>> 0 & 0xff;
  36828. o[ 5] = x5 >>> 8 & 0xff;
  36829. o[ 6] = x5 >>> 16 & 0xff;
  36830. o[ 7] = x5 >>> 24 & 0xff;
  36831. o[ 8] = x10 >>> 0 & 0xff;
  36832. o[ 9] = x10 >>> 8 & 0xff;
  36833. o[10] = x10 >>> 16 & 0xff;
  36834. o[11] = x10 >>> 24 & 0xff;
  36835. o[12] = x15 >>> 0 & 0xff;
  36836. o[13] = x15 >>> 8 & 0xff;
  36837. o[14] = x15 >>> 16 & 0xff;
  36838. o[15] = x15 >>> 24 & 0xff;
  36839. o[16] = x6 >>> 0 & 0xff;
  36840. o[17] = x6 >>> 8 & 0xff;
  36841. o[18] = x6 >>> 16 & 0xff;
  36842. o[19] = x6 >>> 24 & 0xff;
  36843. o[20] = x7 >>> 0 & 0xff;
  36844. o[21] = x7 >>> 8 & 0xff;
  36845. o[22] = x7 >>> 16 & 0xff;
  36846. o[23] = x7 >>> 24 & 0xff;
  36847. o[24] = x8 >>> 0 & 0xff;
  36848. o[25] = x8 >>> 8 & 0xff;
  36849. o[26] = x8 >>> 16 & 0xff;
  36850. o[27] = x8 >>> 24 & 0xff;
  36851. o[28] = x9 >>> 0 & 0xff;
  36852. o[29] = x9 >>> 8 & 0xff;
  36853. o[30] = x9 >>> 16 & 0xff;
  36854. o[31] = x9 >>> 24 & 0xff;
  36855. }
  36856. function crypto_core_salsa20(out,inp,k,c) {
  36857. core_salsa20(out,inp,k,c);
  36858. }
  36859. function crypto_core_hsalsa20(out,inp,k,c) {
  36860. core_hsalsa20(out,inp,k,c);
  36861. }
  36862. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36863. // "expand 32-byte k"
  36864. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36865. var z = new Uint8Array(16), x = new Uint8Array(64);
  36866. var u, i;
  36867. for (i = 0; i < 16; i++) z[i] = 0;
  36868. for (i = 0; i < 8; i++) z[i] = n[i];
  36869. while (b >= 64) {
  36870. crypto_core_salsa20(x,z,k,sigma);
  36871. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36872. u = 1;
  36873. for (i = 8; i < 16; i++) {
  36874. u = u + (z[i] & 0xff) | 0;
  36875. z[i] = u & 0xff;
  36876. u >>>= 8;
  36877. }
  36878. b -= 64;
  36879. cpos += 64;
  36880. mpos += 64;
  36881. }
  36882. if (b > 0) {
  36883. crypto_core_salsa20(x,z,k,sigma);
  36884. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36885. }
  36886. return 0;
  36887. }
  36888. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36889. var z = new Uint8Array(16), x = new Uint8Array(64);
  36890. var u, i;
  36891. for (i = 0; i < 16; i++) z[i] = 0;
  36892. for (i = 0; i < 8; i++) z[i] = n[i];
  36893. while (b >= 64) {
  36894. crypto_core_salsa20(x,z,k,sigma);
  36895. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36896. u = 1;
  36897. for (i = 8; i < 16; i++) {
  36898. u = u + (z[i] & 0xff) | 0;
  36899. z[i] = u & 0xff;
  36900. u >>>= 8;
  36901. }
  36902. b -= 64;
  36903. cpos += 64;
  36904. }
  36905. if (b > 0) {
  36906. crypto_core_salsa20(x,z,k,sigma);
  36907. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36908. }
  36909. return 0;
  36910. }
  36911. function crypto_stream(c,cpos,d,n,k) {
  36912. var s = new Uint8Array(32);
  36913. crypto_core_hsalsa20(s,n,k,sigma);
  36914. var sn = new Uint8Array(8);
  36915. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36916. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36917. }
  36918. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36919. var s = new Uint8Array(32);
  36920. crypto_core_hsalsa20(s,n,k,sigma);
  36921. var sn = new Uint8Array(8);
  36922. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36923. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36924. }
  36925. /*
  36926. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36927. * https://github.com/floodyberry/poly1305-donna
  36928. */
  36929. var poly1305 = function(key) {
  36930. this.buffer = new Uint8Array(16);
  36931. this.r = new Uint16Array(10);
  36932. this.h = new Uint16Array(10);
  36933. this.pad = new Uint16Array(8);
  36934. this.leftover = 0;
  36935. this.fin = 0;
  36936. var t0, t1, t2, t3, t4, t5, t6, t7;
  36937. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36938. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36939. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36940. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36941. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36942. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36943. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36944. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36945. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36946. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36947. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36948. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36949. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36950. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36951. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36952. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36953. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36954. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36955. };
  36956. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36957. var hibit = this.fin ? 0 : (1 << 11);
  36958. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36959. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36960. var h0 = this.h[0],
  36961. h1 = this.h[1],
  36962. h2 = this.h[2],
  36963. h3 = this.h[3],
  36964. h4 = this.h[4],
  36965. h5 = this.h[5],
  36966. h6 = this.h[6],
  36967. h7 = this.h[7],
  36968. h8 = this.h[8],
  36969. h9 = this.h[9];
  36970. var r0 = this.r[0],
  36971. r1 = this.r[1],
  36972. r2 = this.r[2],
  36973. r3 = this.r[3],
  36974. r4 = this.r[4],
  36975. r5 = this.r[5],
  36976. r6 = this.r[6],
  36977. r7 = this.r[7],
  36978. r8 = this.r[8],
  36979. r9 = this.r[9];
  36980. while (bytes >= 16) {
  36981. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36982. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36983. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36984. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36985. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36986. h5 += ((t4 >>> 1)) & 0x1fff;
  36987. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36988. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36989. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36990. h9 += ((t7 >>> 5)) | hibit;
  36991. c = 0;
  36992. d0 = c;
  36993. d0 += h0 * r0;
  36994. d0 += h1 * (5 * r9);
  36995. d0 += h2 * (5 * r8);
  36996. d0 += h3 * (5 * r7);
  36997. d0 += h4 * (5 * r6);
  36998. c = (d0 >>> 13); d0 &= 0x1fff;
  36999. d0 += h5 * (5 * r5);
  37000. d0 += h6 * (5 * r4);
  37001. d0 += h7 * (5 * r3);
  37002. d0 += h8 * (5 * r2);
  37003. d0 += h9 * (5 * r1);
  37004. c += (d0 >>> 13); d0 &= 0x1fff;
  37005. d1 = c;
  37006. d1 += h0 * r1;
  37007. d1 += h1 * r0;
  37008. d1 += h2 * (5 * r9);
  37009. d1 += h3 * (5 * r8);
  37010. d1 += h4 * (5 * r7);
  37011. c = (d1 >>> 13); d1 &= 0x1fff;
  37012. d1 += h5 * (5 * r6);
  37013. d1 += h6 * (5 * r5);
  37014. d1 += h7 * (5 * r4);
  37015. d1 += h8 * (5 * r3);
  37016. d1 += h9 * (5 * r2);
  37017. c += (d1 >>> 13); d1 &= 0x1fff;
  37018. d2 = c;
  37019. d2 += h0 * r2;
  37020. d2 += h1 * r1;
  37021. d2 += h2 * r0;
  37022. d2 += h3 * (5 * r9);
  37023. d2 += h4 * (5 * r8);
  37024. c = (d2 >>> 13); d2 &= 0x1fff;
  37025. d2 += h5 * (5 * r7);
  37026. d2 += h6 * (5 * r6);
  37027. d2 += h7 * (5 * r5);
  37028. d2 += h8 * (5 * r4);
  37029. d2 += h9 * (5 * r3);
  37030. c += (d2 >>> 13); d2 &= 0x1fff;
  37031. d3 = c;
  37032. d3 += h0 * r3;
  37033. d3 += h1 * r2;
  37034. d3 += h2 * r1;
  37035. d3 += h3 * r0;
  37036. d3 += h4 * (5 * r9);
  37037. c = (d3 >>> 13); d3 &= 0x1fff;
  37038. d3 += h5 * (5 * r8);
  37039. d3 += h6 * (5 * r7);
  37040. d3 += h7 * (5 * r6);
  37041. d3 += h8 * (5 * r5);
  37042. d3 += h9 * (5 * r4);
  37043. c += (d3 >>> 13); d3 &= 0x1fff;
  37044. d4 = c;
  37045. d4 += h0 * r4;
  37046. d4 += h1 * r3;
  37047. d4 += h2 * r2;
  37048. d4 += h3 * r1;
  37049. d4 += h4 * r0;
  37050. c = (d4 >>> 13); d4 &= 0x1fff;
  37051. d4 += h5 * (5 * r9);
  37052. d4 += h6 * (5 * r8);
  37053. d4 += h7 * (5 * r7);
  37054. d4 += h8 * (5 * r6);
  37055. d4 += h9 * (5 * r5);
  37056. c += (d4 >>> 13); d4 &= 0x1fff;
  37057. d5 = c;
  37058. d5 += h0 * r5;
  37059. d5 += h1 * r4;
  37060. d5 += h2 * r3;
  37061. d5 += h3 * r2;
  37062. d5 += h4 * r1;
  37063. c = (d5 >>> 13); d5 &= 0x1fff;
  37064. d5 += h5 * r0;
  37065. d5 += h6 * (5 * r9);
  37066. d5 += h7 * (5 * r8);
  37067. d5 += h8 * (5 * r7);
  37068. d5 += h9 * (5 * r6);
  37069. c += (d5 >>> 13); d5 &= 0x1fff;
  37070. d6 = c;
  37071. d6 += h0 * r6;
  37072. d6 += h1 * r5;
  37073. d6 += h2 * r4;
  37074. d6 += h3 * r3;
  37075. d6 += h4 * r2;
  37076. c = (d6 >>> 13); d6 &= 0x1fff;
  37077. d6 += h5 * r1;
  37078. d6 += h6 * r0;
  37079. d6 += h7 * (5 * r9);
  37080. d6 += h8 * (5 * r8);
  37081. d6 += h9 * (5 * r7);
  37082. c += (d6 >>> 13); d6 &= 0x1fff;
  37083. d7 = c;
  37084. d7 += h0 * r7;
  37085. d7 += h1 * r6;
  37086. d7 += h2 * r5;
  37087. d7 += h3 * r4;
  37088. d7 += h4 * r3;
  37089. c = (d7 >>> 13); d7 &= 0x1fff;
  37090. d7 += h5 * r2;
  37091. d7 += h6 * r1;
  37092. d7 += h7 * r0;
  37093. d7 += h8 * (5 * r9);
  37094. d7 += h9 * (5 * r8);
  37095. c += (d7 >>> 13); d7 &= 0x1fff;
  37096. d8 = c;
  37097. d8 += h0 * r8;
  37098. d8 += h1 * r7;
  37099. d8 += h2 * r6;
  37100. d8 += h3 * r5;
  37101. d8 += h4 * r4;
  37102. c = (d8 >>> 13); d8 &= 0x1fff;
  37103. d8 += h5 * r3;
  37104. d8 += h6 * r2;
  37105. d8 += h7 * r1;
  37106. d8 += h8 * r0;
  37107. d8 += h9 * (5 * r9);
  37108. c += (d8 >>> 13); d8 &= 0x1fff;
  37109. d9 = c;
  37110. d9 += h0 * r9;
  37111. d9 += h1 * r8;
  37112. d9 += h2 * r7;
  37113. d9 += h3 * r6;
  37114. d9 += h4 * r5;
  37115. c = (d9 >>> 13); d9 &= 0x1fff;
  37116. d9 += h5 * r4;
  37117. d9 += h6 * r3;
  37118. d9 += h7 * r2;
  37119. d9 += h8 * r1;
  37120. d9 += h9 * r0;
  37121. c += (d9 >>> 13); d9 &= 0x1fff;
  37122. c = (((c << 2) + c)) | 0;
  37123. c = (c + d0) | 0;
  37124. d0 = c & 0x1fff;
  37125. c = (c >>> 13);
  37126. d1 += c;
  37127. h0 = d0;
  37128. h1 = d1;
  37129. h2 = d2;
  37130. h3 = d3;
  37131. h4 = d4;
  37132. h5 = d5;
  37133. h6 = d6;
  37134. h7 = d7;
  37135. h8 = d8;
  37136. h9 = d9;
  37137. mpos += 16;
  37138. bytes -= 16;
  37139. }
  37140. this.h[0] = h0;
  37141. this.h[1] = h1;
  37142. this.h[2] = h2;
  37143. this.h[3] = h3;
  37144. this.h[4] = h4;
  37145. this.h[5] = h5;
  37146. this.h[6] = h6;
  37147. this.h[7] = h7;
  37148. this.h[8] = h8;
  37149. this.h[9] = h9;
  37150. };
  37151. poly1305.prototype.finish = function(mac, macpos) {
  37152. var g = new Uint16Array(10);
  37153. var c, mask, f, i;
  37154. if (this.leftover) {
  37155. i = this.leftover;
  37156. this.buffer[i++] = 1;
  37157. for (; i < 16; i++) this.buffer[i] = 0;
  37158. this.fin = 1;
  37159. this.blocks(this.buffer, 0, 16);
  37160. }
  37161. c = this.h[1] >>> 13;
  37162. this.h[1] &= 0x1fff;
  37163. for (i = 2; i < 10; i++) {
  37164. this.h[i] += c;
  37165. c = this.h[i] >>> 13;
  37166. this.h[i] &= 0x1fff;
  37167. }
  37168. this.h[0] += (c * 5);
  37169. c = this.h[0] >>> 13;
  37170. this.h[0] &= 0x1fff;
  37171. this.h[1] += c;
  37172. c = this.h[1] >>> 13;
  37173. this.h[1] &= 0x1fff;
  37174. this.h[2] += c;
  37175. g[0] = this.h[0] + 5;
  37176. c = g[0] >>> 13;
  37177. g[0] &= 0x1fff;
  37178. for (i = 1; i < 10; i++) {
  37179. g[i] = this.h[i] + c;
  37180. c = g[i] >>> 13;
  37181. g[i] &= 0x1fff;
  37182. }
  37183. g[9] -= (1 << 13);
  37184. mask = (c ^ 1) - 1;
  37185. for (i = 0; i < 10; i++) g[i] &= mask;
  37186. mask = ~mask;
  37187. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37188. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37189. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37190. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37191. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37192. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37193. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37194. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37195. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37196. f = this.h[0] + this.pad[0];
  37197. this.h[0] = f & 0xffff;
  37198. for (i = 1; i < 8; i++) {
  37199. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37200. this.h[i] = f & 0xffff;
  37201. }
  37202. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37203. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37204. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37205. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37206. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37207. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37208. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37209. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37210. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37211. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37212. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37213. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37214. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37215. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37216. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37217. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37218. };
  37219. poly1305.prototype.update = function(m, mpos, bytes) {
  37220. var i, want;
  37221. if (this.leftover) {
  37222. want = (16 - this.leftover);
  37223. if (want > bytes)
  37224. want = bytes;
  37225. for (i = 0; i < want; i++)
  37226. this.buffer[this.leftover + i] = m[mpos+i];
  37227. bytes -= want;
  37228. mpos += want;
  37229. this.leftover += want;
  37230. if (this.leftover < 16)
  37231. return;
  37232. this.blocks(this.buffer, 0, 16);
  37233. this.leftover = 0;
  37234. }
  37235. if (bytes >= 16) {
  37236. want = bytes - (bytes % 16);
  37237. this.blocks(m, mpos, want);
  37238. mpos += want;
  37239. bytes -= want;
  37240. }
  37241. if (bytes) {
  37242. for (i = 0; i < bytes; i++)
  37243. this.buffer[this.leftover + i] = m[mpos+i];
  37244. this.leftover += bytes;
  37245. }
  37246. };
  37247. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37248. var s = new poly1305(k);
  37249. s.update(m, mpos, n);
  37250. s.finish(out, outpos);
  37251. return 0;
  37252. }
  37253. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37254. var x = new Uint8Array(16);
  37255. crypto_onetimeauth(x,0,m,mpos,n,k);
  37256. return crypto_verify_16(h,hpos,x,0);
  37257. }
  37258. function crypto_secretbox(c,m,d,n,k) {
  37259. var i;
  37260. if (d < 32) return -1;
  37261. crypto_stream_xor(c,0,m,0,d,n,k);
  37262. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37263. for (i = 0; i < 16; i++) c[i] = 0;
  37264. return 0;
  37265. }
  37266. function crypto_secretbox_open(m,c,d,n,k) {
  37267. var i;
  37268. var x = new Uint8Array(32);
  37269. if (d < 32) return -1;
  37270. crypto_stream(x,0,32,n,k);
  37271. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37272. crypto_stream_xor(m,0,c,0,d,n,k);
  37273. for (i = 0; i < 32; i++) m[i] = 0;
  37274. return 0;
  37275. }
  37276. function set25519(r, a) {
  37277. var i;
  37278. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37279. }
  37280. function car25519(o) {
  37281. var i, v, c = 1;
  37282. for (i = 0; i < 16; i++) {
  37283. v = o[i] + c + 65535;
  37284. c = Math.floor(v / 65536);
  37285. o[i] = v - c * 65536;
  37286. }
  37287. o[0] += c-1 + 37 * (c-1);
  37288. }
  37289. function sel25519(p, q, b) {
  37290. var t, c = ~(b-1);
  37291. for (var i = 0; i < 16; i++) {
  37292. t = c & (p[i] ^ q[i]);
  37293. p[i] ^= t;
  37294. q[i] ^= t;
  37295. }
  37296. }
  37297. function pack25519(o, n) {
  37298. var i, j, b;
  37299. var m = gf(), t = gf();
  37300. for (i = 0; i < 16; i++) t[i] = n[i];
  37301. car25519(t);
  37302. car25519(t);
  37303. car25519(t);
  37304. for (j = 0; j < 2; j++) {
  37305. m[0] = t[0] - 0xffed;
  37306. for (i = 1; i < 15; i++) {
  37307. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37308. m[i-1] &= 0xffff;
  37309. }
  37310. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37311. b = (m[15]>>16) & 1;
  37312. m[14] &= 0xffff;
  37313. sel25519(t, m, 1-b);
  37314. }
  37315. for (i = 0; i < 16; i++) {
  37316. o[2*i] = t[i] & 0xff;
  37317. o[2*i+1] = t[i]>>8;
  37318. }
  37319. }
  37320. function neq25519(a, b) {
  37321. var c = new Uint8Array(32), d = new Uint8Array(32);
  37322. pack25519(c, a);
  37323. pack25519(d, b);
  37324. return crypto_verify_32(c, 0, d, 0);
  37325. }
  37326. function par25519(a) {
  37327. var d = new Uint8Array(32);
  37328. pack25519(d, a);
  37329. return d[0] & 1;
  37330. }
  37331. function unpack25519(o, n) {
  37332. var i;
  37333. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37334. o[15] &= 0x7fff;
  37335. }
  37336. function A(o, a, b) {
  37337. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37338. }
  37339. function Z(o, a, b) {
  37340. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37341. }
  37342. function M(o, a, b) {
  37343. var v, c,
  37344. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37345. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37346. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37347. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37348. b0 = b[0],
  37349. b1 = b[1],
  37350. b2 = b[2],
  37351. b3 = b[3],
  37352. b4 = b[4],
  37353. b5 = b[5],
  37354. b6 = b[6],
  37355. b7 = b[7],
  37356. b8 = b[8],
  37357. b9 = b[9],
  37358. b10 = b[10],
  37359. b11 = b[11],
  37360. b12 = b[12],
  37361. b13 = b[13],
  37362. b14 = b[14],
  37363. b15 = b[15];
  37364. v = a[0];
  37365. t0 += v * b0;
  37366. t1 += v * b1;
  37367. t2 += v * b2;
  37368. t3 += v * b3;
  37369. t4 += v * b4;
  37370. t5 += v * b5;
  37371. t6 += v * b6;
  37372. t7 += v * b7;
  37373. t8 += v * b8;
  37374. t9 += v * b9;
  37375. t10 += v * b10;
  37376. t11 += v * b11;
  37377. t12 += v * b12;
  37378. t13 += v * b13;
  37379. t14 += v * b14;
  37380. t15 += v * b15;
  37381. v = a[1];
  37382. t1 += v * b0;
  37383. t2 += v * b1;
  37384. t3 += v * b2;
  37385. t4 += v * b3;
  37386. t5 += v * b4;
  37387. t6 += v * b5;
  37388. t7 += v * b6;
  37389. t8 += v * b7;
  37390. t9 += v * b8;
  37391. t10 += v * b9;
  37392. t11 += v * b10;
  37393. t12 += v * b11;
  37394. t13 += v * b12;
  37395. t14 += v * b13;
  37396. t15 += v * b14;
  37397. t16 += v * b15;
  37398. v = a[2];
  37399. t2 += v * b0;
  37400. t3 += v * b1;
  37401. t4 += v * b2;
  37402. t5 += v * b3;
  37403. t6 += v * b4;
  37404. t7 += v * b5;
  37405. t8 += v * b6;
  37406. t9 += v * b7;
  37407. t10 += v * b8;
  37408. t11 += v * b9;
  37409. t12 += v * b10;
  37410. t13 += v * b11;
  37411. t14 += v * b12;
  37412. t15 += v * b13;
  37413. t16 += v * b14;
  37414. t17 += v * b15;
  37415. v = a[3];
  37416. t3 += v * b0;
  37417. t4 += v * b1;
  37418. t5 += v * b2;
  37419. t6 += v * b3;
  37420. t7 += v * b4;
  37421. t8 += v * b5;
  37422. t9 += v * b6;
  37423. t10 += v * b7;
  37424. t11 += v * b8;
  37425. t12 += v * b9;
  37426. t13 += v * b10;
  37427. t14 += v * b11;
  37428. t15 += v * b12;
  37429. t16 += v * b13;
  37430. t17 += v * b14;
  37431. t18 += v * b15;
  37432. v = a[4];
  37433. t4 += v * b0;
  37434. t5 += v * b1;
  37435. t6 += v * b2;
  37436. t7 += v * b3;
  37437. t8 += v * b4;
  37438. t9 += v * b5;
  37439. t10 += v * b6;
  37440. t11 += v * b7;
  37441. t12 += v * b8;
  37442. t13 += v * b9;
  37443. t14 += v * b10;
  37444. t15 += v * b11;
  37445. t16 += v * b12;
  37446. t17 += v * b13;
  37447. t18 += v * b14;
  37448. t19 += v * b15;
  37449. v = a[5];
  37450. t5 += v * b0;
  37451. t6 += v * b1;
  37452. t7 += v * b2;
  37453. t8 += v * b3;
  37454. t9 += v * b4;
  37455. t10 += v * b5;
  37456. t11 += v * b6;
  37457. t12 += v * b7;
  37458. t13 += v * b8;
  37459. t14 += v * b9;
  37460. t15 += v * b10;
  37461. t16 += v * b11;
  37462. t17 += v * b12;
  37463. t18 += v * b13;
  37464. t19 += v * b14;
  37465. t20 += v * b15;
  37466. v = a[6];
  37467. t6 += v * b0;
  37468. t7 += v * b1;
  37469. t8 += v * b2;
  37470. t9 += v * b3;
  37471. t10 += v * b4;
  37472. t11 += v * b5;
  37473. t12 += v * b6;
  37474. t13 += v * b7;
  37475. t14 += v * b8;
  37476. t15 += v * b9;
  37477. t16 += v * b10;
  37478. t17 += v * b11;
  37479. t18 += v * b12;
  37480. t19 += v * b13;
  37481. t20 += v * b14;
  37482. t21 += v * b15;
  37483. v = a[7];
  37484. t7 += v * b0;
  37485. t8 += v * b1;
  37486. t9 += v * b2;
  37487. t10 += v * b3;
  37488. t11 += v * b4;
  37489. t12 += v * b5;
  37490. t13 += v * b6;
  37491. t14 += v * b7;
  37492. t15 += v * b8;
  37493. t16 += v * b9;
  37494. t17 += v * b10;
  37495. t18 += v * b11;
  37496. t19 += v * b12;
  37497. t20 += v * b13;
  37498. t21 += v * b14;
  37499. t22 += v * b15;
  37500. v = a[8];
  37501. t8 += v * b0;
  37502. t9 += v * b1;
  37503. t10 += v * b2;
  37504. t11 += v * b3;
  37505. t12 += v * b4;
  37506. t13 += v * b5;
  37507. t14 += v * b6;
  37508. t15 += v * b7;
  37509. t16 += v * b8;
  37510. t17 += v * b9;
  37511. t18 += v * b10;
  37512. t19 += v * b11;
  37513. t20 += v * b12;
  37514. t21 += v * b13;
  37515. t22 += v * b14;
  37516. t23 += v * b15;
  37517. v = a[9];
  37518. t9 += v * b0;
  37519. t10 += v * b1;
  37520. t11 += v * b2;
  37521. t12 += v * b3;
  37522. t13 += v * b4;
  37523. t14 += v * b5;
  37524. t15 += v * b6;
  37525. t16 += v * b7;
  37526. t17 += v * b8;
  37527. t18 += v * b9;
  37528. t19 += v * b10;
  37529. t20 += v * b11;
  37530. t21 += v * b12;
  37531. t22 += v * b13;
  37532. t23 += v * b14;
  37533. t24 += v * b15;
  37534. v = a[10];
  37535. t10 += v * b0;
  37536. t11 += v * b1;
  37537. t12 += v * b2;
  37538. t13 += v * b3;
  37539. t14 += v * b4;
  37540. t15 += v * b5;
  37541. t16 += v * b6;
  37542. t17 += v * b7;
  37543. t18 += v * b8;
  37544. t19 += v * b9;
  37545. t20 += v * b10;
  37546. t21 += v * b11;
  37547. t22 += v * b12;
  37548. t23 += v * b13;
  37549. t24 += v * b14;
  37550. t25 += v * b15;
  37551. v = a[11];
  37552. t11 += v * b0;
  37553. t12 += v * b1;
  37554. t13 += v * b2;
  37555. t14 += v * b3;
  37556. t15 += v * b4;
  37557. t16 += v * b5;
  37558. t17 += v * b6;
  37559. t18 += v * b7;
  37560. t19 += v * b8;
  37561. t20 += v * b9;
  37562. t21 += v * b10;
  37563. t22 += v * b11;
  37564. t23 += v * b12;
  37565. t24 += v * b13;
  37566. t25 += v * b14;
  37567. t26 += v * b15;
  37568. v = a[12];
  37569. t12 += v * b0;
  37570. t13 += v * b1;
  37571. t14 += v * b2;
  37572. t15 += v * b3;
  37573. t16 += v * b4;
  37574. t17 += v * b5;
  37575. t18 += v * b6;
  37576. t19 += v * b7;
  37577. t20 += v * b8;
  37578. t21 += v * b9;
  37579. t22 += v * b10;
  37580. t23 += v * b11;
  37581. t24 += v * b12;
  37582. t25 += v * b13;
  37583. t26 += v * b14;
  37584. t27 += v * b15;
  37585. v = a[13];
  37586. t13 += v * b0;
  37587. t14 += v * b1;
  37588. t15 += v * b2;
  37589. t16 += v * b3;
  37590. t17 += v * b4;
  37591. t18 += v * b5;
  37592. t19 += v * b6;
  37593. t20 += v * b7;
  37594. t21 += v * b8;
  37595. t22 += v * b9;
  37596. t23 += v * b10;
  37597. t24 += v * b11;
  37598. t25 += v * b12;
  37599. t26 += v * b13;
  37600. t27 += v * b14;
  37601. t28 += v * b15;
  37602. v = a[14];
  37603. t14 += v * b0;
  37604. t15 += v * b1;
  37605. t16 += v * b2;
  37606. t17 += v * b3;
  37607. t18 += v * b4;
  37608. t19 += v * b5;
  37609. t20 += v * b6;
  37610. t21 += v * b7;
  37611. t22 += v * b8;
  37612. t23 += v * b9;
  37613. t24 += v * b10;
  37614. t25 += v * b11;
  37615. t26 += v * b12;
  37616. t27 += v * b13;
  37617. t28 += v * b14;
  37618. t29 += v * b15;
  37619. v = a[15];
  37620. t15 += v * b0;
  37621. t16 += v * b1;
  37622. t17 += v * b2;
  37623. t18 += v * b3;
  37624. t19 += v * b4;
  37625. t20 += v * b5;
  37626. t21 += v * b6;
  37627. t22 += v * b7;
  37628. t23 += v * b8;
  37629. t24 += v * b9;
  37630. t25 += v * b10;
  37631. t26 += v * b11;
  37632. t27 += v * b12;
  37633. t28 += v * b13;
  37634. t29 += v * b14;
  37635. t30 += v * b15;
  37636. t0 += 38 * t16;
  37637. t1 += 38 * t17;
  37638. t2 += 38 * t18;
  37639. t3 += 38 * t19;
  37640. t4 += 38 * t20;
  37641. t5 += 38 * t21;
  37642. t6 += 38 * t22;
  37643. t7 += 38 * t23;
  37644. t8 += 38 * t24;
  37645. t9 += 38 * t25;
  37646. t10 += 38 * t26;
  37647. t11 += 38 * t27;
  37648. t12 += 38 * t28;
  37649. t13 += 38 * t29;
  37650. t14 += 38 * t30;
  37651. // t15 left as is
  37652. // first car
  37653. c = 1;
  37654. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37655. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37656. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37657. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37658. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37659. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37660. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37661. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37662. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37663. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37664. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37665. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37666. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37667. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37668. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37669. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37670. t0 += c-1 + 37 * (c-1);
  37671. // second car
  37672. c = 1;
  37673. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37674. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37675. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37676. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37677. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37678. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37679. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37680. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37681. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37682. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37683. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37684. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37685. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37686. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37687. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37688. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37689. t0 += c-1 + 37 * (c-1);
  37690. o[ 0] = t0;
  37691. o[ 1] = t1;
  37692. o[ 2] = t2;
  37693. o[ 3] = t3;
  37694. o[ 4] = t4;
  37695. o[ 5] = t5;
  37696. o[ 6] = t6;
  37697. o[ 7] = t7;
  37698. o[ 8] = t8;
  37699. o[ 9] = t9;
  37700. o[10] = t10;
  37701. o[11] = t11;
  37702. o[12] = t12;
  37703. o[13] = t13;
  37704. o[14] = t14;
  37705. o[15] = t15;
  37706. }
  37707. function S(o, a) {
  37708. M(o, a, a);
  37709. }
  37710. function inv25519(o, i) {
  37711. var c = gf();
  37712. var a;
  37713. for (a = 0; a < 16; a++) c[a] = i[a];
  37714. for (a = 253; a >= 0; a--) {
  37715. S(c, c);
  37716. if(a !== 2 && a !== 4) M(c, c, i);
  37717. }
  37718. for (a = 0; a < 16; a++) o[a] = c[a];
  37719. }
  37720. function pow2523(o, i) {
  37721. var c = gf();
  37722. var a;
  37723. for (a = 0; a < 16; a++) c[a] = i[a];
  37724. for (a = 250; a >= 0; a--) {
  37725. S(c, c);
  37726. if(a !== 1) M(c, c, i);
  37727. }
  37728. for (a = 0; a < 16; a++) o[a] = c[a];
  37729. }
  37730. function crypto_scalarmult(q, n, p) {
  37731. var z = new Uint8Array(32);
  37732. var x = new Float64Array(80), r, i;
  37733. var a = gf(), b = gf(), c = gf(),
  37734. d = gf(), e = gf(), f = gf();
  37735. for (i = 0; i < 31; i++) z[i] = n[i];
  37736. z[31]=(n[31]&127)|64;
  37737. z[0]&=248;
  37738. unpack25519(x,p);
  37739. for (i = 0; i < 16; i++) {
  37740. b[i]=x[i];
  37741. d[i]=a[i]=c[i]=0;
  37742. }
  37743. a[0]=d[0]=1;
  37744. for (i=254; i>=0; --i) {
  37745. r=(z[i>>>3]>>>(i&7))&1;
  37746. sel25519(a,b,r);
  37747. sel25519(c,d,r);
  37748. A(e,a,c);
  37749. Z(a,a,c);
  37750. A(c,b,d);
  37751. Z(b,b,d);
  37752. S(d,e);
  37753. S(f,a);
  37754. M(a,c,a);
  37755. M(c,b,e);
  37756. A(e,a,c);
  37757. Z(a,a,c);
  37758. S(b,a);
  37759. Z(c,d,f);
  37760. M(a,c,_121665);
  37761. A(a,a,d);
  37762. M(c,c,a);
  37763. M(a,d,f);
  37764. M(d,b,x);
  37765. S(b,e);
  37766. sel25519(a,b,r);
  37767. sel25519(c,d,r);
  37768. }
  37769. for (i = 0; i < 16; i++) {
  37770. x[i+16]=a[i];
  37771. x[i+32]=c[i];
  37772. x[i+48]=b[i];
  37773. x[i+64]=d[i];
  37774. }
  37775. var x32 = x.subarray(32);
  37776. var x16 = x.subarray(16);
  37777. inv25519(x32,x32);
  37778. M(x16,x16,x32);
  37779. pack25519(q,x16);
  37780. return 0;
  37781. }
  37782. function crypto_scalarmult_base(q, n) {
  37783. return crypto_scalarmult(q, n, _9);
  37784. }
  37785. function crypto_box_keypair(y, x) {
  37786. randombytes(x, 32);
  37787. return crypto_scalarmult_base(y, x);
  37788. }
  37789. function crypto_box_beforenm(k, y, x) {
  37790. var s = new Uint8Array(32);
  37791. crypto_scalarmult(s, x, y);
  37792. return crypto_core_hsalsa20(k, _0, s, sigma);
  37793. }
  37794. var crypto_box_afternm = crypto_secretbox;
  37795. var crypto_box_open_afternm = crypto_secretbox_open;
  37796. function crypto_box(c, m, d, n, y, x) {
  37797. var k = new Uint8Array(32);
  37798. crypto_box_beforenm(k, y, x);
  37799. return crypto_box_afternm(c, m, d, n, k);
  37800. }
  37801. function crypto_box_open(m, c, d, n, y, x) {
  37802. var k = new Uint8Array(32);
  37803. crypto_box_beforenm(k, y, x);
  37804. return crypto_box_open_afternm(m, c, d, n, k);
  37805. }
  37806. var K = [
  37807. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37808. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37809. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37810. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37811. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37812. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37813. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37814. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37815. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37816. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37817. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37818. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37819. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37820. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37821. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37822. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37823. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37824. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37825. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37826. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37827. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37828. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37829. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37830. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37831. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37832. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37833. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37834. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37835. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37836. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37837. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37838. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37839. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37840. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37841. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37842. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37843. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37844. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37845. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37846. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37847. ];
  37848. function crypto_hashblocks_hl(hh, hl, m, n) {
  37849. var wh = new Int32Array(16), wl = new Int32Array(16),
  37850. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37851. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37852. th, tl, i, j, h, l, a, b, c, d;
  37853. var ah0 = hh[0],
  37854. ah1 = hh[1],
  37855. ah2 = hh[2],
  37856. ah3 = hh[3],
  37857. ah4 = hh[4],
  37858. ah5 = hh[5],
  37859. ah6 = hh[6],
  37860. ah7 = hh[7],
  37861. al0 = hl[0],
  37862. al1 = hl[1],
  37863. al2 = hl[2],
  37864. al3 = hl[3],
  37865. al4 = hl[4],
  37866. al5 = hl[5],
  37867. al6 = hl[6],
  37868. al7 = hl[7];
  37869. var pos = 0;
  37870. while (n >= 128) {
  37871. for (i = 0; i < 16; i++) {
  37872. j = 8 * i + pos;
  37873. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37874. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37875. }
  37876. for (i = 0; i < 80; i++) {
  37877. bh0 = ah0;
  37878. bh1 = ah1;
  37879. bh2 = ah2;
  37880. bh3 = ah3;
  37881. bh4 = ah4;
  37882. bh5 = ah5;
  37883. bh6 = ah6;
  37884. bh7 = ah7;
  37885. bl0 = al0;
  37886. bl1 = al1;
  37887. bl2 = al2;
  37888. bl3 = al3;
  37889. bl4 = al4;
  37890. bl5 = al5;
  37891. bl6 = al6;
  37892. bl7 = al7;
  37893. // add
  37894. h = ah7;
  37895. l = al7;
  37896. a = l & 0xffff; b = l >>> 16;
  37897. c = h & 0xffff; d = h >>> 16;
  37898. // Sigma1
  37899. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37900. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37901. a += l & 0xffff; b += l >>> 16;
  37902. c += h & 0xffff; d += h >>> 16;
  37903. // Ch
  37904. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37905. l = (al4 & al5) ^ (~al4 & al6);
  37906. a += l & 0xffff; b += l >>> 16;
  37907. c += h & 0xffff; d += h >>> 16;
  37908. // K
  37909. h = K[i*2];
  37910. l = K[i*2+1];
  37911. a += l & 0xffff; b += l >>> 16;
  37912. c += h & 0xffff; d += h >>> 16;
  37913. // w
  37914. h = wh[i%16];
  37915. l = wl[i%16];
  37916. a += l & 0xffff; b += l >>> 16;
  37917. c += h & 0xffff; d += h >>> 16;
  37918. b += a >>> 16;
  37919. c += b >>> 16;
  37920. d += c >>> 16;
  37921. th = c & 0xffff | d << 16;
  37922. tl = a & 0xffff | b << 16;
  37923. // add
  37924. h = th;
  37925. l = tl;
  37926. a = l & 0xffff; b = l >>> 16;
  37927. c = h & 0xffff; d = h >>> 16;
  37928. // Sigma0
  37929. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37930. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37931. a += l & 0xffff; b += l >>> 16;
  37932. c += h & 0xffff; d += h >>> 16;
  37933. // Maj
  37934. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37935. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37936. a += l & 0xffff; b += l >>> 16;
  37937. c += h & 0xffff; d += h >>> 16;
  37938. b += a >>> 16;
  37939. c += b >>> 16;
  37940. d += c >>> 16;
  37941. bh7 = (c & 0xffff) | (d << 16);
  37942. bl7 = (a & 0xffff) | (b << 16);
  37943. // add
  37944. h = bh3;
  37945. l = bl3;
  37946. a = l & 0xffff; b = l >>> 16;
  37947. c = h & 0xffff; d = h >>> 16;
  37948. h = th;
  37949. l = tl;
  37950. a += l & 0xffff; b += l >>> 16;
  37951. c += h & 0xffff; d += h >>> 16;
  37952. b += a >>> 16;
  37953. c += b >>> 16;
  37954. d += c >>> 16;
  37955. bh3 = (c & 0xffff) | (d << 16);
  37956. bl3 = (a & 0xffff) | (b << 16);
  37957. ah1 = bh0;
  37958. ah2 = bh1;
  37959. ah3 = bh2;
  37960. ah4 = bh3;
  37961. ah5 = bh4;
  37962. ah6 = bh5;
  37963. ah7 = bh6;
  37964. ah0 = bh7;
  37965. al1 = bl0;
  37966. al2 = bl1;
  37967. al3 = bl2;
  37968. al4 = bl3;
  37969. al5 = bl4;
  37970. al6 = bl5;
  37971. al7 = bl6;
  37972. al0 = bl7;
  37973. if (i%16 === 15) {
  37974. for (j = 0; j < 16; j++) {
  37975. // add
  37976. h = wh[j];
  37977. l = wl[j];
  37978. a = l & 0xffff; b = l >>> 16;
  37979. c = h & 0xffff; d = h >>> 16;
  37980. h = wh[(j+9)%16];
  37981. l = wl[(j+9)%16];
  37982. a += l & 0xffff; b += l >>> 16;
  37983. c += h & 0xffff; d += h >>> 16;
  37984. // sigma0
  37985. th = wh[(j+1)%16];
  37986. tl = wl[(j+1)%16];
  37987. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37988. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37989. a += l & 0xffff; b += l >>> 16;
  37990. c += h & 0xffff; d += h >>> 16;
  37991. // sigma1
  37992. th = wh[(j+14)%16];
  37993. tl = wl[(j+14)%16];
  37994. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  37995. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  37996. a += l & 0xffff; b += l >>> 16;
  37997. c += h & 0xffff; d += h >>> 16;
  37998. b += a >>> 16;
  37999. c += b >>> 16;
  38000. d += c >>> 16;
  38001. wh[j] = (c & 0xffff) | (d << 16);
  38002. wl[j] = (a & 0xffff) | (b << 16);
  38003. }
  38004. }
  38005. }
  38006. // add
  38007. h = ah0;
  38008. l = al0;
  38009. a = l & 0xffff; b = l >>> 16;
  38010. c = h & 0xffff; d = h >>> 16;
  38011. h = hh[0];
  38012. l = hl[0];
  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[0] = ah0 = (c & 0xffff) | (d << 16);
  38019. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38020. h = ah1;
  38021. l = al1;
  38022. a = l & 0xffff; b = l >>> 16;
  38023. c = h & 0xffff; d = h >>> 16;
  38024. h = hh[1];
  38025. l = hl[1];
  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[1] = ah1 = (c & 0xffff) | (d << 16);
  38032. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38033. h = ah2;
  38034. l = al2;
  38035. a = l & 0xffff; b = l >>> 16;
  38036. c = h & 0xffff; d = h >>> 16;
  38037. h = hh[2];
  38038. l = hl[2];
  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[2] = ah2 = (c & 0xffff) | (d << 16);
  38045. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38046. h = ah3;
  38047. l = al3;
  38048. a = l & 0xffff; b = l >>> 16;
  38049. c = h & 0xffff; d = h >>> 16;
  38050. h = hh[3];
  38051. l = hl[3];
  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[3] = ah3 = (c & 0xffff) | (d << 16);
  38058. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38059. h = ah4;
  38060. l = al4;
  38061. a = l & 0xffff; b = l >>> 16;
  38062. c = h & 0xffff; d = h >>> 16;
  38063. h = hh[4];
  38064. l = hl[4];
  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[4] = ah4 = (c & 0xffff) | (d << 16);
  38071. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38072. h = ah5;
  38073. l = al5;
  38074. a = l & 0xffff; b = l >>> 16;
  38075. c = h & 0xffff; d = h >>> 16;
  38076. h = hh[5];
  38077. l = hl[5];
  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[5] = ah5 = (c & 0xffff) | (d << 16);
  38084. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38085. h = ah6;
  38086. l = al6;
  38087. a = l & 0xffff; b = l >>> 16;
  38088. c = h & 0xffff; d = h >>> 16;
  38089. h = hh[6];
  38090. l = hl[6];
  38091. a += l & 0xffff; b += l >>> 16;
  38092. c += h & 0xffff; d += h >>> 16;
  38093. b += a >>> 16;
  38094. c += b >>> 16;
  38095. d += c >>> 16;
  38096. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38097. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38098. h = ah7;
  38099. l = al7;
  38100. a = l & 0xffff; b = l >>> 16;
  38101. c = h & 0xffff; d = h >>> 16;
  38102. h = hh[7];
  38103. l = hl[7];
  38104. a += l & 0xffff; b += l >>> 16;
  38105. c += h & 0xffff; d += h >>> 16;
  38106. b += a >>> 16;
  38107. c += b >>> 16;
  38108. d += c >>> 16;
  38109. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38110. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38111. pos += 128;
  38112. n -= 128;
  38113. }
  38114. return n;
  38115. }
  38116. function crypto_hash(out, m, n) {
  38117. var hh = new Int32Array(8),
  38118. hl = new Int32Array(8),
  38119. x = new Uint8Array(256),
  38120. i, b = n;
  38121. hh[0] = 0x6a09e667;
  38122. hh[1] = 0xbb67ae85;
  38123. hh[2] = 0x3c6ef372;
  38124. hh[3] = 0xa54ff53a;
  38125. hh[4] = 0x510e527f;
  38126. hh[5] = 0x9b05688c;
  38127. hh[6] = 0x1f83d9ab;
  38128. hh[7] = 0x5be0cd19;
  38129. hl[0] = 0xf3bcc908;
  38130. hl[1] = 0x84caa73b;
  38131. hl[2] = 0xfe94f82b;
  38132. hl[3] = 0x5f1d36f1;
  38133. hl[4] = 0xade682d1;
  38134. hl[5] = 0x2b3e6c1f;
  38135. hl[6] = 0xfb41bd6b;
  38136. hl[7] = 0x137e2179;
  38137. crypto_hashblocks_hl(hh, hl, m, n);
  38138. n %= 128;
  38139. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38140. x[n] = 128;
  38141. n = 256-128*(n<112?1:0);
  38142. x[n-9] = 0;
  38143. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38144. crypto_hashblocks_hl(hh, hl, x, n);
  38145. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38146. return 0;
  38147. }
  38148. function add(p, q) {
  38149. var a = gf(), b = gf(), c = gf(),
  38150. d = gf(), e = gf(), f = gf(),
  38151. g = gf(), h = gf(), t = gf();
  38152. Z(a, p[1], p[0]);
  38153. Z(t, q[1], q[0]);
  38154. M(a, a, t);
  38155. A(b, p[0], p[1]);
  38156. A(t, q[0], q[1]);
  38157. M(b, b, t);
  38158. M(c, p[3], q[3]);
  38159. M(c, c, D2);
  38160. M(d, p[2], q[2]);
  38161. A(d, d, d);
  38162. Z(e, b, a);
  38163. Z(f, d, c);
  38164. A(g, d, c);
  38165. A(h, b, a);
  38166. M(p[0], e, f);
  38167. M(p[1], h, g);
  38168. M(p[2], g, f);
  38169. M(p[3], e, h);
  38170. }
  38171. function cswap(p, q, b) {
  38172. var i;
  38173. for (i = 0; i < 4; i++) {
  38174. sel25519(p[i], q[i], b);
  38175. }
  38176. }
  38177. function pack(r, p) {
  38178. var tx = gf(), ty = gf(), zi = gf();
  38179. inv25519(zi, p[2]);
  38180. M(tx, p[0], zi);
  38181. M(ty, p[1], zi);
  38182. pack25519(r, ty);
  38183. r[31] ^= par25519(tx) << 7;
  38184. }
  38185. function scalarmult(p, q, s) {
  38186. var b, i;
  38187. set25519(p[0], gf0);
  38188. set25519(p[1], gf1);
  38189. set25519(p[2], gf1);
  38190. set25519(p[3], gf0);
  38191. for (i = 255; i >= 0; --i) {
  38192. b = (s[(i/8)|0] >> (i&7)) & 1;
  38193. cswap(p, q, b);
  38194. add(q, p);
  38195. add(p, p);
  38196. cswap(p, q, b);
  38197. }
  38198. }
  38199. function scalarbase(p, s) {
  38200. var q = [gf(), gf(), gf(), gf()];
  38201. set25519(q[0], X);
  38202. set25519(q[1], Y);
  38203. set25519(q[2], gf1);
  38204. M(q[3], X, Y);
  38205. scalarmult(p, q, s);
  38206. }
  38207. function crypto_sign_keypair(pk, sk, seeded) {
  38208. var d = new Uint8Array(64);
  38209. var p = [gf(), gf(), gf(), gf()];
  38210. var i;
  38211. if (!seeded) randombytes(sk, 32);
  38212. crypto_hash(d, sk, 32);
  38213. d[0] &= 248;
  38214. d[31] &= 127;
  38215. d[31] |= 64;
  38216. scalarbase(p, d);
  38217. pack(pk, p);
  38218. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38219. return 0;
  38220. }
  38221. 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]);
  38222. function modL(r, x) {
  38223. var carry, i, j, k;
  38224. for (i = 63; i >= 32; --i) {
  38225. carry = 0;
  38226. for (j = i - 32, k = i - 12; j < k; ++j) {
  38227. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38228. carry = (x[j] + 128) >> 8;
  38229. x[j] -= carry * 256;
  38230. }
  38231. x[j] += carry;
  38232. x[i] = 0;
  38233. }
  38234. carry = 0;
  38235. for (j = 0; j < 32; j++) {
  38236. x[j] += carry - (x[31] >> 4) * L[j];
  38237. carry = x[j] >> 8;
  38238. x[j] &= 255;
  38239. }
  38240. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38241. for (i = 0; i < 32; i++) {
  38242. x[i+1] += x[i] >> 8;
  38243. r[i] = x[i] & 255;
  38244. }
  38245. }
  38246. function reduce(r) {
  38247. var x = new Float64Array(64), i;
  38248. for (i = 0; i < 64; i++) x[i] = r[i];
  38249. for (i = 0; i < 64; i++) r[i] = 0;
  38250. modL(r, x);
  38251. }
  38252. // Note: difference from C - smlen returned, not passed as argument.
  38253. function crypto_sign(sm, m, n, sk) {
  38254. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38255. var i, j, x = new Float64Array(64);
  38256. var p = [gf(), gf(), gf(), gf()];
  38257. crypto_hash(d, sk, 32);
  38258. d[0] &= 248;
  38259. d[31] &= 127;
  38260. d[31] |= 64;
  38261. var smlen = n + 64;
  38262. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38263. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38264. crypto_hash(r, sm.subarray(32), n+32);
  38265. reduce(r);
  38266. scalarbase(p, r);
  38267. pack(sm, p);
  38268. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38269. crypto_hash(h, sm, n + 64);
  38270. reduce(h);
  38271. for (i = 0; i < 64; i++) x[i] = 0;
  38272. for (i = 0; i < 32; i++) x[i] = r[i];
  38273. for (i = 0; i < 32; i++) {
  38274. for (j = 0; j < 32; j++) {
  38275. x[i+j] += h[i] * d[j];
  38276. }
  38277. }
  38278. modL(sm.subarray(32), x);
  38279. return smlen;
  38280. }
  38281. function unpackneg(r, p) {
  38282. var t = gf(), chk = gf(), num = gf(),
  38283. den = gf(), den2 = gf(), den4 = gf(),
  38284. den6 = gf();
  38285. set25519(r[2], gf1);
  38286. unpack25519(r[1], p);
  38287. S(num, r[1]);
  38288. M(den, num, D);
  38289. Z(num, num, r[2]);
  38290. A(den, r[2], den);
  38291. S(den2, den);
  38292. S(den4, den2);
  38293. M(den6, den4, den2);
  38294. M(t, den6, num);
  38295. M(t, t, den);
  38296. pow2523(t, t);
  38297. M(t, t, num);
  38298. M(t, t, den);
  38299. M(t, t, den);
  38300. M(r[0], t, den);
  38301. S(chk, r[0]);
  38302. M(chk, chk, den);
  38303. if (neq25519(chk, num)) M(r[0], r[0], I);
  38304. S(chk, r[0]);
  38305. M(chk, chk, den);
  38306. if (neq25519(chk, num)) return -1;
  38307. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38308. M(r[3], r[0], r[1]);
  38309. return 0;
  38310. }
  38311. function crypto_sign_open(m, sm, n, pk) {
  38312. var i, mlen;
  38313. var t = new Uint8Array(32), h = new Uint8Array(64);
  38314. var p = [gf(), gf(), gf(), gf()],
  38315. q = [gf(), gf(), gf(), gf()];
  38316. mlen = -1;
  38317. if (n < 64) return -1;
  38318. if (unpackneg(q, pk)) return -1;
  38319. for (i = 0; i < n; i++) m[i] = sm[i];
  38320. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38321. crypto_hash(h, m, n);
  38322. reduce(h);
  38323. scalarmult(p, q, h);
  38324. scalarbase(q, sm.subarray(32));
  38325. add(p, q);
  38326. pack(t, p);
  38327. n -= 64;
  38328. if (crypto_verify_32(sm, 0, t, 0)) {
  38329. for (i = 0; i < n; i++) m[i] = 0;
  38330. return -1;
  38331. }
  38332. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38333. mlen = n;
  38334. return mlen;
  38335. }
  38336. var crypto_secretbox_KEYBYTES = 32,
  38337. crypto_secretbox_NONCEBYTES = 24,
  38338. crypto_secretbox_ZEROBYTES = 32,
  38339. crypto_secretbox_BOXZEROBYTES = 16,
  38340. crypto_scalarmult_BYTES = 32,
  38341. crypto_scalarmult_SCALARBYTES = 32,
  38342. crypto_box_PUBLICKEYBYTES = 32,
  38343. crypto_box_SECRETKEYBYTES = 32,
  38344. crypto_box_BEFORENMBYTES = 32,
  38345. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38346. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38347. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38348. crypto_sign_BYTES = 64,
  38349. crypto_sign_PUBLICKEYBYTES = 32,
  38350. crypto_sign_SECRETKEYBYTES = 64,
  38351. crypto_sign_SEEDBYTES = 32,
  38352. crypto_hash_BYTES = 64;
  38353. nacl.lowlevel = {
  38354. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38355. crypto_stream_xor: crypto_stream_xor,
  38356. crypto_stream: crypto_stream,
  38357. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38358. crypto_stream_salsa20: crypto_stream_salsa20,
  38359. crypto_onetimeauth: crypto_onetimeauth,
  38360. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38361. crypto_verify_16: crypto_verify_16,
  38362. crypto_verify_32: crypto_verify_32,
  38363. crypto_secretbox: crypto_secretbox,
  38364. crypto_secretbox_open: crypto_secretbox_open,
  38365. crypto_scalarmult: crypto_scalarmult,
  38366. crypto_scalarmult_base: crypto_scalarmult_base,
  38367. crypto_box_beforenm: crypto_box_beforenm,
  38368. crypto_box_afternm: crypto_box_afternm,
  38369. crypto_box: crypto_box,
  38370. crypto_box_open: crypto_box_open,
  38371. crypto_box_keypair: crypto_box_keypair,
  38372. crypto_hash: crypto_hash,
  38373. crypto_sign: crypto_sign,
  38374. crypto_sign_keypair: crypto_sign_keypair,
  38375. crypto_sign_open: crypto_sign_open,
  38376. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38377. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38378. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38379. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38380. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38381. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38382. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38383. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38384. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38385. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38386. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38387. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38388. crypto_sign_BYTES: crypto_sign_BYTES,
  38389. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38390. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38391. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38392. crypto_hash_BYTES: crypto_hash_BYTES
  38393. };
  38394. /* High-level API */
  38395. function checkLengths(k, n) {
  38396. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38397. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38398. }
  38399. function checkBoxLengths(pk, sk) {
  38400. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38401. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38402. }
  38403. function checkArrayTypes() {
  38404. for (var i = 0; i < arguments.length; i++) {
  38405. if (!(arguments[i] instanceof Uint8Array))
  38406. throw new TypeError('unexpected type, use Uint8Array');
  38407. }
  38408. }
  38409. function cleanup(arr) {
  38410. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38411. }
  38412. nacl.randomBytes = function(n) {
  38413. var b = new Uint8Array(n);
  38414. randombytes(b, n);
  38415. return b;
  38416. };
  38417. nacl.secretbox = function(msg, nonce, key) {
  38418. checkArrayTypes(msg, nonce, key);
  38419. checkLengths(key, nonce);
  38420. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38421. var c = new Uint8Array(m.length);
  38422. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38423. crypto_secretbox(c, m, m.length, nonce, key);
  38424. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38425. };
  38426. nacl.secretbox.open = function(box, nonce, key) {
  38427. checkArrayTypes(box, nonce, key);
  38428. checkLengths(key, nonce);
  38429. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38430. var m = new Uint8Array(c.length);
  38431. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38432. if (c.length < 32) return null;
  38433. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38434. return m.subarray(crypto_secretbox_ZEROBYTES);
  38435. };
  38436. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38437. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38438. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38439. nacl.scalarMult = function(n, p) {
  38440. checkArrayTypes(n, p);
  38441. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38442. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38443. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38444. crypto_scalarmult(q, n, p);
  38445. return q;
  38446. };
  38447. nacl.scalarMult.base = function(n) {
  38448. checkArrayTypes(n);
  38449. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38450. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38451. crypto_scalarmult_base(q, n);
  38452. return q;
  38453. };
  38454. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38455. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38456. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38457. var k = nacl.box.before(publicKey, secretKey);
  38458. return nacl.secretbox(msg, nonce, k);
  38459. };
  38460. nacl.box.before = function(publicKey, secretKey) {
  38461. checkArrayTypes(publicKey, secretKey);
  38462. checkBoxLengths(publicKey, secretKey);
  38463. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38464. crypto_box_beforenm(k, publicKey, secretKey);
  38465. return k;
  38466. };
  38467. nacl.box.after = nacl.secretbox;
  38468. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38469. var k = nacl.box.before(publicKey, secretKey);
  38470. return nacl.secretbox.open(msg, nonce, k);
  38471. };
  38472. nacl.box.open.after = nacl.secretbox.open;
  38473. nacl.box.keyPair = function() {
  38474. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38475. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38476. crypto_box_keypair(pk, sk);
  38477. return {publicKey: pk, secretKey: sk};
  38478. };
  38479. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38480. checkArrayTypes(secretKey);
  38481. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38482. throw new Error('bad secret key size');
  38483. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38484. crypto_scalarmult_base(pk, secretKey);
  38485. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38486. };
  38487. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38488. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38489. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38490. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38491. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38492. nacl.sign = function(msg, secretKey) {
  38493. checkArrayTypes(msg, secretKey);
  38494. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38495. throw new Error('bad secret key size');
  38496. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38497. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38498. return signedMsg;
  38499. };
  38500. nacl.sign.open = function(signedMsg, publicKey) {
  38501. checkArrayTypes(signedMsg, publicKey);
  38502. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38503. throw new Error('bad public key size');
  38504. var tmp = new Uint8Array(signedMsg.length);
  38505. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38506. if (mlen < 0) return null;
  38507. var m = new Uint8Array(mlen);
  38508. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38509. return m;
  38510. };
  38511. nacl.sign.detached = function(msg, secretKey) {
  38512. var signedMsg = nacl.sign(msg, secretKey);
  38513. var sig = new Uint8Array(crypto_sign_BYTES);
  38514. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38515. return sig;
  38516. };
  38517. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38518. checkArrayTypes(msg, sig, publicKey);
  38519. if (sig.length !== crypto_sign_BYTES)
  38520. throw new Error('bad signature size');
  38521. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38522. throw new Error('bad public key size');
  38523. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38524. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38525. var i;
  38526. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38527. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38528. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38529. };
  38530. nacl.sign.keyPair = function() {
  38531. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38532. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38533. crypto_sign_keypair(pk, sk);
  38534. return {publicKey: pk, secretKey: sk};
  38535. };
  38536. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38537. checkArrayTypes(secretKey);
  38538. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38539. throw new Error('bad secret key size');
  38540. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38541. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38542. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38543. };
  38544. nacl.sign.keyPair.fromSeed = function(seed) {
  38545. checkArrayTypes(seed);
  38546. if (seed.length !== crypto_sign_SEEDBYTES)
  38547. throw new Error('bad seed size');
  38548. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38549. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38550. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38551. crypto_sign_keypair(pk, sk, true);
  38552. return {publicKey: pk, secretKey: sk};
  38553. };
  38554. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38555. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38556. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38557. nacl.sign.signatureLength = crypto_sign_BYTES;
  38558. nacl.hash = function(msg) {
  38559. checkArrayTypes(msg);
  38560. var h = new Uint8Array(crypto_hash_BYTES);
  38561. crypto_hash(h, msg, msg.length);
  38562. return h;
  38563. };
  38564. nacl.hash.hashLength = crypto_hash_BYTES;
  38565. nacl.verify = function(x, y) {
  38566. checkArrayTypes(x, y);
  38567. // Zero length arguments are considered not equal.
  38568. if (x.length === 0 || y.length === 0) return false;
  38569. if (x.length !== y.length) return false;
  38570. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38571. };
  38572. nacl.setPRNG = function(fn) {
  38573. randombytes = fn;
  38574. };
  38575. (function() {
  38576. // Initialize PRNG if environment provides CSPRNG.
  38577. // If not, methods calling randombytes will throw.
  38578. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38579. if (crypto && crypto.getRandomValues) {
  38580. // Browsers.
  38581. var QUOTA = 65536;
  38582. nacl.setPRNG(function(x, n) {
  38583. var i, v = new Uint8Array(n);
  38584. for (i = 0; i < n; i += QUOTA) {
  38585. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38586. }
  38587. for (i = 0; i < n; i++) x[i] = v[i];
  38588. cleanup(v);
  38589. });
  38590. } else if (true) {
  38591. // Node.js.
  38592. crypto = __webpack_require__(3);
  38593. if (crypto && crypto.randomBytes) {
  38594. nacl.setPRNG(function(x, n) {
  38595. var i, v = crypto.randomBytes(n);
  38596. for (i = 0; i < n; i++) x[i] = v[i];
  38597. cleanup(v);
  38598. });
  38599. }
  38600. }
  38601. })();
  38602. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38603. /***/ }),
  38604. /* 1 */
  38605. /***/ (function(module, exports, __webpack_require__) {
  38606. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38607. // Public domain.
  38608. (function(root, f) {
  38609. 'use strict';
  38610. if ( true && module.exports) module.exports = f();
  38611. else if (root.nacl) root.nacl.util = f();
  38612. else {
  38613. root.nacl = {};
  38614. root.nacl.util = f();
  38615. }
  38616. }(this, function() {
  38617. 'use strict';
  38618. var util = {};
  38619. function validateBase64(s) {
  38620. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38621. throw new TypeError('invalid encoding');
  38622. }
  38623. }
  38624. util.decodeUTF8 = function(s) {
  38625. if (typeof s !== 'string') throw new TypeError('expected string');
  38626. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38627. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38628. return b;
  38629. };
  38630. util.encodeUTF8 = function(arr) {
  38631. var i, s = [];
  38632. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38633. return decodeURIComponent(escape(s.join('')));
  38634. };
  38635. if (typeof atob === 'undefined') {
  38636. // Node.js
  38637. if (typeof Buffer.from !== 'undefined') {
  38638. // Node v6 and later
  38639. util.encodeBase64 = function (arr) { // v6 and later
  38640. return Buffer.from(arr).toString('base64');
  38641. };
  38642. util.decodeBase64 = function (s) {
  38643. validateBase64(s);
  38644. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38645. };
  38646. } else {
  38647. // Node earlier than v6
  38648. util.encodeBase64 = function (arr) { // v6 and later
  38649. return (new Buffer(arr)).toString('base64');
  38650. };
  38651. util.decodeBase64 = function(s) {
  38652. validateBase64(s);
  38653. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38654. };
  38655. }
  38656. } else {
  38657. // Browsers
  38658. util.encodeBase64 = function(arr) {
  38659. var i, s = [], len = arr.length;
  38660. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38661. return btoa(s.join(''));
  38662. };
  38663. util.decodeBase64 = function(s) {
  38664. validateBase64(s);
  38665. var i, d = atob(s), b = new Uint8Array(d.length);
  38666. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38667. return b;
  38668. };
  38669. }
  38670. return util;
  38671. }));
  38672. /***/ }),
  38673. /* 2 */
  38674. /***/ (function(module, exports, __webpack_require__) {
  38675. // required so we don't have to do require('pusher').default etc.
  38676. module.exports = __webpack_require__(4).default;
  38677. /***/ }),
  38678. /* 3 */
  38679. /***/ (function(module, exports) {
  38680. /* (ignored) */
  38681. /***/ }),
  38682. /* 4 */
  38683. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38684. "use strict";
  38685. __webpack_require__.r(__webpack_exports__);
  38686. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38687. var ScriptReceiverFactory = (function () {
  38688. function ScriptReceiverFactory(prefix, name) {
  38689. this.lastId = 0;
  38690. this.prefix = prefix;
  38691. this.name = name;
  38692. }
  38693. ScriptReceiverFactory.prototype.create = function (callback) {
  38694. this.lastId++;
  38695. var number = this.lastId;
  38696. var id = this.prefix + number;
  38697. var name = this.name + "[" + number + "]";
  38698. var called = false;
  38699. var callbackWrapper = function () {
  38700. if (!called) {
  38701. callback.apply(null, arguments);
  38702. called = true;
  38703. }
  38704. };
  38705. this[number] = callbackWrapper;
  38706. return { number: number, id: id, name: name, callback: callbackWrapper };
  38707. };
  38708. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38709. delete this[receiver.number];
  38710. };
  38711. return ScriptReceiverFactory;
  38712. }());
  38713. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38714. // CONCATENATED MODULE: ./src/core/defaults.ts
  38715. var Defaults = {
  38716. VERSION: "5.0.3",
  38717. PROTOCOL: 7,
  38718. host: 'ws.pusherapp.com',
  38719. ws_port: 80,
  38720. wss_port: 443,
  38721. ws_path: '',
  38722. sockjs_host: 'sockjs.pusher.com',
  38723. sockjs_http_port: 80,
  38724. sockjs_https_port: 443,
  38725. sockjs_path: '/pusher',
  38726. stats_host: 'stats.pusher.com',
  38727. channel_auth_endpoint: '/pusher/auth',
  38728. channel_auth_transport: 'ajax',
  38729. activity_timeout: 120000,
  38730. pong_timeout: 30000,
  38731. unavailable_timeout: 10000,
  38732. cdn_http: "http://js.pusher.com",
  38733. cdn_https: "https://js.pusher.com",
  38734. dependency_suffix: ""
  38735. };
  38736. /* harmony default export */ var defaults = (Defaults);
  38737. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38738. var dependency_loader_DependencyLoader = (function () {
  38739. function DependencyLoader(options) {
  38740. this.options = options;
  38741. this.receivers = options.receivers || ScriptReceivers;
  38742. this.loading = {};
  38743. }
  38744. DependencyLoader.prototype.load = function (name, options, callback) {
  38745. var self = this;
  38746. if (self.loading[name] && self.loading[name].length > 0) {
  38747. self.loading[name].push(callback);
  38748. }
  38749. else {
  38750. self.loading[name] = [callback];
  38751. var request = runtime.createScriptRequest(self.getPath(name, options));
  38752. var receiver = self.receivers.create(function (error) {
  38753. self.receivers.remove(receiver);
  38754. if (self.loading[name]) {
  38755. var callbacks = self.loading[name];
  38756. delete self.loading[name];
  38757. var successCallback = function (wasSuccessful) {
  38758. if (!wasSuccessful) {
  38759. request.cleanup();
  38760. }
  38761. };
  38762. for (var i = 0; i < callbacks.length; i++) {
  38763. callbacks[i](error, successCallback);
  38764. }
  38765. }
  38766. });
  38767. request.send(receiver);
  38768. }
  38769. };
  38770. DependencyLoader.prototype.getRoot = function (options) {
  38771. var cdn;
  38772. var protocol = runtime.getDocument().location.protocol;
  38773. if ((options && options.useTLS) || protocol === "https:") {
  38774. cdn = this.options.cdn_https;
  38775. }
  38776. else {
  38777. cdn = this.options.cdn_http;
  38778. }
  38779. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38780. };
  38781. DependencyLoader.prototype.getPath = function (name, options) {
  38782. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38783. };
  38784. ;
  38785. return DependencyLoader;
  38786. }());
  38787. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38788. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38789. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38790. var Dependencies = new dependency_loader({
  38791. cdn_http: defaults.cdn_http,
  38792. cdn_https: defaults.cdn_https,
  38793. version: defaults.VERSION,
  38794. suffix: defaults.dependency_suffix,
  38795. receivers: DependenciesReceivers
  38796. });
  38797. // CONCATENATED MODULE: ./src/core/base64.ts
  38798. function encode(s) {
  38799. return btoa(utob(s));
  38800. }
  38801. var fromCharCode = String.fromCharCode;
  38802. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38803. var b64tab = {};
  38804. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38805. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38806. }
  38807. var cb_utob = function (c) {
  38808. var cc = c.charCodeAt(0);
  38809. return cc < 0x80
  38810. ? c
  38811. : cc < 0x800
  38812. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38813. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38814. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38815. fromCharCode(0x80 | (cc & 0x3f));
  38816. };
  38817. var utob = function (u) {
  38818. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38819. };
  38820. var cb_encode = function (ccc) {
  38821. var padlen = [0, 2, 1][ccc.length % 3];
  38822. var ord = (ccc.charCodeAt(0) << 16) |
  38823. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38824. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38825. var chars = [
  38826. b64chars.charAt(ord >>> 18),
  38827. b64chars.charAt((ord >>> 12) & 63),
  38828. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38829. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38830. ];
  38831. return chars.join('');
  38832. };
  38833. var btoa = window.btoa ||
  38834. function (b) {
  38835. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38836. };
  38837. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38838. var Timer = (function () {
  38839. function Timer(set, clear, delay, callback) {
  38840. var _this = this;
  38841. this.clear = clear;
  38842. this.timer = set(function () {
  38843. if (_this.timer) {
  38844. _this.timer = callback(_this.timer);
  38845. }
  38846. }, delay);
  38847. }
  38848. Timer.prototype.isRunning = function () {
  38849. return this.timer !== null;
  38850. };
  38851. Timer.prototype.ensureAborted = function () {
  38852. if (this.timer) {
  38853. this.clear(this.timer);
  38854. this.timer = null;
  38855. }
  38856. };
  38857. return Timer;
  38858. }());
  38859. /* harmony default export */ var abstract_timer = (Timer);
  38860. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38861. var __extends = (undefined && undefined.__extends) || (function () {
  38862. var extendStatics = function (d, b) {
  38863. extendStatics = Object.setPrototypeOf ||
  38864. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38865. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38866. return extendStatics(d, b);
  38867. };
  38868. return function (d, b) {
  38869. extendStatics(d, b);
  38870. function __() { this.constructor = d; }
  38871. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38872. };
  38873. })();
  38874. function timers_clearTimeout(timer) {
  38875. window.clearTimeout(timer);
  38876. }
  38877. function timers_clearInterval(timer) {
  38878. window.clearInterval(timer);
  38879. }
  38880. var OneOffTimer = (function (_super) {
  38881. __extends(OneOffTimer, _super);
  38882. function OneOffTimer(delay, callback) {
  38883. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38884. callback();
  38885. return null;
  38886. }) || this;
  38887. }
  38888. return OneOffTimer;
  38889. }(abstract_timer));
  38890. var PeriodicTimer = (function (_super) {
  38891. __extends(PeriodicTimer, _super);
  38892. function PeriodicTimer(delay, callback) {
  38893. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38894. callback();
  38895. return timer;
  38896. }) || this;
  38897. }
  38898. return PeriodicTimer;
  38899. }(abstract_timer));
  38900. // CONCATENATED MODULE: ./src/core/util.ts
  38901. var Util = {
  38902. now: function () {
  38903. if (Date.now) {
  38904. return Date.now();
  38905. }
  38906. else {
  38907. return new Date().valueOf();
  38908. }
  38909. },
  38910. defer: function (callback) {
  38911. return new OneOffTimer(0, callback);
  38912. },
  38913. method: function (name) {
  38914. var args = [];
  38915. for (var _i = 1; _i < arguments.length; _i++) {
  38916. args[_i - 1] = arguments[_i];
  38917. }
  38918. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38919. return function (object) {
  38920. return object[name].apply(object, boundArguments.concat(arguments));
  38921. };
  38922. }
  38923. };
  38924. /* harmony default export */ var util = (Util);
  38925. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38926. function extend(target) {
  38927. var sources = [];
  38928. for (var _i = 1; _i < arguments.length; _i++) {
  38929. sources[_i - 1] = arguments[_i];
  38930. }
  38931. for (var i = 0; i < sources.length; i++) {
  38932. var extensions = sources[i];
  38933. for (var property in extensions) {
  38934. if (extensions[property] && extensions[property].constructor &&
  38935. extensions[property].constructor === Object) {
  38936. target[property] = extend(target[property] || {}, extensions[property]);
  38937. }
  38938. else {
  38939. target[property] = extensions[property];
  38940. }
  38941. }
  38942. }
  38943. return target;
  38944. }
  38945. function stringify() {
  38946. var m = ["Pusher"];
  38947. for (var i = 0; i < arguments.length; i++) {
  38948. if (typeof arguments[i] === "string") {
  38949. m.push(arguments[i]);
  38950. }
  38951. else {
  38952. m.push(safeJSONStringify(arguments[i]));
  38953. }
  38954. }
  38955. return m.join(" : ");
  38956. }
  38957. function arrayIndexOf(array, item) {
  38958. var nativeIndexOf = Array.prototype.indexOf;
  38959. if (array === null) {
  38960. return -1;
  38961. }
  38962. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38963. return array.indexOf(item);
  38964. }
  38965. for (var i = 0, l = array.length; i < l; i++) {
  38966. if (array[i] === item) {
  38967. return i;
  38968. }
  38969. }
  38970. return -1;
  38971. }
  38972. function objectApply(object, f) {
  38973. for (var key in object) {
  38974. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38975. f(object[key], key, object);
  38976. }
  38977. }
  38978. }
  38979. function keys(object) {
  38980. var keys = [];
  38981. objectApply(object, function (_, key) {
  38982. keys.push(key);
  38983. });
  38984. return keys;
  38985. }
  38986. function values(object) {
  38987. var values = [];
  38988. objectApply(object, function (value) {
  38989. values.push(value);
  38990. });
  38991. return values;
  38992. }
  38993. function apply(array, f, context) {
  38994. for (var i = 0; i < array.length; i++) {
  38995. f.call(context || window, array[i], i, array);
  38996. }
  38997. }
  38998. function map(array, f) {
  38999. var result = [];
  39000. for (var i = 0; i < array.length; i++) {
  39001. result.push(f(array[i], i, array, result));
  39002. }
  39003. return result;
  39004. }
  39005. function mapObject(object, f) {
  39006. var result = {};
  39007. objectApply(object, function (value, key) {
  39008. result[key] = f(value);
  39009. });
  39010. return result;
  39011. }
  39012. function filter(array, test) {
  39013. test = test || function (value) { return !!value; };
  39014. var result = [];
  39015. for (var i = 0; i < array.length; i++) {
  39016. if (test(array[i], i, array, result)) {
  39017. result.push(array[i]);
  39018. }
  39019. }
  39020. return result;
  39021. }
  39022. function filterObject(object, test) {
  39023. var result = {};
  39024. objectApply(object, function (value, key) {
  39025. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39026. result[key] = value;
  39027. }
  39028. });
  39029. return result;
  39030. }
  39031. function flatten(object) {
  39032. var result = [];
  39033. objectApply(object, function (value, key) {
  39034. result.push([key, value]);
  39035. });
  39036. return result;
  39037. }
  39038. function any(array, test) {
  39039. for (var i = 0; i < array.length; i++) {
  39040. if (test(array[i], i, array)) {
  39041. return true;
  39042. }
  39043. }
  39044. return false;
  39045. }
  39046. function collections_all(array, test) {
  39047. for (var i = 0; i < array.length; i++) {
  39048. if (!test(array[i], i, array)) {
  39049. return false;
  39050. }
  39051. }
  39052. return true;
  39053. }
  39054. function encodeParamsObject(data) {
  39055. return mapObject(data, function (value) {
  39056. if (typeof value === "object") {
  39057. value = safeJSONStringify(value);
  39058. }
  39059. return encodeURIComponent(encode(value.toString()));
  39060. });
  39061. }
  39062. function buildQueryString(data) {
  39063. var params = filterObject(data, function (value) {
  39064. return value !== undefined;
  39065. });
  39066. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39067. return query;
  39068. }
  39069. function decycleObject(object) {
  39070. var objects = [], paths = [];
  39071. return (function derez(value, path) {
  39072. var i, name, nu;
  39073. switch (typeof value) {
  39074. case 'object':
  39075. if (!value) {
  39076. return null;
  39077. }
  39078. for (i = 0; i < objects.length; i += 1) {
  39079. if (objects[i] === value) {
  39080. return { $ref: paths[i] };
  39081. }
  39082. }
  39083. objects.push(value);
  39084. paths.push(path);
  39085. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39086. nu = [];
  39087. for (i = 0; i < value.length; i += 1) {
  39088. nu[i] = derez(value[i], path + '[' + i + ']');
  39089. }
  39090. }
  39091. else {
  39092. nu = {};
  39093. for (name in value) {
  39094. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39095. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39096. }
  39097. }
  39098. }
  39099. return nu;
  39100. case 'number':
  39101. case 'string':
  39102. case 'boolean':
  39103. return value;
  39104. }
  39105. }(object, '$'));
  39106. }
  39107. function safeJSONStringify(source) {
  39108. try {
  39109. return JSON.stringify(source);
  39110. }
  39111. catch (e) {
  39112. return JSON.stringify(decycleObject(source));
  39113. }
  39114. }
  39115. // CONCATENATED MODULE: ./src/core/logger.ts
  39116. var logger_Logger = (function () {
  39117. function Logger() {
  39118. this.globalLog = function (message) {
  39119. if (window.console && window.console.log) {
  39120. window.console.log(message);
  39121. }
  39122. };
  39123. }
  39124. Logger.prototype.debug = function () {
  39125. var args = [];
  39126. for (var _i = 0; _i < arguments.length; _i++) {
  39127. args[_i] = arguments[_i];
  39128. }
  39129. this.log(this.globalLog, args);
  39130. };
  39131. Logger.prototype.warn = function () {
  39132. var args = [];
  39133. for (var _i = 0; _i < arguments.length; _i++) {
  39134. args[_i] = arguments[_i];
  39135. }
  39136. this.log(this.globalLogWarn, args);
  39137. };
  39138. Logger.prototype.error = function () {
  39139. var args = [];
  39140. for (var _i = 0; _i < arguments.length; _i++) {
  39141. args[_i] = arguments[_i];
  39142. }
  39143. this.log(this.globalLogError, args);
  39144. };
  39145. Logger.prototype.globalLogWarn = function (message) {
  39146. if (window.console && window.console.warn) {
  39147. window.console.warn(message);
  39148. }
  39149. else {
  39150. this.globalLog(message);
  39151. }
  39152. };
  39153. Logger.prototype.globalLogError = function (message) {
  39154. if (window.console && window.console.error) {
  39155. window.console.error(message);
  39156. }
  39157. else {
  39158. this.globalLogWarn(message);
  39159. }
  39160. };
  39161. Logger.prototype.log = function (defaultLoggingFunction) {
  39162. var args = [];
  39163. for (var _i = 1; _i < arguments.length; _i++) {
  39164. args[_i - 1] = arguments[_i];
  39165. }
  39166. var message = stringify.apply(this, arguments);
  39167. if (core_pusher.log) {
  39168. core_pusher.log(message);
  39169. }
  39170. else if (core_pusher.logToConsole) {
  39171. var log = defaultLoggingFunction.bind(this);
  39172. log(message);
  39173. }
  39174. };
  39175. return Logger;
  39176. }());
  39177. /* harmony default export */ var logger = (new logger_Logger());
  39178. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39179. var urlStore = {
  39180. baseUrl: "https://pusher.com",
  39181. urls: {
  39182. authenticationEndpoint: {
  39183. path: "/docs/authenticating_users",
  39184. },
  39185. javascriptQuickStart: {
  39186. path: "/docs/javascript_quick_start"
  39187. },
  39188. triggeringClientEvents: {
  39189. path: "/docs/client_api_guide/client_events#trigger-events"
  39190. }
  39191. }
  39192. };
  39193. var buildLogSuffix = function (key) {
  39194. var urlPrefix = "See:";
  39195. var urlObj = urlStore.urls[key];
  39196. if (!urlObj)
  39197. return "";
  39198. var url;
  39199. if (urlObj.fullUrl) {
  39200. url = urlObj.fullUrl;
  39201. }
  39202. else if (urlObj.path) {
  39203. url = urlStore.baseUrl + urlObj.path;
  39204. }
  39205. if (!url)
  39206. return "";
  39207. return urlPrefix + " " + url;
  39208. };
  39209. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39210. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39211. var ajax = function (context, socketId, callback) {
  39212. var self = this, xhr;
  39213. xhr = runtime.createXHR();
  39214. xhr.open("POST", self.options.authEndpoint, true);
  39215. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39216. for (var headerName in this.authOptions.headers) {
  39217. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39218. }
  39219. xhr.onreadystatechange = function () {
  39220. if (xhr.readyState === 4) {
  39221. if (xhr.status === 200) {
  39222. var data, parsed = false;
  39223. try {
  39224. data = JSON.parse(xhr.responseText);
  39225. parsed = true;
  39226. }
  39227. catch (e) {
  39228. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39229. }
  39230. if (parsed) {
  39231. callback(false, data);
  39232. }
  39233. }
  39234. else {
  39235. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39236. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39237. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39238. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39239. callback(true, xhr.status);
  39240. }
  39241. }
  39242. };
  39243. xhr.send(this.composeQuery(socketId));
  39244. return xhr;
  39245. };
  39246. /* harmony default export */ var xhr_auth = (ajax);
  39247. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39248. var jsonp = function (context, socketId, callback) {
  39249. if (this.authOptions.headers !== undefined) {
  39250. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39251. }
  39252. var callbackName = context.nextAuthCallbackID.toString();
  39253. context.nextAuthCallbackID++;
  39254. var document = context.getDocument();
  39255. var script = document.createElement("script");
  39256. context.auth_callbacks[callbackName] = function (data) {
  39257. callback(false, data);
  39258. };
  39259. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39260. script.src = this.options.authEndpoint +
  39261. '?callback=' +
  39262. encodeURIComponent(callback_name) +
  39263. '&' +
  39264. this.composeQuery(socketId);
  39265. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39266. head.insertBefore(script, head.firstChild);
  39267. };
  39268. /* harmony default export */ var jsonp_auth = (jsonp);
  39269. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39270. var ScriptRequest = (function () {
  39271. function ScriptRequest(src) {
  39272. this.src = src;
  39273. }
  39274. ScriptRequest.prototype.send = function (receiver) {
  39275. var self = this;
  39276. var errorString = "Error loading " + self.src;
  39277. self.script = document.createElement("script");
  39278. self.script.id = receiver.id;
  39279. self.script.src = self.src;
  39280. self.script.type = "text/javascript";
  39281. self.script.charset = "UTF-8";
  39282. if (self.script.addEventListener) {
  39283. self.script.onerror = function () {
  39284. receiver.callback(errorString);
  39285. };
  39286. self.script.onload = function () {
  39287. receiver.callback(null);
  39288. };
  39289. }
  39290. else {
  39291. self.script.onreadystatechange = function () {
  39292. if (self.script.readyState === 'loaded' ||
  39293. self.script.readyState === 'complete') {
  39294. receiver.callback(null);
  39295. }
  39296. };
  39297. }
  39298. if (self.script.async === undefined && document.attachEvent &&
  39299. /opera/i.test(navigator.userAgent)) {
  39300. self.errorScript = document.createElement("script");
  39301. self.errorScript.id = receiver.id + "_error";
  39302. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39303. self.script.async = self.errorScript.async = false;
  39304. }
  39305. else {
  39306. self.script.async = true;
  39307. }
  39308. var head = document.getElementsByTagName('head')[0];
  39309. head.insertBefore(self.script, head.firstChild);
  39310. if (self.errorScript) {
  39311. head.insertBefore(self.errorScript, self.script.nextSibling);
  39312. }
  39313. };
  39314. ScriptRequest.prototype.cleanup = function () {
  39315. if (this.script) {
  39316. this.script.onload = this.script.onerror = null;
  39317. this.script.onreadystatechange = null;
  39318. }
  39319. if (this.script && this.script.parentNode) {
  39320. this.script.parentNode.removeChild(this.script);
  39321. }
  39322. if (this.errorScript && this.errorScript.parentNode) {
  39323. this.errorScript.parentNode.removeChild(this.errorScript);
  39324. }
  39325. this.script = null;
  39326. this.errorScript = null;
  39327. };
  39328. return ScriptRequest;
  39329. }());
  39330. /* harmony default export */ var script_request = (ScriptRequest);
  39331. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39332. var jsonp_request_JSONPRequest = (function () {
  39333. function JSONPRequest(url, data) {
  39334. this.url = url;
  39335. this.data = data;
  39336. }
  39337. JSONPRequest.prototype.send = function (receiver) {
  39338. if (this.request) {
  39339. return;
  39340. }
  39341. var query = buildQueryString(this.data);
  39342. var url = this.url + "/" + receiver.number + "?" + query;
  39343. this.request = runtime.createScriptRequest(url);
  39344. this.request.send(receiver);
  39345. };
  39346. JSONPRequest.prototype.cleanup = function () {
  39347. if (this.request) {
  39348. this.request.cleanup();
  39349. }
  39350. };
  39351. return JSONPRequest;
  39352. }());
  39353. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39354. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39355. var getAgent = function (sender, useTLS) {
  39356. return function (data, callback) {
  39357. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39358. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39359. var request = runtime.createJSONPRequest(url, data);
  39360. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39361. ScriptReceivers.remove(receiver);
  39362. request.cleanup();
  39363. if (result && result.host) {
  39364. sender.host = result.host;
  39365. }
  39366. if (callback) {
  39367. callback(error, result);
  39368. }
  39369. });
  39370. request.send(receiver);
  39371. };
  39372. };
  39373. var jsonp_timeline_jsonp = {
  39374. name: 'jsonp',
  39375. getAgent: getAgent
  39376. };
  39377. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39378. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39379. function getGenericURL(baseScheme, params, path) {
  39380. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39381. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39382. return scheme + "://" + host + path;
  39383. }
  39384. function getGenericPath(key, queryString) {
  39385. var path = "/app/" + key;
  39386. var query = "?protocol=" + defaults.PROTOCOL +
  39387. "&client=js" +
  39388. "&version=" + defaults.VERSION +
  39389. (queryString ? ("&" + queryString) : "");
  39390. return path + query;
  39391. }
  39392. var ws = {
  39393. getInitial: function (key, params) {
  39394. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39395. return getGenericURL("ws", params, path);
  39396. }
  39397. };
  39398. var http = {
  39399. getInitial: function (key, params) {
  39400. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39401. return getGenericURL("http", params, path);
  39402. }
  39403. };
  39404. var sockjs = {
  39405. getInitial: function (key, params) {
  39406. return getGenericURL("http", params, params.httpPath || "/pusher");
  39407. },
  39408. getPath: function (key, params) {
  39409. return getGenericPath(key);
  39410. }
  39411. };
  39412. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39413. var callback_registry_CallbackRegistry = (function () {
  39414. function CallbackRegistry() {
  39415. this._callbacks = {};
  39416. }
  39417. CallbackRegistry.prototype.get = function (name) {
  39418. return this._callbacks[prefix(name)];
  39419. };
  39420. CallbackRegistry.prototype.add = function (name, callback, context) {
  39421. var prefixedEventName = prefix(name);
  39422. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39423. this._callbacks[prefixedEventName].push({
  39424. fn: callback,
  39425. context: context
  39426. });
  39427. };
  39428. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39429. if (!name && !callback && !context) {
  39430. this._callbacks = {};
  39431. return;
  39432. }
  39433. var names = name ? [prefix(name)] : keys(this._callbacks);
  39434. if (callback || context) {
  39435. this.removeCallback(names, callback, context);
  39436. }
  39437. else {
  39438. this.removeAllCallbacks(names);
  39439. }
  39440. };
  39441. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39442. apply(names, function (name) {
  39443. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39444. return (callback && callback !== binding.fn) ||
  39445. (context && context !== binding.context);
  39446. });
  39447. if (this._callbacks[name].length === 0) {
  39448. delete this._callbacks[name];
  39449. }
  39450. }, this);
  39451. };
  39452. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39453. apply(names, function (name) {
  39454. delete this._callbacks[name];
  39455. }, this);
  39456. };
  39457. return CallbackRegistry;
  39458. }());
  39459. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39460. function prefix(name) {
  39461. return "_" + name;
  39462. }
  39463. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39464. var dispatcher_Dispatcher = (function () {
  39465. function Dispatcher(failThrough) {
  39466. this.callbacks = new callback_registry();
  39467. this.global_callbacks = [];
  39468. this.failThrough = failThrough;
  39469. }
  39470. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39471. this.callbacks.add(eventName, callback, context);
  39472. return this;
  39473. };
  39474. Dispatcher.prototype.bind_global = function (callback) {
  39475. this.global_callbacks.push(callback);
  39476. return this;
  39477. };
  39478. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39479. this.callbacks.remove(eventName, callback, context);
  39480. return this;
  39481. };
  39482. Dispatcher.prototype.unbind_global = function (callback) {
  39483. if (!callback) {
  39484. this.global_callbacks = [];
  39485. return this;
  39486. }
  39487. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39488. return this;
  39489. };
  39490. Dispatcher.prototype.unbind_all = function () {
  39491. this.unbind();
  39492. this.unbind_global();
  39493. return this;
  39494. };
  39495. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39496. for (var i = 0; i < this.global_callbacks.length; i++) {
  39497. this.global_callbacks[i](eventName, data);
  39498. }
  39499. var callbacks = this.callbacks.get(eventName);
  39500. var args = [];
  39501. if (metadata) {
  39502. args.push(data, metadata);
  39503. }
  39504. else if (data) {
  39505. args.push(data);
  39506. }
  39507. if (callbacks && callbacks.length > 0) {
  39508. for (var i = 0; i < callbacks.length; i++) {
  39509. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39510. }
  39511. }
  39512. else if (this.failThrough) {
  39513. this.failThrough(eventName, data);
  39514. }
  39515. return this;
  39516. };
  39517. return Dispatcher;
  39518. }());
  39519. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39520. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39521. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39522. var extendStatics = function (d, b) {
  39523. extendStatics = Object.setPrototypeOf ||
  39524. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39525. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39526. return extendStatics(d, b);
  39527. };
  39528. return function (d, b) {
  39529. extendStatics(d, b);
  39530. function __() { this.constructor = d; }
  39531. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39532. };
  39533. })();
  39534. var transport_connection_TransportConnection = (function (_super) {
  39535. transport_connection_extends(TransportConnection, _super);
  39536. function TransportConnection(hooks, name, priority, key, options) {
  39537. var _this = _super.call(this) || this;
  39538. _this.initialize = runtime.transportConnectionInitializer;
  39539. _this.hooks = hooks;
  39540. _this.name = name;
  39541. _this.priority = priority;
  39542. _this.key = key;
  39543. _this.options = options;
  39544. _this.state = "new";
  39545. _this.timeline = options.timeline;
  39546. _this.activityTimeout = options.activityTimeout;
  39547. _this.id = _this.timeline.generateUniqueID();
  39548. return _this;
  39549. }
  39550. TransportConnection.prototype.handlesActivityChecks = function () {
  39551. return Boolean(this.hooks.handlesActivityChecks);
  39552. };
  39553. TransportConnection.prototype.supportsPing = function () {
  39554. return Boolean(this.hooks.supportsPing);
  39555. };
  39556. TransportConnection.prototype.connect = function () {
  39557. var _this = this;
  39558. if (this.socket || this.state !== "initialized") {
  39559. return false;
  39560. }
  39561. var url = this.hooks.urls.getInitial(this.key, this.options);
  39562. try {
  39563. this.socket = this.hooks.getSocket(url, this.options);
  39564. }
  39565. catch (e) {
  39566. util.defer(function () {
  39567. _this.onError(e);
  39568. _this.changeState("closed");
  39569. });
  39570. return false;
  39571. }
  39572. this.bindListeners();
  39573. logger.debug("Connecting", { transport: this.name, url: url });
  39574. this.changeState("connecting");
  39575. return true;
  39576. };
  39577. TransportConnection.prototype.close = function () {
  39578. if (this.socket) {
  39579. this.socket.close();
  39580. return true;
  39581. }
  39582. else {
  39583. return false;
  39584. }
  39585. };
  39586. TransportConnection.prototype.send = function (data) {
  39587. var _this = this;
  39588. if (this.state === "open") {
  39589. util.defer(function () {
  39590. if (_this.socket) {
  39591. _this.socket.send(data);
  39592. }
  39593. });
  39594. return true;
  39595. }
  39596. else {
  39597. return false;
  39598. }
  39599. };
  39600. TransportConnection.prototype.ping = function () {
  39601. if (this.state === "open" && this.supportsPing()) {
  39602. this.socket.ping();
  39603. }
  39604. };
  39605. TransportConnection.prototype.onOpen = function () {
  39606. if (this.hooks.beforeOpen) {
  39607. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39608. }
  39609. this.changeState("open");
  39610. this.socket.onopen = undefined;
  39611. };
  39612. TransportConnection.prototype.onError = function (error) {
  39613. this.emit("error", { type: 'WebSocketError', error: error });
  39614. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39615. };
  39616. TransportConnection.prototype.onClose = function (closeEvent) {
  39617. if (closeEvent) {
  39618. this.changeState("closed", {
  39619. code: closeEvent.code,
  39620. reason: closeEvent.reason,
  39621. wasClean: closeEvent.wasClean
  39622. });
  39623. }
  39624. else {
  39625. this.changeState("closed");
  39626. }
  39627. this.unbindListeners();
  39628. this.socket = undefined;
  39629. };
  39630. TransportConnection.prototype.onMessage = function (message) {
  39631. this.emit("message", message);
  39632. };
  39633. TransportConnection.prototype.onActivity = function () {
  39634. this.emit("activity");
  39635. };
  39636. TransportConnection.prototype.bindListeners = function () {
  39637. var _this = this;
  39638. this.socket.onopen = function () {
  39639. _this.onOpen();
  39640. };
  39641. this.socket.onerror = function (error) {
  39642. _this.onError(error);
  39643. };
  39644. this.socket.onclose = function (closeEvent) {
  39645. _this.onClose(closeEvent);
  39646. };
  39647. this.socket.onmessage = function (message) {
  39648. _this.onMessage(message);
  39649. };
  39650. if (this.supportsPing()) {
  39651. this.socket.onactivity = function () { _this.onActivity(); };
  39652. }
  39653. };
  39654. TransportConnection.prototype.unbindListeners = function () {
  39655. if (this.socket) {
  39656. this.socket.onopen = undefined;
  39657. this.socket.onerror = undefined;
  39658. this.socket.onclose = undefined;
  39659. this.socket.onmessage = undefined;
  39660. if (this.supportsPing()) {
  39661. this.socket.onactivity = undefined;
  39662. }
  39663. }
  39664. };
  39665. TransportConnection.prototype.changeState = function (state, params) {
  39666. this.state = state;
  39667. this.timeline.info(this.buildTimelineMessage({
  39668. state: state,
  39669. params: params
  39670. }));
  39671. this.emit(state, params);
  39672. };
  39673. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39674. return extend({ cid: this.id }, message);
  39675. };
  39676. return TransportConnection;
  39677. }(dispatcher));
  39678. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39679. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39680. var transport_Transport = (function () {
  39681. function Transport(hooks) {
  39682. this.hooks = hooks;
  39683. }
  39684. Transport.prototype.isSupported = function (environment) {
  39685. return this.hooks.isSupported(environment);
  39686. };
  39687. Transport.prototype.createConnection = function (name, priority, key, options) {
  39688. return new transport_connection(this.hooks, name, priority, key, options);
  39689. };
  39690. return Transport;
  39691. }());
  39692. /* harmony default export */ var transports_transport = (transport_Transport);
  39693. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39694. var WSTransport = new transports_transport({
  39695. urls: ws,
  39696. handlesActivityChecks: false,
  39697. supportsPing: false,
  39698. isInitialized: function () {
  39699. return Boolean(runtime.getWebSocketAPI());
  39700. },
  39701. isSupported: function () {
  39702. return Boolean(runtime.getWebSocketAPI());
  39703. },
  39704. getSocket: function (url) {
  39705. return runtime.createWebSocket(url);
  39706. }
  39707. });
  39708. var httpConfiguration = {
  39709. urls: http,
  39710. handlesActivityChecks: false,
  39711. supportsPing: true,
  39712. isInitialized: function () {
  39713. return true;
  39714. }
  39715. };
  39716. var streamingConfiguration = extend({ getSocket: function (url) {
  39717. return runtime.HTTPFactory.createStreamingSocket(url);
  39718. }
  39719. }, httpConfiguration);
  39720. var pollingConfiguration = extend({ getSocket: function (url) {
  39721. return runtime.HTTPFactory.createPollingSocket(url);
  39722. }
  39723. }, httpConfiguration);
  39724. var xhrConfiguration = {
  39725. isSupported: function () {
  39726. return runtime.isXHRSupported();
  39727. }
  39728. };
  39729. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39730. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39731. var Transports = {
  39732. ws: WSTransport,
  39733. xhr_streaming: XHRStreamingTransport,
  39734. xhr_polling: XHRPollingTransport
  39735. };
  39736. /* harmony default export */ var transports = (Transports);
  39737. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39738. var SockJSTransport = new transports_transport({
  39739. file: "sockjs",
  39740. urls: sockjs,
  39741. handlesActivityChecks: true,
  39742. supportsPing: false,
  39743. isSupported: function () {
  39744. return true;
  39745. },
  39746. isInitialized: function () {
  39747. return window.SockJS !== undefined;
  39748. },
  39749. getSocket: function (url, options) {
  39750. return new window.SockJS(url, null, {
  39751. js_path: Dependencies.getPath("sockjs", {
  39752. useTLS: options.useTLS
  39753. }),
  39754. ignore_null_origin: options.ignoreNullOrigin
  39755. });
  39756. },
  39757. beforeOpen: function (socket, path) {
  39758. socket.send(JSON.stringify({
  39759. path: path
  39760. }));
  39761. }
  39762. });
  39763. var xdrConfiguration = {
  39764. isSupported: function (environment) {
  39765. var yes = runtime.isXDRSupported(environment.useTLS);
  39766. return yes;
  39767. }
  39768. };
  39769. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39770. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39771. transports.xdr_streaming = XDRStreamingTransport;
  39772. transports.xdr_polling = XDRPollingTransport;
  39773. transports.sockjs = SockJSTransport;
  39774. /* harmony default export */ var transports_transports = (transports);
  39775. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39776. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39777. var extendStatics = function (d, b) {
  39778. extendStatics = Object.setPrototypeOf ||
  39779. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39780. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39781. return extendStatics(d, b);
  39782. };
  39783. return function (d, b) {
  39784. extendStatics(d, b);
  39785. function __() { this.constructor = d; }
  39786. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39787. };
  39788. })();
  39789. var NetInfo = (function (_super) {
  39790. net_info_extends(NetInfo, _super);
  39791. function NetInfo() {
  39792. var _this = _super.call(this) || this;
  39793. var self = _this;
  39794. if (window.addEventListener !== undefined) {
  39795. window.addEventListener("online", function () {
  39796. self.emit('online');
  39797. }, false);
  39798. window.addEventListener("offline", function () {
  39799. self.emit('offline');
  39800. }, false);
  39801. }
  39802. return _this;
  39803. }
  39804. NetInfo.prototype.isOnline = function () {
  39805. if (window.navigator.onLine === undefined) {
  39806. return true;
  39807. }
  39808. else {
  39809. return window.navigator.onLine;
  39810. }
  39811. };
  39812. return NetInfo;
  39813. }(dispatcher));
  39814. var net_info_Network = new NetInfo();
  39815. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39816. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39817. function AssistantToTheTransportManager(manager, transport, options) {
  39818. this.manager = manager;
  39819. this.transport = transport;
  39820. this.minPingDelay = options.minPingDelay;
  39821. this.maxPingDelay = options.maxPingDelay;
  39822. this.pingDelay = undefined;
  39823. }
  39824. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39825. var _this = this;
  39826. options = extend({}, options, {
  39827. activityTimeout: this.pingDelay
  39828. });
  39829. var connection = this.transport.createConnection(name, priority, key, options);
  39830. var openTimestamp = null;
  39831. var onOpen = function () {
  39832. connection.unbind("open", onOpen);
  39833. connection.bind("closed", onClosed);
  39834. openTimestamp = util.now();
  39835. };
  39836. var onClosed = function (closeEvent) {
  39837. connection.unbind("closed", onClosed);
  39838. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39839. _this.manager.reportDeath();
  39840. }
  39841. else if (!closeEvent.wasClean && openTimestamp) {
  39842. var lifespan = util.now() - openTimestamp;
  39843. if (lifespan < 2 * _this.maxPingDelay) {
  39844. _this.manager.reportDeath();
  39845. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39846. }
  39847. }
  39848. };
  39849. connection.bind("open", onOpen);
  39850. return connection;
  39851. };
  39852. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39853. return this.manager.isAlive() && this.transport.isSupported(environment);
  39854. };
  39855. return AssistantToTheTransportManager;
  39856. }());
  39857. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39858. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39859. var Protocol = {
  39860. decodeMessage: function (messageEvent) {
  39861. try {
  39862. var messageData = JSON.parse(messageEvent.data);
  39863. var pusherEventData = messageData.data;
  39864. if (typeof pusherEventData === 'string') {
  39865. try {
  39866. pusherEventData = JSON.parse(messageData.data);
  39867. }
  39868. catch (e) { }
  39869. }
  39870. var pusherEvent = {
  39871. event: messageData.event,
  39872. channel: messageData.channel,
  39873. data: pusherEventData,
  39874. };
  39875. if (messageData.user_id) {
  39876. pusherEvent.user_id = messageData.user_id;
  39877. }
  39878. return pusherEvent;
  39879. }
  39880. catch (e) {
  39881. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39882. }
  39883. },
  39884. encodeMessage: function (event) {
  39885. return JSON.stringify(event);
  39886. },
  39887. processHandshake: function (messageEvent) {
  39888. var message = Protocol.decodeMessage(messageEvent);
  39889. if (message.event === "pusher:connection_established") {
  39890. if (!message.data.activity_timeout) {
  39891. throw "No activity timeout specified in handshake";
  39892. }
  39893. return {
  39894. action: "connected",
  39895. id: message.data.socket_id,
  39896. activityTimeout: message.data.activity_timeout * 1000
  39897. };
  39898. }
  39899. else if (message.event === "pusher:error") {
  39900. return {
  39901. action: this.getCloseAction(message.data),
  39902. error: this.getCloseError(message.data)
  39903. };
  39904. }
  39905. else {
  39906. throw "Invalid handshake";
  39907. }
  39908. },
  39909. getCloseAction: function (closeEvent) {
  39910. if (closeEvent.code < 4000) {
  39911. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39912. return "backoff";
  39913. }
  39914. else {
  39915. return null;
  39916. }
  39917. }
  39918. else if (closeEvent.code === 4000) {
  39919. return "tls_only";
  39920. }
  39921. else if (closeEvent.code < 4100) {
  39922. return "refused";
  39923. }
  39924. else if (closeEvent.code < 4200) {
  39925. return "backoff";
  39926. }
  39927. else if (closeEvent.code < 4300) {
  39928. return "retry";
  39929. }
  39930. else {
  39931. return "refused";
  39932. }
  39933. },
  39934. getCloseError: function (closeEvent) {
  39935. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39936. return {
  39937. type: 'PusherError',
  39938. data: {
  39939. code: closeEvent.code,
  39940. message: closeEvent.reason || closeEvent.message
  39941. }
  39942. };
  39943. }
  39944. else {
  39945. return null;
  39946. }
  39947. }
  39948. };
  39949. /* harmony default export */ var protocol_protocol = (Protocol);
  39950. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39951. var connection_extends = (undefined && undefined.__extends) || (function () {
  39952. var extendStatics = function (d, b) {
  39953. extendStatics = Object.setPrototypeOf ||
  39954. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39955. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39956. return extendStatics(d, b);
  39957. };
  39958. return function (d, b) {
  39959. extendStatics(d, b);
  39960. function __() { this.constructor = d; }
  39961. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39962. };
  39963. })();
  39964. var connection_Connection = (function (_super) {
  39965. connection_extends(Connection, _super);
  39966. function Connection(id, transport) {
  39967. var _this = _super.call(this) || this;
  39968. _this.id = id;
  39969. _this.transport = transport;
  39970. _this.activityTimeout = transport.activityTimeout;
  39971. _this.bindListeners();
  39972. return _this;
  39973. }
  39974. Connection.prototype.handlesActivityChecks = function () {
  39975. return this.transport.handlesActivityChecks();
  39976. };
  39977. Connection.prototype.send = function (data) {
  39978. return this.transport.send(data);
  39979. };
  39980. Connection.prototype.send_event = function (name, data, channel) {
  39981. var event = { event: name, data: data };
  39982. if (channel) {
  39983. event.channel = channel;
  39984. }
  39985. logger.debug('Event sent', event);
  39986. return this.send(protocol_protocol.encodeMessage(event));
  39987. };
  39988. Connection.prototype.ping = function () {
  39989. if (this.transport.supportsPing()) {
  39990. this.transport.ping();
  39991. }
  39992. else {
  39993. this.send_event('pusher:ping', {});
  39994. }
  39995. };
  39996. Connection.prototype.close = function () {
  39997. this.transport.close();
  39998. };
  39999. Connection.prototype.bindListeners = function () {
  40000. var _this = this;
  40001. var listeners = {
  40002. message: function (messageEvent) {
  40003. var pusherEvent;
  40004. try {
  40005. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40006. }
  40007. catch (e) {
  40008. _this.emit('error', {
  40009. type: 'MessageParseError',
  40010. error: e,
  40011. data: messageEvent.data
  40012. });
  40013. }
  40014. if (pusherEvent !== undefined) {
  40015. logger.debug('Event recd', pusherEvent);
  40016. switch (pusherEvent.event) {
  40017. case 'pusher:error':
  40018. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40019. break;
  40020. case 'pusher:ping':
  40021. _this.emit("ping");
  40022. break;
  40023. case 'pusher:pong':
  40024. _this.emit("pong");
  40025. break;
  40026. }
  40027. _this.emit('message', pusherEvent);
  40028. }
  40029. },
  40030. activity: function () {
  40031. _this.emit("activity");
  40032. },
  40033. error: function (error) {
  40034. _this.emit("error", { type: "WebSocketError", error: error });
  40035. },
  40036. closed: function (closeEvent) {
  40037. unbindListeners();
  40038. if (closeEvent && closeEvent.code) {
  40039. _this.handleCloseEvent(closeEvent);
  40040. }
  40041. _this.transport = null;
  40042. _this.emit("closed");
  40043. }
  40044. };
  40045. var unbindListeners = function () {
  40046. objectApply(listeners, function (listener, event) {
  40047. _this.transport.unbind(event, listener);
  40048. });
  40049. };
  40050. objectApply(listeners, function (listener, event) {
  40051. _this.transport.bind(event, listener);
  40052. });
  40053. };
  40054. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40055. var action = protocol_protocol.getCloseAction(closeEvent);
  40056. var error = protocol_protocol.getCloseError(closeEvent);
  40057. if (error) {
  40058. this.emit('error', error);
  40059. }
  40060. if (action) {
  40061. this.emit(action, { action: action, error: error });
  40062. }
  40063. };
  40064. return Connection;
  40065. }(dispatcher));
  40066. /* harmony default export */ var connection_connection = (connection_Connection);
  40067. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40068. var handshake_Handshake = (function () {
  40069. function Handshake(transport, callback) {
  40070. this.transport = transport;
  40071. this.callback = callback;
  40072. this.bindListeners();
  40073. }
  40074. Handshake.prototype.close = function () {
  40075. this.unbindListeners();
  40076. this.transport.close();
  40077. };
  40078. Handshake.prototype.bindListeners = function () {
  40079. var _this = this;
  40080. this.onMessage = function (m) {
  40081. _this.unbindListeners();
  40082. var result;
  40083. try {
  40084. result = protocol_protocol.processHandshake(m);
  40085. }
  40086. catch (e) {
  40087. _this.finish("error", { error: e });
  40088. _this.transport.close();
  40089. return;
  40090. }
  40091. if (result.action === "connected") {
  40092. _this.finish("connected", {
  40093. connection: new connection_connection(result.id, _this.transport),
  40094. activityTimeout: result.activityTimeout
  40095. });
  40096. }
  40097. else {
  40098. _this.finish(result.action, { error: result.error });
  40099. _this.transport.close();
  40100. }
  40101. };
  40102. this.onClosed = function (closeEvent) {
  40103. _this.unbindListeners();
  40104. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40105. var error = protocol_protocol.getCloseError(closeEvent);
  40106. _this.finish(action, { error: error });
  40107. };
  40108. this.transport.bind("message", this.onMessage);
  40109. this.transport.bind("closed", this.onClosed);
  40110. };
  40111. Handshake.prototype.unbindListeners = function () {
  40112. this.transport.unbind("message", this.onMessage);
  40113. this.transport.unbind("closed", this.onClosed);
  40114. };
  40115. Handshake.prototype.finish = function (action, params) {
  40116. this.callback(extend({ transport: this.transport, action: action }, params));
  40117. };
  40118. return Handshake;
  40119. }());
  40120. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40121. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40122. var pusher_authorizer_PusherAuthorizer = (function () {
  40123. function PusherAuthorizer(channel, options) {
  40124. this.channel = channel;
  40125. var authTransport = options.authTransport;
  40126. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40127. throw "'" + authTransport + "' is not a recognized auth transport";
  40128. }
  40129. this.type = authTransport;
  40130. this.options = options;
  40131. this.authOptions = (options || {}).auth || {};
  40132. }
  40133. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40134. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40135. '&channel_name=' + encodeURIComponent(this.channel.name);
  40136. for (var i in this.authOptions.params) {
  40137. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40138. }
  40139. return query;
  40140. };
  40141. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40142. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40143. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40144. };
  40145. return PusherAuthorizer;
  40146. }());
  40147. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40148. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40149. var timeline_sender_TimelineSender = (function () {
  40150. function TimelineSender(timeline, options) {
  40151. this.timeline = timeline;
  40152. this.options = options || {};
  40153. }
  40154. TimelineSender.prototype.send = function (useTLS, callback) {
  40155. if (this.timeline.isEmpty()) {
  40156. return;
  40157. }
  40158. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40159. };
  40160. return TimelineSender;
  40161. }());
  40162. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40163. // CONCATENATED MODULE: ./src/core/errors.ts
  40164. var errors_extends = (undefined && undefined.__extends) || (function () {
  40165. var extendStatics = function (d, b) {
  40166. extendStatics = Object.setPrototypeOf ||
  40167. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40168. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40169. return extendStatics(d, b);
  40170. };
  40171. return function (d, b) {
  40172. extendStatics(d, b);
  40173. function __() { this.constructor = d; }
  40174. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40175. };
  40176. })();
  40177. var BadEventName = (function (_super) {
  40178. errors_extends(BadEventName, _super);
  40179. function BadEventName(msg) {
  40180. var _newTarget = this.constructor;
  40181. var _this = _super.call(this, msg) || this;
  40182. Object.setPrototypeOf(_this, _newTarget.prototype);
  40183. return _this;
  40184. }
  40185. return BadEventName;
  40186. }(Error));
  40187. var RequestTimedOut = (function (_super) {
  40188. errors_extends(RequestTimedOut, _super);
  40189. function RequestTimedOut(msg) {
  40190. var _newTarget = this.constructor;
  40191. var _this = _super.call(this, msg) || this;
  40192. Object.setPrototypeOf(_this, _newTarget.prototype);
  40193. return _this;
  40194. }
  40195. return RequestTimedOut;
  40196. }(Error));
  40197. var TransportPriorityTooLow = (function (_super) {
  40198. errors_extends(TransportPriorityTooLow, _super);
  40199. function TransportPriorityTooLow(msg) {
  40200. var _newTarget = this.constructor;
  40201. var _this = _super.call(this, msg) || this;
  40202. Object.setPrototypeOf(_this, _newTarget.prototype);
  40203. return _this;
  40204. }
  40205. return TransportPriorityTooLow;
  40206. }(Error));
  40207. var TransportClosed = (function (_super) {
  40208. errors_extends(TransportClosed, _super);
  40209. function TransportClosed(msg) {
  40210. var _newTarget = this.constructor;
  40211. var _this = _super.call(this, msg) || this;
  40212. Object.setPrototypeOf(_this, _newTarget.prototype);
  40213. return _this;
  40214. }
  40215. return TransportClosed;
  40216. }(Error));
  40217. var UnsupportedFeature = (function (_super) {
  40218. errors_extends(UnsupportedFeature, _super);
  40219. function UnsupportedFeature(msg) {
  40220. var _newTarget = this.constructor;
  40221. var _this = _super.call(this, msg) || this;
  40222. Object.setPrototypeOf(_this, _newTarget.prototype);
  40223. return _this;
  40224. }
  40225. return UnsupportedFeature;
  40226. }(Error));
  40227. var UnsupportedTransport = (function (_super) {
  40228. errors_extends(UnsupportedTransport, _super);
  40229. function UnsupportedTransport(msg) {
  40230. var _newTarget = this.constructor;
  40231. var _this = _super.call(this, msg) || this;
  40232. Object.setPrototypeOf(_this, _newTarget.prototype);
  40233. return _this;
  40234. }
  40235. return UnsupportedTransport;
  40236. }(Error));
  40237. var UnsupportedStrategy = (function (_super) {
  40238. errors_extends(UnsupportedStrategy, _super);
  40239. function UnsupportedStrategy(msg) {
  40240. var _newTarget = this.constructor;
  40241. var _this = _super.call(this, msg) || this;
  40242. Object.setPrototypeOf(_this, _newTarget.prototype);
  40243. return _this;
  40244. }
  40245. return UnsupportedStrategy;
  40246. }(Error));
  40247. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40248. var channel_extends = (undefined && undefined.__extends) || (function () {
  40249. var extendStatics = function (d, b) {
  40250. extendStatics = Object.setPrototypeOf ||
  40251. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40252. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40253. return extendStatics(d, b);
  40254. };
  40255. return function (d, b) {
  40256. extendStatics(d, b);
  40257. function __() { this.constructor = d; }
  40258. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40259. };
  40260. })();
  40261. var channel_Channel = (function (_super) {
  40262. channel_extends(Channel, _super);
  40263. function Channel(name, pusher) {
  40264. var _this = _super.call(this, function (event, data) {
  40265. logger.debug('No callbacks on ' + name + ' for ' + event);
  40266. }) || this;
  40267. _this.name = name;
  40268. _this.pusher = pusher;
  40269. _this.subscribed = false;
  40270. _this.subscriptionPending = false;
  40271. _this.subscriptionCancelled = false;
  40272. return _this;
  40273. }
  40274. Channel.prototype.authorize = function (socketId, callback) {
  40275. return callback(false, {});
  40276. };
  40277. Channel.prototype.trigger = function (event, data) {
  40278. if (event.indexOf("client-") !== 0) {
  40279. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40280. }
  40281. if (!this.subscribed) {
  40282. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40283. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40284. }
  40285. return this.pusher.send_event(event, data, this.name);
  40286. };
  40287. Channel.prototype.disconnect = function () {
  40288. this.subscribed = false;
  40289. this.subscriptionPending = false;
  40290. };
  40291. Channel.prototype.handleEvent = function (event) {
  40292. var eventName = event.event;
  40293. var data = event.data;
  40294. if (eventName === "pusher_internal:subscription_succeeded") {
  40295. this.handleSubscriptionSucceededEvent(event);
  40296. }
  40297. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40298. var metadata = {};
  40299. this.emit(eventName, data, metadata);
  40300. }
  40301. };
  40302. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40303. this.subscriptionPending = false;
  40304. this.subscribed = true;
  40305. if (this.subscriptionCancelled) {
  40306. this.pusher.unsubscribe(this.name);
  40307. }
  40308. else {
  40309. this.emit("pusher:subscription_succeeded", event.data);
  40310. }
  40311. };
  40312. Channel.prototype.subscribe = function () {
  40313. var _this = this;
  40314. if (this.subscribed) {
  40315. return;
  40316. }
  40317. this.subscriptionPending = true;
  40318. this.subscriptionCancelled = false;
  40319. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40320. if (error) {
  40321. logger.error(data);
  40322. _this.emit('pusher:subscription_error', data);
  40323. }
  40324. else {
  40325. _this.pusher.send_event('pusher:subscribe', {
  40326. auth: data.auth,
  40327. channel_data: data.channel_data,
  40328. channel: _this.name
  40329. });
  40330. }
  40331. });
  40332. };
  40333. Channel.prototype.unsubscribe = function () {
  40334. this.subscribed = false;
  40335. this.pusher.send_event('pusher:unsubscribe', {
  40336. channel: this.name
  40337. });
  40338. };
  40339. Channel.prototype.cancelSubscription = function () {
  40340. this.subscriptionCancelled = true;
  40341. };
  40342. Channel.prototype.reinstateSubscription = function () {
  40343. this.subscriptionCancelled = false;
  40344. };
  40345. return Channel;
  40346. }(dispatcher));
  40347. /* harmony default export */ var channels_channel = (channel_Channel);
  40348. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40349. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40350. var extendStatics = function (d, b) {
  40351. extendStatics = Object.setPrototypeOf ||
  40352. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40353. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40354. return extendStatics(d, b);
  40355. };
  40356. return function (d, b) {
  40357. extendStatics(d, b);
  40358. function __() { this.constructor = d; }
  40359. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40360. };
  40361. })();
  40362. var private_channel_PrivateChannel = (function (_super) {
  40363. private_channel_extends(PrivateChannel, _super);
  40364. function PrivateChannel() {
  40365. return _super !== null && _super.apply(this, arguments) || this;
  40366. }
  40367. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40368. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40369. return authorizer.authorize(socketId, callback);
  40370. };
  40371. return PrivateChannel;
  40372. }(channels_channel));
  40373. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40374. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40375. var members_Members = (function () {
  40376. function Members() {
  40377. this.reset();
  40378. }
  40379. Members.prototype.get = function (id) {
  40380. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40381. return {
  40382. id: id,
  40383. info: this.members[id]
  40384. };
  40385. }
  40386. else {
  40387. return null;
  40388. }
  40389. };
  40390. Members.prototype.each = function (callback) {
  40391. var _this = this;
  40392. objectApply(this.members, function (member, id) {
  40393. callback(_this.get(id));
  40394. });
  40395. };
  40396. Members.prototype.setMyID = function (id) {
  40397. this.myID = id;
  40398. };
  40399. Members.prototype.onSubscription = function (subscriptionData) {
  40400. this.members = subscriptionData.presence.hash;
  40401. this.count = subscriptionData.presence.count;
  40402. this.me = this.get(this.myID);
  40403. };
  40404. Members.prototype.addMember = function (memberData) {
  40405. if (this.get(memberData.user_id) === null) {
  40406. this.count++;
  40407. }
  40408. this.members[memberData.user_id] = memberData.user_info;
  40409. return this.get(memberData.user_id);
  40410. };
  40411. Members.prototype.removeMember = function (memberData) {
  40412. var member = this.get(memberData.user_id);
  40413. if (member) {
  40414. delete this.members[memberData.user_id];
  40415. this.count--;
  40416. }
  40417. return member;
  40418. };
  40419. Members.prototype.reset = function () {
  40420. this.members = {};
  40421. this.count = 0;
  40422. this.myID = null;
  40423. this.me = null;
  40424. };
  40425. return Members;
  40426. }());
  40427. /* harmony default export */ var members = (members_Members);
  40428. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40429. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40430. var extendStatics = function (d, b) {
  40431. extendStatics = Object.setPrototypeOf ||
  40432. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40433. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40434. return extendStatics(d, b);
  40435. };
  40436. return function (d, b) {
  40437. extendStatics(d, b);
  40438. function __() { this.constructor = d; }
  40439. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40440. };
  40441. })();
  40442. var presence_channel_PresenceChannel = (function (_super) {
  40443. presence_channel_extends(PresenceChannel, _super);
  40444. function PresenceChannel(name, pusher) {
  40445. var _this = _super.call(this, name, pusher) || this;
  40446. _this.members = new members();
  40447. return _this;
  40448. }
  40449. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40450. var _this = this;
  40451. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40452. if (!error) {
  40453. if (authData.channel_data === undefined) {
  40454. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40455. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40456. ("expected 'channel_data' field. " + suffix));
  40457. callback("Invalid auth response");
  40458. return;
  40459. }
  40460. var channelData = JSON.parse(authData.channel_data);
  40461. _this.members.setMyID(channelData.user_id);
  40462. }
  40463. callback(error, authData);
  40464. });
  40465. };
  40466. PresenceChannel.prototype.handleEvent = function (event) {
  40467. var eventName = event.event;
  40468. if (eventName.indexOf("pusher_internal:") === 0) {
  40469. this.handleInternalEvent(event);
  40470. }
  40471. else {
  40472. var data = event.data;
  40473. var metadata = {};
  40474. if (event.user_id) {
  40475. metadata.user_id = event.user_id;
  40476. }
  40477. this.emit(eventName, data, metadata);
  40478. }
  40479. };
  40480. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40481. var eventName = event.event;
  40482. var data = event.data;
  40483. switch (eventName) {
  40484. case "pusher_internal:subscription_succeeded":
  40485. this.handleSubscriptionSucceededEvent(event);
  40486. break;
  40487. case "pusher_internal:member_added":
  40488. var addedMember = this.members.addMember(data);
  40489. this.emit('pusher:member_added', addedMember);
  40490. break;
  40491. case "pusher_internal:member_removed":
  40492. var removedMember = this.members.removeMember(data);
  40493. if (removedMember) {
  40494. this.emit('pusher:member_removed', removedMember);
  40495. }
  40496. break;
  40497. }
  40498. };
  40499. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40500. this.subscriptionPending = false;
  40501. this.subscribed = true;
  40502. if (this.subscriptionCancelled) {
  40503. this.pusher.unsubscribe(this.name);
  40504. }
  40505. else {
  40506. this.members.onSubscription(event.data);
  40507. this.emit("pusher:subscription_succeeded", this.members);
  40508. }
  40509. };
  40510. PresenceChannel.prototype.disconnect = function () {
  40511. this.members.reset();
  40512. _super.prototype.disconnect.call(this);
  40513. };
  40514. return PresenceChannel;
  40515. }(private_channel));
  40516. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40517. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40518. var nacl_fast = __webpack_require__(0);
  40519. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40520. var nacl_util = __webpack_require__(1);
  40521. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40522. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40523. var extendStatics = function (d, b) {
  40524. extendStatics = Object.setPrototypeOf ||
  40525. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40526. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40527. return extendStatics(d, b);
  40528. };
  40529. return function (d, b) {
  40530. extendStatics(d, b);
  40531. function __() { this.constructor = d; }
  40532. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40533. };
  40534. })();
  40535. var encrypted_channel_EncryptedChannel = (function (_super) {
  40536. encrypted_channel_extends(EncryptedChannel, _super);
  40537. function EncryptedChannel() {
  40538. var _this = _super !== null && _super.apply(this, arguments) || this;
  40539. _this.key = null;
  40540. return _this;
  40541. }
  40542. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40543. var _this = this;
  40544. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40545. if (error) {
  40546. callback(true, authData);
  40547. return;
  40548. }
  40549. var sharedSecret = authData["shared_secret"];
  40550. if (!sharedSecret) {
  40551. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40552. callback(true, errorMsg);
  40553. return;
  40554. }
  40555. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40556. delete authData["shared_secret"];
  40557. callback(false, authData);
  40558. });
  40559. };
  40560. EncryptedChannel.prototype.trigger = function (event, data) {
  40561. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40562. };
  40563. EncryptedChannel.prototype.handleEvent = function (event) {
  40564. var eventName = event.event;
  40565. var data = event.data;
  40566. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40567. _super.prototype.handleEvent.call(this, event);
  40568. return;
  40569. }
  40570. this.handleEncryptedEvent(eventName, data);
  40571. };
  40572. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40573. var _this = this;
  40574. if (!this.key) {
  40575. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40576. return;
  40577. }
  40578. if (!data.ciphertext || !data.nonce) {
  40579. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40580. return;
  40581. }
  40582. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40583. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40584. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40585. return;
  40586. }
  40587. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40588. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40589. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40590. return;
  40591. }
  40592. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40593. if (bytes === null) {
  40594. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40595. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40596. if (error) {
  40597. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40598. return;
  40599. }
  40600. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40601. if (bytes === null) {
  40602. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40603. return;
  40604. }
  40605. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40606. return;
  40607. });
  40608. return;
  40609. }
  40610. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40611. };
  40612. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40613. try {
  40614. this.emit(eventName, JSON.parse(data));
  40615. }
  40616. catch (e) {
  40617. this.emit(eventName, data);
  40618. }
  40619. return this;
  40620. };
  40621. return EncryptedChannel;
  40622. }(private_channel));
  40623. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40624. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40625. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40626. var extendStatics = function (d, b) {
  40627. extendStatics = Object.setPrototypeOf ||
  40628. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40629. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40630. return extendStatics(d, b);
  40631. };
  40632. return function (d, b) {
  40633. extendStatics(d, b);
  40634. function __() { this.constructor = d; }
  40635. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40636. };
  40637. })();
  40638. var connection_manager_ConnectionManager = (function (_super) {
  40639. connection_manager_extends(ConnectionManager, _super);
  40640. function ConnectionManager(key, options) {
  40641. var _this = _super.call(this) || this;
  40642. _this.key = key;
  40643. _this.options = options || {};
  40644. _this.state = "initialized";
  40645. _this.connection = null;
  40646. _this.usingTLS = !!options.useTLS;
  40647. _this.timeline = _this.options.timeline;
  40648. _this.errorCallbacks = _this.buildErrorCallbacks();
  40649. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40650. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40651. var Network = runtime.getNetwork();
  40652. Network.bind("online", function () {
  40653. _this.timeline.info({ netinfo: "online" });
  40654. if (_this.state === "connecting" || _this.state === "unavailable") {
  40655. _this.retryIn(0);
  40656. }
  40657. });
  40658. Network.bind("offline", function () {
  40659. _this.timeline.info({ netinfo: "offline" });
  40660. if (_this.connection) {
  40661. _this.sendActivityCheck();
  40662. }
  40663. });
  40664. _this.updateStrategy();
  40665. return _this;
  40666. }
  40667. ConnectionManager.prototype.connect = function () {
  40668. if (this.connection || this.runner) {
  40669. return;
  40670. }
  40671. if (!this.strategy.isSupported()) {
  40672. this.updateState("failed");
  40673. return;
  40674. }
  40675. this.updateState("connecting");
  40676. this.startConnecting();
  40677. this.setUnavailableTimer();
  40678. };
  40679. ;
  40680. ConnectionManager.prototype.send = function (data) {
  40681. if (this.connection) {
  40682. return this.connection.send(data);
  40683. }
  40684. else {
  40685. return false;
  40686. }
  40687. };
  40688. ;
  40689. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40690. if (this.connection) {
  40691. return this.connection.send_event(name, data, channel);
  40692. }
  40693. else {
  40694. return false;
  40695. }
  40696. };
  40697. ;
  40698. ConnectionManager.prototype.disconnect = function () {
  40699. this.disconnectInternally();
  40700. this.updateState("disconnected");
  40701. };
  40702. ;
  40703. ConnectionManager.prototype.isUsingTLS = function () {
  40704. return this.usingTLS;
  40705. };
  40706. ;
  40707. ConnectionManager.prototype.startConnecting = function () {
  40708. var _this = this;
  40709. var callback = function (error, handshake) {
  40710. if (error) {
  40711. _this.runner = _this.strategy.connect(0, callback);
  40712. }
  40713. else {
  40714. if (handshake.action === "error") {
  40715. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40716. _this.timeline.error({ handshakeError: handshake.error });
  40717. }
  40718. else {
  40719. _this.abortConnecting();
  40720. _this.handshakeCallbacks[handshake.action](handshake);
  40721. }
  40722. }
  40723. };
  40724. this.runner = this.strategy.connect(0, callback);
  40725. };
  40726. ;
  40727. ConnectionManager.prototype.abortConnecting = function () {
  40728. if (this.runner) {
  40729. this.runner.abort();
  40730. this.runner = null;
  40731. }
  40732. };
  40733. ;
  40734. ConnectionManager.prototype.disconnectInternally = function () {
  40735. this.abortConnecting();
  40736. this.clearRetryTimer();
  40737. this.clearUnavailableTimer();
  40738. if (this.connection) {
  40739. var connection = this.abandonConnection();
  40740. connection.close();
  40741. }
  40742. };
  40743. ;
  40744. ConnectionManager.prototype.updateStrategy = function () {
  40745. this.strategy = this.options.getStrategy({
  40746. key: this.key,
  40747. timeline: this.timeline,
  40748. useTLS: this.usingTLS
  40749. });
  40750. };
  40751. ;
  40752. ConnectionManager.prototype.retryIn = function (delay) {
  40753. var _this = this;
  40754. this.timeline.info({ action: "retry", delay: delay });
  40755. if (delay > 0) {
  40756. this.emit("connecting_in", Math.round(delay / 1000));
  40757. }
  40758. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40759. _this.disconnectInternally();
  40760. _this.connect();
  40761. });
  40762. };
  40763. ;
  40764. ConnectionManager.prototype.clearRetryTimer = function () {
  40765. if (this.retryTimer) {
  40766. this.retryTimer.ensureAborted();
  40767. this.retryTimer = null;
  40768. }
  40769. };
  40770. ;
  40771. ConnectionManager.prototype.setUnavailableTimer = function () {
  40772. var _this = this;
  40773. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40774. _this.updateState("unavailable");
  40775. });
  40776. };
  40777. ;
  40778. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40779. if (this.unavailableTimer) {
  40780. this.unavailableTimer.ensureAborted();
  40781. }
  40782. };
  40783. ;
  40784. ConnectionManager.prototype.sendActivityCheck = function () {
  40785. var _this = this;
  40786. this.stopActivityCheck();
  40787. this.connection.ping();
  40788. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40789. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40790. _this.retryIn(0);
  40791. });
  40792. };
  40793. ;
  40794. ConnectionManager.prototype.resetActivityCheck = function () {
  40795. var _this = this;
  40796. this.stopActivityCheck();
  40797. if (this.connection && !this.connection.handlesActivityChecks()) {
  40798. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40799. _this.sendActivityCheck();
  40800. });
  40801. }
  40802. };
  40803. ;
  40804. ConnectionManager.prototype.stopActivityCheck = function () {
  40805. if (this.activityTimer) {
  40806. this.activityTimer.ensureAborted();
  40807. }
  40808. };
  40809. ;
  40810. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40811. var _this = this;
  40812. return extend({}, errorCallbacks, {
  40813. message: function (message) {
  40814. _this.resetActivityCheck();
  40815. _this.emit('message', message);
  40816. },
  40817. ping: function () {
  40818. _this.send_event('pusher:pong', {});
  40819. },
  40820. activity: function () {
  40821. _this.resetActivityCheck();
  40822. },
  40823. error: function (error) {
  40824. _this.emit("error", { type: "WebSocketError", error: error });
  40825. },
  40826. closed: function () {
  40827. _this.abandonConnection();
  40828. if (_this.shouldRetry()) {
  40829. _this.retryIn(1000);
  40830. }
  40831. }
  40832. });
  40833. };
  40834. ;
  40835. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40836. var _this = this;
  40837. return extend({}, errorCallbacks, {
  40838. connected: function (handshake) {
  40839. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40840. _this.clearUnavailableTimer();
  40841. _this.setConnection(handshake.connection);
  40842. _this.socket_id = _this.connection.id;
  40843. _this.updateState("connected", { socket_id: _this.socket_id });
  40844. }
  40845. });
  40846. };
  40847. ;
  40848. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40849. var _this = this;
  40850. var withErrorEmitted = function (callback) {
  40851. return function (result) {
  40852. if (result.error) {
  40853. _this.emit("error", { type: "WebSocketError", error: result.error });
  40854. }
  40855. callback(result);
  40856. };
  40857. };
  40858. return {
  40859. tls_only: withErrorEmitted(function () {
  40860. _this.usingTLS = true;
  40861. _this.updateStrategy();
  40862. _this.retryIn(0);
  40863. }),
  40864. refused: withErrorEmitted(function () {
  40865. _this.disconnect();
  40866. }),
  40867. backoff: withErrorEmitted(function () {
  40868. _this.retryIn(1000);
  40869. }),
  40870. retry: withErrorEmitted(function () {
  40871. _this.retryIn(0);
  40872. })
  40873. };
  40874. };
  40875. ;
  40876. ConnectionManager.prototype.setConnection = function (connection) {
  40877. this.connection = connection;
  40878. for (var event in this.connectionCallbacks) {
  40879. this.connection.bind(event, this.connectionCallbacks[event]);
  40880. }
  40881. this.resetActivityCheck();
  40882. };
  40883. ;
  40884. ConnectionManager.prototype.abandonConnection = function () {
  40885. if (!this.connection) {
  40886. return;
  40887. }
  40888. this.stopActivityCheck();
  40889. for (var event in this.connectionCallbacks) {
  40890. this.connection.unbind(event, this.connectionCallbacks[event]);
  40891. }
  40892. var connection = this.connection;
  40893. this.connection = null;
  40894. return connection;
  40895. };
  40896. ConnectionManager.prototype.updateState = function (newState, data) {
  40897. var previousState = this.state;
  40898. this.state = newState;
  40899. if (previousState !== newState) {
  40900. var newStateDescription = newState;
  40901. if (newStateDescription === "connected") {
  40902. newStateDescription += " with new socket ID " + data.socket_id;
  40903. }
  40904. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40905. this.timeline.info({ state: newState, params: data });
  40906. this.emit('state_change', { previous: previousState, current: newState });
  40907. this.emit(newState, data);
  40908. }
  40909. };
  40910. ConnectionManager.prototype.shouldRetry = function () {
  40911. return this.state === "connecting" || this.state === "connected";
  40912. };
  40913. return ConnectionManager;
  40914. }(dispatcher));
  40915. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40916. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40917. var channels_Channels = (function () {
  40918. function Channels() {
  40919. this.channels = {};
  40920. }
  40921. Channels.prototype.add = function (name, pusher) {
  40922. if (!this.channels[name]) {
  40923. this.channels[name] = createChannel(name, pusher);
  40924. }
  40925. return this.channels[name];
  40926. };
  40927. Channels.prototype.all = function () {
  40928. return values(this.channels);
  40929. };
  40930. Channels.prototype.find = function (name) {
  40931. return this.channels[name];
  40932. };
  40933. Channels.prototype.remove = function (name) {
  40934. var channel = this.channels[name];
  40935. delete this.channels[name];
  40936. return channel;
  40937. };
  40938. Channels.prototype.disconnect = function () {
  40939. objectApply(this.channels, function (channel) {
  40940. channel.disconnect();
  40941. });
  40942. };
  40943. return Channels;
  40944. }());
  40945. /* harmony default export */ var channels = (channels_Channels);
  40946. function createChannel(name, pusher) {
  40947. if (name.indexOf('private-encrypted-') === 0) {
  40948. if (false) { var errorMsg; }
  40949. return factory.createEncryptedChannel(name, pusher);
  40950. }
  40951. else if (name.indexOf('private-') === 0) {
  40952. return factory.createPrivateChannel(name, pusher);
  40953. }
  40954. else if (name.indexOf('presence-') === 0) {
  40955. return factory.createPresenceChannel(name, pusher);
  40956. }
  40957. else {
  40958. return factory.createChannel(name, pusher);
  40959. }
  40960. }
  40961. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40962. var Factory = {
  40963. createChannels: function () {
  40964. return new channels();
  40965. },
  40966. createConnectionManager: function (key, options) {
  40967. return new connection_manager(key, options);
  40968. },
  40969. createChannel: function (name, pusher) {
  40970. return new channels_channel(name, pusher);
  40971. },
  40972. createPrivateChannel: function (name, pusher) {
  40973. return new private_channel(name, pusher);
  40974. },
  40975. createPresenceChannel: function (name, pusher) {
  40976. return new presence_channel(name, pusher);
  40977. },
  40978. createEncryptedChannel: function (name, pusher) {
  40979. return new encrypted_channel(name, pusher);
  40980. },
  40981. createTimelineSender: function (timeline, options) {
  40982. return new timeline_sender(timeline, options);
  40983. },
  40984. createAuthorizer: function (channel, options) {
  40985. if (options.authorizer) {
  40986. return options.authorizer(channel, options);
  40987. }
  40988. return new pusher_authorizer(channel, options);
  40989. },
  40990. createHandshake: function (transport, callback) {
  40991. return new connection_handshake(transport, callback);
  40992. },
  40993. createAssistantToTheTransportManager: function (manager, transport, options) {
  40994. return new assistant_to_the_transport_manager(manager, transport, options);
  40995. }
  40996. };
  40997. /* harmony default export */ var factory = (Factory);
  40998. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  40999. var transport_manager_TransportManager = (function () {
  41000. function TransportManager(options) {
  41001. this.options = options || {};
  41002. this.livesLeft = this.options.lives || Infinity;
  41003. }
  41004. TransportManager.prototype.getAssistant = function (transport) {
  41005. return factory.createAssistantToTheTransportManager(this, transport, {
  41006. minPingDelay: this.options.minPingDelay,
  41007. maxPingDelay: this.options.maxPingDelay
  41008. });
  41009. };
  41010. TransportManager.prototype.isAlive = function () {
  41011. return this.livesLeft > 0;
  41012. };
  41013. TransportManager.prototype.reportDeath = function () {
  41014. this.livesLeft -= 1;
  41015. };
  41016. return TransportManager;
  41017. }());
  41018. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41019. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41020. var sequential_strategy_SequentialStrategy = (function () {
  41021. function SequentialStrategy(strategies, options) {
  41022. this.strategies = strategies;
  41023. this.loop = Boolean(options.loop);
  41024. this.failFast = Boolean(options.failFast);
  41025. this.timeout = options.timeout;
  41026. this.timeoutLimit = options.timeoutLimit;
  41027. }
  41028. SequentialStrategy.prototype.isSupported = function () {
  41029. return any(this.strategies, util.method("isSupported"));
  41030. };
  41031. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41032. var _this = this;
  41033. var strategies = this.strategies;
  41034. var current = 0;
  41035. var timeout = this.timeout;
  41036. var runner = null;
  41037. var tryNextStrategy = function (error, handshake) {
  41038. if (handshake) {
  41039. callback(null, handshake);
  41040. }
  41041. else {
  41042. current = current + 1;
  41043. if (_this.loop) {
  41044. current = current % strategies.length;
  41045. }
  41046. if (current < strategies.length) {
  41047. if (timeout) {
  41048. timeout = timeout * 2;
  41049. if (_this.timeoutLimit) {
  41050. timeout = Math.min(timeout, _this.timeoutLimit);
  41051. }
  41052. }
  41053. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41054. }
  41055. else {
  41056. callback(true);
  41057. }
  41058. }
  41059. };
  41060. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41061. return {
  41062. abort: function () {
  41063. runner.abort();
  41064. },
  41065. forceMinPriority: function (p) {
  41066. minPriority = p;
  41067. if (runner) {
  41068. runner.forceMinPriority(p);
  41069. }
  41070. }
  41071. };
  41072. };
  41073. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41074. var timer = null;
  41075. var runner = null;
  41076. if (options.timeout > 0) {
  41077. timer = new OneOffTimer(options.timeout, function () {
  41078. runner.abort();
  41079. callback(true);
  41080. });
  41081. }
  41082. runner = strategy.connect(minPriority, function (error, handshake) {
  41083. if (error && timer && timer.isRunning() && !options.failFast) {
  41084. return;
  41085. }
  41086. if (timer) {
  41087. timer.ensureAborted();
  41088. }
  41089. callback(error, handshake);
  41090. });
  41091. return {
  41092. abort: function () {
  41093. if (timer) {
  41094. timer.ensureAborted();
  41095. }
  41096. runner.abort();
  41097. },
  41098. forceMinPriority: function (p) {
  41099. runner.forceMinPriority(p);
  41100. }
  41101. };
  41102. };
  41103. return SequentialStrategy;
  41104. }());
  41105. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41106. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41107. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41108. function BestConnectedEverStrategy(strategies) {
  41109. this.strategies = strategies;
  41110. }
  41111. BestConnectedEverStrategy.prototype.isSupported = function () {
  41112. return any(this.strategies, util.method("isSupported"));
  41113. };
  41114. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41115. return connect(this.strategies, minPriority, function (i, runners) {
  41116. return function (error, handshake) {
  41117. runners[i].error = error;
  41118. if (error) {
  41119. if (allRunnersFailed(runners)) {
  41120. callback(true);
  41121. }
  41122. return;
  41123. }
  41124. apply(runners, function (runner) {
  41125. runner.forceMinPriority(handshake.transport.priority);
  41126. });
  41127. callback(null, handshake);
  41128. };
  41129. });
  41130. };
  41131. return BestConnectedEverStrategy;
  41132. }());
  41133. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41134. function connect(strategies, minPriority, callbackBuilder) {
  41135. var runners = map(strategies, function (strategy, i, _, rs) {
  41136. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41137. });
  41138. return {
  41139. abort: function () {
  41140. apply(runners, abortRunner);
  41141. },
  41142. forceMinPriority: function (p) {
  41143. apply(runners, function (runner) {
  41144. runner.forceMinPriority(p);
  41145. });
  41146. }
  41147. };
  41148. }
  41149. function allRunnersFailed(runners) {
  41150. return collections_all(runners, function (runner) {
  41151. return Boolean(runner.error);
  41152. });
  41153. }
  41154. function abortRunner(runner) {
  41155. if (!runner.error && !runner.aborted) {
  41156. runner.abort();
  41157. runner.aborted = true;
  41158. }
  41159. }
  41160. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41161. var cached_strategy_CachedStrategy = (function () {
  41162. function CachedStrategy(strategy, transports, options) {
  41163. this.strategy = strategy;
  41164. this.transports = transports;
  41165. this.ttl = options.ttl || 1800 * 1000;
  41166. this.usingTLS = options.useTLS;
  41167. this.timeline = options.timeline;
  41168. }
  41169. CachedStrategy.prototype.isSupported = function () {
  41170. return this.strategy.isSupported();
  41171. };
  41172. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41173. var usingTLS = this.usingTLS;
  41174. var info = fetchTransportCache(usingTLS);
  41175. var strategies = [this.strategy];
  41176. if (info && info.timestamp + this.ttl >= util.now()) {
  41177. var transport = this.transports[info.transport];
  41178. if (transport) {
  41179. this.timeline.info({
  41180. cached: true,
  41181. transport: info.transport,
  41182. latency: info.latency
  41183. });
  41184. strategies.push(new sequential_strategy([transport], {
  41185. timeout: info.latency * 2 + 1000,
  41186. failFast: true
  41187. }));
  41188. }
  41189. }
  41190. var startTimestamp = util.now();
  41191. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41192. if (error) {
  41193. flushTransportCache(usingTLS);
  41194. if (strategies.length > 0) {
  41195. startTimestamp = util.now();
  41196. runner = strategies.pop().connect(minPriority, cb);
  41197. }
  41198. else {
  41199. callback(error);
  41200. }
  41201. }
  41202. else {
  41203. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41204. callback(null, handshake);
  41205. }
  41206. });
  41207. return {
  41208. abort: function () {
  41209. runner.abort();
  41210. },
  41211. forceMinPriority: function (p) {
  41212. minPriority = p;
  41213. if (runner) {
  41214. runner.forceMinPriority(p);
  41215. }
  41216. }
  41217. };
  41218. };
  41219. return CachedStrategy;
  41220. }());
  41221. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41222. function getTransportCacheKey(usingTLS) {
  41223. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41224. }
  41225. function fetchTransportCache(usingTLS) {
  41226. var storage = runtime.getLocalStorage();
  41227. if (storage) {
  41228. try {
  41229. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41230. if (serializedCache) {
  41231. return JSON.parse(serializedCache);
  41232. }
  41233. }
  41234. catch (e) {
  41235. flushTransportCache(usingTLS);
  41236. }
  41237. }
  41238. return null;
  41239. }
  41240. function storeTransportCache(usingTLS, transport, latency) {
  41241. var storage = runtime.getLocalStorage();
  41242. if (storage) {
  41243. try {
  41244. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41245. timestamp: util.now(),
  41246. transport: transport,
  41247. latency: latency
  41248. });
  41249. }
  41250. catch (e) {
  41251. }
  41252. }
  41253. }
  41254. function flushTransportCache(usingTLS) {
  41255. var storage = runtime.getLocalStorage();
  41256. if (storage) {
  41257. try {
  41258. delete storage[getTransportCacheKey(usingTLS)];
  41259. }
  41260. catch (e) {
  41261. }
  41262. }
  41263. }
  41264. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41265. var delayed_strategy_DelayedStrategy = (function () {
  41266. function DelayedStrategy(strategy, _a) {
  41267. var number = _a.delay;
  41268. this.strategy = strategy;
  41269. this.options = { delay: number };
  41270. }
  41271. DelayedStrategy.prototype.isSupported = function () {
  41272. return this.strategy.isSupported();
  41273. };
  41274. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41275. var strategy = this.strategy;
  41276. var runner;
  41277. var timer = new OneOffTimer(this.options.delay, function () {
  41278. runner = strategy.connect(minPriority, callback);
  41279. });
  41280. return {
  41281. abort: function () {
  41282. timer.ensureAborted();
  41283. if (runner) {
  41284. runner.abort();
  41285. }
  41286. },
  41287. forceMinPriority: function (p) {
  41288. minPriority = p;
  41289. if (runner) {
  41290. runner.forceMinPriority(p);
  41291. }
  41292. }
  41293. };
  41294. };
  41295. return DelayedStrategy;
  41296. }());
  41297. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41298. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41299. var IfStrategy = (function () {
  41300. function IfStrategy(test, trueBranch, falseBranch) {
  41301. this.test = test;
  41302. this.trueBranch = trueBranch;
  41303. this.falseBranch = falseBranch;
  41304. }
  41305. IfStrategy.prototype.isSupported = function () {
  41306. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41307. return branch.isSupported();
  41308. };
  41309. IfStrategy.prototype.connect = function (minPriority, callback) {
  41310. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41311. return branch.connect(minPriority, callback);
  41312. };
  41313. return IfStrategy;
  41314. }());
  41315. /* harmony default export */ var if_strategy = (IfStrategy);
  41316. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41317. var FirstConnectedStrategy = (function () {
  41318. function FirstConnectedStrategy(strategy) {
  41319. this.strategy = strategy;
  41320. }
  41321. FirstConnectedStrategy.prototype.isSupported = function () {
  41322. return this.strategy.isSupported();
  41323. };
  41324. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41325. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41326. if (handshake) {
  41327. runner.abort();
  41328. }
  41329. callback(error, handshake);
  41330. });
  41331. return runner;
  41332. };
  41333. return FirstConnectedStrategy;
  41334. }());
  41335. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41336. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41337. function testSupportsStrategy(strategy) {
  41338. return function () {
  41339. return strategy.isSupported();
  41340. };
  41341. }
  41342. var getDefaultStrategy = function (config, defineTransport) {
  41343. var definedTransports = {};
  41344. function defineTransportStrategy(name, type, priority, options, manager) {
  41345. var transport = defineTransport(config, name, type, priority, options, manager);
  41346. definedTransports[name] = transport;
  41347. return transport;
  41348. }
  41349. var ws_options = {
  41350. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41351. hostTLS: config.wsHost + ":" + config.wssPort,
  41352. httpPath: config.wsPath
  41353. };
  41354. var wss_options = extend({}, ws_options, {
  41355. useTLS: true
  41356. });
  41357. var sockjs_options = {
  41358. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41359. hostTLS: config.httpHost + ":" + config.httpsPort,
  41360. httpPath: config.httpPath
  41361. };
  41362. var timeouts = {
  41363. loop: true,
  41364. timeout: 15000,
  41365. timeoutLimit: 60000
  41366. };
  41367. var ws_manager = new transport_manager({
  41368. lives: 2,
  41369. minPingDelay: 10000,
  41370. maxPingDelay: config.activity_timeout
  41371. });
  41372. var streaming_manager = new transport_manager({
  41373. lives: 2,
  41374. minPingDelay: 10000,
  41375. maxPingDelay: config.activity_timeout
  41376. });
  41377. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41378. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41379. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41380. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41381. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41382. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41383. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41384. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41385. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41386. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41387. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41388. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41389. 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);
  41390. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41391. var wsStrategy;
  41392. if (config.useTLS) {
  41393. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41394. }
  41395. else {
  41396. wsStrategy = new best_connected_ever_strategy([
  41397. ws_loop,
  41398. new delayed_strategy(wss_loop, { delay: 2000 }),
  41399. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41400. ]);
  41401. }
  41402. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41403. ttl: 1800000,
  41404. timeline: config.timeline,
  41405. useTLS: config.useTLS
  41406. });
  41407. };
  41408. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41409. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41410. /* harmony default export */ var transport_connection_initializer = (function () {
  41411. var self = this;
  41412. self.timeline.info(self.buildTimelineMessage({
  41413. transport: self.name + (self.options.useTLS ? "s" : "")
  41414. }));
  41415. if (self.hooks.isInitialized()) {
  41416. self.changeState("initialized");
  41417. }
  41418. else if (self.hooks.file) {
  41419. self.changeState("initializing");
  41420. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41421. if (self.hooks.isInitialized()) {
  41422. self.changeState("initialized");
  41423. callback(true);
  41424. }
  41425. else {
  41426. if (error) {
  41427. self.onError(error);
  41428. }
  41429. self.onClose();
  41430. callback(false);
  41431. }
  41432. });
  41433. }
  41434. else {
  41435. self.onClose();
  41436. }
  41437. });
  41438. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41439. var http_xdomain_request_hooks = {
  41440. getRequest: function (socket) {
  41441. var xdr = new window.XDomainRequest();
  41442. xdr.ontimeout = function () {
  41443. socket.emit("error", new RequestTimedOut());
  41444. socket.close();
  41445. };
  41446. xdr.onerror = function (e) {
  41447. socket.emit("error", e);
  41448. socket.close();
  41449. };
  41450. xdr.onprogress = function () {
  41451. if (xdr.responseText && xdr.responseText.length > 0) {
  41452. socket.onChunk(200, xdr.responseText);
  41453. }
  41454. };
  41455. xdr.onload = function () {
  41456. if (xdr.responseText && xdr.responseText.length > 0) {
  41457. socket.onChunk(200, xdr.responseText);
  41458. }
  41459. socket.emit("finished", 200);
  41460. socket.close();
  41461. };
  41462. return xdr;
  41463. },
  41464. abortRequest: function (xdr) {
  41465. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41466. xdr.abort();
  41467. }
  41468. };
  41469. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41470. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41471. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41472. var extendStatics = function (d, b) {
  41473. extendStatics = Object.setPrototypeOf ||
  41474. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41475. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41476. return extendStatics(d, b);
  41477. };
  41478. return function (d, b) {
  41479. extendStatics(d, b);
  41480. function __() { this.constructor = d; }
  41481. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41482. };
  41483. })();
  41484. var MAX_BUFFER_LENGTH = 256 * 1024;
  41485. var http_request_HTTPRequest = (function (_super) {
  41486. http_request_extends(HTTPRequest, _super);
  41487. function HTTPRequest(hooks, method, url) {
  41488. var _this = _super.call(this) || this;
  41489. _this.hooks = hooks;
  41490. _this.method = method;
  41491. _this.url = url;
  41492. return _this;
  41493. }
  41494. HTTPRequest.prototype.start = function (payload) {
  41495. var _this = this;
  41496. this.position = 0;
  41497. this.xhr = this.hooks.getRequest(this);
  41498. this.unloader = function () {
  41499. _this.close();
  41500. };
  41501. runtime.addUnloadListener(this.unloader);
  41502. this.xhr.open(this.method, this.url, true);
  41503. if (this.xhr.setRequestHeader) {
  41504. this.xhr.setRequestHeader("Content-Type", "application/json");
  41505. }
  41506. this.xhr.send(payload);
  41507. };
  41508. HTTPRequest.prototype.close = function () {
  41509. if (this.unloader) {
  41510. runtime.removeUnloadListener(this.unloader);
  41511. this.unloader = null;
  41512. }
  41513. if (this.xhr) {
  41514. this.hooks.abortRequest(this.xhr);
  41515. this.xhr = null;
  41516. }
  41517. };
  41518. HTTPRequest.prototype.onChunk = function (status, data) {
  41519. while (true) {
  41520. var chunk = this.advanceBuffer(data);
  41521. if (chunk) {
  41522. this.emit("chunk", { status: status, data: chunk });
  41523. }
  41524. else {
  41525. break;
  41526. }
  41527. }
  41528. if (this.isBufferTooLong(data)) {
  41529. this.emit("buffer_too_long");
  41530. }
  41531. };
  41532. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41533. var unreadData = buffer.slice(this.position);
  41534. var endOfLinePosition = unreadData.indexOf("\n");
  41535. if (endOfLinePosition !== -1) {
  41536. this.position += endOfLinePosition + 1;
  41537. return unreadData.slice(0, endOfLinePosition);
  41538. }
  41539. else {
  41540. return null;
  41541. }
  41542. };
  41543. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41544. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41545. };
  41546. return HTTPRequest;
  41547. }(dispatcher));
  41548. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41549. // CONCATENATED MODULE: ./src/core/http/state.ts
  41550. var State;
  41551. (function (State) {
  41552. State[State["CONNECTING"] = 0] = "CONNECTING";
  41553. State[State["OPEN"] = 1] = "OPEN";
  41554. State[State["CLOSED"] = 3] = "CLOSED";
  41555. })(State || (State = {}));
  41556. /* harmony default export */ var state = (State);
  41557. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41558. var autoIncrement = 1;
  41559. var http_socket_HTTPSocket = (function () {
  41560. function HTTPSocket(hooks, url) {
  41561. this.hooks = hooks;
  41562. this.session = randomNumber(1000) + "/" + randomString(8);
  41563. this.location = getLocation(url);
  41564. this.readyState = state.CONNECTING;
  41565. this.openStream();
  41566. }
  41567. HTTPSocket.prototype.send = function (payload) {
  41568. return this.sendRaw(JSON.stringify([payload]));
  41569. };
  41570. HTTPSocket.prototype.ping = function () {
  41571. this.hooks.sendHeartbeat(this);
  41572. };
  41573. HTTPSocket.prototype.close = function (code, reason) {
  41574. this.onClose(code, reason, true);
  41575. };
  41576. HTTPSocket.prototype.sendRaw = function (payload) {
  41577. if (this.readyState === state.OPEN) {
  41578. try {
  41579. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41580. return true;
  41581. }
  41582. catch (e) {
  41583. return false;
  41584. }
  41585. }
  41586. else {
  41587. return false;
  41588. }
  41589. };
  41590. HTTPSocket.prototype.reconnect = function () {
  41591. this.closeStream();
  41592. this.openStream();
  41593. };
  41594. ;
  41595. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41596. this.closeStream();
  41597. this.readyState = state.CLOSED;
  41598. if (this.onclose) {
  41599. this.onclose({
  41600. code: code,
  41601. reason: reason,
  41602. wasClean: wasClean
  41603. });
  41604. }
  41605. };
  41606. HTTPSocket.prototype.onChunk = function (chunk) {
  41607. if (chunk.status !== 200) {
  41608. return;
  41609. }
  41610. if (this.readyState === state.OPEN) {
  41611. this.onActivity();
  41612. }
  41613. var payload;
  41614. var type = chunk.data.slice(0, 1);
  41615. switch (type) {
  41616. case 'o':
  41617. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41618. this.onOpen(payload);
  41619. break;
  41620. case 'a':
  41621. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41622. for (var i = 0; i < payload.length; i++) {
  41623. this.onEvent(payload[i]);
  41624. }
  41625. break;
  41626. case 'm':
  41627. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41628. this.onEvent(payload);
  41629. break;
  41630. case 'h':
  41631. this.hooks.onHeartbeat(this);
  41632. break;
  41633. case 'c':
  41634. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41635. this.onClose(payload[0], payload[1], true);
  41636. break;
  41637. }
  41638. };
  41639. HTTPSocket.prototype.onOpen = function (options) {
  41640. if (this.readyState === state.CONNECTING) {
  41641. if (options && options.hostname) {
  41642. this.location.base = replaceHost(this.location.base, options.hostname);
  41643. }
  41644. this.readyState = state.OPEN;
  41645. if (this.onopen) {
  41646. this.onopen();
  41647. }
  41648. }
  41649. else {
  41650. this.onClose(1006, "Server lost session", true);
  41651. }
  41652. };
  41653. HTTPSocket.prototype.onEvent = function (event) {
  41654. if (this.readyState === state.OPEN && this.onmessage) {
  41655. this.onmessage({ data: event });
  41656. }
  41657. };
  41658. HTTPSocket.prototype.onActivity = function () {
  41659. if (this.onactivity) {
  41660. this.onactivity();
  41661. }
  41662. };
  41663. HTTPSocket.prototype.onError = function (error) {
  41664. if (this.onerror) {
  41665. this.onerror(error);
  41666. }
  41667. };
  41668. HTTPSocket.prototype.openStream = function () {
  41669. var _this = this;
  41670. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41671. this.stream.bind("chunk", function (chunk) {
  41672. _this.onChunk(chunk);
  41673. });
  41674. this.stream.bind("finished", function (status) {
  41675. _this.hooks.onFinished(_this, status);
  41676. });
  41677. this.stream.bind("buffer_too_long", function () {
  41678. _this.reconnect();
  41679. });
  41680. try {
  41681. this.stream.start();
  41682. }
  41683. catch (error) {
  41684. util.defer(function () {
  41685. _this.onError(error);
  41686. _this.onClose(1006, "Could not start streaming", false);
  41687. });
  41688. }
  41689. };
  41690. HTTPSocket.prototype.closeStream = function () {
  41691. if (this.stream) {
  41692. this.stream.unbind_all();
  41693. this.stream.close();
  41694. this.stream = null;
  41695. }
  41696. };
  41697. return HTTPSocket;
  41698. }());
  41699. function getLocation(url) {
  41700. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41701. return {
  41702. base: parts[1],
  41703. queryString: parts[2]
  41704. };
  41705. }
  41706. function getSendURL(url, session) {
  41707. return url.base + "/" + session + "/xhr_send";
  41708. }
  41709. function getUniqueURL(url) {
  41710. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41711. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41712. }
  41713. function replaceHost(url, hostname) {
  41714. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41715. return urlParts[1] + hostname + urlParts[3];
  41716. }
  41717. function randomNumber(max) {
  41718. return Math.floor(Math.random() * max);
  41719. }
  41720. function randomString(length) {
  41721. var result = [];
  41722. for (var i = 0; i < length; i++) {
  41723. result.push(randomNumber(32).toString(32));
  41724. }
  41725. return result.join('');
  41726. }
  41727. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41728. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41729. var http_streaming_socket_hooks = {
  41730. getReceiveURL: function (url, session) {
  41731. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41732. },
  41733. onHeartbeat: function (socket) {
  41734. socket.sendRaw("[]");
  41735. },
  41736. sendHeartbeat: function (socket) {
  41737. socket.sendRaw("[]");
  41738. },
  41739. onFinished: function (socket, status) {
  41740. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41741. }
  41742. };
  41743. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41744. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41745. var http_polling_socket_hooks = {
  41746. getReceiveURL: function (url, session) {
  41747. return url.base + "/" + session + "/xhr" + url.queryString;
  41748. },
  41749. onHeartbeat: function () {
  41750. },
  41751. sendHeartbeat: function (socket) {
  41752. socket.sendRaw("[]");
  41753. },
  41754. onFinished: function (socket, status) {
  41755. if (status === 200) {
  41756. socket.reconnect();
  41757. }
  41758. else {
  41759. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41760. }
  41761. }
  41762. };
  41763. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41764. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41765. var http_xhr_request_hooks = {
  41766. getRequest: function (socket) {
  41767. var Constructor = runtime.getXHRAPI();
  41768. var xhr = new Constructor();
  41769. xhr.onreadystatechange = xhr.onprogress = function () {
  41770. switch (xhr.readyState) {
  41771. case 3:
  41772. if (xhr.responseText && xhr.responseText.length > 0) {
  41773. socket.onChunk(xhr.status, xhr.responseText);
  41774. }
  41775. break;
  41776. case 4:
  41777. if (xhr.responseText && xhr.responseText.length > 0) {
  41778. socket.onChunk(xhr.status, xhr.responseText);
  41779. }
  41780. socket.emit("finished", xhr.status);
  41781. socket.close();
  41782. break;
  41783. }
  41784. };
  41785. return xhr;
  41786. },
  41787. abortRequest: function (xhr) {
  41788. xhr.onreadystatechange = null;
  41789. xhr.abort();
  41790. }
  41791. };
  41792. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41793. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41794. var HTTP = {
  41795. createStreamingSocket: function (url) {
  41796. return this.createSocket(http_streaming_socket, url);
  41797. },
  41798. createPollingSocket: function (url) {
  41799. return this.createSocket(http_polling_socket, url);
  41800. },
  41801. createSocket: function (hooks, url) {
  41802. return new http_socket(hooks, url);
  41803. },
  41804. createXHR: function (method, url) {
  41805. return this.createRequest(http_xhr_request, method, url);
  41806. },
  41807. createRequest: function (hooks, method, url) {
  41808. return new http_request(hooks, method, url);
  41809. }
  41810. };
  41811. /* harmony default export */ var http_http = (HTTP);
  41812. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41813. http_http.createXDR = function (method, url) {
  41814. return this.createRequest(http_xdomain_request, method, url);
  41815. };
  41816. /* harmony default export */ var web_http_http = (http_http);
  41817. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41818. var Runtime = {
  41819. nextAuthCallbackID: 1,
  41820. auth_callbacks: {},
  41821. ScriptReceivers: ScriptReceivers,
  41822. DependenciesReceivers: DependenciesReceivers,
  41823. getDefaultStrategy: default_strategy,
  41824. Transports: transports_transports,
  41825. transportConnectionInitializer: transport_connection_initializer,
  41826. HTTPFactory: web_http_http,
  41827. TimelineTransport: jsonp_timeline,
  41828. getXHRAPI: function () {
  41829. return window.XMLHttpRequest;
  41830. },
  41831. getWebSocketAPI: function () {
  41832. return window.WebSocket || window.MozWebSocket;
  41833. },
  41834. setup: function (PusherClass) {
  41835. var _this = this;
  41836. window.Pusher = PusherClass;
  41837. var initializeOnDocumentBody = function () {
  41838. _this.onDocumentBody(PusherClass.ready);
  41839. };
  41840. if (!window.JSON) {
  41841. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41842. }
  41843. else {
  41844. initializeOnDocumentBody();
  41845. }
  41846. },
  41847. getDocument: function () {
  41848. return document;
  41849. },
  41850. getProtocol: function () {
  41851. return this.getDocument().location.protocol;
  41852. },
  41853. getAuthorizers: function () {
  41854. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41855. },
  41856. onDocumentBody: function (callback) {
  41857. var _this = this;
  41858. if (document.body) {
  41859. callback();
  41860. }
  41861. else {
  41862. setTimeout(function () {
  41863. _this.onDocumentBody(callback);
  41864. }, 0);
  41865. }
  41866. },
  41867. createJSONPRequest: function (url, data) {
  41868. return new jsonp_request(url, data);
  41869. },
  41870. createScriptRequest: function (src) {
  41871. return new script_request(src);
  41872. },
  41873. getLocalStorage: function () {
  41874. try {
  41875. return window.localStorage;
  41876. }
  41877. catch (e) {
  41878. return undefined;
  41879. }
  41880. },
  41881. createXHR: function () {
  41882. if (this.getXHRAPI()) {
  41883. return this.createXMLHttpRequest();
  41884. }
  41885. else {
  41886. return this.createMicrosoftXHR();
  41887. }
  41888. },
  41889. createXMLHttpRequest: function () {
  41890. var Constructor = this.getXHRAPI();
  41891. return new Constructor();
  41892. },
  41893. createMicrosoftXHR: function () {
  41894. return new ActiveXObject("Microsoft.XMLHTTP");
  41895. },
  41896. getNetwork: function () {
  41897. return net_info_Network;
  41898. },
  41899. createWebSocket: function (url) {
  41900. var Constructor = this.getWebSocketAPI();
  41901. return new Constructor(url);
  41902. },
  41903. createSocketRequest: function (method, url) {
  41904. if (this.isXHRSupported()) {
  41905. return this.HTTPFactory.createXHR(method, url);
  41906. }
  41907. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41908. return this.HTTPFactory.createXDR(method, url);
  41909. }
  41910. else {
  41911. throw "Cross-origin HTTP requests are not supported";
  41912. }
  41913. },
  41914. isXHRSupported: function () {
  41915. var Constructor = this.getXHRAPI();
  41916. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41917. },
  41918. isXDRSupported: function (useTLS) {
  41919. var protocol = useTLS ? "https:" : "http:";
  41920. var documentProtocol = this.getProtocol();
  41921. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41922. },
  41923. addUnloadListener: function (listener) {
  41924. if (window.addEventListener !== undefined) {
  41925. window.addEventListener("unload", listener, false);
  41926. }
  41927. else if (window.attachEvent !== undefined) {
  41928. window.attachEvent("onunload", listener);
  41929. }
  41930. },
  41931. removeUnloadListener: function (listener) {
  41932. if (window.addEventListener !== undefined) {
  41933. window.removeEventListener("unload", listener, false);
  41934. }
  41935. else if (window.detachEvent !== undefined) {
  41936. window.detachEvent("onunload", listener);
  41937. }
  41938. }
  41939. };
  41940. /* harmony default export */ var runtime = (Runtime);
  41941. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41942. var TimelineLevel;
  41943. (function (TimelineLevel) {
  41944. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41945. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41946. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41947. })(TimelineLevel || (TimelineLevel = {}));
  41948. /* harmony default export */ var timeline_level = (TimelineLevel);
  41949. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41950. var timeline_Timeline = (function () {
  41951. function Timeline(key, session, options) {
  41952. this.key = key;
  41953. this.session = session;
  41954. this.events = [];
  41955. this.options = options || {};
  41956. this.sent = 0;
  41957. this.uniqueID = 0;
  41958. }
  41959. Timeline.prototype.log = function (level, event) {
  41960. if (level <= this.options.level) {
  41961. this.events.push(extend({}, event, { timestamp: util.now() }));
  41962. if (this.options.limit && this.events.length > this.options.limit) {
  41963. this.events.shift();
  41964. }
  41965. }
  41966. };
  41967. Timeline.prototype.error = function (event) {
  41968. this.log(timeline_level.ERROR, event);
  41969. };
  41970. Timeline.prototype.info = function (event) {
  41971. this.log(timeline_level.INFO, event);
  41972. };
  41973. Timeline.prototype.debug = function (event) {
  41974. this.log(timeline_level.DEBUG, event);
  41975. };
  41976. Timeline.prototype.isEmpty = function () {
  41977. return this.events.length === 0;
  41978. };
  41979. Timeline.prototype.send = function (sendfn, callback) {
  41980. var _this = this;
  41981. var data = extend({
  41982. session: this.session,
  41983. bundle: this.sent + 1,
  41984. key: this.key,
  41985. lib: "js",
  41986. version: this.options.version,
  41987. cluster: this.options.cluster,
  41988. features: this.options.features,
  41989. timeline: this.events
  41990. }, this.options.params);
  41991. this.events = [];
  41992. sendfn(data, function (error, result) {
  41993. if (!error) {
  41994. _this.sent++;
  41995. }
  41996. if (callback) {
  41997. callback(error, result);
  41998. }
  41999. });
  42000. return true;
  42001. };
  42002. Timeline.prototype.generateUniqueID = function () {
  42003. this.uniqueID++;
  42004. return this.uniqueID;
  42005. };
  42006. return Timeline;
  42007. }());
  42008. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42009. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42010. var transport_strategy_TransportStrategy = (function () {
  42011. function TransportStrategy(name, priority, transport, options) {
  42012. this.name = name;
  42013. this.priority = priority;
  42014. this.transport = transport;
  42015. this.options = options || {};
  42016. }
  42017. TransportStrategy.prototype.isSupported = function () {
  42018. return this.transport.isSupported({
  42019. useTLS: this.options.useTLS
  42020. });
  42021. };
  42022. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42023. var _this = this;
  42024. if (!this.isSupported()) {
  42025. return failAttempt(new UnsupportedStrategy(), callback);
  42026. }
  42027. else if (this.priority < minPriority) {
  42028. return failAttempt(new TransportPriorityTooLow(), callback);
  42029. }
  42030. var connected = false;
  42031. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42032. var handshake = null;
  42033. var onInitialized = function () {
  42034. transport.unbind("initialized", onInitialized);
  42035. transport.connect();
  42036. };
  42037. var onOpen = function () {
  42038. handshake = factory.createHandshake(transport, function (result) {
  42039. connected = true;
  42040. unbindListeners();
  42041. callback(null, result);
  42042. });
  42043. };
  42044. var onError = function (error) {
  42045. unbindListeners();
  42046. callback(error);
  42047. };
  42048. var onClosed = function () {
  42049. unbindListeners();
  42050. var serializedTransport;
  42051. serializedTransport = safeJSONStringify(transport);
  42052. callback(new TransportClosed(serializedTransport));
  42053. };
  42054. var unbindListeners = function () {
  42055. transport.unbind("initialized", onInitialized);
  42056. transport.unbind("open", onOpen);
  42057. transport.unbind("error", onError);
  42058. transport.unbind("closed", onClosed);
  42059. };
  42060. transport.bind("initialized", onInitialized);
  42061. transport.bind("open", onOpen);
  42062. transport.bind("error", onError);
  42063. transport.bind("closed", onClosed);
  42064. transport.initialize();
  42065. return {
  42066. abort: function () {
  42067. if (connected) {
  42068. return;
  42069. }
  42070. unbindListeners();
  42071. if (handshake) {
  42072. handshake.close();
  42073. }
  42074. else {
  42075. transport.close();
  42076. }
  42077. },
  42078. forceMinPriority: function (p) {
  42079. if (connected) {
  42080. return;
  42081. }
  42082. if (_this.priority < p) {
  42083. if (handshake) {
  42084. handshake.close();
  42085. }
  42086. else {
  42087. transport.close();
  42088. }
  42089. }
  42090. }
  42091. };
  42092. };
  42093. return TransportStrategy;
  42094. }());
  42095. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42096. function failAttempt(error, callback) {
  42097. util.defer(function () {
  42098. callback(error);
  42099. });
  42100. return {
  42101. abort: function () { },
  42102. forceMinPriority: function () { }
  42103. };
  42104. }
  42105. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42106. var strategy_builder_Transports = runtime.Transports;
  42107. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42108. var transportClass = strategy_builder_Transports[type];
  42109. if (!transportClass) {
  42110. throw new UnsupportedTransport(type);
  42111. }
  42112. var enabled = (!config.enabledTransports ||
  42113. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42114. (!config.disabledTransports ||
  42115. arrayIndexOf(config.disabledTransports, name) === -1);
  42116. var transport;
  42117. if (enabled) {
  42118. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42119. key: config.key,
  42120. useTLS: config.useTLS,
  42121. timeline: config.timeline,
  42122. ignoreNullOrigin: config.ignoreNullOrigin
  42123. }, options));
  42124. }
  42125. else {
  42126. transport = strategy_builder_UnsupportedStrategy;
  42127. }
  42128. return transport;
  42129. };
  42130. var strategy_builder_UnsupportedStrategy = {
  42131. isSupported: function () {
  42132. return false;
  42133. },
  42134. connect: function (_, callback) {
  42135. var deferred = util.defer(function () {
  42136. callback(new UnsupportedStrategy());
  42137. });
  42138. return {
  42139. abort: function () {
  42140. deferred.ensureAborted();
  42141. },
  42142. forceMinPriority: function () { }
  42143. };
  42144. }
  42145. };
  42146. // CONCATENATED MODULE: ./src/core/config.ts
  42147. var getGlobalConfig = function () {
  42148. return {
  42149. wsHost: defaults.host,
  42150. wsPort: defaults.ws_port,
  42151. wssPort: defaults.wss_port,
  42152. wsPath: defaults.ws_path,
  42153. httpHost: defaults.sockjs_host,
  42154. httpPort: defaults.sockjs_http_port,
  42155. httpsPort: defaults.sockjs_https_port,
  42156. httpPath: defaults.sockjs_path,
  42157. statsHost: defaults.stats_host,
  42158. authEndpoint: defaults.channel_auth_endpoint,
  42159. authTransport: defaults.channel_auth_transport,
  42160. activity_timeout: defaults.activity_timeout,
  42161. pong_timeout: defaults.pong_timeout,
  42162. unavailable_timeout: defaults.unavailable_timeout
  42163. };
  42164. };
  42165. var getClusterConfig = function (clusterName) {
  42166. return {
  42167. wsHost: 'ws-' + clusterName + '.pusher.com',
  42168. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42169. };
  42170. };
  42171. // CONCATENATED MODULE: ./src/core/pusher.ts
  42172. var pusher_Pusher = (function () {
  42173. function Pusher(app_key, options) {
  42174. var _this = this;
  42175. checkAppKey(app_key);
  42176. options = options || {};
  42177. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42178. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42179. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42180. }
  42181. this.key = app_key;
  42182. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42183. this.channels = factory.createChannels();
  42184. this.global_emitter = new dispatcher();
  42185. this.sessionID = Math.floor(Math.random() * 1000000000);
  42186. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42187. cluster: this.config.cluster,
  42188. features: Pusher.getClientFeatures(),
  42189. params: this.config.timelineParams || {},
  42190. limit: 50,
  42191. level: timeline_level.INFO,
  42192. version: defaults.VERSION
  42193. });
  42194. if (!this.config.disableStats) {
  42195. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42196. host: this.config.statsHost,
  42197. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42198. });
  42199. }
  42200. var getStrategy = function (options) {
  42201. var config = extend({}, _this.config, options);
  42202. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42203. };
  42204. this.connection = factory.createConnectionManager(this.key, extend({
  42205. getStrategy: getStrategy,
  42206. timeline: this.timeline,
  42207. activityTimeout: this.config.activity_timeout,
  42208. pongTimeout: this.config.pong_timeout,
  42209. unavailableTimeout: this.config.unavailable_timeout
  42210. }, this.config, { useTLS: this.shouldUseTLS() }));
  42211. this.connection.bind('connected', function () {
  42212. _this.subscribeAll();
  42213. if (_this.timelineSender) {
  42214. _this.timelineSender.send(_this.connection.isUsingTLS());
  42215. }
  42216. });
  42217. this.connection.bind('message', function (event) {
  42218. var eventName = event.event;
  42219. var internal = eventName.indexOf('pusher_internal:') === 0;
  42220. if (event.channel) {
  42221. var channel = _this.channel(event.channel);
  42222. if (channel) {
  42223. channel.handleEvent(event);
  42224. }
  42225. }
  42226. if (!internal) {
  42227. _this.global_emitter.emit(event.event, event.data);
  42228. }
  42229. });
  42230. this.connection.bind('connecting', function () {
  42231. _this.channels.disconnect();
  42232. });
  42233. this.connection.bind('disconnected', function () {
  42234. _this.channels.disconnect();
  42235. });
  42236. this.connection.bind('error', function (err) {
  42237. logger.warn(err);
  42238. });
  42239. Pusher.instances.push(this);
  42240. this.timeline.info({ instances: Pusher.instances.length });
  42241. if (Pusher.isReady) {
  42242. this.connect();
  42243. }
  42244. }
  42245. Pusher.ready = function () {
  42246. Pusher.isReady = true;
  42247. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42248. Pusher.instances[i].connect();
  42249. }
  42250. };
  42251. Pusher.getClientFeatures = function () {
  42252. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42253. return t.isSupported({});
  42254. }));
  42255. };
  42256. Pusher.prototype.channel = function (name) {
  42257. return this.channels.find(name);
  42258. };
  42259. Pusher.prototype.allChannels = function () {
  42260. return this.channels.all();
  42261. };
  42262. Pusher.prototype.connect = function () {
  42263. this.connection.connect();
  42264. if (this.timelineSender) {
  42265. if (!this.timelineSenderTimer) {
  42266. var usingTLS = this.connection.isUsingTLS();
  42267. var timelineSender = this.timelineSender;
  42268. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42269. timelineSender.send(usingTLS);
  42270. });
  42271. }
  42272. }
  42273. };
  42274. Pusher.prototype.disconnect = function () {
  42275. this.connection.disconnect();
  42276. if (this.timelineSenderTimer) {
  42277. this.timelineSenderTimer.ensureAborted();
  42278. this.timelineSenderTimer = null;
  42279. }
  42280. };
  42281. Pusher.prototype.bind = function (event_name, callback, context) {
  42282. this.global_emitter.bind(event_name, callback, context);
  42283. return this;
  42284. };
  42285. Pusher.prototype.unbind = function (event_name, callback, context) {
  42286. this.global_emitter.unbind(event_name, callback, context);
  42287. return this;
  42288. };
  42289. Pusher.prototype.bind_global = function (callback) {
  42290. this.global_emitter.bind_global(callback);
  42291. return this;
  42292. };
  42293. Pusher.prototype.unbind_global = function (callback) {
  42294. this.global_emitter.unbind_global(callback);
  42295. return this;
  42296. };
  42297. Pusher.prototype.unbind_all = function (callback) {
  42298. this.global_emitter.unbind_all();
  42299. return this;
  42300. };
  42301. Pusher.prototype.subscribeAll = function () {
  42302. var channelName;
  42303. for (channelName in this.channels.channels) {
  42304. if (this.channels.channels.hasOwnProperty(channelName)) {
  42305. this.subscribe(channelName);
  42306. }
  42307. }
  42308. };
  42309. Pusher.prototype.subscribe = function (channel_name) {
  42310. var channel = this.channels.add(channel_name, this);
  42311. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42312. channel.reinstateSubscription();
  42313. }
  42314. else if (!channel.subscriptionPending &&
  42315. this.connection.state === 'connected') {
  42316. channel.subscribe();
  42317. }
  42318. return channel;
  42319. };
  42320. Pusher.prototype.unsubscribe = function (channel_name) {
  42321. var channel = this.channels.find(channel_name);
  42322. if (channel && channel.subscriptionPending) {
  42323. channel.cancelSubscription();
  42324. }
  42325. else {
  42326. channel = this.channels.remove(channel_name);
  42327. if (channel && this.connection.state === 'connected') {
  42328. channel.unsubscribe();
  42329. }
  42330. }
  42331. };
  42332. Pusher.prototype.send_event = function (event_name, data, channel) {
  42333. return this.connection.send_event(event_name, data, channel);
  42334. };
  42335. Pusher.prototype.shouldUseTLS = function () {
  42336. if (runtime.getProtocol() === 'https:') {
  42337. return true;
  42338. }
  42339. else if (this.config.forceTLS === true) {
  42340. return true;
  42341. }
  42342. else {
  42343. return Boolean(this.config.encrypted);
  42344. }
  42345. };
  42346. Pusher.instances = [];
  42347. Pusher.isReady = false;
  42348. Pusher.logToConsole = false;
  42349. Pusher.Runtime = runtime;
  42350. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42351. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42352. Pusher.auth_callbacks = runtime.auth_callbacks;
  42353. return Pusher;
  42354. }());
  42355. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42356. function checkAppKey(key) {
  42357. if (key === null || key === undefined) {
  42358. throw 'You must pass your app key when you instantiate Pusher.';
  42359. }
  42360. }
  42361. runtime.setup(pusher_Pusher);
  42362. /***/ })
  42363. /******/ ]);
  42364. });
  42365. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42366. /***/ }),
  42367. /***/ "./node_modules/setimmediate/setImmediate.js":
  42368. /*!***************************************************!*\
  42369. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42370. \***************************************************/
  42371. /*! no static exports found */
  42372. /***/ (function(module, exports, __webpack_require__) {
  42373. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42374. "use strict";
  42375. if (global.setImmediate) {
  42376. return;
  42377. }
  42378. var nextHandle = 1; // Spec says greater than zero
  42379. var tasksByHandle = {};
  42380. var currentlyRunningATask = false;
  42381. var doc = global.document;
  42382. var registerImmediate;
  42383. function setImmediate(callback) {
  42384. // Callback can either be a function or a string
  42385. if (typeof callback !== "function") {
  42386. callback = new Function("" + callback);
  42387. }
  42388. // Copy function arguments
  42389. var args = new Array(arguments.length - 1);
  42390. for (var i = 0; i < args.length; i++) {
  42391. args[i] = arguments[i + 1];
  42392. }
  42393. // Store and register the task
  42394. var task = { callback: callback, args: args };
  42395. tasksByHandle[nextHandle] = task;
  42396. registerImmediate(nextHandle);
  42397. return nextHandle++;
  42398. }
  42399. function clearImmediate(handle) {
  42400. delete tasksByHandle[handle];
  42401. }
  42402. function run(task) {
  42403. var callback = task.callback;
  42404. var args = task.args;
  42405. switch (args.length) {
  42406. case 0:
  42407. callback();
  42408. break;
  42409. case 1:
  42410. callback(args[0]);
  42411. break;
  42412. case 2:
  42413. callback(args[0], args[1]);
  42414. break;
  42415. case 3:
  42416. callback(args[0], args[1], args[2]);
  42417. break;
  42418. default:
  42419. callback.apply(undefined, args);
  42420. break;
  42421. }
  42422. }
  42423. function runIfPresent(handle) {
  42424. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42425. // So if we're currently running a task, we'll need to delay this invocation.
  42426. if (currentlyRunningATask) {
  42427. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42428. // "too much recursion" error.
  42429. setTimeout(runIfPresent, 0, handle);
  42430. } else {
  42431. var task = tasksByHandle[handle];
  42432. if (task) {
  42433. currentlyRunningATask = true;
  42434. try {
  42435. run(task);
  42436. } finally {
  42437. clearImmediate(handle);
  42438. currentlyRunningATask = false;
  42439. }
  42440. }
  42441. }
  42442. }
  42443. function installNextTickImplementation() {
  42444. registerImmediate = function(handle) {
  42445. process.nextTick(function () { runIfPresent(handle); });
  42446. };
  42447. }
  42448. function canUsePostMessage() {
  42449. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42450. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42451. if (global.postMessage && !global.importScripts) {
  42452. var postMessageIsAsynchronous = true;
  42453. var oldOnMessage = global.onmessage;
  42454. global.onmessage = function() {
  42455. postMessageIsAsynchronous = false;
  42456. };
  42457. global.postMessage("", "*");
  42458. global.onmessage = oldOnMessage;
  42459. return postMessageIsAsynchronous;
  42460. }
  42461. }
  42462. function installPostMessageImplementation() {
  42463. // Installs an event handler on `global` for the `message` event: see
  42464. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42465. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42466. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42467. var onGlobalMessage = function(event) {
  42468. if (event.source === global &&
  42469. typeof event.data === "string" &&
  42470. event.data.indexOf(messagePrefix) === 0) {
  42471. runIfPresent(+event.data.slice(messagePrefix.length));
  42472. }
  42473. };
  42474. if (global.addEventListener) {
  42475. global.addEventListener("message", onGlobalMessage, false);
  42476. } else {
  42477. global.attachEvent("onmessage", onGlobalMessage);
  42478. }
  42479. registerImmediate = function(handle) {
  42480. global.postMessage(messagePrefix + handle, "*");
  42481. };
  42482. }
  42483. function installMessageChannelImplementation() {
  42484. var channel = new MessageChannel();
  42485. channel.port1.onmessage = function(event) {
  42486. var handle = event.data;
  42487. runIfPresent(handle);
  42488. };
  42489. registerImmediate = function(handle) {
  42490. channel.port2.postMessage(handle);
  42491. };
  42492. }
  42493. function installReadyStateChangeImplementation() {
  42494. var html = doc.documentElement;
  42495. registerImmediate = function(handle) {
  42496. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42497. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42498. var script = doc.createElement("script");
  42499. script.onreadystatechange = function () {
  42500. runIfPresent(handle);
  42501. script.onreadystatechange = null;
  42502. html.removeChild(script);
  42503. script = null;
  42504. };
  42505. html.appendChild(script);
  42506. };
  42507. }
  42508. function installSetTimeoutImplementation() {
  42509. registerImmediate = function(handle) {
  42510. setTimeout(runIfPresent, 0, handle);
  42511. };
  42512. }
  42513. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42514. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42515. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42516. // Don't get fooled by e.g. browserify environments.
  42517. if ({}.toString.call(global.process) === "[object process]") {
  42518. // For Node.js before 0.9
  42519. installNextTickImplementation();
  42520. } else if (canUsePostMessage()) {
  42521. // For non-IE10 modern browsers
  42522. installPostMessageImplementation();
  42523. } else if (global.MessageChannel) {
  42524. // For web workers, where supported
  42525. installMessageChannelImplementation();
  42526. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42527. // For IE 6–8
  42528. installReadyStateChangeImplementation();
  42529. } else {
  42530. // For older browsers
  42531. installSetTimeoutImplementation();
  42532. }
  42533. attachTo.setImmediate = setImmediate;
  42534. attachTo.clearImmediate = clearImmediate;
  42535. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42536. /* 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")))
  42537. /***/ }),
  42538. /***/ "./node_modules/timers-browserify/main.js":
  42539. /*!************************************************!*\
  42540. !*** ./node_modules/timers-browserify/main.js ***!
  42541. \************************************************/
  42542. /*! no static exports found */
  42543. /***/ (function(module, exports, __webpack_require__) {
  42544. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42545. (typeof self !== "undefined" && self) ||
  42546. window;
  42547. var apply = Function.prototype.apply;
  42548. // DOM APIs, for completeness
  42549. exports.setTimeout = function() {
  42550. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42551. };
  42552. exports.setInterval = function() {
  42553. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42554. };
  42555. exports.clearTimeout =
  42556. exports.clearInterval = function(timeout) {
  42557. if (timeout) {
  42558. timeout.close();
  42559. }
  42560. };
  42561. function Timeout(id, clearFn) {
  42562. this._id = id;
  42563. this._clearFn = clearFn;
  42564. }
  42565. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42566. Timeout.prototype.close = function() {
  42567. this._clearFn.call(scope, this._id);
  42568. };
  42569. // Does not start the time, just sets up the members needed.
  42570. exports.enroll = function(item, msecs) {
  42571. clearTimeout(item._idleTimeoutId);
  42572. item._idleTimeout = msecs;
  42573. };
  42574. exports.unenroll = function(item) {
  42575. clearTimeout(item._idleTimeoutId);
  42576. item._idleTimeout = -1;
  42577. };
  42578. exports._unrefActive = exports.active = function(item) {
  42579. clearTimeout(item._idleTimeoutId);
  42580. var msecs = item._idleTimeout;
  42581. if (msecs >= 0) {
  42582. item._idleTimeoutId = setTimeout(function onTimeout() {
  42583. if (item._onTimeout)
  42584. item._onTimeout();
  42585. }, msecs);
  42586. }
  42587. };
  42588. // setimmediate attaches itself to the global object
  42589. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42590. // On some exotic environments, it's not clear which object `setimmediate` was
  42591. // able to install onto. Search each possibility in the same order as the
  42592. // `setimmediate` library.
  42593. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42594. (typeof global !== "undefined" && global.setImmediate) ||
  42595. (this && this.setImmediate);
  42596. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42597. (typeof global !== "undefined" && global.clearImmediate) ||
  42598. (this && this.clearImmediate);
  42599. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42600. /***/ }),
  42601. /***/ "./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&":
  42602. /*!*******************************************************************************************************************************************************************************************************************!*\
  42603. !*** ./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& ***!
  42604. \*******************************************************************************************************************************************************************************************************************/
  42605. /*! exports provided: render, staticRenderFns */
  42606. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42607. "use strict";
  42608. __webpack_require__.r(__webpack_exports__);
  42609. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42610. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42611. var render = function() {
  42612. var _vm = this
  42613. var _h = _vm.$createElement
  42614. var _c = _vm._self._c || _h
  42615. return _vm._m(0)
  42616. }
  42617. var staticRenderFns = [
  42618. function() {
  42619. var _vm = this
  42620. var _h = _vm.$createElement
  42621. var _c = _vm._self._c || _h
  42622. return _c("div", { staticClass: "container" }, [
  42623. _c("div", { staticClass: "row justify-content-center" }, [
  42624. _c("div", { staticClass: "col-md-8" }, [
  42625. _c("div", { staticClass: "card" }, [
  42626. _c("div", { staticClass: "card-header" }, [
  42627. _vm._v("Example Component")
  42628. ]),
  42629. _vm._v(" "),
  42630. _c("div", { staticClass: "card-body" }, [
  42631. _vm._v(
  42632. "\n I'm an example component.\n "
  42633. )
  42634. ])
  42635. ])
  42636. ])
  42637. ])
  42638. ])
  42639. }
  42640. ]
  42641. render._withStripped = true
  42642. /***/ }),
  42643. /***/ "./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&":
  42644. /*!************************************************************************************************************************************************************************************************************!*\
  42645. !*** ./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& ***!
  42646. \************************************************************************************************************************************************************************************************************/
  42647. /*! exports provided: render, staticRenderFns */
  42648. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42649. "use strict";
  42650. __webpack_require__.r(__webpack_exports__);
  42651. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42652. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42653. var render = function() {
  42654. var _vm = this
  42655. var _h = _vm.$createElement
  42656. var _c = _vm._self._c || _h
  42657. return _c(
  42658. "div",
  42659. [
  42660. _c(
  42661. "modal",
  42662. {
  42663. attrs: {
  42664. id: "asseteditModal",
  42665. tabindex: "-1",
  42666. role: "dialog",
  42667. "aria-labelledby": "asseteditModalLabel"
  42668. }
  42669. },
  42670. [
  42671. _c(
  42672. "h5",
  42673. {
  42674. staticClass: "modal-title",
  42675. attrs: { slot: "header", id: "asseteditModalLabel" },
  42676. slot: "header"
  42677. },
  42678. [_vm._v("\n Edit Work Order Information\n ")]
  42679. ),
  42680. _vm._v(" "),
  42681. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42682. _c("div", { staticClass: "form-group" }, [
  42683. _c("label", { attrs: { for: "manufacturer" } }, [
  42684. _vm._v("Manufacturer")
  42685. ]),
  42686. _vm._v(" "),
  42687. _c("input", {
  42688. directives: [
  42689. {
  42690. name: "model",
  42691. rawName: "v-model",
  42692. value: _vm.data.pcmanu,
  42693. expression: "data.pcmanu"
  42694. }
  42695. ],
  42696. staticClass: "form-control",
  42697. attrs: {
  42698. type: "text",
  42699. name: "manufacturer",
  42700. id: "manufacturer"
  42701. },
  42702. domProps: { value: _vm.data.pcmanu },
  42703. on: {
  42704. input: function($event) {
  42705. if ($event.target.composing) {
  42706. return
  42707. }
  42708. _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42709. }
  42710. }
  42711. })
  42712. ]),
  42713. _vm._v(" "),
  42714. _c("div", { staticClass: "form-group" }, [
  42715. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42716. _vm._v(" "),
  42717. _c("input", {
  42718. directives: [
  42719. {
  42720. name: "model",
  42721. rawName: "v-model",
  42722. value: _vm.data.pcmake,
  42723. expression: "data.pcmake"
  42724. }
  42725. ],
  42726. staticClass: "form-control",
  42727. attrs: { type: "text", name: "make", id: "make" },
  42728. domProps: { value: _vm.data.pcmake },
  42729. on: {
  42730. input: function($event) {
  42731. if ($event.target.composing) {
  42732. return
  42733. }
  42734. _vm.$set(_vm.data, "pcmake", $event.target.value)
  42735. }
  42736. }
  42737. })
  42738. ]),
  42739. _vm._v(" "),
  42740. _c("div", { staticClass: "form-group" }, [
  42741. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42742. _vm._v(" "),
  42743. _c("input", {
  42744. directives: [
  42745. {
  42746. name: "model",
  42747. rawName: "v-model",
  42748. value: _vm.data.pcnickname,
  42749. expression: "data.pcnickname"
  42750. }
  42751. ],
  42752. staticClass: "form-control",
  42753. attrs: { type: "text", name: "nickname", id: "nickname" },
  42754. domProps: { value: _vm.data.pcnickname },
  42755. on: {
  42756. input: function($event) {
  42757. if ($event.target.composing) {
  42758. return
  42759. }
  42760. _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42761. }
  42762. }
  42763. })
  42764. ]),
  42765. _vm._v(" "),
  42766. _c("div", { staticClass: "form-group" }, [
  42767. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42768. _vm._v(" "),
  42769. _c("input", {
  42770. directives: [
  42771. {
  42772. name: "model",
  42773. rawName: "v-model",
  42774. value: _vm.pcextra[2],
  42775. expression: "pcextra[2]"
  42776. }
  42777. ],
  42778. staticClass: "form-control",
  42779. attrs: { type: "text", name: "os", id: "os" },
  42780. domProps: { value: _vm.pcextra[2] },
  42781. on: {
  42782. input: function($event) {
  42783. if ($event.target.composing) {
  42784. return
  42785. }
  42786. _vm.$set(_vm.pcextra, 2, $event.target.value)
  42787. }
  42788. }
  42789. })
  42790. ]),
  42791. _vm._v(" "),
  42792. _c("div", { staticClass: "form-group" }, [
  42793. _c("label", { attrs: { for: "serial" } }, [
  42794. _vm._v("Serial Number")
  42795. ]),
  42796. _vm._v(" "),
  42797. _c("input", {
  42798. directives: [
  42799. {
  42800. name: "model",
  42801. rawName: "v-model",
  42802. value: _vm.pcextra[104],
  42803. expression: "pcextra[104]"
  42804. }
  42805. ],
  42806. staticClass: "form-control",
  42807. attrs: { type: "text", id: "serial", name: "serial" },
  42808. domProps: { value: _vm.pcextra[104] },
  42809. on: {
  42810. input: function($event) {
  42811. if ($event.target.composing) {
  42812. return
  42813. }
  42814. _vm.$set(_vm.pcextra, 104, $event.target.value)
  42815. }
  42816. }
  42817. })
  42818. ]),
  42819. _vm._v(" "),
  42820. _c("div", { staticClass: "form-group" }, [
  42821. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42822. _vm._v(" "),
  42823. _c("input", {
  42824. directives: [
  42825. {
  42826. name: "model",
  42827. rawName: "v-model",
  42828. value: _vm.pcextra[101],
  42829. expression: "pcextra[101]"
  42830. }
  42831. ],
  42832. staticClass: "form-control",
  42833. attrs: { type: "text", id: "cpu", name: "cpu" },
  42834. domProps: { value: _vm.pcextra[101] },
  42835. on: {
  42836. input: function($event) {
  42837. if ($event.target.composing) {
  42838. return
  42839. }
  42840. _vm.$set(_vm.pcextra, 101, $event.target.value)
  42841. }
  42842. }
  42843. })
  42844. ]),
  42845. _vm._v(" "),
  42846. _c("div", { staticClass: "form-group" }, [
  42847. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42848. _vm._v(" "),
  42849. _c("input", {
  42850. directives: [
  42851. {
  42852. name: "model",
  42853. rawName: "v-model",
  42854. value: _vm.pcextra[100],
  42855. expression: "pcextra[100]"
  42856. }
  42857. ],
  42858. staticClass: "form-control",
  42859. attrs: { type: "text", name: "ram", id: "ram" },
  42860. domProps: { value: _vm.pcextra[100] },
  42861. on: {
  42862. input: function($event) {
  42863. if ($event.target.composing) {
  42864. return
  42865. }
  42866. _vm.$set(_vm.pcextra, 100, $event.target.value)
  42867. }
  42868. }
  42869. })
  42870. ]),
  42871. _vm._v(" "),
  42872. _c("div", { staticClass: "form-group" }, [
  42873. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42874. _vm._v(" "),
  42875. _c("input", {
  42876. directives: [
  42877. {
  42878. name: "model",
  42879. rawName: "v-model",
  42880. value: _vm.pcextra[4],
  42881. expression: "pcextra[4]"
  42882. }
  42883. ],
  42884. staticClass: "form-control",
  42885. attrs: { type: "text", name: "graphics", id: "grapics" },
  42886. domProps: { value: _vm.pcextra[4] },
  42887. on: {
  42888. input: function($event) {
  42889. if ($event.target.composing) {
  42890. return
  42891. }
  42892. _vm.$set(_vm.pcextra, 4, $event.target.value)
  42893. }
  42894. }
  42895. })
  42896. ])
  42897. ]),
  42898. _vm._v(" "),
  42899. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42900. _c(
  42901. "button",
  42902. {
  42903. staticClass: "btn btn-secondary",
  42904. attrs: { type: "button", "data-dismiss": "modal" }
  42905. },
  42906. [_vm._v("Close")]
  42907. ),
  42908. _vm._v(" "),
  42909. _c(
  42910. "button",
  42911. {
  42912. staticClass: "btn btn-primary",
  42913. attrs: { type: "button" },
  42914. on: {
  42915. click: function($event) {
  42916. return _vm.updateAsset()
  42917. }
  42918. }
  42919. },
  42920. [_vm._v("Save")]
  42921. )
  42922. ])
  42923. ]
  42924. ),
  42925. _vm._v(" "),
  42926. _c("h4", { staticClass: "text-center" }, [
  42927. _vm._v(
  42928. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  42929. ),
  42930. _c("small", { staticClass: "text-muted" }, [
  42931. _vm._v(_vm._s(this.data.pcnickname))
  42932. ])
  42933. ]),
  42934. _vm._v(" "),
  42935. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  42936. _vm._v(" "),
  42937. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  42938. _vm._v(" "),
  42939. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  42940. _vm._v(" "),
  42941. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  42942. _vm._v(" "),
  42943. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  42944. _vm._v(" "),
  42945. _c(
  42946. "button",
  42947. {
  42948. staticClass: "btn btn-primary",
  42949. attrs: {
  42950. type: "button",
  42951. "data-toggle": "modal",
  42952. "data-target": "#asseteditModal"
  42953. }
  42954. },
  42955. [_vm._v("Edit")]
  42956. )
  42957. ],
  42958. 1
  42959. )
  42960. }
  42961. var staticRenderFns = []
  42962. render._withStripped = true
  42963. /***/ }),
  42964. /***/ "./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&":
  42965. /*!*************************************************************************************************************************************************************************************************************!*\
  42966. !*** ./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& ***!
  42967. \*************************************************************************************************************************************************************************************************************/
  42968. /*! exports provided: render, staticRenderFns */
  42969. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42970. "use strict";
  42971. __webpack_require__.r(__webpack_exports__);
  42972. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42973. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42974. var render = function() {
  42975. var _vm = this
  42976. var _h = _vm.$createElement
  42977. var _c = _vm._self._c || _h
  42978. return _c(
  42979. "div",
  42980. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42981. [
  42982. _c(
  42983. "modal",
  42984. {
  42985. attrs: {
  42986. id: "credential" + this.data.credid + "editModal",
  42987. tabindex: "-1",
  42988. role: "dialog",
  42989. "aria-labelledby":
  42990. "credential" + this.data.credid + "editModalLabel"
  42991. }
  42992. },
  42993. [
  42994. _c(
  42995. "h5",
  42996. {
  42997. staticClass: "modal-title",
  42998. attrs: { slot: "header", id: "credentialeditModalLabel" },
  42999. slot: "header"
  43000. },
  43001. [_vm._v("\r\n Edit Credential\r\n ")]
  43002. ),
  43003. _vm._v(" "),
  43004. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43005. _c("div", { staticClass: "form-group" }, [
  43006. _c("label", { attrs: { for: "username" } }, [_vm._v("Username")]),
  43007. _vm._v(" "),
  43008. _c("input", {
  43009. directives: [
  43010. {
  43011. name: "model",
  43012. rawName: "v-model",
  43013. value: this.data.creduser,
  43014. expression: "this.data.creduser"
  43015. }
  43016. ],
  43017. staticClass: "form-control credential",
  43018. attrs: {
  43019. type: "text",
  43020. name: "username" + this.data.credid,
  43021. id: "username" + this.data.credid
  43022. },
  43023. domProps: { value: this.data.creduser },
  43024. on: {
  43025. input: function($event) {
  43026. if ($event.target.composing) {
  43027. return
  43028. }
  43029. _vm.$set(this.data, "creduser", $event.target.value)
  43030. }
  43031. }
  43032. })
  43033. ]),
  43034. _vm._v(" "),
  43035. _c("div", { staticClass: "form-group" }, [
  43036. _c("label", { attrs: { for: "password" } }, [_vm._v("Password")]),
  43037. _vm._v(" "),
  43038. _c("input", {
  43039. directives: [
  43040. {
  43041. name: "model",
  43042. rawName: "v-model",
  43043. value: this.data.credpass,
  43044. expression: "this.data.credpass"
  43045. }
  43046. ],
  43047. staticClass: "form-control credential",
  43048. attrs: {
  43049. type: "text",
  43050. name: "password" + this.data.credid,
  43051. id: "password" + this.data.credid
  43052. },
  43053. domProps: { value: this.data.credpass },
  43054. on: {
  43055. input: function($event) {
  43056. if ($event.target.composing) {
  43057. return
  43058. }
  43059. _vm.$set(this.data, "credpass", $event.target.value)
  43060. }
  43061. }
  43062. }),
  43063. _vm._v(" "),
  43064. _c(
  43065. "button",
  43066. {
  43067. staticClass: "btn btn-secondary",
  43068. attrs: { type: "button" },
  43069. on: {
  43070. click: function($event) {
  43071. return _vm.getRandomPassword()
  43072. }
  43073. }
  43074. },
  43075. [_vm._v("Generate Random")]
  43076. )
  43077. ]),
  43078. _vm._v(" "),
  43079. _c("div", { staticClass: "form-group" })
  43080. ]),
  43081. _vm._v(" "),
  43082. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43083. _c(
  43084. "button",
  43085. {
  43086. staticClass: "btn btn-secondary",
  43087. attrs: { type: "button", "data-dismiss": "modal" }
  43088. },
  43089. [_vm._v("Close")]
  43090. ),
  43091. _vm._v(" "),
  43092. _c(
  43093. "button",
  43094. {
  43095. staticClass: "btn btn-primary",
  43096. attrs: { type: "button" },
  43097. on: {
  43098. click: function($event) {
  43099. return _vm.updateCredential()
  43100. }
  43101. }
  43102. },
  43103. [_vm._v("Save")]
  43104. )
  43105. ])
  43106. ]
  43107. ),
  43108. _vm._v(" "),
  43109. _c("div", { staticClass: "row no-gutters" }, [
  43110. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43111. _vm._v(_vm._s(this.data.creddesc))
  43112. ]),
  43113. _vm._v(" "),
  43114. _c("div", { staticClass: "col-9 text-right" }, [
  43115. _vm._v(_vm._s(this.data.creddate))
  43116. ])
  43117. ]),
  43118. _vm._v(" "),
  43119. _c("div", { staticClass: "row" }, [
  43120. _c("div", { staticClass: "col-lg-9" }, [
  43121. _c("div", [
  43122. _vm._m(0),
  43123. _vm._v(" "),
  43124. _c("input", {
  43125. staticClass: "border-0 credential",
  43126. attrs: {
  43127. type: "text",
  43128. id: "username" + this.data.credid,
  43129. readonly: ""
  43130. },
  43131. domProps: { value: this.data.creduser }
  43132. }),
  43133. _vm._v(" "),
  43134. _c(
  43135. "button",
  43136. {
  43137. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43138. attrs: {
  43139. id: "btn-username" + this.data.credid,
  43140. "data-clipboard-target": "#username" + this.data.credid
  43141. }
  43142. },
  43143. [_c("i", { staticClass: "far fa-clone" })]
  43144. )
  43145. ]),
  43146. _vm._v(" "),
  43147. _c("div", [
  43148. _vm._m(1),
  43149. _vm._v(" "),
  43150. _c("input", {
  43151. staticClass: "border-0 credential",
  43152. attrs: {
  43153. type: "text",
  43154. id: "password" + this.data.credid,
  43155. readonly: ""
  43156. },
  43157. domProps: { value: this.data.credpass }
  43158. }),
  43159. _vm._v(" "),
  43160. _c(
  43161. "button",
  43162. {
  43163. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43164. attrs: {
  43165. id: "btn-password" + this.data.credid,
  43166. "data-clipboard-target": "#password" + this.data.credid
  43167. }
  43168. },
  43169. [_c("i", { staticClass: "far fa-clone" })]
  43170. )
  43171. ])
  43172. ]),
  43173. _vm._v(" "),
  43174. _c(
  43175. "div",
  43176. {
  43177. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43178. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43179. },
  43180. [
  43181. _c(
  43182. "button",
  43183. {
  43184. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43185. attrs: {
  43186. type: "button",
  43187. "data-toggle": "modal",
  43188. "data-target": "#credential" + this.data.credid + "editModal"
  43189. }
  43190. },
  43191. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43192. ),
  43193. _vm._v(" "),
  43194. _vm._m(2)
  43195. ]
  43196. )
  43197. ])
  43198. ],
  43199. 1
  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("label", { attrs: { for: "username" } }, [
  43208. _c("i", { staticClass: "fas fa-fw fa-user" })
  43209. ])
  43210. },
  43211. function() {
  43212. var _vm = this
  43213. var _h = _vm.$createElement
  43214. var _c = _vm._self._c || _h
  43215. return _c("label", { attrs: { for: "password" } }, [
  43216. _c("i", { staticClass: "fas fa-fw fa-key" })
  43217. ])
  43218. },
  43219. function() {
  43220. var _vm = this
  43221. var _h = _vm.$createElement
  43222. var _c = _vm._self._c || _h
  43223. return _c(
  43224. "button",
  43225. {
  43226. staticClass: "btn btn-sm btn-danger p-lg-1",
  43227. attrs: { type: "button" }
  43228. },
  43229. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43230. )
  43231. }
  43232. ]
  43233. render._withStripped = true
  43234. /***/ }),
  43235. /***/ "./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&":
  43236. /*!********************************************************************************************************************************************************************************************************!*\
  43237. !*** ./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& ***!
  43238. \********************************************************************************************************************************************************************************************************/
  43239. /*! exports provided: render, staticRenderFns */
  43240. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43241. "use strict";
  43242. __webpack_require__.r(__webpack_exports__);
  43243. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43244. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43245. var render = function() {
  43246. var _vm = this
  43247. var _h = _vm.$createElement
  43248. var _c = _vm._self._c || _h
  43249. return _c("div", { staticClass: "modal fade" }, [
  43250. _c(
  43251. "div",
  43252. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43253. [
  43254. _c("div", { staticClass: "modal-content" }, [
  43255. _c(
  43256. "div",
  43257. { staticClass: "modal-header" },
  43258. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43259. 2
  43260. ),
  43261. _vm._v(" "),
  43262. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43263. _vm._v(" "),
  43264. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43265. ])
  43266. ]
  43267. )
  43268. ])
  43269. }
  43270. var staticRenderFns = [
  43271. function() {
  43272. var _vm = this
  43273. var _h = _vm.$createElement
  43274. var _c = _vm._self._c || _h
  43275. return _c(
  43276. "button",
  43277. {
  43278. staticClass: "close",
  43279. attrs: {
  43280. type: "button",
  43281. "data-dismiss": "modal",
  43282. "aria-label": "Close"
  43283. }
  43284. },
  43285. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43286. )
  43287. }
  43288. ]
  43289. render._withStripped = true
  43290. /***/ }),
  43291. /***/ "./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&":
  43292. /*!********************************************************************************************************************************************************************************************************!*\
  43293. !*** ./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& ***!
  43294. \********************************************************************************************************************************************************************************************************/
  43295. /*! exports provided: render, staticRenderFns */
  43296. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43297. "use strict";
  43298. __webpack_require__.r(__webpack_exports__);
  43299. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43300. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43301. var render = function() {
  43302. var _vm = this
  43303. var _h = _vm.$createElement
  43304. var _c = _vm._self._c || _h
  43305. return _c(
  43306. "ul",
  43307. { staticClass: "list-unstyled" },
  43308. _vm._l(this.notes, function(note) {
  43309. return _c(
  43310. "li",
  43311. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43312. [
  43313. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43314. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43315. _vm._v(_vm._s(note.noteuser))
  43316. ]),
  43317. _vm._v(" "),
  43318. _c(
  43319. "div",
  43320. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43321. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43322. ),
  43323. _vm._v(" "),
  43324. _c(
  43325. "div",
  43326. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43327. [
  43328. _vm.authusername === note.noteuser ||
  43329. _vm.authusername === "admin"
  43330. ? [
  43331. _vm._m(0, true),
  43332. _vm._v(" "),
  43333. _vm._m(1, true),
  43334. _vm._v(" "),
  43335. _vm._m(2, true)
  43336. ]
  43337. : _vm._e()
  43338. ],
  43339. 2
  43340. )
  43341. ]),
  43342. _vm._v(" "),
  43343. _c("div", { staticClass: "col-md-10" }, [
  43344. _c("div", { staticClass: "card m-2" }, [
  43345. _c("div", { staticClass: "card-body p-2" }, [
  43346. _vm._v(
  43347. "\n " +
  43348. _vm._s(note.thenote) +
  43349. "\n "
  43350. )
  43351. ])
  43352. ])
  43353. ])
  43354. ]
  43355. )
  43356. }),
  43357. 0
  43358. )
  43359. }
  43360. var staticRenderFns = [
  43361. function() {
  43362. var _vm = this
  43363. var _h = _vm.$createElement
  43364. var _c = _vm._self._c || _h
  43365. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43366. _c("i", { staticClass: "fas fa-fw fa-edit" })
  43367. ])
  43368. },
  43369. function() {
  43370. var _vm = this
  43371. var _h = _vm.$createElement
  43372. var _c = _vm._self._c || _h
  43373. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43374. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43375. ])
  43376. },
  43377. function() {
  43378. var _vm = this
  43379. var _h = _vm.$createElement
  43380. var _c = _vm._self._c || _h
  43381. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43382. _c("i", { staticClass: "fa fa-fw fa-random" })
  43383. ])
  43384. }
  43385. ]
  43386. render._withStripped = true
  43387. /***/ }),
  43388. /***/ "./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&":
  43389. /*!*********************************************************************************************************************************************************************************************************!*\
  43390. !*** ./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& ***!
  43391. \*********************************************************************************************************************************************************************************************************/
  43392. /*! exports provided: render, staticRenderFns */
  43393. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43394. "use strict";
  43395. __webpack_require__.r(__webpack_exports__);
  43396. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43397. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43398. var render = function() {
  43399. var _vm = this
  43400. var _h = _vm.$createElement
  43401. var _c = _vm._self._c || _h
  43402. return _c(
  43403. "div",
  43404. [
  43405. _c(
  43406. "modal",
  43407. {
  43408. attrs: {
  43409. id: "workordereditModal",
  43410. tabindex: "-1",
  43411. role: "dialog",
  43412. "aria-labelledby": "workordereditModalLabel"
  43413. }
  43414. },
  43415. [
  43416. _c(
  43417. "h5",
  43418. {
  43419. staticClass: "modal-title",
  43420. attrs: { slot: "header", id: "workordereditModalLabel" },
  43421. slot: "header"
  43422. },
  43423. [_vm._v("\n Edit Work Order Information\n ")]
  43424. ),
  43425. _vm._v(" "),
  43426. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43427. _c("div", { staticClass: "form-group" }, [
  43428. _c("label", { attrs: { for: "probdesc" } }, [
  43429. _vm._v("Problem Description")
  43430. ]),
  43431. _vm._v(" "),
  43432. _c("textarea", {
  43433. directives: [
  43434. {
  43435. name: "model",
  43436. rawName: "v-model",
  43437. value: _vm.data.probdesc,
  43438. expression: "data.probdesc"
  43439. }
  43440. ],
  43441. staticClass: "form-control",
  43442. attrs: { id: "probdesc", name: "probdesc" },
  43443. domProps: { value: _vm.data.probdesc },
  43444. on: {
  43445. input: function($event) {
  43446. if ($event.target.composing) {
  43447. return
  43448. }
  43449. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43450. }
  43451. }
  43452. })
  43453. ]),
  43454. _vm._v(" "),
  43455. _c("div", { staticClass: "form-group" }, [
  43456. _c("label", { attrs: { for: "suggested" } }, [
  43457. _vm._v("Suggested Solution")
  43458. ]),
  43459. _vm._v(" "),
  43460. _c("textarea", {
  43461. directives: [
  43462. {
  43463. name: "model",
  43464. rawName: "v-model",
  43465. value: _vm.data.suggested,
  43466. expression: "data.suggested"
  43467. }
  43468. ],
  43469. staticClass: "form-control",
  43470. attrs: { id: "suggested", name: "suggested" },
  43471. domProps: { value: _vm.data.suggested },
  43472. on: {
  43473. input: function($event) {
  43474. if ($event.target.composing) {
  43475. return
  43476. }
  43477. _vm.$set(_vm.data, "suggested", $event.target.value)
  43478. }
  43479. }
  43480. })
  43481. ]),
  43482. _vm._v(" "),
  43483. _c("div", { staticClass: "form-group" }, [
  43484. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43485. _vm._v(" "),
  43486. _vm.storeList
  43487. ? _c(
  43488. "select",
  43489. {
  43490. directives: [
  43491. {
  43492. name: "model",
  43493. rawName: "v-model",
  43494. value: _vm.data.storeid,
  43495. expression: "data.storeid"
  43496. }
  43497. ],
  43498. staticClass: "form-control",
  43499. attrs: { name: "storelist", id: "storelist" },
  43500. on: {
  43501. change: function($event) {
  43502. var $$selectedVal = Array.prototype.filter
  43503. .call($event.target.options, function(o) {
  43504. return o.selected
  43505. })
  43506. .map(function(o) {
  43507. var val = "_value" in o ? o._value : o.value
  43508. return val
  43509. })
  43510. _vm.$set(
  43511. _vm.data,
  43512. "storeid",
  43513. $event.target.multiple
  43514. ? $$selectedVal
  43515. : $$selectedVal[0]
  43516. )
  43517. }
  43518. }
  43519. },
  43520. _vm._l(_vm.storeList.values(), function(store) {
  43521. return _c(
  43522. "option",
  43523. {
  43524. key: store.storeid,
  43525. domProps: { value: store.storeid }
  43526. },
  43527. [
  43528. _vm._v(
  43529. "\n " +
  43530. _vm._s(store.storesname) +
  43531. "\n "
  43532. )
  43533. ]
  43534. )
  43535. }),
  43536. 0
  43537. )
  43538. : _vm._e()
  43539. ])
  43540. ]),
  43541. _vm._v(" "),
  43542. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43543. _c(
  43544. "button",
  43545. {
  43546. staticClass: "btn btn-secondary",
  43547. attrs: { type: "button", "data-dismiss": "modal" }
  43548. },
  43549. [_vm._v("Close")]
  43550. ),
  43551. _vm._v(" "),
  43552. _c(
  43553. "button",
  43554. {
  43555. staticClass: "btn btn-primary",
  43556. attrs: { type: "button" },
  43557. on: {
  43558. click: function($event) {
  43559. return _vm.updateWorkOrder()
  43560. }
  43561. }
  43562. },
  43563. [_vm._v("Save")]
  43564. )
  43565. ])
  43566. ]
  43567. ),
  43568. _vm._v(" "),
  43569. _c("p", [
  43570. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43571. _vm._v(" "),
  43572. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43573. ]),
  43574. _vm._v(" "),
  43575. _c("p", [
  43576. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43577. _vm._v(" "),
  43578. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43579. ]),
  43580. _vm._v(" "),
  43581. _c("p", [
  43582. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43583. _vm._v(" "),
  43584. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43585. ]),
  43586. _vm._v(" "),
  43587. _c("p", [
  43588. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43589. _vm._v(" "),
  43590. this.storeList
  43591. ? _c("span", [
  43592. _vm._v(_vm._s(this.storeList.get(this.data.storeid).storesname))
  43593. ])
  43594. : _vm._e()
  43595. ]),
  43596. _vm._v(" "),
  43597. _c("p", [
  43598. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43599. _vm._v(" "),
  43600. _c(
  43601. "span",
  43602. {
  43603. staticClass: "dashed-underline",
  43604. attrs: {
  43605. "data-toggle": "tooltip",
  43606. "data-placement": "bottom",
  43607. title: this.getHRDate(this.data.dropdate)
  43608. }
  43609. },
  43610. [
  43611. _vm._v(
  43612. "\n " +
  43613. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43614. " days ago\n "
  43615. )
  43616. ]
  43617. )
  43618. ]),
  43619. _vm._v(" "),
  43620. _c("p", [
  43621. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43622. _vm._v(" "),
  43623. !this.isZero(this.data.pickupdate)
  43624. ? _c(
  43625. "span",
  43626. {
  43627. staticClass: "dashed-underline",
  43628. attrs: {
  43629. "data-toggle": "tooltip",
  43630. "data-placement": "bottom",
  43631. title: this.getHRDate(this.data.pickupdate)
  43632. }
  43633. },
  43634. [
  43635. _vm._v(
  43636. "\n " +
  43637. _vm._s(
  43638. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43639. ) +
  43640. " days ago\n "
  43641. )
  43642. ]
  43643. )
  43644. : _vm._e()
  43645. ]),
  43646. _vm._v(" "),
  43647. _c(
  43648. "button",
  43649. {
  43650. staticClass: "btn btn-primary",
  43651. attrs: {
  43652. type: "button",
  43653. "data-toggle": "modal",
  43654. "data-target": "#workordereditModal"
  43655. }
  43656. },
  43657. [_vm._v("Edit")]
  43658. )
  43659. ],
  43660. 1
  43661. )
  43662. }
  43663. var staticRenderFns = []
  43664. render._withStripped = true
  43665. /***/ }),
  43666. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43667. /*!********************************************************************!*\
  43668. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43669. \********************************************************************/
  43670. /*! exports provided: default */
  43671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43672. "use strict";
  43673. __webpack_require__.r(__webpack_exports__);
  43674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43675. /* globals __VUE_SSR_CONTEXT__ */
  43676. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43677. // This module is a runtime utility for cleaner component module output and will
  43678. // be included in the final webpack user bundle.
  43679. function normalizeComponent (
  43680. scriptExports,
  43681. render,
  43682. staticRenderFns,
  43683. functionalTemplate,
  43684. injectStyles,
  43685. scopeId,
  43686. moduleIdentifier, /* server only */
  43687. shadowMode /* vue-cli only */
  43688. ) {
  43689. // Vue.extend constructor export interop
  43690. var options = typeof scriptExports === 'function'
  43691. ? scriptExports.options
  43692. : scriptExports
  43693. // render functions
  43694. if (render) {
  43695. options.render = render
  43696. options.staticRenderFns = staticRenderFns
  43697. options._compiled = true
  43698. }
  43699. // functional template
  43700. if (functionalTemplate) {
  43701. options.functional = true
  43702. }
  43703. // scopedId
  43704. if (scopeId) {
  43705. options._scopeId = 'data-v-' + scopeId
  43706. }
  43707. var hook
  43708. if (moduleIdentifier) { // server build
  43709. hook = function (context) {
  43710. // 2.3 injection
  43711. context =
  43712. context || // cached call
  43713. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43714. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43715. // 2.2 with runInNewContext: true
  43716. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43717. context = __VUE_SSR_CONTEXT__
  43718. }
  43719. // inject component styles
  43720. if (injectStyles) {
  43721. injectStyles.call(this, context)
  43722. }
  43723. // register component module identifier for async chunk inferrence
  43724. if (context && context._registeredComponents) {
  43725. context._registeredComponents.add(moduleIdentifier)
  43726. }
  43727. }
  43728. // used by ssr in case component is cached and beforeCreate
  43729. // never gets called
  43730. options._ssrRegister = hook
  43731. } else if (injectStyles) {
  43732. hook = shadowMode
  43733. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43734. : injectStyles
  43735. }
  43736. if (hook) {
  43737. if (options.functional) {
  43738. // for template-only hot-reload because in that case the render fn doesn't
  43739. // go through the normalizer
  43740. options._injectStyles = hook
  43741. // register for functioal component in vue file
  43742. var originalRender = options.render
  43743. options.render = function renderWithStyleInjection (h, context) {
  43744. hook.call(context)
  43745. return originalRender(h, context)
  43746. }
  43747. } else {
  43748. // inject component registration as beforeCreate hook
  43749. var existing = options.beforeCreate
  43750. options.beforeCreate = existing
  43751. ? [].concat(existing, hook)
  43752. : [hook]
  43753. }
  43754. }
  43755. return {
  43756. exports: scriptExports,
  43757. options: options
  43758. }
  43759. }
  43760. /***/ }),
  43761. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43762. /*!*************************************************!*\
  43763. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  43764. \*************************************************/
  43765. /*! no static exports found */
  43766. /***/ (function(module, exports, __webpack_require__) {
  43767. "use strict";
  43768. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  43769. * Vue.js v2.6.11
  43770. * (c) 2014-2019 Evan You
  43771. * Released under the MIT License.
  43772. */
  43773. /* */
  43774. var emptyObject = Object.freeze({});
  43775. // These helpers produce better VM code in JS engines due to their
  43776. // explicitness and function inlining.
  43777. function isUndef (v) {
  43778. return v === undefined || v === null
  43779. }
  43780. function isDef (v) {
  43781. return v !== undefined && v !== null
  43782. }
  43783. function isTrue (v) {
  43784. return v === true
  43785. }
  43786. function isFalse (v) {
  43787. return v === false
  43788. }
  43789. /**
  43790. * Check if value is primitive.
  43791. */
  43792. function isPrimitive (value) {
  43793. return (
  43794. typeof value === 'string' ||
  43795. typeof value === 'number' ||
  43796. // $flow-disable-line
  43797. typeof value === 'symbol' ||
  43798. typeof value === 'boolean'
  43799. )
  43800. }
  43801. /**
  43802. * Quick object check - this is primarily used to tell
  43803. * Objects from primitive values when we know the value
  43804. * is a JSON-compliant type.
  43805. */
  43806. function isObject (obj) {
  43807. return obj !== null && typeof obj === 'object'
  43808. }
  43809. /**
  43810. * Get the raw type string of a value, e.g., [object Object].
  43811. */
  43812. var _toString = Object.prototype.toString;
  43813. function toRawType (value) {
  43814. return _toString.call(value).slice(8, -1)
  43815. }
  43816. /**
  43817. * Strict object type check. Only returns true
  43818. * for plain JavaScript objects.
  43819. */
  43820. function isPlainObject (obj) {
  43821. return _toString.call(obj) === '[object Object]'
  43822. }
  43823. function isRegExp (v) {
  43824. return _toString.call(v) === '[object RegExp]'
  43825. }
  43826. /**
  43827. * Check if val is a valid array index.
  43828. */
  43829. function isValidArrayIndex (val) {
  43830. var n = parseFloat(String(val));
  43831. return n >= 0 && Math.floor(n) === n && isFinite(val)
  43832. }
  43833. function isPromise (val) {
  43834. return (
  43835. isDef(val) &&
  43836. typeof val.then === 'function' &&
  43837. typeof val.catch === 'function'
  43838. )
  43839. }
  43840. /**
  43841. * Convert a value to a string that is actually rendered.
  43842. */
  43843. function toString (val) {
  43844. return val == null
  43845. ? ''
  43846. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  43847. ? JSON.stringify(val, null, 2)
  43848. : String(val)
  43849. }
  43850. /**
  43851. * Convert an input value to a number for persistence.
  43852. * If the conversion fails, return original string.
  43853. */
  43854. function toNumber (val) {
  43855. var n = parseFloat(val);
  43856. return isNaN(n) ? val : n
  43857. }
  43858. /**
  43859. * Make a map and return a function for checking if a key
  43860. * is in that map.
  43861. */
  43862. function makeMap (
  43863. str,
  43864. expectsLowerCase
  43865. ) {
  43866. var map = Object.create(null);
  43867. var list = str.split(',');
  43868. for (var i = 0; i < list.length; i++) {
  43869. map[list[i]] = true;
  43870. }
  43871. return expectsLowerCase
  43872. ? function (val) { return map[val.toLowerCase()]; }
  43873. : function (val) { return map[val]; }
  43874. }
  43875. /**
  43876. * Check if a tag is a built-in tag.
  43877. */
  43878. var isBuiltInTag = makeMap('slot,component', true);
  43879. /**
  43880. * Check if an attribute is a reserved attribute.
  43881. */
  43882. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  43883. /**
  43884. * Remove an item from an array.
  43885. */
  43886. function remove (arr, item) {
  43887. if (arr.length) {
  43888. var index = arr.indexOf(item);
  43889. if (index > -1) {
  43890. return arr.splice(index, 1)
  43891. }
  43892. }
  43893. }
  43894. /**
  43895. * Check whether an object has the property.
  43896. */
  43897. var hasOwnProperty = Object.prototype.hasOwnProperty;
  43898. function hasOwn (obj, key) {
  43899. return hasOwnProperty.call(obj, key)
  43900. }
  43901. /**
  43902. * Create a cached version of a pure function.
  43903. */
  43904. function cached (fn) {
  43905. var cache = Object.create(null);
  43906. return (function cachedFn (str) {
  43907. var hit = cache[str];
  43908. return hit || (cache[str] = fn(str))
  43909. })
  43910. }
  43911. /**
  43912. * Camelize a hyphen-delimited string.
  43913. */
  43914. var camelizeRE = /-(\w)/g;
  43915. var camelize = cached(function (str) {
  43916. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  43917. });
  43918. /**
  43919. * Capitalize a string.
  43920. */
  43921. var capitalize = cached(function (str) {
  43922. return str.charAt(0).toUpperCase() + str.slice(1)
  43923. });
  43924. /**
  43925. * Hyphenate a camelCase string.
  43926. */
  43927. var hyphenateRE = /\B([A-Z])/g;
  43928. var hyphenate = cached(function (str) {
  43929. return str.replace(hyphenateRE, '-$1').toLowerCase()
  43930. });
  43931. /**
  43932. * Simple bind polyfill for environments that do not support it,
  43933. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43934. * since native bind is now performant enough in most browsers.
  43935. * But removing it would mean breaking code that was able to run in
  43936. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43937. */
  43938. /* istanbul ignore next */
  43939. function polyfillBind (fn, ctx) {
  43940. function boundFn (a) {
  43941. var l = arguments.length;
  43942. return l
  43943. ? l > 1
  43944. ? fn.apply(ctx, arguments)
  43945. : fn.call(ctx, a)
  43946. : fn.call(ctx)
  43947. }
  43948. boundFn._length = fn.length;
  43949. return boundFn
  43950. }
  43951. function nativeBind (fn, ctx) {
  43952. return fn.bind(ctx)
  43953. }
  43954. var bind = Function.prototype.bind
  43955. ? nativeBind
  43956. : polyfillBind;
  43957. /**
  43958. * Convert an Array-like object to a real Array.
  43959. */
  43960. function toArray (list, start) {
  43961. start = start || 0;
  43962. var i = list.length - start;
  43963. var ret = new Array(i);
  43964. while (i--) {
  43965. ret[i] = list[i + start];
  43966. }
  43967. return ret
  43968. }
  43969. /**
  43970. * Mix properties into target object.
  43971. */
  43972. function extend (to, _from) {
  43973. for (var key in _from) {
  43974. to[key] = _from[key];
  43975. }
  43976. return to
  43977. }
  43978. /**
  43979. * Merge an Array of Objects into a single Object.
  43980. */
  43981. function toObject (arr) {
  43982. var res = {};
  43983. for (var i = 0; i < arr.length; i++) {
  43984. if (arr[i]) {
  43985. extend(res, arr[i]);
  43986. }
  43987. }
  43988. return res
  43989. }
  43990. /* eslint-disable no-unused-vars */
  43991. /**
  43992. * Perform no operation.
  43993. * Stubbing args to make Flow happy without leaving useless transpiled code
  43994. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  43995. */
  43996. function noop (a, b, c) {}
  43997. /**
  43998. * Always return false.
  43999. */
  44000. var no = function (a, b, c) { return false; };
  44001. /* eslint-enable no-unused-vars */
  44002. /**
  44003. * Return the same value.
  44004. */
  44005. var identity = function (_) { return _; };
  44006. /**
  44007. * Generate a string containing static keys from compiler modules.
  44008. */
  44009. function genStaticKeys (modules) {
  44010. return modules.reduce(function (keys, m) {
  44011. return keys.concat(m.staticKeys || [])
  44012. }, []).join(',')
  44013. }
  44014. /**
  44015. * Check if two values are loosely equal - that is,
  44016. * if they are plain objects, do they have the same shape?
  44017. */
  44018. function looseEqual (a, b) {
  44019. if (a === b) { return true }
  44020. var isObjectA = isObject(a);
  44021. var isObjectB = isObject(b);
  44022. if (isObjectA && isObjectB) {
  44023. try {
  44024. var isArrayA = Array.isArray(a);
  44025. var isArrayB = Array.isArray(b);
  44026. if (isArrayA && isArrayB) {
  44027. return a.length === b.length && a.every(function (e, i) {
  44028. return looseEqual(e, b[i])
  44029. })
  44030. } else if (a instanceof Date && b instanceof Date) {
  44031. return a.getTime() === b.getTime()
  44032. } else if (!isArrayA && !isArrayB) {
  44033. var keysA = Object.keys(a);
  44034. var keysB = Object.keys(b);
  44035. return keysA.length === keysB.length && keysA.every(function (key) {
  44036. return looseEqual(a[key], b[key])
  44037. })
  44038. } else {
  44039. /* istanbul ignore next */
  44040. return false
  44041. }
  44042. } catch (e) {
  44043. /* istanbul ignore next */
  44044. return false
  44045. }
  44046. } else if (!isObjectA && !isObjectB) {
  44047. return String(a) === String(b)
  44048. } else {
  44049. return false
  44050. }
  44051. }
  44052. /**
  44053. * Return the first index at which a loosely equal value can be
  44054. * found in the array (if value is a plain object, the array must
  44055. * contain an object of the same shape), or -1 if it is not present.
  44056. */
  44057. function looseIndexOf (arr, val) {
  44058. for (var i = 0; i < arr.length; i++) {
  44059. if (looseEqual(arr[i], val)) { return i }
  44060. }
  44061. return -1
  44062. }
  44063. /**
  44064. * Ensure a function is called only once.
  44065. */
  44066. function once (fn) {
  44067. var called = false;
  44068. return function () {
  44069. if (!called) {
  44070. called = true;
  44071. fn.apply(this, arguments);
  44072. }
  44073. }
  44074. }
  44075. var SSR_ATTR = 'data-server-rendered';
  44076. var ASSET_TYPES = [
  44077. 'component',
  44078. 'directive',
  44079. 'filter'
  44080. ];
  44081. var LIFECYCLE_HOOKS = [
  44082. 'beforeCreate',
  44083. 'created',
  44084. 'beforeMount',
  44085. 'mounted',
  44086. 'beforeUpdate',
  44087. 'updated',
  44088. 'beforeDestroy',
  44089. 'destroyed',
  44090. 'activated',
  44091. 'deactivated',
  44092. 'errorCaptured',
  44093. 'serverPrefetch'
  44094. ];
  44095. /* */
  44096. var config = ({
  44097. /**
  44098. * Option merge strategies (used in core/util/options)
  44099. */
  44100. // $flow-disable-line
  44101. optionMergeStrategies: Object.create(null),
  44102. /**
  44103. * Whether to suppress warnings.
  44104. */
  44105. silent: false,
  44106. /**
  44107. * Show production mode tip message on boot?
  44108. */
  44109. productionTip: "development" !== 'production',
  44110. /**
  44111. * Whether to enable devtools
  44112. */
  44113. devtools: "development" !== 'production',
  44114. /**
  44115. * Whether to record perf
  44116. */
  44117. performance: false,
  44118. /**
  44119. * Error handler for watcher errors
  44120. */
  44121. errorHandler: null,
  44122. /**
  44123. * Warn handler for watcher warns
  44124. */
  44125. warnHandler: null,
  44126. /**
  44127. * Ignore certain custom elements
  44128. */
  44129. ignoredElements: [],
  44130. /**
  44131. * Custom user key aliases for v-on
  44132. */
  44133. // $flow-disable-line
  44134. keyCodes: Object.create(null),
  44135. /**
  44136. * Check if a tag is reserved so that it cannot be registered as a
  44137. * component. This is platform-dependent and may be overwritten.
  44138. */
  44139. isReservedTag: no,
  44140. /**
  44141. * Check if an attribute is reserved so that it cannot be used as a component
  44142. * prop. This is platform-dependent and may be overwritten.
  44143. */
  44144. isReservedAttr: no,
  44145. /**
  44146. * Check if a tag is an unknown element.
  44147. * Platform-dependent.
  44148. */
  44149. isUnknownElement: no,
  44150. /**
  44151. * Get the namespace of an element
  44152. */
  44153. getTagNamespace: noop,
  44154. /**
  44155. * Parse the real tag name for the specific platform.
  44156. */
  44157. parsePlatformTagName: identity,
  44158. /**
  44159. * Check if an attribute must be bound using property, e.g. value
  44160. * Platform-dependent.
  44161. */
  44162. mustUseProp: no,
  44163. /**
  44164. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44165. * This will significantly reduce performance if set to false.
  44166. */
  44167. async: true,
  44168. /**
  44169. * Exposed for legacy reasons
  44170. */
  44171. _lifecycleHooks: LIFECYCLE_HOOKS
  44172. });
  44173. /* */
  44174. /**
  44175. * unicode letters used for parsing html tags, component names and property paths.
  44176. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44177. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44178. */
  44179. 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/;
  44180. /**
  44181. * Check if a string starts with $ or _
  44182. */
  44183. function isReserved (str) {
  44184. var c = (str + '').charCodeAt(0);
  44185. return c === 0x24 || c === 0x5F
  44186. }
  44187. /**
  44188. * Define a property.
  44189. */
  44190. function def (obj, key, val, enumerable) {
  44191. Object.defineProperty(obj, key, {
  44192. value: val,
  44193. enumerable: !!enumerable,
  44194. writable: true,
  44195. configurable: true
  44196. });
  44197. }
  44198. /**
  44199. * Parse simple path.
  44200. */
  44201. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44202. function parsePath (path) {
  44203. if (bailRE.test(path)) {
  44204. return
  44205. }
  44206. var segments = path.split('.');
  44207. return function (obj) {
  44208. for (var i = 0; i < segments.length; i++) {
  44209. if (!obj) { return }
  44210. obj = obj[segments[i]];
  44211. }
  44212. return obj
  44213. }
  44214. }
  44215. /* */
  44216. // can we use __proto__?
  44217. var hasProto = '__proto__' in {};
  44218. // Browser environment sniffing
  44219. var inBrowser = typeof window !== 'undefined';
  44220. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44221. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44222. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44223. var isIE = UA && /msie|trident/.test(UA);
  44224. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44225. var isEdge = UA && UA.indexOf('edge/') > 0;
  44226. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44227. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44228. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44229. var isPhantomJS = UA && /phantomjs/.test(UA);
  44230. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44231. // Firefox has a "watch" function on Object.prototype...
  44232. var nativeWatch = ({}).watch;
  44233. var supportsPassive = false;
  44234. if (inBrowser) {
  44235. try {
  44236. var opts = {};
  44237. Object.defineProperty(opts, 'passive', ({
  44238. get: function get () {
  44239. /* istanbul ignore next */
  44240. supportsPassive = true;
  44241. }
  44242. })); // https://github.com/facebook/flow/issues/285
  44243. window.addEventListener('test-passive', null, opts);
  44244. } catch (e) {}
  44245. }
  44246. // this needs to be lazy-evaled because vue may be required before
  44247. // vue-server-renderer can set VUE_ENV
  44248. var _isServer;
  44249. var isServerRendering = function () {
  44250. if (_isServer === undefined) {
  44251. /* istanbul ignore if */
  44252. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44253. // detect presence of vue-server-renderer and avoid
  44254. // Webpack shimming the process
  44255. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44256. } else {
  44257. _isServer = false;
  44258. }
  44259. }
  44260. return _isServer
  44261. };
  44262. // detect devtools
  44263. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44264. /* istanbul ignore next */
  44265. function isNative (Ctor) {
  44266. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44267. }
  44268. var hasSymbol =
  44269. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44270. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44271. var _Set;
  44272. /* istanbul ignore if */ // $flow-disable-line
  44273. if (typeof Set !== 'undefined' && isNative(Set)) {
  44274. // use native Set when available.
  44275. _Set = Set;
  44276. } else {
  44277. // a non-standard Set polyfill that only works with primitive keys.
  44278. _Set = /*@__PURE__*/(function () {
  44279. function Set () {
  44280. this.set = Object.create(null);
  44281. }
  44282. Set.prototype.has = function has (key) {
  44283. return this.set[key] === true
  44284. };
  44285. Set.prototype.add = function add (key) {
  44286. this.set[key] = true;
  44287. };
  44288. Set.prototype.clear = function clear () {
  44289. this.set = Object.create(null);
  44290. };
  44291. return Set;
  44292. }());
  44293. }
  44294. /* */
  44295. var warn = noop;
  44296. var tip = noop;
  44297. var generateComponentTrace = (noop); // work around flow check
  44298. var formatComponentName = (noop);
  44299. {
  44300. var hasConsole = typeof console !== 'undefined';
  44301. var classifyRE = /(?:^|[-_])(\w)/g;
  44302. var classify = function (str) { return str
  44303. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44304. .replace(/[-_]/g, ''); };
  44305. warn = function (msg, vm) {
  44306. var trace = vm ? generateComponentTrace(vm) : '';
  44307. if (config.warnHandler) {
  44308. config.warnHandler.call(null, msg, vm, trace);
  44309. } else if (hasConsole && (!config.silent)) {
  44310. console.error(("[Vue warn]: " + msg + trace));
  44311. }
  44312. };
  44313. tip = function (msg, vm) {
  44314. if (hasConsole && (!config.silent)) {
  44315. console.warn("[Vue tip]: " + msg + (
  44316. vm ? generateComponentTrace(vm) : ''
  44317. ));
  44318. }
  44319. };
  44320. formatComponentName = function (vm, includeFile) {
  44321. if (vm.$root === vm) {
  44322. return '<Root>'
  44323. }
  44324. var options = typeof vm === 'function' && vm.cid != null
  44325. ? vm.options
  44326. : vm._isVue
  44327. ? vm.$options || vm.constructor.options
  44328. : vm;
  44329. var name = options.name || options._componentTag;
  44330. var file = options.__file;
  44331. if (!name && file) {
  44332. var match = file.match(/([^/\\]+)\.vue$/);
  44333. name = match && match[1];
  44334. }
  44335. return (
  44336. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44337. (file && includeFile !== false ? (" at " + file) : '')
  44338. )
  44339. };
  44340. var repeat = function (str, n) {
  44341. var res = '';
  44342. while (n) {
  44343. if (n % 2 === 1) { res += str; }
  44344. if (n > 1) { str += str; }
  44345. n >>= 1;
  44346. }
  44347. return res
  44348. };
  44349. generateComponentTrace = function (vm) {
  44350. if (vm._isVue && vm.$parent) {
  44351. var tree = [];
  44352. var currentRecursiveSequence = 0;
  44353. while (vm) {
  44354. if (tree.length > 0) {
  44355. var last = tree[tree.length - 1];
  44356. if (last.constructor === vm.constructor) {
  44357. currentRecursiveSequence++;
  44358. vm = vm.$parent;
  44359. continue
  44360. } else if (currentRecursiveSequence > 0) {
  44361. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44362. currentRecursiveSequence = 0;
  44363. }
  44364. }
  44365. tree.push(vm);
  44366. vm = vm.$parent;
  44367. }
  44368. return '\n\nfound in\n\n' + tree
  44369. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44370. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44371. : formatComponentName(vm))); })
  44372. .join('\n')
  44373. } else {
  44374. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44375. }
  44376. };
  44377. }
  44378. /* */
  44379. var uid = 0;
  44380. /**
  44381. * A dep is an observable that can have multiple
  44382. * directives subscribing to it.
  44383. */
  44384. var Dep = function Dep () {
  44385. this.id = uid++;
  44386. this.subs = [];
  44387. };
  44388. Dep.prototype.addSub = function addSub (sub) {
  44389. this.subs.push(sub);
  44390. };
  44391. Dep.prototype.removeSub = function removeSub (sub) {
  44392. remove(this.subs, sub);
  44393. };
  44394. Dep.prototype.depend = function depend () {
  44395. if (Dep.target) {
  44396. Dep.target.addDep(this);
  44397. }
  44398. };
  44399. Dep.prototype.notify = function notify () {
  44400. // stabilize the subscriber list first
  44401. var subs = this.subs.slice();
  44402. if (!config.async) {
  44403. // subs aren't sorted in scheduler if not running async
  44404. // we need to sort them now to make sure they fire in correct
  44405. // order
  44406. subs.sort(function (a, b) { return a.id - b.id; });
  44407. }
  44408. for (var i = 0, l = subs.length; i < l; i++) {
  44409. subs[i].update();
  44410. }
  44411. };
  44412. // The current target watcher being evaluated.
  44413. // This is globally unique because only one watcher
  44414. // can be evaluated at a time.
  44415. Dep.target = null;
  44416. var targetStack = [];
  44417. function pushTarget (target) {
  44418. targetStack.push(target);
  44419. Dep.target = target;
  44420. }
  44421. function popTarget () {
  44422. targetStack.pop();
  44423. Dep.target = targetStack[targetStack.length - 1];
  44424. }
  44425. /* */
  44426. var VNode = function VNode (
  44427. tag,
  44428. data,
  44429. children,
  44430. text,
  44431. elm,
  44432. context,
  44433. componentOptions,
  44434. asyncFactory
  44435. ) {
  44436. this.tag = tag;
  44437. this.data = data;
  44438. this.children = children;
  44439. this.text = text;
  44440. this.elm = elm;
  44441. this.ns = undefined;
  44442. this.context = context;
  44443. this.fnContext = undefined;
  44444. this.fnOptions = undefined;
  44445. this.fnScopeId = undefined;
  44446. this.key = data && data.key;
  44447. this.componentOptions = componentOptions;
  44448. this.componentInstance = undefined;
  44449. this.parent = undefined;
  44450. this.raw = false;
  44451. this.isStatic = false;
  44452. this.isRootInsert = true;
  44453. this.isComment = false;
  44454. this.isCloned = false;
  44455. this.isOnce = false;
  44456. this.asyncFactory = asyncFactory;
  44457. this.asyncMeta = undefined;
  44458. this.isAsyncPlaceholder = false;
  44459. };
  44460. var prototypeAccessors = { child: { configurable: true } };
  44461. // DEPRECATED: alias for componentInstance for backwards compat.
  44462. /* istanbul ignore next */
  44463. prototypeAccessors.child.get = function () {
  44464. return this.componentInstance
  44465. };
  44466. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44467. var createEmptyVNode = function (text) {
  44468. if ( text === void 0 ) text = '';
  44469. var node = new VNode();
  44470. node.text = text;
  44471. node.isComment = true;
  44472. return node
  44473. };
  44474. function createTextVNode (val) {
  44475. return new VNode(undefined, undefined, undefined, String(val))
  44476. }
  44477. // optimized shallow clone
  44478. // used for static nodes and slot nodes because they may be reused across
  44479. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44480. // on their elm reference.
  44481. function cloneVNode (vnode) {
  44482. var cloned = new VNode(
  44483. vnode.tag,
  44484. vnode.data,
  44485. // #7975
  44486. // clone children array to avoid mutating original in case of cloning
  44487. // a child.
  44488. vnode.children && vnode.children.slice(),
  44489. vnode.text,
  44490. vnode.elm,
  44491. vnode.context,
  44492. vnode.componentOptions,
  44493. vnode.asyncFactory
  44494. );
  44495. cloned.ns = vnode.ns;
  44496. cloned.isStatic = vnode.isStatic;
  44497. cloned.key = vnode.key;
  44498. cloned.isComment = vnode.isComment;
  44499. cloned.fnContext = vnode.fnContext;
  44500. cloned.fnOptions = vnode.fnOptions;
  44501. cloned.fnScopeId = vnode.fnScopeId;
  44502. cloned.asyncMeta = vnode.asyncMeta;
  44503. cloned.isCloned = true;
  44504. return cloned
  44505. }
  44506. /*
  44507. * not type checking this file because flow doesn't play well with
  44508. * dynamically accessing methods on Array prototype
  44509. */
  44510. var arrayProto = Array.prototype;
  44511. var arrayMethods = Object.create(arrayProto);
  44512. var methodsToPatch = [
  44513. 'push',
  44514. 'pop',
  44515. 'shift',
  44516. 'unshift',
  44517. 'splice',
  44518. 'sort',
  44519. 'reverse'
  44520. ];
  44521. /**
  44522. * Intercept mutating methods and emit events
  44523. */
  44524. methodsToPatch.forEach(function (method) {
  44525. // cache original method
  44526. var original = arrayProto[method];
  44527. def(arrayMethods, method, function mutator () {
  44528. var args = [], len = arguments.length;
  44529. while ( len-- ) args[ len ] = arguments[ len ];
  44530. var result = original.apply(this, args);
  44531. var ob = this.__ob__;
  44532. var inserted;
  44533. switch (method) {
  44534. case 'push':
  44535. case 'unshift':
  44536. inserted = args;
  44537. break
  44538. case 'splice':
  44539. inserted = args.slice(2);
  44540. break
  44541. }
  44542. if (inserted) { ob.observeArray(inserted); }
  44543. // notify change
  44544. ob.dep.notify();
  44545. return result
  44546. });
  44547. });
  44548. /* */
  44549. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44550. /**
  44551. * In some cases we may want to disable observation inside a component's
  44552. * update computation.
  44553. */
  44554. var shouldObserve = true;
  44555. function toggleObserving (value) {
  44556. shouldObserve = value;
  44557. }
  44558. /**
  44559. * Observer class that is attached to each observed
  44560. * object. Once attached, the observer converts the target
  44561. * object's property keys into getter/setters that
  44562. * collect dependencies and dispatch updates.
  44563. */
  44564. var Observer = function Observer (value) {
  44565. this.value = value;
  44566. this.dep = new Dep();
  44567. this.vmCount = 0;
  44568. def(value, '__ob__', this);
  44569. if (Array.isArray(value)) {
  44570. if (hasProto) {
  44571. protoAugment(value, arrayMethods);
  44572. } else {
  44573. copyAugment(value, arrayMethods, arrayKeys);
  44574. }
  44575. this.observeArray(value);
  44576. } else {
  44577. this.walk(value);
  44578. }
  44579. };
  44580. /**
  44581. * Walk through all properties and convert them into
  44582. * getter/setters. This method should only be called when
  44583. * value type is Object.
  44584. */
  44585. Observer.prototype.walk = function walk (obj) {
  44586. var keys = Object.keys(obj);
  44587. for (var i = 0; i < keys.length; i++) {
  44588. defineReactive$$1(obj, keys[i]);
  44589. }
  44590. };
  44591. /**
  44592. * Observe a list of Array items.
  44593. */
  44594. Observer.prototype.observeArray = function observeArray (items) {
  44595. for (var i = 0, l = items.length; i < l; i++) {
  44596. observe(items[i]);
  44597. }
  44598. };
  44599. // helpers
  44600. /**
  44601. * Augment a target Object or Array by intercepting
  44602. * the prototype chain using __proto__
  44603. */
  44604. function protoAugment (target, src) {
  44605. /* eslint-disable no-proto */
  44606. target.__proto__ = src;
  44607. /* eslint-enable no-proto */
  44608. }
  44609. /**
  44610. * Augment a target Object or Array by defining
  44611. * hidden properties.
  44612. */
  44613. /* istanbul ignore next */
  44614. function copyAugment (target, src, keys) {
  44615. for (var i = 0, l = keys.length; i < l; i++) {
  44616. var key = keys[i];
  44617. def(target, key, src[key]);
  44618. }
  44619. }
  44620. /**
  44621. * Attempt to create an observer instance for a value,
  44622. * returns the new observer if successfully observed,
  44623. * or the existing observer if the value already has one.
  44624. */
  44625. function observe (value, asRootData) {
  44626. if (!isObject(value) || value instanceof VNode) {
  44627. return
  44628. }
  44629. var ob;
  44630. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44631. ob = value.__ob__;
  44632. } else if (
  44633. shouldObserve &&
  44634. !isServerRendering() &&
  44635. (Array.isArray(value) || isPlainObject(value)) &&
  44636. Object.isExtensible(value) &&
  44637. !value._isVue
  44638. ) {
  44639. ob = new Observer(value);
  44640. }
  44641. if (asRootData && ob) {
  44642. ob.vmCount++;
  44643. }
  44644. return ob
  44645. }
  44646. /**
  44647. * Define a reactive property on an Object.
  44648. */
  44649. function defineReactive$$1 (
  44650. obj,
  44651. key,
  44652. val,
  44653. customSetter,
  44654. shallow
  44655. ) {
  44656. var dep = new Dep();
  44657. var property = Object.getOwnPropertyDescriptor(obj, key);
  44658. if (property && property.configurable === false) {
  44659. return
  44660. }
  44661. // cater for pre-defined getter/setters
  44662. var getter = property && property.get;
  44663. var setter = property && property.set;
  44664. if ((!getter || setter) && arguments.length === 2) {
  44665. val = obj[key];
  44666. }
  44667. var childOb = !shallow && observe(val);
  44668. Object.defineProperty(obj, key, {
  44669. enumerable: true,
  44670. configurable: true,
  44671. get: function reactiveGetter () {
  44672. var value = getter ? getter.call(obj) : val;
  44673. if (Dep.target) {
  44674. dep.depend();
  44675. if (childOb) {
  44676. childOb.dep.depend();
  44677. if (Array.isArray(value)) {
  44678. dependArray(value);
  44679. }
  44680. }
  44681. }
  44682. return value
  44683. },
  44684. set: function reactiveSetter (newVal) {
  44685. var value = getter ? getter.call(obj) : val;
  44686. /* eslint-disable no-self-compare */
  44687. if (newVal === value || (newVal !== newVal && value !== value)) {
  44688. return
  44689. }
  44690. /* eslint-enable no-self-compare */
  44691. if (customSetter) {
  44692. customSetter();
  44693. }
  44694. // #7981: for accessor properties without setter
  44695. if (getter && !setter) { return }
  44696. if (setter) {
  44697. setter.call(obj, newVal);
  44698. } else {
  44699. val = newVal;
  44700. }
  44701. childOb = !shallow && observe(newVal);
  44702. dep.notify();
  44703. }
  44704. });
  44705. }
  44706. /**
  44707. * Set a property on an object. Adds the new property and
  44708. * triggers change notification if the property doesn't
  44709. * already exist.
  44710. */
  44711. function set (target, key, val) {
  44712. if (isUndef(target) || isPrimitive(target)
  44713. ) {
  44714. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44715. }
  44716. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44717. target.length = Math.max(target.length, key);
  44718. target.splice(key, 1, val);
  44719. return val
  44720. }
  44721. if (key in target && !(key in Object.prototype)) {
  44722. target[key] = val;
  44723. return val
  44724. }
  44725. var ob = (target).__ob__;
  44726. if (target._isVue || (ob && ob.vmCount)) {
  44727. warn(
  44728. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44729. 'at runtime - declare it upfront in the data option.'
  44730. );
  44731. return val
  44732. }
  44733. if (!ob) {
  44734. target[key] = val;
  44735. return val
  44736. }
  44737. defineReactive$$1(ob.value, key, val);
  44738. ob.dep.notify();
  44739. return val
  44740. }
  44741. /**
  44742. * Delete a property and trigger change if necessary.
  44743. */
  44744. function del (target, key) {
  44745. if (isUndef(target) || isPrimitive(target)
  44746. ) {
  44747. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44748. }
  44749. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44750. target.splice(key, 1);
  44751. return
  44752. }
  44753. var ob = (target).__ob__;
  44754. if (target._isVue || (ob && ob.vmCount)) {
  44755. warn(
  44756. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44757. '- just set it to null.'
  44758. );
  44759. return
  44760. }
  44761. if (!hasOwn(target, key)) {
  44762. return
  44763. }
  44764. delete target[key];
  44765. if (!ob) {
  44766. return
  44767. }
  44768. ob.dep.notify();
  44769. }
  44770. /**
  44771. * Collect dependencies on array elements when the array is touched, since
  44772. * we cannot intercept array element access like property getters.
  44773. */
  44774. function dependArray (value) {
  44775. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  44776. e = value[i];
  44777. e && e.__ob__ && e.__ob__.dep.depend();
  44778. if (Array.isArray(e)) {
  44779. dependArray(e);
  44780. }
  44781. }
  44782. }
  44783. /* */
  44784. /**
  44785. * Option overwriting strategies are functions that handle
  44786. * how to merge a parent option value and a child option
  44787. * value into the final value.
  44788. */
  44789. var strats = config.optionMergeStrategies;
  44790. /**
  44791. * Options with restrictions
  44792. */
  44793. {
  44794. strats.el = strats.propsData = function (parent, child, vm, key) {
  44795. if (!vm) {
  44796. warn(
  44797. "option \"" + key + "\" can only be used during instance " +
  44798. 'creation with the `new` keyword.'
  44799. );
  44800. }
  44801. return defaultStrat(parent, child)
  44802. };
  44803. }
  44804. /**
  44805. * Helper that recursively merges two data objects together.
  44806. */
  44807. function mergeData (to, from) {
  44808. if (!from) { return to }
  44809. var key, toVal, fromVal;
  44810. var keys = hasSymbol
  44811. ? Reflect.ownKeys(from)
  44812. : Object.keys(from);
  44813. for (var i = 0; i < keys.length; i++) {
  44814. key = keys[i];
  44815. // in case the object is already observed...
  44816. if (key === '__ob__') { continue }
  44817. toVal = to[key];
  44818. fromVal = from[key];
  44819. if (!hasOwn(to, key)) {
  44820. set(to, key, fromVal);
  44821. } else if (
  44822. toVal !== fromVal &&
  44823. isPlainObject(toVal) &&
  44824. isPlainObject(fromVal)
  44825. ) {
  44826. mergeData(toVal, fromVal);
  44827. }
  44828. }
  44829. return to
  44830. }
  44831. /**
  44832. * Data
  44833. */
  44834. function mergeDataOrFn (
  44835. parentVal,
  44836. childVal,
  44837. vm
  44838. ) {
  44839. if (!vm) {
  44840. // in a Vue.extend merge, both should be functions
  44841. if (!childVal) {
  44842. return parentVal
  44843. }
  44844. if (!parentVal) {
  44845. return childVal
  44846. }
  44847. // when parentVal & childVal are both present,
  44848. // we need to return a function that returns the
  44849. // merged result of both functions... no need to
  44850. // check if parentVal is a function here because
  44851. // it has to be a function to pass previous merges.
  44852. return function mergedDataFn () {
  44853. return mergeData(
  44854. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  44855. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  44856. )
  44857. }
  44858. } else {
  44859. return function mergedInstanceDataFn () {
  44860. // instance merge
  44861. var instanceData = typeof childVal === 'function'
  44862. ? childVal.call(vm, vm)
  44863. : childVal;
  44864. var defaultData = typeof parentVal === 'function'
  44865. ? parentVal.call(vm, vm)
  44866. : parentVal;
  44867. if (instanceData) {
  44868. return mergeData(instanceData, defaultData)
  44869. } else {
  44870. return defaultData
  44871. }
  44872. }
  44873. }
  44874. }
  44875. strats.data = function (
  44876. parentVal,
  44877. childVal,
  44878. vm
  44879. ) {
  44880. if (!vm) {
  44881. if (childVal && typeof childVal !== 'function') {
  44882. warn(
  44883. 'The "data" option should be a function ' +
  44884. 'that returns a per-instance value in component ' +
  44885. 'definitions.',
  44886. vm
  44887. );
  44888. return parentVal
  44889. }
  44890. return mergeDataOrFn(parentVal, childVal)
  44891. }
  44892. return mergeDataOrFn(parentVal, childVal, vm)
  44893. };
  44894. /**
  44895. * Hooks and props are merged as arrays.
  44896. */
  44897. function mergeHook (
  44898. parentVal,
  44899. childVal
  44900. ) {
  44901. var res = childVal
  44902. ? parentVal
  44903. ? parentVal.concat(childVal)
  44904. : Array.isArray(childVal)
  44905. ? childVal
  44906. : [childVal]
  44907. : parentVal;
  44908. return res
  44909. ? dedupeHooks(res)
  44910. : res
  44911. }
  44912. function dedupeHooks (hooks) {
  44913. var res = [];
  44914. for (var i = 0; i < hooks.length; i++) {
  44915. if (res.indexOf(hooks[i]) === -1) {
  44916. res.push(hooks[i]);
  44917. }
  44918. }
  44919. return res
  44920. }
  44921. LIFECYCLE_HOOKS.forEach(function (hook) {
  44922. strats[hook] = mergeHook;
  44923. });
  44924. /**
  44925. * Assets
  44926. *
  44927. * When a vm is present (instance creation), we need to do
  44928. * a three-way merge between constructor options, instance
  44929. * options and parent options.
  44930. */
  44931. function mergeAssets (
  44932. parentVal,
  44933. childVal,
  44934. vm,
  44935. key
  44936. ) {
  44937. var res = Object.create(parentVal || null);
  44938. if (childVal) {
  44939. assertObjectType(key, childVal, vm);
  44940. return extend(res, childVal)
  44941. } else {
  44942. return res
  44943. }
  44944. }
  44945. ASSET_TYPES.forEach(function (type) {
  44946. strats[type + 's'] = mergeAssets;
  44947. });
  44948. /**
  44949. * Watchers.
  44950. *
  44951. * Watchers hashes should not overwrite one
  44952. * another, so we merge them as arrays.
  44953. */
  44954. strats.watch = function (
  44955. parentVal,
  44956. childVal,
  44957. vm,
  44958. key
  44959. ) {
  44960. // work around Firefox's Object.prototype.watch...
  44961. if (parentVal === nativeWatch) { parentVal = undefined; }
  44962. if (childVal === nativeWatch) { childVal = undefined; }
  44963. /* istanbul ignore if */
  44964. if (!childVal) { return Object.create(parentVal || null) }
  44965. {
  44966. assertObjectType(key, childVal, vm);
  44967. }
  44968. if (!parentVal) { return childVal }
  44969. var ret = {};
  44970. extend(ret, parentVal);
  44971. for (var key$1 in childVal) {
  44972. var parent = ret[key$1];
  44973. var child = childVal[key$1];
  44974. if (parent && !Array.isArray(parent)) {
  44975. parent = [parent];
  44976. }
  44977. ret[key$1] = parent
  44978. ? parent.concat(child)
  44979. : Array.isArray(child) ? child : [child];
  44980. }
  44981. return ret
  44982. };
  44983. /**
  44984. * Other object hashes.
  44985. */
  44986. strats.props =
  44987. strats.methods =
  44988. strats.inject =
  44989. strats.computed = function (
  44990. parentVal,
  44991. childVal,
  44992. vm,
  44993. key
  44994. ) {
  44995. if (childVal && "development" !== 'production') {
  44996. assertObjectType(key, childVal, vm);
  44997. }
  44998. if (!parentVal) { return childVal }
  44999. var ret = Object.create(null);
  45000. extend(ret, parentVal);
  45001. if (childVal) { extend(ret, childVal); }
  45002. return ret
  45003. };
  45004. strats.provide = mergeDataOrFn;
  45005. /**
  45006. * Default strategy.
  45007. */
  45008. var defaultStrat = function (parentVal, childVal) {
  45009. return childVal === undefined
  45010. ? parentVal
  45011. : childVal
  45012. };
  45013. /**
  45014. * Validate component names
  45015. */
  45016. function checkComponents (options) {
  45017. for (var key in options.components) {
  45018. validateComponentName(key);
  45019. }
  45020. }
  45021. function validateComponentName (name) {
  45022. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45023. warn(
  45024. 'Invalid component name: "' + name + '". Component names ' +
  45025. 'should conform to valid custom element name in html5 specification.'
  45026. );
  45027. }
  45028. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45029. warn(
  45030. 'Do not use built-in or reserved HTML elements as component ' +
  45031. 'id: ' + name
  45032. );
  45033. }
  45034. }
  45035. /**
  45036. * Ensure all props option syntax are normalized into the
  45037. * Object-based format.
  45038. */
  45039. function normalizeProps (options, vm) {
  45040. var props = options.props;
  45041. if (!props) { return }
  45042. var res = {};
  45043. var i, val, name;
  45044. if (Array.isArray(props)) {
  45045. i = props.length;
  45046. while (i--) {
  45047. val = props[i];
  45048. if (typeof val === 'string') {
  45049. name = camelize(val);
  45050. res[name] = { type: null };
  45051. } else {
  45052. warn('props must be strings when using array syntax.');
  45053. }
  45054. }
  45055. } else if (isPlainObject(props)) {
  45056. for (var key in props) {
  45057. val = props[key];
  45058. name = camelize(key);
  45059. res[name] = isPlainObject(val)
  45060. ? val
  45061. : { type: val };
  45062. }
  45063. } else {
  45064. warn(
  45065. "Invalid value for option \"props\": expected an Array or an Object, " +
  45066. "but got " + (toRawType(props)) + ".",
  45067. vm
  45068. );
  45069. }
  45070. options.props = res;
  45071. }
  45072. /**
  45073. * Normalize all injections into Object-based format
  45074. */
  45075. function normalizeInject (options, vm) {
  45076. var inject = options.inject;
  45077. if (!inject) { return }
  45078. var normalized = options.inject = {};
  45079. if (Array.isArray(inject)) {
  45080. for (var i = 0; i < inject.length; i++) {
  45081. normalized[inject[i]] = { from: inject[i] };
  45082. }
  45083. } else if (isPlainObject(inject)) {
  45084. for (var key in inject) {
  45085. var val = inject[key];
  45086. normalized[key] = isPlainObject(val)
  45087. ? extend({ from: key }, val)
  45088. : { from: val };
  45089. }
  45090. } else {
  45091. warn(
  45092. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45093. "but got " + (toRawType(inject)) + ".",
  45094. vm
  45095. );
  45096. }
  45097. }
  45098. /**
  45099. * Normalize raw function directives into object format.
  45100. */
  45101. function normalizeDirectives (options) {
  45102. var dirs = options.directives;
  45103. if (dirs) {
  45104. for (var key in dirs) {
  45105. var def$$1 = dirs[key];
  45106. if (typeof def$$1 === 'function') {
  45107. dirs[key] = { bind: def$$1, update: def$$1 };
  45108. }
  45109. }
  45110. }
  45111. }
  45112. function assertObjectType (name, value, vm) {
  45113. if (!isPlainObject(value)) {
  45114. warn(
  45115. "Invalid value for option \"" + name + "\": expected an Object, " +
  45116. "but got " + (toRawType(value)) + ".",
  45117. vm
  45118. );
  45119. }
  45120. }
  45121. /**
  45122. * Merge two option objects into a new one.
  45123. * Core utility used in both instantiation and inheritance.
  45124. */
  45125. function mergeOptions (
  45126. parent,
  45127. child,
  45128. vm
  45129. ) {
  45130. {
  45131. checkComponents(child);
  45132. }
  45133. if (typeof child === 'function') {
  45134. child = child.options;
  45135. }
  45136. normalizeProps(child, vm);
  45137. normalizeInject(child, vm);
  45138. normalizeDirectives(child);
  45139. // Apply extends and mixins on the child options,
  45140. // but only if it is a raw options object that isn't
  45141. // the result of another mergeOptions call.
  45142. // Only merged options has the _base property.
  45143. if (!child._base) {
  45144. if (child.extends) {
  45145. parent = mergeOptions(parent, child.extends, vm);
  45146. }
  45147. if (child.mixins) {
  45148. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45149. parent = mergeOptions(parent, child.mixins[i], vm);
  45150. }
  45151. }
  45152. }
  45153. var options = {};
  45154. var key;
  45155. for (key in parent) {
  45156. mergeField(key);
  45157. }
  45158. for (key in child) {
  45159. if (!hasOwn(parent, key)) {
  45160. mergeField(key);
  45161. }
  45162. }
  45163. function mergeField (key) {
  45164. var strat = strats[key] || defaultStrat;
  45165. options[key] = strat(parent[key], child[key], vm, key);
  45166. }
  45167. return options
  45168. }
  45169. /**
  45170. * Resolve an asset.
  45171. * This function is used because child instances need access
  45172. * to assets defined in its ancestor chain.
  45173. */
  45174. function resolveAsset (
  45175. options,
  45176. type,
  45177. id,
  45178. warnMissing
  45179. ) {
  45180. /* istanbul ignore if */
  45181. if (typeof id !== 'string') {
  45182. return
  45183. }
  45184. var assets = options[type];
  45185. // check local registration variations first
  45186. if (hasOwn(assets, id)) { return assets[id] }
  45187. var camelizedId = camelize(id);
  45188. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45189. var PascalCaseId = capitalize(camelizedId);
  45190. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45191. // fallback to prototype chain
  45192. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45193. if (warnMissing && !res) {
  45194. warn(
  45195. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45196. options
  45197. );
  45198. }
  45199. return res
  45200. }
  45201. /* */
  45202. function validateProp (
  45203. key,
  45204. propOptions,
  45205. propsData,
  45206. vm
  45207. ) {
  45208. var prop = propOptions[key];
  45209. var absent = !hasOwn(propsData, key);
  45210. var value = propsData[key];
  45211. // boolean casting
  45212. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45213. if (booleanIndex > -1) {
  45214. if (absent && !hasOwn(prop, 'default')) {
  45215. value = false;
  45216. } else if (value === '' || value === hyphenate(key)) {
  45217. // only cast empty string / same name to boolean if
  45218. // boolean has higher priority
  45219. var stringIndex = getTypeIndex(String, prop.type);
  45220. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45221. value = true;
  45222. }
  45223. }
  45224. }
  45225. // check default value
  45226. if (value === undefined) {
  45227. value = getPropDefaultValue(vm, prop, key);
  45228. // since the default value is a fresh copy,
  45229. // make sure to observe it.
  45230. var prevShouldObserve = shouldObserve;
  45231. toggleObserving(true);
  45232. observe(value);
  45233. toggleObserving(prevShouldObserve);
  45234. }
  45235. {
  45236. assertProp(prop, key, value, vm, absent);
  45237. }
  45238. return value
  45239. }
  45240. /**
  45241. * Get the default value of a prop.
  45242. */
  45243. function getPropDefaultValue (vm, prop, key) {
  45244. // no default, return undefined
  45245. if (!hasOwn(prop, 'default')) {
  45246. return undefined
  45247. }
  45248. var def = prop.default;
  45249. // warn against non-factory defaults for Object & Array
  45250. if (isObject(def)) {
  45251. warn(
  45252. 'Invalid default value for prop "' + key + '": ' +
  45253. 'Props with type Object/Array must use a factory function ' +
  45254. 'to return the default value.',
  45255. vm
  45256. );
  45257. }
  45258. // the raw prop value was also undefined from previous render,
  45259. // return previous default value to avoid unnecessary watcher trigger
  45260. if (vm && vm.$options.propsData &&
  45261. vm.$options.propsData[key] === undefined &&
  45262. vm._props[key] !== undefined
  45263. ) {
  45264. return vm._props[key]
  45265. }
  45266. // call factory function for non-Function types
  45267. // a value is Function if its prototype is function even across different execution context
  45268. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45269. ? def.call(vm)
  45270. : def
  45271. }
  45272. /**
  45273. * Assert whether a prop is valid.
  45274. */
  45275. function assertProp (
  45276. prop,
  45277. name,
  45278. value,
  45279. vm,
  45280. absent
  45281. ) {
  45282. if (prop.required && absent) {
  45283. warn(
  45284. 'Missing required prop: "' + name + '"',
  45285. vm
  45286. );
  45287. return
  45288. }
  45289. if (value == null && !prop.required) {
  45290. return
  45291. }
  45292. var type = prop.type;
  45293. var valid = !type || type === true;
  45294. var expectedTypes = [];
  45295. if (type) {
  45296. if (!Array.isArray(type)) {
  45297. type = [type];
  45298. }
  45299. for (var i = 0; i < type.length && !valid; i++) {
  45300. var assertedType = assertType(value, type[i]);
  45301. expectedTypes.push(assertedType.expectedType || '');
  45302. valid = assertedType.valid;
  45303. }
  45304. }
  45305. if (!valid) {
  45306. warn(
  45307. getInvalidTypeMessage(name, value, expectedTypes),
  45308. vm
  45309. );
  45310. return
  45311. }
  45312. var validator = prop.validator;
  45313. if (validator) {
  45314. if (!validator(value)) {
  45315. warn(
  45316. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45317. vm
  45318. );
  45319. }
  45320. }
  45321. }
  45322. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45323. function assertType (value, type) {
  45324. var valid;
  45325. var expectedType = getType(type);
  45326. if (simpleCheckRE.test(expectedType)) {
  45327. var t = typeof value;
  45328. valid = t === expectedType.toLowerCase();
  45329. // for primitive wrapper objects
  45330. if (!valid && t === 'object') {
  45331. valid = value instanceof type;
  45332. }
  45333. } else if (expectedType === 'Object') {
  45334. valid = isPlainObject(value);
  45335. } else if (expectedType === 'Array') {
  45336. valid = Array.isArray(value);
  45337. } else {
  45338. valid = value instanceof type;
  45339. }
  45340. return {
  45341. valid: valid,
  45342. expectedType: expectedType
  45343. }
  45344. }
  45345. /**
  45346. * Use function string name to check built-in types,
  45347. * because a simple equality check will fail when running
  45348. * across different vms / iframes.
  45349. */
  45350. function getType (fn) {
  45351. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45352. return match ? match[1] : ''
  45353. }
  45354. function isSameType (a, b) {
  45355. return getType(a) === getType(b)
  45356. }
  45357. function getTypeIndex (type, expectedTypes) {
  45358. if (!Array.isArray(expectedTypes)) {
  45359. return isSameType(expectedTypes, type) ? 0 : -1
  45360. }
  45361. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45362. if (isSameType(expectedTypes[i], type)) {
  45363. return i
  45364. }
  45365. }
  45366. return -1
  45367. }
  45368. function getInvalidTypeMessage (name, value, expectedTypes) {
  45369. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45370. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45371. var expectedType = expectedTypes[0];
  45372. var receivedType = toRawType(value);
  45373. var expectedValue = styleValue(value, expectedType);
  45374. var receivedValue = styleValue(value, receivedType);
  45375. // check if we need to specify expected value
  45376. if (expectedTypes.length === 1 &&
  45377. isExplicable(expectedType) &&
  45378. !isBoolean(expectedType, receivedType)) {
  45379. message += " with value " + expectedValue;
  45380. }
  45381. message += ", got " + receivedType + " ";
  45382. // check if we need to specify received value
  45383. if (isExplicable(receivedType)) {
  45384. message += "with value " + receivedValue + ".";
  45385. }
  45386. return message
  45387. }
  45388. function styleValue (value, type) {
  45389. if (type === 'String') {
  45390. return ("\"" + value + "\"")
  45391. } else if (type === 'Number') {
  45392. return ("" + (Number(value)))
  45393. } else {
  45394. return ("" + value)
  45395. }
  45396. }
  45397. function isExplicable (value) {
  45398. var explicitTypes = ['string', 'number', 'boolean'];
  45399. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45400. }
  45401. function isBoolean () {
  45402. var args = [], len = arguments.length;
  45403. while ( len-- ) args[ len ] = arguments[ len ];
  45404. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45405. }
  45406. /* */
  45407. function handleError (err, vm, info) {
  45408. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45409. // See: https://github.com/vuejs/vuex/issues/1505
  45410. pushTarget();
  45411. try {
  45412. if (vm) {
  45413. var cur = vm;
  45414. while ((cur = cur.$parent)) {
  45415. var hooks = cur.$options.errorCaptured;
  45416. if (hooks) {
  45417. for (var i = 0; i < hooks.length; i++) {
  45418. try {
  45419. var capture = hooks[i].call(cur, err, vm, info) === false;
  45420. if (capture) { return }
  45421. } catch (e) {
  45422. globalHandleError(e, cur, 'errorCaptured hook');
  45423. }
  45424. }
  45425. }
  45426. }
  45427. }
  45428. globalHandleError(err, vm, info);
  45429. } finally {
  45430. popTarget();
  45431. }
  45432. }
  45433. function invokeWithErrorHandling (
  45434. handler,
  45435. context,
  45436. args,
  45437. vm,
  45438. info
  45439. ) {
  45440. var res;
  45441. try {
  45442. res = args ? handler.apply(context, args) : handler.call(context);
  45443. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45444. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45445. // issue #9511
  45446. // avoid catch triggering multiple times when nested calls
  45447. res._handled = true;
  45448. }
  45449. } catch (e) {
  45450. handleError(e, vm, info);
  45451. }
  45452. return res
  45453. }
  45454. function globalHandleError (err, vm, info) {
  45455. if (config.errorHandler) {
  45456. try {
  45457. return config.errorHandler.call(null, err, vm, info)
  45458. } catch (e) {
  45459. // if the user intentionally throws the original error in the handler,
  45460. // do not log it twice
  45461. if (e !== err) {
  45462. logError(e, null, 'config.errorHandler');
  45463. }
  45464. }
  45465. }
  45466. logError(err, vm, info);
  45467. }
  45468. function logError (err, vm, info) {
  45469. {
  45470. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45471. }
  45472. /* istanbul ignore else */
  45473. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45474. console.error(err);
  45475. } else {
  45476. throw err
  45477. }
  45478. }
  45479. /* */
  45480. var isUsingMicroTask = false;
  45481. var callbacks = [];
  45482. var pending = false;
  45483. function flushCallbacks () {
  45484. pending = false;
  45485. var copies = callbacks.slice(0);
  45486. callbacks.length = 0;
  45487. for (var i = 0; i < copies.length; i++) {
  45488. copies[i]();
  45489. }
  45490. }
  45491. // Here we have async deferring wrappers using microtasks.
  45492. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45493. // However, it has subtle problems when state is changed right before repaint
  45494. // (e.g. #6813, out-in transitions).
  45495. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45496. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45497. // So we now use microtasks everywhere, again.
  45498. // A major drawback of this tradeoff is that there are some scenarios
  45499. // where microtasks have too high a priority and fire in between supposedly
  45500. // sequential events (e.g. #4521, #6690, which have workarounds)
  45501. // or even between bubbling of the same event (#6566).
  45502. var timerFunc;
  45503. // The nextTick behavior leverages the microtask queue, which can be accessed
  45504. // via either native Promise.then or MutationObserver.
  45505. // MutationObserver has wider support, however it is seriously bugged in
  45506. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45507. // completely stops working after triggering a few times... so, if native
  45508. // Promise is available, we will use it:
  45509. /* istanbul ignore next, $flow-disable-line */
  45510. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45511. var p = Promise.resolve();
  45512. timerFunc = function () {
  45513. p.then(flushCallbacks);
  45514. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45515. // it can get stuck in a weird state where callbacks are pushed into the
  45516. // microtask queue but the queue isn't being flushed, until the browser
  45517. // needs to do some other work, e.g. handle a timer. Therefore we can
  45518. // "force" the microtask queue to be flushed by adding an empty timer.
  45519. if (isIOS) { setTimeout(noop); }
  45520. };
  45521. isUsingMicroTask = true;
  45522. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45523. isNative(MutationObserver) ||
  45524. // PhantomJS and iOS 7.x
  45525. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45526. )) {
  45527. // Use MutationObserver where native Promise is not available,
  45528. // e.g. PhantomJS, iOS7, Android 4.4
  45529. // (#6466 MutationObserver is unreliable in IE11)
  45530. var counter = 1;
  45531. var observer = new MutationObserver(flushCallbacks);
  45532. var textNode = document.createTextNode(String(counter));
  45533. observer.observe(textNode, {
  45534. characterData: true
  45535. });
  45536. timerFunc = function () {
  45537. counter = (counter + 1) % 2;
  45538. textNode.data = String(counter);
  45539. };
  45540. isUsingMicroTask = true;
  45541. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45542. // Fallback to setImmediate.
  45543. // Technically it leverages the (macro) task queue,
  45544. // but it is still a better choice than setTimeout.
  45545. timerFunc = function () {
  45546. setImmediate(flushCallbacks);
  45547. };
  45548. } else {
  45549. // Fallback to setTimeout.
  45550. timerFunc = function () {
  45551. setTimeout(flushCallbacks, 0);
  45552. };
  45553. }
  45554. function nextTick (cb, ctx) {
  45555. var _resolve;
  45556. callbacks.push(function () {
  45557. if (cb) {
  45558. try {
  45559. cb.call(ctx);
  45560. } catch (e) {
  45561. handleError(e, ctx, 'nextTick');
  45562. }
  45563. } else if (_resolve) {
  45564. _resolve(ctx);
  45565. }
  45566. });
  45567. if (!pending) {
  45568. pending = true;
  45569. timerFunc();
  45570. }
  45571. // $flow-disable-line
  45572. if (!cb && typeof Promise !== 'undefined') {
  45573. return new Promise(function (resolve) {
  45574. _resolve = resolve;
  45575. })
  45576. }
  45577. }
  45578. /* */
  45579. var mark;
  45580. var measure;
  45581. {
  45582. var perf = inBrowser && window.performance;
  45583. /* istanbul ignore if */
  45584. if (
  45585. perf &&
  45586. perf.mark &&
  45587. perf.measure &&
  45588. perf.clearMarks &&
  45589. perf.clearMeasures
  45590. ) {
  45591. mark = function (tag) { return perf.mark(tag); };
  45592. measure = function (name, startTag, endTag) {
  45593. perf.measure(name, startTag, endTag);
  45594. perf.clearMarks(startTag);
  45595. perf.clearMarks(endTag);
  45596. // perf.clearMeasures(name)
  45597. };
  45598. }
  45599. }
  45600. /* not type checking this file because flow doesn't play well with Proxy */
  45601. var initProxy;
  45602. {
  45603. var allowedGlobals = makeMap(
  45604. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45605. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45606. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45607. 'require' // for Webpack/Browserify
  45608. );
  45609. var warnNonPresent = function (target, key) {
  45610. warn(
  45611. "Property or method \"" + key + "\" is not defined on the instance but " +
  45612. 'referenced during render. Make sure that this property is reactive, ' +
  45613. 'either in the data option, or for class-based components, by ' +
  45614. 'initializing the property. ' +
  45615. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45616. target
  45617. );
  45618. };
  45619. var warnReservedPrefix = function (target, key) {
  45620. warn(
  45621. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45622. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45623. 'prevent conflicts with Vue internals. ' +
  45624. 'See: https://vuejs.org/v2/api/#data',
  45625. target
  45626. );
  45627. };
  45628. var hasProxy =
  45629. typeof Proxy !== 'undefined' && isNative(Proxy);
  45630. if (hasProxy) {
  45631. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45632. config.keyCodes = new Proxy(config.keyCodes, {
  45633. set: function set (target, key, value) {
  45634. if (isBuiltInModifier(key)) {
  45635. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45636. return false
  45637. } else {
  45638. target[key] = value;
  45639. return true
  45640. }
  45641. }
  45642. });
  45643. }
  45644. var hasHandler = {
  45645. has: function has (target, key) {
  45646. var has = key in target;
  45647. var isAllowed = allowedGlobals(key) ||
  45648. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45649. if (!has && !isAllowed) {
  45650. if (key in target.$data) { warnReservedPrefix(target, key); }
  45651. else { warnNonPresent(target, key); }
  45652. }
  45653. return has || !isAllowed
  45654. }
  45655. };
  45656. var getHandler = {
  45657. get: function get (target, key) {
  45658. if (typeof key === 'string' && !(key in target)) {
  45659. if (key in target.$data) { warnReservedPrefix(target, key); }
  45660. else { warnNonPresent(target, key); }
  45661. }
  45662. return target[key]
  45663. }
  45664. };
  45665. initProxy = function initProxy (vm) {
  45666. if (hasProxy) {
  45667. // determine which proxy handler to use
  45668. var options = vm.$options;
  45669. var handlers = options.render && options.render._withStripped
  45670. ? getHandler
  45671. : hasHandler;
  45672. vm._renderProxy = new Proxy(vm, handlers);
  45673. } else {
  45674. vm._renderProxy = vm;
  45675. }
  45676. };
  45677. }
  45678. /* */
  45679. var seenObjects = new _Set();
  45680. /**
  45681. * Recursively traverse an object to evoke all converted
  45682. * getters, so that every nested property inside the object
  45683. * is collected as a "deep" dependency.
  45684. */
  45685. function traverse (val) {
  45686. _traverse(val, seenObjects);
  45687. seenObjects.clear();
  45688. }
  45689. function _traverse (val, seen) {
  45690. var i, keys;
  45691. var isA = Array.isArray(val);
  45692. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45693. return
  45694. }
  45695. if (val.__ob__) {
  45696. var depId = val.__ob__.dep.id;
  45697. if (seen.has(depId)) {
  45698. return
  45699. }
  45700. seen.add(depId);
  45701. }
  45702. if (isA) {
  45703. i = val.length;
  45704. while (i--) { _traverse(val[i], seen); }
  45705. } else {
  45706. keys = Object.keys(val);
  45707. i = keys.length;
  45708. while (i--) { _traverse(val[keys[i]], seen); }
  45709. }
  45710. }
  45711. /* */
  45712. var normalizeEvent = cached(function (name) {
  45713. var passive = name.charAt(0) === '&';
  45714. name = passive ? name.slice(1) : name;
  45715. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45716. name = once$$1 ? name.slice(1) : name;
  45717. var capture = name.charAt(0) === '!';
  45718. name = capture ? name.slice(1) : name;
  45719. return {
  45720. name: name,
  45721. once: once$$1,
  45722. capture: capture,
  45723. passive: passive
  45724. }
  45725. });
  45726. function createFnInvoker (fns, vm) {
  45727. function invoker () {
  45728. var arguments$1 = arguments;
  45729. var fns = invoker.fns;
  45730. if (Array.isArray(fns)) {
  45731. var cloned = fns.slice();
  45732. for (var i = 0; i < cloned.length; i++) {
  45733. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45734. }
  45735. } else {
  45736. // return handler return value for single handlers
  45737. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45738. }
  45739. }
  45740. invoker.fns = fns;
  45741. return invoker
  45742. }
  45743. function updateListeners (
  45744. on,
  45745. oldOn,
  45746. add,
  45747. remove$$1,
  45748. createOnceHandler,
  45749. vm
  45750. ) {
  45751. var name, def$$1, cur, old, event;
  45752. for (name in on) {
  45753. def$$1 = cur = on[name];
  45754. old = oldOn[name];
  45755. event = normalizeEvent(name);
  45756. if (isUndef(cur)) {
  45757. warn(
  45758. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45759. vm
  45760. );
  45761. } else if (isUndef(old)) {
  45762. if (isUndef(cur.fns)) {
  45763. cur = on[name] = createFnInvoker(cur, vm);
  45764. }
  45765. if (isTrue(event.once)) {
  45766. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  45767. }
  45768. add(event.name, cur, event.capture, event.passive, event.params);
  45769. } else if (cur !== old) {
  45770. old.fns = cur;
  45771. on[name] = old;
  45772. }
  45773. }
  45774. for (name in oldOn) {
  45775. if (isUndef(on[name])) {
  45776. event = normalizeEvent(name);
  45777. remove$$1(event.name, oldOn[name], event.capture);
  45778. }
  45779. }
  45780. }
  45781. /* */
  45782. function mergeVNodeHook (def, hookKey, hook) {
  45783. if (def instanceof VNode) {
  45784. def = def.data.hook || (def.data.hook = {});
  45785. }
  45786. var invoker;
  45787. var oldHook = def[hookKey];
  45788. function wrappedHook () {
  45789. hook.apply(this, arguments);
  45790. // important: remove merged hook to ensure it's called only once
  45791. // and prevent memory leak
  45792. remove(invoker.fns, wrappedHook);
  45793. }
  45794. if (isUndef(oldHook)) {
  45795. // no existing hook
  45796. invoker = createFnInvoker([wrappedHook]);
  45797. } else {
  45798. /* istanbul ignore if */
  45799. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  45800. // already a merged invoker
  45801. invoker = oldHook;
  45802. invoker.fns.push(wrappedHook);
  45803. } else {
  45804. // existing plain hook
  45805. invoker = createFnInvoker([oldHook, wrappedHook]);
  45806. }
  45807. }
  45808. invoker.merged = true;
  45809. def[hookKey] = invoker;
  45810. }
  45811. /* */
  45812. function extractPropsFromVNodeData (
  45813. data,
  45814. Ctor,
  45815. tag
  45816. ) {
  45817. // we are only extracting raw values here.
  45818. // validation and default values are handled in the child
  45819. // component itself.
  45820. var propOptions = Ctor.options.props;
  45821. if (isUndef(propOptions)) {
  45822. return
  45823. }
  45824. var res = {};
  45825. var attrs = data.attrs;
  45826. var props = data.props;
  45827. if (isDef(attrs) || isDef(props)) {
  45828. for (var key in propOptions) {
  45829. var altKey = hyphenate(key);
  45830. {
  45831. var keyInLowerCase = key.toLowerCase();
  45832. if (
  45833. key !== keyInLowerCase &&
  45834. attrs && hasOwn(attrs, keyInLowerCase)
  45835. ) {
  45836. tip(
  45837. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  45838. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  45839. " \"" + key + "\". " +
  45840. "Note that HTML attributes are case-insensitive and camelCased " +
  45841. "props need to use their kebab-case equivalents when using in-DOM " +
  45842. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  45843. );
  45844. }
  45845. }
  45846. checkProp(res, props, key, altKey, true) ||
  45847. checkProp(res, attrs, key, altKey, false);
  45848. }
  45849. }
  45850. return res
  45851. }
  45852. function checkProp (
  45853. res,
  45854. hash,
  45855. key,
  45856. altKey,
  45857. preserve
  45858. ) {
  45859. if (isDef(hash)) {
  45860. if (hasOwn(hash, key)) {
  45861. res[key] = hash[key];
  45862. if (!preserve) {
  45863. delete hash[key];
  45864. }
  45865. return true
  45866. } else if (hasOwn(hash, altKey)) {
  45867. res[key] = hash[altKey];
  45868. if (!preserve) {
  45869. delete hash[altKey];
  45870. }
  45871. return true
  45872. }
  45873. }
  45874. return false
  45875. }
  45876. /* */
  45877. // The template compiler attempts to minimize the need for normalization by
  45878. // statically analyzing the template at compile time.
  45879. //
  45880. // For plain HTML markup, normalization can be completely skipped because the
  45881. // generated render function is guaranteed to return Array<VNode>. There are
  45882. // two cases where extra normalization is needed:
  45883. // 1. When the children contains components - because a functional component
  45884. // may return an Array instead of a single root. In this case, just a simple
  45885. // normalization is needed - if any child is an Array, we flatten the whole
  45886. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  45887. // because functional components already normalize their own children.
  45888. function simpleNormalizeChildren (children) {
  45889. for (var i = 0; i < children.length; i++) {
  45890. if (Array.isArray(children[i])) {
  45891. return Array.prototype.concat.apply([], children)
  45892. }
  45893. }
  45894. return children
  45895. }
  45896. // 2. When the children contains constructs that always generated nested Arrays,
  45897. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  45898. // with hand-written render functions / JSX. In such cases a full normalization
  45899. // is needed to cater to all possible types of children values.
  45900. function normalizeChildren (children) {
  45901. return isPrimitive(children)
  45902. ? [createTextVNode(children)]
  45903. : Array.isArray(children)
  45904. ? normalizeArrayChildren(children)
  45905. : undefined
  45906. }
  45907. function isTextNode (node) {
  45908. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  45909. }
  45910. function normalizeArrayChildren (children, nestedIndex) {
  45911. var res = [];
  45912. var i, c, lastIndex, last;
  45913. for (i = 0; i < children.length; i++) {
  45914. c = children[i];
  45915. if (isUndef(c) || typeof c === 'boolean') { continue }
  45916. lastIndex = res.length - 1;
  45917. last = res[lastIndex];
  45918. // nested
  45919. if (Array.isArray(c)) {
  45920. if (c.length > 0) {
  45921. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  45922. // merge adjacent text nodes
  45923. if (isTextNode(c[0]) && isTextNode(last)) {
  45924. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  45925. c.shift();
  45926. }
  45927. res.push.apply(res, c);
  45928. }
  45929. } else if (isPrimitive(c)) {
  45930. if (isTextNode(last)) {
  45931. // merge adjacent text nodes
  45932. // this is necessary for SSR hydration because text nodes are
  45933. // essentially merged when rendered to HTML strings
  45934. res[lastIndex] = createTextVNode(last.text + c);
  45935. } else if (c !== '') {
  45936. // convert primitive to vnode
  45937. res.push(createTextVNode(c));
  45938. }
  45939. } else {
  45940. if (isTextNode(c) && isTextNode(last)) {
  45941. // merge adjacent text nodes
  45942. res[lastIndex] = createTextVNode(last.text + c.text);
  45943. } else {
  45944. // default key for nested array children (likely generated by v-for)
  45945. if (isTrue(children._isVList) &&
  45946. isDef(c.tag) &&
  45947. isUndef(c.key) &&
  45948. isDef(nestedIndex)) {
  45949. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45950. }
  45951. res.push(c);
  45952. }
  45953. }
  45954. }
  45955. return res
  45956. }
  45957. /* */
  45958. function initProvide (vm) {
  45959. var provide = vm.$options.provide;
  45960. if (provide) {
  45961. vm._provided = typeof provide === 'function'
  45962. ? provide.call(vm)
  45963. : provide;
  45964. }
  45965. }
  45966. function initInjections (vm) {
  45967. var result = resolveInject(vm.$options.inject, vm);
  45968. if (result) {
  45969. toggleObserving(false);
  45970. Object.keys(result).forEach(function (key) {
  45971. /* istanbul ignore else */
  45972. {
  45973. defineReactive$$1(vm, key, result[key], function () {
  45974. warn(
  45975. "Avoid mutating an injected value directly since the changes will be " +
  45976. "overwritten whenever the provided component re-renders. " +
  45977. "injection being mutated: \"" + key + "\"",
  45978. vm
  45979. );
  45980. });
  45981. }
  45982. });
  45983. toggleObserving(true);
  45984. }
  45985. }
  45986. function resolveInject (inject, vm) {
  45987. if (inject) {
  45988. // inject is :any because flow is not smart enough to figure out cached
  45989. var result = Object.create(null);
  45990. var keys = hasSymbol
  45991. ? Reflect.ownKeys(inject)
  45992. : Object.keys(inject);
  45993. for (var i = 0; i < keys.length; i++) {
  45994. var key = keys[i];
  45995. // #6574 in case the inject object is observed...
  45996. if (key === '__ob__') { continue }
  45997. var provideKey = inject[key].from;
  45998. var source = vm;
  45999. while (source) {
  46000. if (source._provided && hasOwn(source._provided, provideKey)) {
  46001. result[key] = source._provided[provideKey];
  46002. break
  46003. }
  46004. source = source.$parent;
  46005. }
  46006. if (!source) {
  46007. if ('default' in inject[key]) {
  46008. var provideDefault = inject[key].default;
  46009. result[key] = typeof provideDefault === 'function'
  46010. ? provideDefault.call(vm)
  46011. : provideDefault;
  46012. } else {
  46013. warn(("Injection \"" + key + "\" not found"), vm);
  46014. }
  46015. }
  46016. }
  46017. return result
  46018. }
  46019. }
  46020. /* */
  46021. /**
  46022. * Runtime helper for resolving raw children VNodes into a slot object.
  46023. */
  46024. function resolveSlots (
  46025. children,
  46026. context
  46027. ) {
  46028. if (!children || !children.length) {
  46029. return {}
  46030. }
  46031. var slots = {};
  46032. for (var i = 0, l = children.length; i < l; i++) {
  46033. var child = children[i];
  46034. var data = child.data;
  46035. // remove slot attribute if the node is resolved as a Vue slot node
  46036. if (data && data.attrs && data.attrs.slot) {
  46037. delete data.attrs.slot;
  46038. }
  46039. // named slots should only be respected if the vnode was rendered in the
  46040. // same context.
  46041. if ((child.context === context || child.fnContext === context) &&
  46042. data && data.slot != null
  46043. ) {
  46044. var name = data.slot;
  46045. var slot = (slots[name] || (slots[name] = []));
  46046. if (child.tag === 'template') {
  46047. slot.push.apply(slot, child.children || []);
  46048. } else {
  46049. slot.push(child);
  46050. }
  46051. } else {
  46052. (slots.default || (slots.default = [])).push(child);
  46053. }
  46054. }
  46055. // ignore slots that contains only whitespace
  46056. for (var name$1 in slots) {
  46057. if (slots[name$1].every(isWhitespace)) {
  46058. delete slots[name$1];
  46059. }
  46060. }
  46061. return slots
  46062. }
  46063. function isWhitespace (node) {
  46064. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46065. }
  46066. /* */
  46067. function normalizeScopedSlots (
  46068. slots,
  46069. normalSlots,
  46070. prevSlots
  46071. ) {
  46072. var res;
  46073. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46074. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46075. var key = slots && slots.$key;
  46076. if (!slots) {
  46077. res = {};
  46078. } else if (slots._normalized) {
  46079. // fast path 1: child component re-render only, parent did not change
  46080. return slots._normalized
  46081. } else if (
  46082. isStable &&
  46083. prevSlots &&
  46084. prevSlots !== emptyObject &&
  46085. key === prevSlots.$key &&
  46086. !hasNormalSlots &&
  46087. !prevSlots.$hasNormal
  46088. ) {
  46089. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46090. // only need to normalize once
  46091. return prevSlots
  46092. } else {
  46093. res = {};
  46094. for (var key$1 in slots) {
  46095. if (slots[key$1] && key$1[0] !== '$') {
  46096. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46097. }
  46098. }
  46099. }
  46100. // expose normal slots on scopedSlots
  46101. for (var key$2 in normalSlots) {
  46102. if (!(key$2 in res)) {
  46103. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46104. }
  46105. }
  46106. // avoriaz seems to mock a non-extensible $scopedSlots object
  46107. // and when that is passed down this would cause an error
  46108. if (slots && Object.isExtensible(slots)) {
  46109. (slots)._normalized = res;
  46110. }
  46111. def(res, '$stable', isStable);
  46112. def(res, '$key', key);
  46113. def(res, '$hasNormal', hasNormalSlots);
  46114. return res
  46115. }
  46116. function normalizeScopedSlot(normalSlots, key, fn) {
  46117. var normalized = function () {
  46118. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46119. res = res && typeof res === 'object' && !Array.isArray(res)
  46120. ? [res] // single vnode
  46121. : normalizeChildren(res);
  46122. return res && (
  46123. res.length === 0 ||
  46124. (res.length === 1 && res[0].isComment) // #9658
  46125. ) ? undefined
  46126. : res
  46127. };
  46128. // this is a slot using the new v-slot syntax without scope. although it is
  46129. // compiled as a scoped slot, render fn users would expect it to be present
  46130. // on this.$slots because the usage is semantically a normal slot.
  46131. if (fn.proxy) {
  46132. Object.defineProperty(normalSlots, key, {
  46133. get: normalized,
  46134. enumerable: true,
  46135. configurable: true
  46136. });
  46137. }
  46138. return normalized
  46139. }
  46140. function proxyNormalSlot(slots, key) {
  46141. return function () { return slots[key]; }
  46142. }
  46143. /* */
  46144. /**
  46145. * Runtime helper for rendering v-for lists.
  46146. */
  46147. function renderList (
  46148. val,
  46149. render
  46150. ) {
  46151. var ret, i, l, keys, key;
  46152. if (Array.isArray(val) || typeof val === 'string') {
  46153. ret = new Array(val.length);
  46154. for (i = 0, l = val.length; i < l; i++) {
  46155. ret[i] = render(val[i], i);
  46156. }
  46157. } else if (typeof val === 'number') {
  46158. ret = new Array(val);
  46159. for (i = 0; i < val; i++) {
  46160. ret[i] = render(i + 1, i);
  46161. }
  46162. } else if (isObject(val)) {
  46163. if (hasSymbol && val[Symbol.iterator]) {
  46164. ret = [];
  46165. var iterator = val[Symbol.iterator]();
  46166. var result = iterator.next();
  46167. while (!result.done) {
  46168. ret.push(render(result.value, ret.length));
  46169. result = iterator.next();
  46170. }
  46171. } else {
  46172. keys = Object.keys(val);
  46173. ret = new Array(keys.length);
  46174. for (i = 0, l = keys.length; i < l; i++) {
  46175. key = keys[i];
  46176. ret[i] = render(val[key], key, i);
  46177. }
  46178. }
  46179. }
  46180. if (!isDef(ret)) {
  46181. ret = [];
  46182. }
  46183. (ret)._isVList = true;
  46184. return ret
  46185. }
  46186. /* */
  46187. /**
  46188. * Runtime helper for rendering <slot>
  46189. */
  46190. function renderSlot (
  46191. name,
  46192. fallback,
  46193. props,
  46194. bindObject
  46195. ) {
  46196. var scopedSlotFn = this.$scopedSlots[name];
  46197. var nodes;
  46198. if (scopedSlotFn) { // scoped slot
  46199. props = props || {};
  46200. if (bindObject) {
  46201. if (!isObject(bindObject)) {
  46202. warn(
  46203. 'slot v-bind without argument expects an Object',
  46204. this
  46205. );
  46206. }
  46207. props = extend(extend({}, bindObject), props);
  46208. }
  46209. nodes = scopedSlotFn(props) || fallback;
  46210. } else {
  46211. nodes = this.$slots[name] || fallback;
  46212. }
  46213. var target = props && props.slot;
  46214. if (target) {
  46215. return this.$createElement('template', { slot: target }, nodes)
  46216. } else {
  46217. return nodes
  46218. }
  46219. }
  46220. /* */
  46221. /**
  46222. * Runtime helper for resolving filters
  46223. */
  46224. function resolveFilter (id) {
  46225. return resolveAsset(this.$options, 'filters', id, true) || identity
  46226. }
  46227. /* */
  46228. function isKeyNotMatch (expect, actual) {
  46229. if (Array.isArray(expect)) {
  46230. return expect.indexOf(actual) === -1
  46231. } else {
  46232. return expect !== actual
  46233. }
  46234. }
  46235. /**
  46236. * Runtime helper for checking keyCodes from config.
  46237. * exposed as Vue.prototype._k
  46238. * passing in eventKeyName as last argument separately for backwards compat
  46239. */
  46240. function checkKeyCodes (
  46241. eventKeyCode,
  46242. key,
  46243. builtInKeyCode,
  46244. eventKeyName,
  46245. builtInKeyName
  46246. ) {
  46247. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46248. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46249. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46250. } else if (mappedKeyCode) {
  46251. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46252. } else if (eventKeyName) {
  46253. return hyphenate(eventKeyName) !== key
  46254. }
  46255. }
  46256. /* */
  46257. /**
  46258. * Runtime helper for merging v-bind="object" into a VNode's data.
  46259. */
  46260. function bindObjectProps (
  46261. data,
  46262. tag,
  46263. value,
  46264. asProp,
  46265. isSync
  46266. ) {
  46267. if (value) {
  46268. if (!isObject(value)) {
  46269. warn(
  46270. 'v-bind without argument expects an Object or Array value',
  46271. this
  46272. );
  46273. } else {
  46274. if (Array.isArray(value)) {
  46275. value = toObject(value);
  46276. }
  46277. var hash;
  46278. var loop = function ( key ) {
  46279. if (
  46280. key === 'class' ||
  46281. key === 'style' ||
  46282. isReservedAttribute(key)
  46283. ) {
  46284. hash = data;
  46285. } else {
  46286. var type = data.attrs && data.attrs.type;
  46287. hash = asProp || config.mustUseProp(tag, type, key)
  46288. ? data.domProps || (data.domProps = {})
  46289. : data.attrs || (data.attrs = {});
  46290. }
  46291. var camelizedKey = camelize(key);
  46292. var hyphenatedKey = hyphenate(key);
  46293. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46294. hash[key] = value[key];
  46295. if (isSync) {
  46296. var on = data.on || (data.on = {});
  46297. on[("update:" + key)] = function ($event) {
  46298. value[key] = $event;
  46299. };
  46300. }
  46301. }
  46302. };
  46303. for (var key in value) loop( key );
  46304. }
  46305. }
  46306. return data
  46307. }
  46308. /* */
  46309. /**
  46310. * Runtime helper for rendering static trees.
  46311. */
  46312. function renderStatic (
  46313. index,
  46314. isInFor
  46315. ) {
  46316. var cached = this._staticTrees || (this._staticTrees = []);
  46317. var tree = cached[index];
  46318. // if has already-rendered static tree and not inside v-for,
  46319. // we can reuse the same tree.
  46320. if (tree && !isInFor) {
  46321. return tree
  46322. }
  46323. // otherwise, render a fresh tree.
  46324. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46325. this._renderProxy,
  46326. null,
  46327. this // for render fns generated for functional component templates
  46328. );
  46329. markStatic(tree, ("__static__" + index), false);
  46330. return tree
  46331. }
  46332. /**
  46333. * Runtime helper for v-once.
  46334. * Effectively it means marking the node as static with a unique key.
  46335. */
  46336. function markOnce (
  46337. tree,
  46338. index,
  46339. key
  46340. ) {
  46341. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46342. return tree
  46343. }
  46344. function markStatic (
  46345. tree,
  46346. key,
  46347. isOnce
  46348. ) {
  46349. if (Array.isArray(tree)) {
  46350. for (var i = 0; i < tree.length; i++) {
  46351. if (tree[i] && typeof tree[i] !== 'string') {
  46352. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46353. }
  46354. }
  46355. } else {
  46356. markStaticNode(tree, key, isOnce);
  46357. }
  46358. }
  46359. function markStaticNode (node, key, isOnce) {
  46360. node.isStatic = true;
  46361. node.key = key;
  46362. node.isOnce = isOnce;
  46363. }
  46364. /* */
  46365. function bindObjectListeners (data, value) {
  46366. if (value) {
  46367. if (!isPlainObject(value)) {
  46368. warn(
  46369. 'v-on without argument expects an Object value',
  46370. this
  46371. );
  46372. } else {
  46373. var on = data.on = data.on ? extend({}, data.on) : {};
  46374. for (var key in value) {
  46375. var existing = on[key];
  46376. var ours = value[key];
  46377. on[key] = existing ? [].concat(existing, ours) : ours;
  46378. }
  46379. }
  46380. }
  46381. return data
  46382. }
  46383. /* */
  46384. function resolveScopedSlots (
  46385. fns, // see flow/vnode
  46386. res,
  46387. // the following are added in 2.6
  46388. hasDynamicKeys,
  46389. contentHashKey
  46390. ) {
  46391. res = res || { $stable: !hasDynamicKeys };
  46392. for (var i = 0; i < fns.length; i++) {
  46393. var slot = fns[i];
  46394. if (Array.isArray(slot)) {
  46395. resolveScopedSlots(slot, res, hasDynamicKeys);
  46396. } else if (slot) {
  46397. // marker for reverse proxying v-slot without scope on this.$slots
  46398. if (slot.proxy) {
  46399. slot.fn.proxy = true;
  46400. }
  46401. res[slot.key] = slot.fn;
  46402. }
  46403. }
  46404. if (contentHashKey) {
  46405. (res).$key = contentHashKey;
  46406. }
  46407. return res
  46408. }
  46409. /* */
  46410. function bindDynamicKeys (baseObj, values) {
  46411. for (var i = 0; i < values.length; i += 2) {
  46412. var key = values[i];
  46413. if (typeof key === 'string' && key) {
  46414. baseObj[values[i]] = values[i + 1];
  46415. } else if (key !== '' && key !== null) {
  46416. // null is a special value for explicitly removing a binding
  46417. warn(
  46418. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46419. this
  46420. );
  46421. }
  46422. }
  46423. return baseObj
  46424. }
  46425. // helper to dynamically append modifier runtime markers to event names.
  46426. // ensure only append when value is already string, otherwise it will be cast
  46427. // to string and cause the type check to miss.
  46428. function prependModifier (value, symbol) {
  46429. return typeof value === 'string' ? symbol + value : value
  46430. }
  46431. /* */
  46432. function installRenderHelpers (target) {
  46433. target._o = markOnce;
  46434. target._n = toNumber;
  46435. target._s = toString;
  46436. target._l = renderList;
  46437. target._t = renderSlot;
  46438. target._q = looseEqual;
  46439. target._i = looseIndexOf;
  46440. target._m = renderStatic;
  46441. target._f = resolveFilter;
  46442. target._k = checkKeyCodes;
  46443. target._b = bindObjectProps;
  46444. target._v = createTextVNode;
  46445. target._e = createEmptyVNode;
  46446. target._u = resolveScopedSlots;
  46447. target._g = bindObjectListeners;
  46448. target._d = bindDynamicKeys;
  46449. target._p = prependModifier;
  46450. }
  46451. /* */
  46452. function FunctionalRenderContext (
  46453. data,
  46454. props,
  46455. children,
  46456. parent,
  46457. Ctor
  46458. ) {
  46459. var this$1 = this;
  46460. var options = Ctor.options;
  46461. // ensure the createElement function in functional components
  46462. // gets a unique context - this is necessary for correct named slot check
  46463. var contextVm;
  46464. if (hasOwn(parent, '_uid')) {
  46465. contextVm = Object.create(parent);
  46466. // $flow-disable-line
  46467. contextVm._original = parent;
  46468. } else {
  46469. // the context vm passed in is a functional context as well.
  46470. // in this case we want to make sure we are able to get a hold to the
  46471. // real context instance.
  46472. contextVm = parent;
  46473. // $flow-disable-line
  46474. parent = parent._original;
  46475. }
  46476. var isCompiled = isTrue(options._compiled);
  46477. var needNormalization = !isCompiled;
  46478. this.data = data;
  46479. this.props = props;
  46480. this.children = children;
  46481. this.parent = parent;
  46482. this.listeners = data.on || emptyObject;
  46483. this.injections = resolveInject(options.inject, parent);
  46484. this.slots = function () {
  46485. if (!this$1.$slots) {
  46486. normalizeScopedSlots(
  46487. data.scopedSlots,
  46488. this$1.$slots = resolveSlots(children, parent)
  46489. );
  46490. }
  46491. return this$1.$slots
  46492. };
  46493. Object.defineProperty(this, 'scopedSlots', ({
  46494. enumerable: true,
  46495. get: function get () {
  46496. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46497. }
  46498. }));
  46499. // support for compiled functional template
  46500. if (isCompiled) {
  46501. // exposing $options for renderStatic()
  46502. this.$options = options;
  46503. // pre-resolve slots for renderSlot()
  46504. this.$slots = this.slots();
  46505. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46506. }
  46507. if (options._scopeId) {
  46508. this._c = function (a, b, c, d) {
  46509. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46510. if (vnode && !Array.isArray(vnode)) {
  46511. vnode.fnScopeId = options._scopeId;
  46512. vnode.fnContext = parent;
  46513. }
  46514. return vnode
  46515. };
  46516. } else {
  46517. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46518. }
  46519. }
  46520. installRenderHelpers(FunctionalRenderContext.prototype);
  46521. function createFunctionalComponent (
  46522. Ctor,
  46523. propsData,
  46524. data,
  46525. contextVm,
  46526. children
  46527. ) {
  46528. var options = Ctor.options;
  46529. var props = {};
  46530. var propOptions = options.props;
  46531. if (isDef(propOptions)) {
  46532. for (var key in propOptions) {
  46533. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46534. }
  46535. } else {
  46536. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46537. if (isDef(data.props)) { mergeProps(props, data.props); }
  46538. }
  46539. var renderContext = new FunctionalRenderContext(
  46540. data,
  46541. props,
  46542. children,
  46543. contextVm,
  46544. Ctor
  46545. );
  46546. var vnode = options.render.call(null, renderContext._c, renderContext);
  46547. if (vnode instanceof VNode) {
  46548. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46549. } else if (Array.isArray(vnode)) {
  46550. var vnodes = normalizeChildren(vnode) || [];
  46551. var res = new Array(vnodes.length);
  46552. for (var i = 0; i < vnodes.length; i++) {
  46553. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46554. }
  46555. return res
  46556. }
  46557. }
  46558. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46559. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46560. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46561. // that should not be matched to match.
  46562. var clone = cloneVNode(vnode);
  46563. clone.fnContext = contextVm;
  46564. clone.fnOptions = options;
  46565. {
  46566. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46567. }
  46568. if (data.slot) {
  46569. (clone.data || (clone.data = {})).slot = data.slot;
  46570. }
  46571. return clone
  46572. }
  46573. function mergeProps (to, from) {
  46574. for (var key in from) {
  46575. to[camelize(key)] = from[key];
  46576. }
  46577. }
  46578. /* */
  46579. /* */
  46580. /* */
  46581. /* */
  46582. // inline hooks to be invoked on component VNodes during patch
  46583. var componentVNodeHooks = {
  46584. init: function init (vnode, hydrating) {
  46585. if (
  46586. vnode.componentInstance &&
  46587. !vnode.componentInstance._isDestroyed &&
  46588. vnode.data.keepAlive
  46589. ) {
  46590. // kept-alive components, treat as a patch
  46591. var mountedNode = vnode; // work around flow
  46592. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46593. } else {
  46594. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46595. vnode,
  46596. activeInstance
  46597. );
  46598. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46599. }
  46600. },
  46601. prepatch: function prepatch (oldVnode, vnode) {
  46602. var options = vnode.componentOptions;
  46603. var child = vnode.componentInstance = oldVnode.componentInstance;
  46604. updateChildComponent(
  46605. child,
  46606. options.propsData, // updated props
  46607. options.listeners, // updated listeners
  46608. vnode, // new parent vnode
  46609. options.children // new children
  46610. );
  46611. },
  46612. insert: function insert (vnode) {
  46613. var context = vnode.context;
  46614. var componentInstance = vnode.componentInstance;
  46615. if (!componentInstance._isMounted) {
  46616. componentInstance._isMounted = true;
  46617. callHook(componentInstance, 'mounted');
  46618. }
  46619. if (vnode.data.keepAlive) {
  46620. if (context._isMounted) {
  46621. // vue-router#1212
  46622. // During updates, a kept-alive component's child components may
  46623. // change, so directly walking the tree here may call activated hooks
  46624. // on incorrect children. Instead we push them into a queue which will
  46625. // be processed after the whole patch process ended.
  46626. queueActivatedComponent(componentInstance);
  46627. } else {
  46628. activateChildComponent(componentInstance, true /* direct */);
  46629. }
  46630. }
  46631. },
  46632. destroy: function destroy (vnode) {
  46633. var componentInstance = vnode.componentInstance;
  46634. if (!componentInstance._isDestroyed) {
  46635. if (!vnode.data.keepAlive) {
  46636. componentInstance.$destroy();
  46637. } else {
  46638. deactivateChildComponent(componentInstance, true /* direct */);
  46639. }
  46640. }
  46641. }
  46642. };
  46643. var hooksToMerge = Object.keys(componentVNodeHooks);
  46644. function createComponent (
  46645. Ctor,
  46646. data,
  46647. context,
  46648. children,
  46649. tag
  46650. ) {
  46651. if (isUndef(Ctor)) {
  46652. return
  46653. }
  46654. var baseCtor = context.$options._base;
  46655. // plain options object: turn it into a constructor
  46656. if (isObject(Ctor)) {
  46657. Ctor = baseCtor.extend(Ctor);
  46658. }
  46659. // if at this stage it's not a constructor or an async component factory,
  46660. // reject.
  46661. if (typeof Ctor !== 'function') {
  46662. {
  46663. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46664. }
  46665. return
  46666. }
  46667. // async component
  46668. var asyncFactory;
  46669. if (isUndef(Ctor.cid)) {
  46670. asyncFactory = Ctor;
  46671. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46672. if (Ctor === undefined) {
  46673. // return a placeholder node for async component, which is rendered
  46674. // as a comment node but preserves all the raw information for the node.
  46675. // the information will be used for async server-rendering and hydration.
  46676. return createAsyncPlaceholder(
  46677. asyncFactory,
  46678. data,
  46679. context,
  46680. children,
  46681. tag
  46682. )
  46683. }
  46684. }
  46685. data = data || {};
  46686. // resolve constructor options in case global mixins are applied after
  46687. // component constructor creation
  46688. resolveConstructorOptions(Ctor);
  46689. // transform component v-model data into props & events
  46690. if (isDef(data.model)) {
  46691. transformModel(Ctor.options, data);
  46692. }
  46693. // extract props
  46694. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46695. // functional component
  46696. if (isTrue(Ctor.options.functional)) {
  46697. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46698. }
  46699. // extract listeners, since these needs to be treated as
  46700. // child component listeners instead of DOM listeners
  46701. var listeners = data.on;
  46702. // replace with listeners with .native modifier
  46703. // so it gets processed during parent component patch.
  46704. data.on = data.nativeOn;
  46705. if (isTrue(Ctor.options.abstract)) {
  46706. // abstract components do not keep anything
  46707. // other than props & listeners & slot
  46708. // work around flow
  46709. var slot = data.slot;
  46710. data = {};
  46711. if (slot) {
  46712. data.slot = slot;
  46713. }
  46714. }
  46715. // install component management hooks onto the placeholder node
  46716. installComponentHooks(data);
  46717. // return a placeholder vnode
  46718. var name = Ctor.options.name || tag;
  46719. var vnode = new VNode(
  46720. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46721. data, undefined, undefined, undefined, context,
  46722. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46723. asyncFactory
  46724. );
  46725. return vnode
  46726. }
  46727. function createComponentInstanceForVnode (
  46728. vnode, // we know it's MountedComponentVNode but flow doesn't
  46729. parent // activeInstance in lifecycle state
  46730. ) {
  46731. var options = {
  46732. _isComponent: true,
  46733. _parentVnode: vnode,
  46734. parent: parent
  46735. };
  46736. // check inline-template render functions
  46737. var inlineTemplate = vnode.data.inlineTemplate;
  46738. if (isDef(inlineTemplate)) {
  46739. options.render = inlineTemplate.render;
  46740. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46741. }
  46742. return new vnode.componentOptions.Ctor(options)
  46743. }
  46744. function installComponentHooks (data) {
  46745. var hooks = data.hook || (data.hook = {});
  46746. for (var i = 0; i < hooksToMerge.length; i++) {
  46747. var key = hooksToMerge[i];
  46748. var existing = hooks[key];
  46749. var toMerge = componentVNodeHooks[key];
  46750. if (existing !== toMerge && !(existing && existing._merged)) {
  46751. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46752. }
  46753. }
  46754. }
  46755. function mergeHook$1 (f1, f2) {
  46756. var merged = function (a, b) {
  46757. // flow complains about extra args which is why we use any
  46758. f1(a, b);
  46759. f2(a, b);
  46760. };
  46761. merged._merged = true;
  46762. return merged
  46763. }
  46764. // transform component v-model info (value and callback) into
  46765. // prop and event handler respectively.
  46766. function transformModel (options, data) {
  46767. var prop = (options.model && options.model.prop) || 'value';
  46768. var event = (options.model && options.model.event) || 'input'
  46769. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  46770. var on = data.on || (data.on = {});
  46771. var existing = on[event];
  46772. var callback = data.model.callback;
  46773. if (isDef(existing)) {
  46774. if (
  46775. Array.isArray(existing)
  46776. ? existing.indexOf(callback) === -1
  46777. : existing !== callback
  46778. ) {
  46779. on[event] = [callback].concat(existing);
  46780. }
  46781. } else {
  46782. on[event] = callback;
  46783. }
  46784. }
  46785. /* */
  46786. var SIMPLE_NORMALIZE = 1;
  46787. var ALWAYS_NORMALIZE = 2;
  46788. // wrapper function for providing a more flexible interface
  46789. // without getting yelled at by flow
  46790. function createElement (
  46791. context,
  46792. tag,
  46793. data,
  46794. children,
  46795. normalizationType,
  46796. alwaysNormalize
  46797. ) {
  46798. if (Array.isArray(data) || isPrimitive(data)) {
  46799. normalizationType = children;
  46800. children = data;
  46801. data = undefined;
  46802. }
  46803. if (isTrue(alwaysNormalize)) {
  46804. normalizationType = ALWAYS_NORMALIZE;
  46805. }
  46806. return _createElement(context, tag, data, children, normalizationType)
  46807. }
  46808. function _createElement (
  46809. context,
  46810. tag,
  46811. data,
  46812. children,
  46813. normalizationType
  46814. ) {
  46815. if (isDef(data) && isDef((data).__ob__)) {
  46816. warn(
  46817. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  46818. 'Always create fresh vnode data objects in each render!',
  46819. context
  46820. );
  46821. return createEmptyVNode()
  46822. }
  46823. // object syntax in v-bind
  46824. if (isDef(data) && isDef(data.is)) {
  46825. tag = data.is;
  46826. }
  46827. if (!tag) {
  46828. // in case of component :is set to falsy value
  46829. return createEmptyVNode()
  46830. }
  46831. // warn against non-primitive key
  46832. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  46833. ) {
  46834. {
  46835. warn(
  46836. 'Avoid using non-primitive value as key, ' +
  46837. 'use string/number value instead.',
  46838. context
  46839. );
  46840. }
  46841. }
  46842. // support single function children as default scoped slot
  46843. if (Array.isArray(children) &&
  46844. typeof children[0] === 'function'
  46845. ) {
  46846. data = data || {};
  46847. data.scopedSlots = { default: children[0] };
  46848. children.length = 0;
  46849. }
  46850. if (normalizationType === ALWAYS_NORMALIZE) {
  46851. children = normalizeChildren(children);
  46852. } else if (normalizationType === SIMPLE_NORMALIZE) {
  46853. children = simpleNormalizeChildren(children);
  46854. }
  46855. var vnode, ns;
  46856. if (typeof tag === 'string') {
  46857. var Ctor;
  46858. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  46859. if (config.isReservedTag(tag)) {
  46860. // platform built-in elements
  46861. if (isDef(data) && isDef(data.nativeOn)) {
  46862. warn(
  46863. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  46864. context
  46865. );
  46866. }
  46867. vnode = new VNode(
  46868. config.parsePlatformTagName(tag), data, children,
  46869. undefined, undefined, context
  46870. );
  46871. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  46872. // component
  46873. vnode = createComponent(Ctor, data, context, children, tag);
  46874. } else {
  46875. // unknown or unlisted namespaced elements
  46876. // check at runtime because it may get assigned a namespace when its
  46877. // parent normalizes children
  46878. vnode = new VNode(
  46879. tag, data, children,
  46880. undefined, undefined, context
  46881. );
  46882. }
  46883. } else {
  46884. // direct component options / constructor
  46885. vnode = createComponent(tag, data, context, children);
  46886. }
  46887. if (Array.isArray(vnode)) {
  46888. return vnode
  46889. } else if (isDef(vnode)) {
  46890. if (isDef(ns)) { applyNS(vnode, ns); }
  46891. if (isDef(data)) { registerDeepBindings(data); }
  46892. return vnode
  46893. } else {
  46894. return createEmptyVNode()
  46895. }
  46896. }
  46897. function applyNS (vnode, ns, force) {
  46898. vnode.ns = ns;
  46899. if (vnode.tag === 'foreignObject') {
  46900. // use default namespace inside foreignObject
  46901. ns = undefined;
  46902. force = true;
  46903. }
  46904. if (isDef(vnode.children)) {
  46905. for (var i = 0, l = vnode.children.length; i < l; i++) {
  46906. var child = vnode.children[i];
  46907. if (isDef(child.tag) && (
  46908. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  46909. applyNS(child, ns, force);
  46910. }
  46911. }
  46912. }
  46913. }
  46914. // ref #5318
  46915. // necessary to ensure parent re-render when deep bindings like :style and
  46916. // :class are used on slot nodes
  46917. function registerDeepBindings (data) {
  46918. if (isObject(data.style)) {
  46919. traverse(data.style);
  46920. }
  46921. if (isObject(data.class)) {
  46922. traverse(data.class);
  46923. }
  46924. }
  46925. /* */
  46926. function initRender (vm) {
  46927. vm._vnode = null; // the root of the child tree
  46928. vm._staticTrees = null; // v-once cached trees
  46929. var options = vm.$options;
  46930. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  46931. var renderContext = parentVnode && parentVnode.context;
  46932. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  46933. vm.$scopedSlots = emptyObject;
  46934. // bind the createElement fn to this instance
  46935. // so that we get proper render context inside it.
  46936. // args order: tag, data, children, normalizationType, alwaysNormalize
  46937. // internal version is used by render functions compiled from templates
  46938. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46939. // normalization is always applied for the public version, used in
  46940. // user-written render functions.
  46941. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46942. // $attrs & $listeners are exposed for easier HOC creation.
  46943. // they need to be reactive so that HOCs using them are always updated
  46944. var parentData = parentVnode && parentVnode.data;
  46945. /* istanbul ignore else */
  46946. {
  46947. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46948. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46949. }, true);
  46950. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46951. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46952. }, true);
  46953. }
  46954. }
  46955. var currentRenderingInstance = null;
  46956. function renderMixin (Vue) {
  46957. // install runtime convenience helpers
  46958. installRenderHelpers(Vue.prototype);
  46959. Vue.prototype.$nextTick = function (fn) {
  46960. return nextTick(fn, this)
  46961. };
  46962. Vue.prototype._render = function () {
  46963. var vm = this;
  46964. var ref = vm.$options;
  46965. var render = ref.render;
  46966. var _parentVnode = ref._parentVnode;
  46967. if (_parentVnode) {
  46968. vm.$scopedSlots = normalizeScopedSlots(
  46969. _parentVnode.data.scopedSlots,
  46970. vm.$slots,
  46971. vm.$scopedSlots
  46972. );
  46973. }
  46974. // set parent vnode. this allows render functions to have access
  46975. // to the data on the placeholder node.
  46976. vm.$vnode = _parentVnode;
  46977. // render self
  46978. var vnode;
  46979. try {
  46980. // There's no need to maintain a stack because all render fns are called
  46981. // separately from one another. Nested component's render fns are called
  46982. // when parent component is patched.
  46983. currentRenderingInstance = vm;
  46984. vnode = render.call(vm._renderProxy, vm.$createElement);
  46985. } catch (e) {
  46986. handleError(e, vm, "render");
  46987. // return error render result,
  46988. // or previous vnode to prevent render error causing blank component
  46989. /* istanbul ignore else */
  46990. if (vm.$options.renderError) {
  46991. try {
  46992. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46993. } catch (e) {
  46994. handleError(e, vm, "renderError");
  46995. vnode = vm._vnode;
  46996. }
  46997. } else {
  46998. vnode = vm._vnode;
  46999. }
  47000. } finally {
  47001. currentRenderingInstance = null;
  47002. }
  47003. // if the returned array contains only a single node, allow it
  47004. if (Array.isArray(vnode) && vnode.length === 1) {
  47005. vnode = vnode[0];
  47006. }
  47007. // return empty vnode in case the render function errored out
  47008. if (!(vnode instanceof VNode)) {
  47009. if (Array.isArray(vnode)) {
  47010. warn(
  47011. 'Multiple root nodes returned from render function. Render function ' +
  47012. 'should return a single root node.',
  47013. vm
  47014. );
  47015. }
  47016. vnode = createEmptyVNode();
  47017. }
  47018. // set parent
  47019. vnode.parent = _parentVnode;
  47020. return vnode
  47021. };
  47022. }
  47023. /* */
  47024. function ensureCtor (comp, base) {
  47025. if (
  47026. comp.__esModule ||
  47027. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47028. ) {
  47029. comp = comp.default;
  47030. }
  47031. return isObject(comp)
  47032. ? base.extend(comp)
  47033. : comp
  47034. }
  47035. function createAsyncPlaceholder (
  47036. factory,
  47037. data,
  47038. context,
  47039. children,
  47040. tag
  47041. ) {
  47042. var node = createEmptyVNode();
  47043. node.asyncFactory = factory;
  47044. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47045. return node
  47046. }
  47047. function resolveAsyncComponent (
  47048. factory,
  47049. baseCtor
  47050. ) {
  47051. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47052. return factory.errorComp
  47053. }
  47054. if (isDef(factory.resolved)) {
  47055. return factory.resolved
  47056. }
  47057. var owner = currentRenderingInstance;
  47058. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47059. // already pending
  47060. factory.owners.push(owner);
  47061. }
  47062. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47063. return factory.loadingComp
  47064. }
  47065. if (owner && !isDef(factory.owners)) {
  47066. var owners = factory.owners = [owner];
  47067. var sync = true;
  47068. var timerLoading = null;
  47069. var timerTimeout = null
  47070. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47071. var forceRender = function (renderCompleted) {
  47072. for (var i = 0, l = owners.length; i < l; i++) {
  47073. (owners[i]).$forceUpdate();
  47074. }
  47075. if (renderCompleted) {
  47076. owners.length = 0;
  47077. if (timerLoading !== null) {
  47078. clearTimeout(timerLoading);
  47079. timerLoading = null;
  47080. }
  47081. if (timerTimeout !== null) {
  47082. clearTimeout(timerTimeout);
  47083. timerTimeout = null;
  47084. }
  47085. }
  47086. };
  47087. var resolve = once(function (res) {
  47088. // cache resolved
  47089. factory.resolved = ensureCtor(res, baseCtor);
  47090. // invoke callbacks only if this is not a synchronous resolve
  47091. // (async resolves are shimmed as synchronous during SSR)
  47092. if (!sync) {
  47093. forceRender(true);
  47094. } else {
  47095. owners.length = 0;
  47096. }
  47097. });
  47098. var reject = once(function (reason) {
  47099. warn(
  47100. "Failed to resolve async component: " + (String(factory)) +
  47101. (reason ? ("\nReason: " + reason) : '')
  47102. );
  47103. if (isDef(factory.errorComp)) {
  47104. factory.error = true;
  47105. forceRender(true);
  47106. }
  47107. });
  47108. var res = factory(resolve, reject);
  47109. if (isObject(res)) {
  47110. if (isPromise(res)) {
  47111. // () => Promise
  47112. if (isUndef(factory.resolved)) {
  47113. res.then(resolve, reject);
  47114. }
  47115. } else if (isPromise(res.component)) {
  47116. res.component.then(resolve, reject);
  47117. if (isDef(res.error)) {
  47118. factory.errorComp = ensureCtor(res.error, baseCtor);
  47119. }
  47120. if (isDef(res.loading)) {
  47121. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47122. if (res.delay === 0) {
  47123. factory.loading = true;
  47124. } else {
  47125. timerLoading = setTimeout(function () {
  47126. timerLoading = null;
  47127. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47128. factory.loading = true;
  47129. forceRender(false);
  47130. }
  47131. }, res.delay || 200);
  47132. }
  47133. }
  47134. if (isDef(res.timeout)) {
  47135. timerTimeout = setTimeout(function () {
  47136. timerTimeout = null;
  47137. if (isUndef(factory.resolved)) {
  47138. reject(
  47139. "timeout (" + (res.timeout) + "ms)"
  47140. );
  47141. }
  47142. }, res.timeout);
  47143. }
  47144. }
  47145. }
  47146. sync = false;
  47147. // return in case resolved synchronously
  47148. return factory.loading
  47149. ? factory.loadingComp
  47150. : factory.resolved
  47151. }
  47152. }
  47153. /* */
  47154. function isAsyncPlaceholder (node) {
  47155. return node.isComment && node.asyncFactory
  47156. }
  47157. /* */
  47158. function getFirstComponentChild (children) {
  47159. if (Array.isArray(children)) {
  47160. for (var i = 0; i < children.length; i++) {
  47161. var c = children[i];
  47162. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47163. return c
  47164. }
  47165. }
  47166. }
  47167. }
  47168. /* */
  47169. /* */
  47170. function initEvents (vm) {
  47171. vm._events = Object.create(null);
  47172. vm._hasHookEvent = false;
  47173. // init parent attached events
  47174. var listeners = vm.$options._parentListeners;
  47175. if (listeners) {
  47176. updateComponentListeners(vm, listeners);
  47177. }
  47178. }
  47179. var target;
  47180. function add (event, fn) {
  47181. target.$on(event, fn);
  47182. }
  47183. function remove$1 (event, fn) {
  47184. target.$off(event, fn);
  47185. }
  47186. function createOnceHandler (event, fn) {
  47187. var _target = target;
  47188. return function onceHandler () {
  47189. var res = fn.apply(null, arguments);
  47190. if (res !== null) {
  47191. _target.$off(event, onceHandler);
  47192. }
  47193. }
  47194. }
  47195. function updateComponentListeners (
  47196. vm,
  47197. listeners,
  47198. oldListeners
  47199. ) {
  47200. target = vm;
  47201. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47202. target = undefined;
  47203. }
  47204. function eventsMixin (Vue) {
  47205. var hookRE = /^hook:/;
  47206. Vue.prototype.$on = function (event, fn) {
  47207. var vm = this;
  47208. if (Array.isArray(event)) {
  47209. for (var i = 0, l = event.length; i < l; i++) {
  47210. vm.$on(event[i], fn);
  47211. }
  47212. } else {
  47213. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47214. // optimize hook:event cost by using a boolean flag marked at registration
  47215. // instead of a hash lookup
  47216. if (hookRE.test(event)) {
  47217. vm._hasHookEvent = true;
  47218. }
  47219. }
  47220. return vm
  47221. };
  47222. Vue.prototype.$once = function (event, fn) {
  47223. var vm = this;
  47224. function on () {
  47225. vm.$off(event, on);
  47226. fn.apply(vm, arguments);
  47227. }
  47228. on.fn = fn;
  47229. vm.$on(event, on);
  47230. return vm
  47231. };
  47232. Vue.prototype.$off = function (event, fn) {
  47233. var vm = this;
  47234. // all
  47235. if (!arguments.length) {
  47236. vm._events = Object.create(null);
  47237. return vm
  47238. }
  47239. // array of events
  47240. if (Array.isArray(event)) {
  47241. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47242. vm.$off(event[i$1], fn);
  47243. }
  47244. return vm
  47245. }
  47246. // specific event
  47247. var cbs = vm._events[event];
  47248. if (!cbs) {
  47249. return vm
  47250. }
  47251. if (!fn) {
  47252. vm._events[event] = null;
  47253. return vm
  47254. }
  47255. // specific handler
  47256. var cb;
  47257. var i = cbs.length;
  47258. while (i--) {
  47259. cb = cbs[i];
  47260. if (cb === fn || cb.fn === fn) {
  47261. cbs.splice(i, 1);
  47262. break
  47263. }
  47264. }
  47265. return vm
  47266. };
  47267. Vue.prototype.$emit = function (event) {
  47268. var vm = this;
  47269. {
  47270. var lowerCaseEvent = event.toLowerCase();
  47271. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47272. tip(
  47273. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47274. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47275. "Note that HTML attributes are case-insensitive and you cannot use " +
  47276. "v-on to listen to camelCase events when using in-DOM templates. " +
  47277. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47278. );
  47279. }
  47280. }
  47281. var cbs = vm._events[event];
  47282. if (cbs) {
  47283. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47284. var args = toArray(arguments, 1);
  47285. var info = "event handler for \"" + event + "\"";
  47286. for (var i = 0, l = cbs.length; i < l; i++) {
  47287. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47288. }
  47289. }
  47290. return vm
  47291. };
  47292. }
  47293. /* */
  47294. var activeInstance = null;
  47295. var isUpdatingChildComponent = false;
  47296. function setActiveInstance(vm) {
  47297. var prevActiveInstance = activeInstance;
  47298. activeInstance = vm;
  47299. return function () {
  47300. activeInstance = prevActiveInstance;
  47301. }
  47302. }
  47303. function initLifecycle (vm) {
  47304. var options = vm.$options;
  47305. // locate first non-abstract parent
  47306. var parent = options.parent;
  47307. if (parent && !options.abstract) {
  47308. while (parent.$options.abstract && parent.$parent) {
  47309. parent = parent.$parent;
  47310. }
  47311. parent.$children.push(vm);
  47312. }
  47313. vm.$parent = parent;
  47314. vm.$root = parent ? parent.$root : vm;
  47315. vm.$children = [];
  47316. vm.$refs = {};
  47317. vm._watcher = null;
  47318. vm._inactive = null;
  47319. vm._directInactive = false;
  47320. vm._isMounted = false;
  47321. vm._isDestroyed = false;
  47322. vm._isBeingDestroyed = false;
  47323. }
  47324. function lifecycleMixin (Vue) {
  47325. Vue.prototype._update = function (vnode, hydrating) {
  47326. var vm = this;
  47327. var prevEl = vm.$el;
  47328. var prevVnode = vm._vnode;
  47329. var restoreActiveInstance = setActiveInstance(vm);
  47330. vm._vnode = vnode;
  47331. // Vue.prototype.__patch__ is injected in entry points
  47332. // based on the rendering backend used.
  47333. if (!prevVnode) {
  47334. // initial render
  47335. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47336. } else {
  47337. // updates
  47338. vm.$el = vm.__patch__(prevVnode, vnode);
  47339. }
  47340. restoreActiveInstance();
  47341. // update __vue__ reference
  47342. if (prevEl) {
  47343. prevEl.__vue__ = null;
  47344. }
  47345. if (vm.$el) {
  47346. vm.$el.__vue__ = vm;
  47347. }
  47348. // if parent is an HOC, update its $el as well
  47349. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47350. vm.$parent.$el = vm.$el;
  47351. }
  47352. // updated hook is called by the scheduler to ensure that children are
  47353. // updated in a parent's updated hook.
  47354. };
  47355. Vue.prototype.$forceUpdate = function () {
  47356. var vm = this;
  47357. if (vm._watcher) {
  47358. vm._watcher.update();
  47359. }
  47360. };
  47361. Vue.prototype.$destroy = function () {
  47362. var vm = this;
  47363. if (vm._isBeingDestroyed) {
  47364. return
  47365. }
  47366. callHook(vm, 'beforeDestroy');
  47367. vm._isBeingDestroyed = true;
  47368. // remove self from parent
  47369. var parent = vm.$parent;
  47370. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47371. remove(parent.$children, vm);
  47372. }
  47373. // teardown watchers
  47374. if (vm._watcher) {
  47375. vm._watcher.teardown();
  47376. }
  47377. var i = vm._watchers.length;
  47378. while (i--) {
  47379. vm._watchers[i].teardown();
  47380. }
  47381. // remove reference from data ob
  47382. // frozen object may not have observer.
  47383. if (vm._data.__ob__) {
  47384. vm._data.__ob__.vmCount--;
  47385. }
  47386. // call the last hook...
  47387. vm._isDestroyed = true;
  47388. // invoke destroy hooks on current rendered tree
  47389. vm.__patch__(vm._vnode, null);
  47390. // fire destroyed hook
  47391. callHook(vm, 'destroyed');
  47392. // turn off all instance listeners.
  47393. vm.$off();
  47394. // remove __vue__ reference
  47395. if (vm.$el) {
  47396. vm.$el.__vue__ = null;
  47397. }
  47398. // release circular reference (#6759)
  47399. if (vm.$vnode) {
  47400. vm.$vnode.parent = null;
  47401. }
  47402. };
  47403. }
  47404. function mountComponent (
  47405. vm,
  47406. el,
  47407. hydrating
  47408. ) {
  47409. vm.$el = el;
  47410. if (!vm.$options.render) {
  47411. vm.$options.render = createEmptyVNode;
  47412. {
  47413. /* istanbul ignore if */
  47414. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47415. vm.$options.el || el) {
  47416. warn(
  47417. 'You are using the runtime-only build of Vue where the template ' +
  47418. 'compiler is not available. Either pre-compile the templates into ' +
  47419. 'render functions, or use the compiler-included build.',
  47420. vm
  47421. );
  47422. } else {
  47423. warn(
  47424. 'Failed to mount component: template or render function not defined.',
  47425. vm
  47426. );
  47427. }
  47428. }
  47429. }
  47430. callHook(vm, 'beforeMount');
  47431. var updateComponent;
  47432. /* istanbul ignore if */
  47433. if (config.performance && mark) {
  47434. updateComponent = function () {
  47435. var name = vm._name;
  47436. var id = vm._uid;
  47437. var startTag = "vue-perf-start:" + id;
  47438. var endTag = "vue-perf-end:" + id;
  47439. mark(startTag);
  47440. var vnode = vm._render();
  47441. mark(endTag);
  47442. measure(("vue " + name + " render"), startTag, endTag);
  47443. mark(startTag);
  47444. vm._update(vnode, hydrating);
  47445. mark(endTag);
  47446. measure(("vue " + name + " patch"), startTag, endTag);
  47447. };
  47448. } else {
  47449. updateComponent = function () {
  47450. vm._update(vm._render(), hydrating);
  47451. };
  47452. }
  47453. // we set this to vm._watcher inside the watcher's constructor
  47454. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47455. // component's mounted hook), which relies on vm._watcher being already defined
  47456. new Watcher(vm, updateComponent, noop, {
  47457. before: function before () {
  47458. if (vm._isMounted && !vm._isDestroyed) {
  47459. callHook(vm, 'beforeUpdate');
  47460. }
  47461. }
  47462. }, true /* isRenderWatcher */);
  47463. hydrating = false;
  47464. // manually mounted instance, call mounted on self
  47465. // mounted is called for render-created child components in its inserted hook
  47466. if (vm.$vnode == null) {
  47467. vm._isMounted = true;
  47468. callHook(vm, 'mounted');
  47469. }
  47470. return vm
  47471. }
  47472. function updateChildComponent (
  47473. vm,
  47474. propsData,
  47475. listeners,
  47476. parentVnode,
  47477. renderChildren
  47478. ) {
  47479. {
  47480. isUpdatingChildComponent = true;
  47481. }
  47482. // determine whether component has slot children
  47483. // we need to do this before overwriting $options._renderChildren.
  47484. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47485. // dynamic slot names). Static scoped slots compiled from template has the
  47486. // "$stable" marker.
  47487. var newScopedSlots = parentVnode.data.scopedSlots;
  47488. var oldScopedSlots = vm.$scopedSlots;
  47489. var hasDynamicScopedSlot = !!(
  47490. (newScopedSlots && !newScopedSlots.$stable) ||
  47491. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47492. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47493. );
  47494. // Any static slot children from the parent may have changed during parent's
  47495. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47496. // update is necessary to ensure correctness.
  47497. var needsForceUpdate = !!(
  47498. renderChildren || // has new static slots
  47499. vm.$options._renderChildren || // has old static slots
  47500. hasDynamicScopedSlot
  47501. );
  47502. vm.$options._parentVnode = parentVnode;
  47503. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47504. if (vm._vnode) { // update child tree's parent
  47505. vm._vnode.parent = parentVnode;
  47506. }
  47507. vm.$options._renderChildren = renderChildren;
  47508. // update $attrs and $listeners hash
  47509. // these are also reactive so they may trigger child update if the child
  47510. // used them during render
  47511. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47512. vm.$listeners = listeners || emptyObject;
  47513. // update props
  47514. if (propsData && vm.$options.props) {
  47515. toggleObserving(false);
  47516. var props = vm._props;
  47517. var propKeys = vm.$options._propKeys || [];
  47518. for (var i = 0; i < propKeys.length; i++) {
  47519. var key = propKeys[i];
  47520. var propOptions = vm.$options.props; // wtf flow?
  47521. props[key] = validateProp(key, propOptions, propsData, vm);
  47522. }
  47523. toggleObserving(true);
  47524. // keep a copy of raw propsData
  47525. vm.$options.propsData = propsData;
  47526. }
  47527. // update listeners
  47528. listeners = listeners || emptyObject;
  47529. var oldListeners = vm.$options._parentListeners;
  47530. vm.$options._parentListeners = listeners;
  47531. updateComponentListeners(vm, listeners, oldListeners);
  47532. // resolve slots + force update if has children
  47533. if (needsForceUpdate) {
  47534. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47535. vm.$forceUpdate();
  47536. }
  47537. {
  47538. isUpdatingChildComponent = false;
  47539. }
  47540. }
  47541. function isInInactiveTree (vm) {
  47542. while (vm && (vm = vm.$parent)) {
  47543. if (vm._inactive) { return true }
  47544. }
  47545. return false
  47546. }
  47547. function activateChildComponent (vm, direct) {
  47548. if (direct) {
  47549. vm._directInactive = false;
  47550. if (isInInactiveTree(vm)) {
  47551. return
  47552. }
  47553. } else if (vm._directInactive) {
  47554. return
  47555. }
  47556. if (vm._inactive || vm._inactive === null) {
  47557. vm._inactive = false;
  47558. for (var i = 0; i < vm.$children.length; i++) {
  47559. activateChildComponent(vm.$children[i]);
  47560. }
  47561. callHook(vm, 'activated');
  47562. }
  47563. }
  47564. function deactivateChildComponent (vm, direct) {
  47565. if (direct) {
  47566. vm._directInactive = true;
  47567. if (isInInactiveTree(vm)) {
  47568. return
  47569. }
  47570. }
  47571. if (!vm._inactive) {
  47572. vm._inactive = true;
  47573. for (var i = 0; i < vm.$children.length; i++) {
  47574. deactivateChildComponent(vm.$children[i]);
  47575. }
  47576. callHook(vm, 'deactivated');
  47577. }
  47578. }
  47579. function callHook (vm, hook) {
  47580. // #7573 disable dep collection when invoking lifecycle hooks
  47581. pushTarget();
  47582. var handlers = vm.$options[hook];
  47583. var info = hook + " hook";
  47584. if (handlers) {
  47585. for (var i = 0, j = handlers.length; i < j; i++) {
  47586. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47587. }
  47588. }
  47589. if (vm._hasHookEvent) {
  47590. vm.$emit('hook:' + hook);
  47591. }
  47592. popTarget();
  47593. }
  47594. /* */
  47595. var MAX_UPDATE_COUNT = 100;
  47596. var queue = [];
  47597. var activatedChildren = [];
  47598. var has = {};
  47599. var circular = {};
  47600. var waiting = false;
  47601. var flushing = false;
  47602. var index = 0;
  47603. /**
  47604. * Reset the scheduler's state.
  47605. */
  47606. function resetSchedulerState () {
  47607. index = queue.length = activatedChildren.length = 0;
  47608. has = {};
  47609. {
  47610. circular = {};
  47611. }
  47612. waiting = flushing = false;
  47613. }
  47614. // Async edge case #6566 requires saving the timestamp when event listeners are
  47615. // attached. However, calling performance.now() has a perf overhead especially
  47616. // if the page has thousands of event listeners. Instead, we take a timestamp
  47617. // every time the scheduler flushes and use that for all event listeners
  47618. // attached during that flush.
  47619. var currentFlushTimestamp = 0;
  47620. // Async edge case fix requires storing an event listener's attach timestamp.
  47621. var getNow = Date.now;
  47622. // Determine what event timestamp the browser is using. Annoyingly, the
  47623. // timestamp can either be hi-res (relative to page load) or low-res
  47624. // (relative to UNIX epoch), so in order to compare time we have to use the
  47625. // same timestamp type when saving the flush timestamp.
  47626. // All IE versions use low-res event timestamps, and have problematic clock
  47627. // implementations (#9632)
  47628. if (inBrowser && !isIE) {
  47629. var performance = window.performance;
  47630. if (
  47631. performance &&
  47632. typeof performance.now === 'function' &&
  47633. getNow() > document.createEvent('Event').timeStamp
  47634. ) {
  47635. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47636. // smaller than it, it means the event is using a hi-res timestamp,
  47637. // and we need to use the hi-res version for event listener timestamps as
  47638. // well.
  47639. getNow = function () { return performance.now(); };
  47640. }
  47641. }
  47642. /**
  47643. * Flush both queues and run the watchers.
  47644. */
  47645. function flushSchedulerQueue () {
  47646. currentFlushTimestamp = getNow();
  47647. flushing = true;
  47648. var watcher, id;
  47649. // Sort queue before flush.
  47650. // This ensures that:
  47651. // 1. Components are updated from parent to child. (because parent is always
  47652. // created before the child)
  47653. // 2. A component's user watchers are run before its render watcher (because
  47654. // user watchers are created before the render watcher)
  47655. // 3. If a component is destroyed during a parent component's watcher run,
  47656. // its watchers can be skipped.
  47657. queue.sort(function (a, b) { return a.id - b.id; });
  47658. // do not cache length because more watchers might be pushed
  47659. // as we run existing watchers
  47660. for (index = 0; index < queue.length; index++) {
  47661. watcher = queue[index];
  47662. if (watcher.before) {
  47663. watcher.before();
  47664. }
  47665. id = watcher.id;
  47666. has[id] = null;
  47667. watcher.run();
  47668. // in dev build, check and stop circular updates.
  47669. if (has[id] != null) {
  47670. circular[id] = (circular[id] || 0) + 1;
  47671. if (circular[id] > MAX_UPDATE_COUNT) {
  47672. warn(
  47673. 'You may have an infinite update loop ' + (
  47674. watcher.user
  47675. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47676. : "in a component render function."
  47677. ),
  47678. watcher.vm
  47679. );
  47680. break
  47681. }
  47682. }
  47683. }
  47684. // keep copies of post queues before resetting state
  47685. var activatedQueue = activatedChildren.slice();
  47686. var updatedQueue = queue.slice();
  47687. resetSchedulerState();
  47688. // call component updated and activated hooks
  47689. callActivatedHooks(activatedQueue);
  47690. callUpdatedHooks(updatedQueue);
  47691. // devtool hook
  47692. /* istanbul ignore if */
  47693. if (devtools && config.devtools) {
  47694. devtools.emit('flush');
  47695. }
  47696. }
  47697. function callUpdatedHooks (queue) {
  47698. var i = queue.length;
  47699. while (i--) {
  47700. var watcher = queue[i];
  47701. var vm = watcher.vm;
  47702. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47703. callHook(vm, 'updated');
  47704. }
  47705. }
  47706. }
  47707. /**
  47708. * Queue a kept-alive component that was activated during patch.
  47709. * The queue will be processed after the entire tree has been patched.
  47710. */
  47711. function queueActivatedComponent (vm) {
  47712. // setting _inactive to false here so that a render function can
  47713. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47714. vm._inactive = false;
  47715. activatedChildren.push(vm);
  47716. }
  47717. function callActivatedHooks (queue) {
  47718. for (var i = 0; i < queue.length; i++) {
  47719. queue[i]._inactive = true;
  47720. activateChildComponent(queue[i], true /* true */);
  47721. }
  47722. }
  47723. /**
  47724. * Push a watcher into the watcher queue.
  47725. * Jobs with duplicate IDs will be skipped unless it's
  47726. * pushed when the queue is being flushed.
  47727. */
  47728. function queueWatcher (watcher) {
  47729. var id = watcher.id;
  47730. if (has[id] == null) {
  47731. has[id] = true;
  47732. if (!flushing) {
  47733. queue.push(watcher);
  47734. } else {
  47735. // if already flushing, splice the watcher based on its id
  47736. // if already past its id, it will be run next immediately.
  47737. var i = queue.length - 1;
  47738. while (i > index && queue[i].id > watcher.id) {
  47739. i--;
  47740. }
  47741. queue.splice(i + 1, 0, watcher);
  47742. }
  47743. // queue the flush
  47744. if (!waiting) {
  47745. waiting = true;
  47746. if (!config.async) {
  47747. flushSchedulerQueue();
  47748. return
  47749. }
  47750. nextTick(flushSchedulerQueue);
  47751. }
  47752. }
  47753. }
  47754. /* */
  47755. var uid$2 = 0;
  47756. /**
  47757. * A watcher parses an expression, collects dependencies,
  47758. * and fires callback when the expression value changes.
  47759. * This is used for both the $watch() api and directives.
  47760. */
  47761. var Watcher = function Watcher (
  47762. vm,
  47763. expOrFn,
  47764. cb,
  47765. options,
  47766. isRenderWatcher
  47767. ) {
  47768. this.vm = vm;
  47769. if (isRenderWatcher) {
  47770. vm._watcher = this;
  47771. }
  47772. vm._watchers.push(this);
  47773. // options
  47774. if (options) {
  47775. this.deep = !!options.deep;
  47776. this.user = !!options.user;
  47777. this.lazy = !!options.lazy;
  47778. this.sync = !!options.sync;
  47779. this.before = options.before;
  47780. } else {
  47781. this.deep = this.user = this.lazy = this.sync = false;
  47782. }
  47783. this.cb = cb;
  47784. this.id = ++uid$2; // uid for batching
  47785. this.active = true;
  47786. this.dirty = this.lazy; // for lazy watchers
  47787. this.deps = [];
  47788. this.newDeps = [];
  47789. this.depIds = new _Set();
  47790. this.newDepIds = new _Set();
  47791. this.expression = expOrFn.toString();
  47792. // parse expression for getter
  47793. if (typeof expOrFn === 'function') {
  47794. this.getter = expOrFn;
  47795. } else {
  47796. this.getter = parsePath(expOrFn);
  47797. if (!this.getter) {
  47798. this.getter = noop;
  47799. warn(
  47800. "Failed watching path: \"" + expOrFn + "\" " +
  47801. 'Watcher only accepts simple dot-delimited paths. ' +
  47802. 'For full control, use a function instead.',
  47803. vm
  47804. );
  47805. }
  47806. }
  47807. this.value = this.lazy
  47808. ? undefined
  47809. : this.get();
  47810. };
  47811. /**
  47812. * Evaluate the getter, and re-collect dependencies.
  47813. */
  47814. Watcher.prototype.get = function get () {
  47815. pushTarget(this);
  47816. var value;
  47817. var vm = this.vm;
  47818. try {
  47819. value = this.getter.call(vm, vm);
  47820. } catch (e) {
  47821. if (this.user) {
  47822. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  47823. } else {
  47824. throw e
  47825. }
  47826. } finally {
  47827. // "touch" every property so they are all tracked as
  47828. // dependencies for deep watching
  47829. if (this.deep) {
  47830. traverse(value);
  47831. }
  47832. popTarget();
  47833. this.cleanupDeps();
  47834. }
  47835. return value
  47836. };
  47837. /**
  47838. * Add a dependency to this directive.
  47839. */
  47840. Watcher.prototype.addDep = function addDep (dep) {
  47841. var id = dep.id;
  47842. if (!this.newDepIds.has(id)) {
  47843. this.newDepIds.add(id);
  47844. this.newDeps.push(dep);
  47845. if (!this.depIds.has(id)) {
  47846. dep.addSub(this);
  47847. }
  47848. }
  47849. };
  47850. /**
  47851. * Clean up for dependency collection.
  47852. */
  47853. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  47854. var i = this.deps.length;
  47855. while (i--) {
  47856. var dep = this.deps[i];
  47857. if (!this.newDepIds.has(dep.id)) {
  47858. dep.removeSub(this);
  47859. }
  47860. }
  47861. var tmp = this.depIds;
  47862. this.depIds = this.newDepIds;
  47863. this.newDepIds = tmp;
  47864. this.newDepIds.clear();
  47865. tmp = this.deps;
  47866. this.deps = this.newDeps;
  47867. this.newDeps = tmp;
  47868. this.newDeps.length = 0;
  47869. };
  47870. /**
  47871. * Subscriber interface.
  47872. * Will be called when a dependency changes.
  47873. */
  47874. Watcher.prototype.update = function update () {
  47875. /* istanbul ignore else */
  47876. if (this.lazy) {
  47877. this.dirty = true;
  47878. } else if (this.sync) {
  47879. this.run();
  47880. } else {
  47881. queueWatcher(this);
  47882. }
  47883. };
  47884. /**
  47885. * Scheduler job interface.
  47886. * Will be called by the scheduler.
  47887. */
  47888. Watcher.prototype.run = function run () {
  47889. if (this.active) {
  47890. var value = this.get();
  47891. if (
  47892. value !== this.value ||
  47893. // Deep watchers and watchers on Object/Arrays should fire even
  47894. // when the value is the same, because the value may
  47895. // have mutated.
  47896. isObject(value) ||
  47897. this.deep
  47898. ) {
  47899. // set new value
  47900. var oldValue = this.value;
  47901. this.value = value;
  47902. if (this.user) {
  47903. try {
  47904. this.cb.call(this.vm, value, oldValue);
  47905. } catch (e) {
  47906. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  47907. }
  47908. } else {
  47909. this.cb.call(this.vm, value, oldValue);
  47910. }
  47911. }
  47912. }
  47913. };
  47914. /**
  47915. * Evaluate the value of the watcher.
  47916. * This only gets called for lazy watchers.
  47917. */
  47918. Watcher.prototype.evaluate = function evaluate () {
  47919. this.value = this.get();
  47920. this.dirty = false;
  47921. };
  47922. /**
  47923. * Depend on all deps collected by this watcher.
  47924. */
  47925. Watcher.prototype.depend = function depend () {
  47926. var i = this.deps.length;
  47927. while (i--) {
  47928. this.deps[i].depend();
  47929. }
  47930. };
  47931. /**
  47932. * Remove self from all dependencies' subscriber list.
  47933. */
  47934. Watcher.prototype.teardown = function teardown () {
  47935. if (this.active) {
  47936. // remove self from vm's watcher list
  47937. // this is a somewhat expensive operation so we skip it
  47938. // if the vm is being destroyed.
  47939. if (!this.vm._isBeingDestroyed) {
  47940. remove(this.vm._watchers, this);
  47941. }
  47942. var i = this.deps.length;
  47943. while (i--) {
  47944. this.deps[i].removeSub(this);
  47945. }
  47946. this.active = false;
  47947. }
  47948. };
  47949. /* */
  47950. var sharedPropertyDefinition = {
  47951. enumerable: true,
  47952. configurable: true,
  47953. get: noop,
  47954. set: noop
  47955. };
  47956. function proxy (target, sourceKey, key) {
  47957. sharedPropertyDefinition.get = function proxyGetter () {
  47958. return this[sourceKey][key]
  47959. };
  47960. sharedPropertyDefinition.set = function proxySetter (val) {
  47961. this[sourceKey][key] = val;
  47962. };
  47963. Object.defineProperty(target, key, sharedPropertyDefinition);
  47964. }
  47965. function initState (vm) {
  47966. vm._watchers = [];
  47967. var opts = vm.$options;
  47968. if (opts.props) { initProps(vm, opts.props); }
  47969. if (opts.methods) { initMethods(vm, opts.methods); }
  47970. if (opts.data) {
  47971. initData(vm);
  47972. } else {
  47973. observe(vm._data = {}, true /* asRootData */);
  47974. }
  47975. if (opts.computed) { initComputed(vm, opts.computed); }
  47976. if (opts.watch && opts.watch !== nativeWatch) {
  47977. initWatch(vm, opts.watch);
  47978. }
  47979. }
  47980. function initProps (vm, propsOptions) {
  47981. var propsData = vm.$options.propsData || {};
  47982. var props = vm._props = {};
  47983. // cache prop keys so that future props updates can iterate using Array
  47984. // instead of dynamic object key enumeration.
  47985. var keys = vm.$options._propKeys = [];
  47986. var isRoot = !vm.$parent;
  47987. // root instance props should be converted
  47988. if (!isRoot) {
  47989. toggleObserving(false);
  47990. }
  47991. var loop = function ( key ) {
  47992. keys.push(key);
  47993. var value = validateProp(key, propsOptions, propsData, vm);
  47994. /* istanbul ignore else */
  47995. {
  47996. var hyphenatedKey = hyphenate(key);
  47997. if (isReservedAttribute(hyphenatedKey) ||
  47998. config.isReservedAttr(hyphenatedKey)) {
  47999. warn(
  48000. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48001. vm
  48002. );
  48003. }
  48004. defineReactive$$1(props, key, value, function () {
  48005. if (!isRoot && !isUpdatingChildComponent) {
  48006. warn(
  48007. "Avoid mutating a prop directly since the value will be " +
  48008. "overwritten whenever the parent component re-renders. " +
  48009. "Instead, use a data or computed property based on the prop's " +
  48010. "value. Prop being mutated: \"" + key + "\"",
  48011. vm
  48012. );
  48013. }
  48014. });
  48015. }
  48016. // static props are already proxied on the component's prototype
  48017. // during Vue.extend(). We only need to proxy props defined at
  48018. // instantiation here.
  48019. if (!(key in vm)) {
  48020. proxy(vm, "_props", key);
  48021. }
  48022. };
  48023. for (var key in propsOptions) loop( key );
  48024. toggleObserving(true);
  48025. }
  48026. function initData (vm) {
  48027. var data = vm.$options.data;
  48028. data = vm._data = typeof data === 'function'
  48029. ? getData(data, vm)
  48030. : data || {};
  48031. if (!isPlainObject(data)) {
  48032. data = {};
  48033. warn(
  48034. 'data functions should return an object:\n' +
  48035. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48036. vm
  48037. );
  48038. }
  48039. // proxy data on instance
  48040. var keys = Object.keys(data);
  48041. var props = vm.$options.props;
  48042. var methods = vm.$options.methods;
  48043. var i = keys.length;
  48044. while (i--) {
  48045. var key = keys[i];
  48046. {
  48047. if (methods && hasOwn(methods, key)) {
  48048. warn(
  48049. ("Method \"" + key + "\" has already been defined as a data property."),
  48050. vm
  48051. );
  48052. }
  48053. }
  48054. if (props && hasOwn(props, key)) {
  48055. warn(
  48056. "The data property \"" + key + "\" is already declared as a prop. " +
  48057. "Use prop default value instead.",
  48058. vm
  48059. );
  48060. } else if (!isReserved(key)) {
  48061. proxy(vm, "_data", key);
  48062. }
  48063. }
  48064. // observe data
  48065. observe(data, true /* asRootData */);
  48066. }
  48067. function getData (data, vm) {
  48068. // #7573 disable dep collection when invoking data getters
  48069. pushTarget();
  48070. try {
  48071. return data.call(vm, vm)
  48072. } catch (e) {
  48073. handleError(e, vm, "data()");
  48074. return {}
  48075. } finally {
  48076. popTarget();
  48077. }
  48078. }
  48079. var computedWatcherOptions = { lazy: true };
  48080. function initComputed (vm, computed) {
  48081. // $flow-disable-line
  48082. var watchers = vm._computedWatchers = Object.create(null);
  48083. // computed properties are just getters during SSR
  48084. var isSSR = isServerRendering();
  48085. for (var key in computed) {
  48086. var userDef = computed[key];
  48087. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48088. if (getter == null) {
  48089. warn(
  48090. ("Getter is missing for computed property \"" + key + "\"."),
  48091. vm
  48092. );
  48093. }
  48094. if (!isSSR) {
  48095. // create internal watcher for the computed property.
  48096. watchers[key] = new Watcher(
  48097. vm,
  48098. getter || noop,
  48099. noop,
  48100. computedWatcherOptions
  48101. );
  48102. }
  48103. // component-defined computed properties are already defined on the
  48104. // component prototype. We only need to define computed properties defined
  48105. // at instantiation here.
  48106. if (!(key in vm)) {
  48107. defineComputed(vm, key, userDef);
  48108. } else {
  48109. if (key in vm.$data) {
  48110. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48111. } else if (vm.$options.props && key in vm.$options.props) {
  48112. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48113. }
  48114. }
  48115. }
  48116. }
  48117. function defineComputed (
  48118. target,
  48119. key,
  48120. userDef
  48121. ) {
  48122. var shouldCache = !isServerRendering();
  48123. if (typeof userDef === 'function') {
  48124. sharedPropertyDefinition.get = shouldCache
  48125. ? createComputedGetter(key)
  48126. : createGetterInvoker(userDef);
  48127. sharedPropertyDefinition.set = noop;
  48128. } else {
  48129. sharedPropertyDefinition.get = userDef.get
  48130. ? shouldCache && userDef.cache !== false
  48131. ? createComputedGetter(key)
  48132. : createGetterInvoker(userDef.get)
  48133. : noop;
  48134. sharedPropertyDefinition.set = userDef.set || noop;
  48135. }
  48136. if (sharedPropertyDefinition.set === noop) {
  48137. sharedPropertyDefinition.set = function () {
  48138. warn(
  48139. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48140. this
  48141. );
  48142. };
  48143. }
  48144. Object.defineProperty(target, key, sharedPropertyDefinition);
  48145. }
  48146. function createComputedGetter (key) {
  48147. return function computedGetter () {
  48148. var watcher = this._computedWatchers && this._computedWatchers[key];
  48149. if (watcher) {
  48150. if (watcher.dirty) {
  48151. watcher.evaluate();
  48152. }
  48153. if (Dep.target) {
  48154. watcher.depend();
  48155. }
  48156. return watcher.value
  48157. }
  48158. }
  48159. }
  48160. function createGetterInvoker(fn) {
  48161. return function computedGetter () {
  48162. return fn.call(this, this)
  48163. }
  48164. }
  48165. function initMethods (vm, methods) {
  48166. var props = vm.$options.props;
  48167. for (var key in methods) {
  48168. {
  48169. if (typeof methods[key] !== 'function') {
  48170. warn(
  48171. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48172. "Did you reference the function correctly?",
  48173. vm
  48174. );
  48175. }
  48176. if (props && hasOwn(props, key)) {
  48177. warn(
  48178. ("Method \"" + key + "\" has already been defined as a prop."),
  48179. vm
  48180. );
  48181. }
  48182. if ((key in vm) && isReserved(key)) {
  48183. warn(
  48184. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48185. "Avoid defining component methods that start with _ or $."
  48186. );
  48187. }
  48188. }
  48189. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48190. }
  48191. }
  48192. function initWatch (vm, watch) {
  48193. for (var key in watch) {
  48194. var handler = watch[key];
  48195. if (Array.isArray(handler)) {
  48196. for (var i = 0; i < handler.length; i++) {
  48197. createWatcher(vm, key, handler[i]);
  48198. }
  48199. } else {
  48200. createWatcher(vm, key, handler);
  48201. }
  48202. }
  48203. }
  48204. function createWatcher (
  48205. vm,
  48206. expOrFn,
  48207. handler,
  48208. options
  48209. ) {
  48210. if (isPlainObject(handler)) {
  48211. options = handler;
  48212. handler = handler.handler;
  48213. }
  48214. if (typeof handler === 'string') {
  48215. handler = vm[handler];
  48216. }
  48217. return vm.$watch(expOrFn, handler, options)
  48218. }
  48219. function stateMixin (Vue) {
  48220. // flow somehow has problems with directly declared definition object
  48221. // when using Object.defineProperty, so we have to procedurally build up
  48222. // the object here.
  48223. var dataDef = {};
  48224. dataDef.get = function () { return this._data };
  48225. var propsDef = {};
  48226. propsDef.get = function () { return this._props };
  48227. {
  48228. dataDef.set = function () {
  48229. warn(
  48230. 'Avoid replacing instance root $data. ' +
  48231. 'Use nested data properties instead.',
  48232. this
  48233. );
  48234. };
  48235. propsDef.set = function () {
  48236. warn("$props is readonly.", this);
  48237. };
  48238. }
  48239. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48240. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48241. Vue.prototype.$set = set;
  48242. Vue.prototype.$delete = del;
  48243. Vue.prototype.$watch = function (
  48244. expOrFn,
  48245. cb,
  48246. options
  48247. ) {
  48248. var vm = this;
  48249. if (isPlainObject(cb)) {
  48250. return createWatcher(vm, expOrFn, cb, options)
  48251. }
  48252. options = options || {};
  48253. options.user = true;
  48254. var watcher = new Watcher(vm, expOrFn, cb, options);
  48255. if (options.immediate) {
  48256. try {
  48257. cb.call(vm, watcher.value);
  48258. } catch (error) {
  48259. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48260. }
  48261. }
  48262. return function unwatchFn () {
  48263. watcher.teardown();
  48264. }
  48265. };
  48266. }
  48267. /* */
  48268. var uid$3 = 0;
  48269. function initMixin (Vue) {
  48270. Vue.prototype._init = function (options) {
  48271. var vm = this;
  48272. // a uid
  48273. vm._uid = uid$3++;
  48274. var startTag, endTag;
  48275. /* istanbul ignore if */
  48276. if (config.performance && mark) {
  48277. startTag = "vue-perf-start:" + (vm._uid);
  48278. endTag = "vue-perf-end:" + (vm._uid);
  48279. mark(startTag);
  48280. }
  48281. // a flag to avoid this being observed
  48282. vm._isVue = true;
  48283. // merge options
  48284. if (options && options._isComponent) {
  48285. // optimize internal component instantiation
  48286. // since dynamic options merging is pretty slow, and none of the
  48287. // internal component options needs special treatment.
  48288. initInternalComponent(vm, options);
  48289. } else {
  48290. vm.$options = mergeOptions(
  48291. resolveConstructorOptions(vm.constructor),
  48292. options || {},
  48293. vm
  48294. );
  48295. }
  48296. /* istanbul ignore else */
  48297. {
  48298. initProxy(vm);
  48299. }
  48300. // expose real self
  48301. vm._self = vm;
  48302. initLifecycle(vm);
  48303. initEvents(vm);
  48304. initRender(vm);
  48305. callHook(vm, 'beforeCreate');
  48306. initInjections(vm); // resolve injections before data/props
  48307. initState(vm);
  48308. initProvide(vm); // resolve provide after data/props
  48309. callHook(vm, 'created');
  48310. /* istanbul ignore if */
  48311. if (config.performance && mark) {
  48312. vm._name = formatComponentName(vm, false);
  48313. mark(endTag);
  48314. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48315. }
  48316. if (vm.$options.el) {
  48317. vm.$mount(vm.$options.el);
  48318. }
  48319. };
  48320. }
  48321. function initInternalComponent (vm, options) {
  48322. var opts = vm.$options = Object.create(vm.constructor.options);
  48323. // doing this because it's faster than dynamic enumeration.
  48324. var parentVnode = options._parentVnode;
  48325. opts.parent = options.parent;
  48326. opts._parentVnode = parentVnode;
  48327. var vnodeComponentOptions = parentVnode.componentOptions;
  48328. opts.propsData = vnodeComponentOptions.propsData;
  48329. opts._parentListeners = vnodeComponentOptions.listeners;
  48330. opts._renderChildren = vnodeComponentOptions.children;
  48331. opts._componentTag = vnodeComponentOptions.tag;
  48332. if (options.render) {
  48333. opts.render = options.render;
  48334. opts.staticRenderFns = options.staticRenderFns;
  48335. }
  48336. }
  48337. function resolveConstructorOptions (Ctor) {
  48338. var options = Ctor.options;
  48339. if (Ctor.super) {
  48340. var superOptions = resolveConstructorOptions(Ctor.super);
  48341. var cachedSuperOptions = Ctor.superOptions;
  48342. if (superOptions !== cachedSuperOptions) {
  48343. // super option changed,
  48344. // need to resolve new options.
  48345. Ctor.superOptions = superOptions;
  48346. // check if there are any late-modified/attached options (#4976)
  48347. var modifiedOptions = resolveModifiedOptions(Ctor);
  48348. // update base extend options
  48349. if (modifiedOptions) {
  48350. extend(Ctor.extendOptions, modifiedOptions);
  48351. }
  48352. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48353. if (options.name) {
  48354. options.components[options.name] = Ctor;
  48355. }
  48356. }
  48357. }
  48358. return options
  48359. }
  48360. function resolveModifiedOptions (Ctor) {
  48361. var modified;
  48362. var latest = Ctor.options;
  48363. var sealed = Ctor.sealedOptions;
  48364. for (var key in latest) {
  48365. if (latest[key] !== sealed[key]) {
  48366. if (!modified) { modified = {}; }
  48367. modified[key] = latest[key];
  48368. }
  48369. }
  48370. return modified
  48371. }
  48372. function Vue (options) {
  48373. if (!(this instanceof Vue)
  48374. ) {
  48375. warn('Vue is a constructor and should be called with the `new` keyword');
  48376. }
  48377. this._init(options);
  48378. }
  48379. initMixin(Vue);
  48380. stateMixin(Vue);
  48381. eventsMixin(Vue);
  48382. lifecycleMixin(Vue);
  48383. renderMixin(Vue);
  48384. /* */
  48385. function initUse (Vue) {
  48386. Vue.use = function (plugin) {
  48387. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48388. if (installedPlugins.indexOf(plugin) > -1) {
  48389. return this
  48390. }
  48391. // additional parameters
  48392. var args = toArray(arguments, 1);
  48393. args.unshift(this);
  48394. if (typeof plugin.install === 'function') {
  48395. plugin.install.apply(plugin, args);
  48396. } else if (typeof plugin === 'function') {
  48397. plugin.apply(null, args);
  48398. }
  48399. installedPlugins.push(plugin);
  48400. return this
  48401. };
  48402. }
  48403. /* */
  48404. function initMixin$1 (Vue) {
  48405. Vue.mixin = function (mixin) {
  48406. this.options = mergeOptions(this.options, mixin);
  48407. return this
  48408. };
  48409. }
  48410. /* */
  48411. function initExtend (Vue) {
  48412. /**
  48413. * Each instance constructor, including Vue, has a unique
  48414. * cid. This enables us to create wrapped "child
  48415. * constructors" for prototypal inheritance and cache them.
  48416. */
  48417. Vue.cid = 0;
  48418. var cid = 1;
  48419. /**
  48420. * Class inheritance
  48421. */
  48422. Vue.extend = function (extendOptions) {
  48423. extendOptions = extendOptions || {};
  48424. var Super = this;
  48425. var SuperId = Super.cid;
  48426. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48427. if (cachedCtors[SuperId]) {
  48428. return cachedCtors[SuperId]
  48429. }
  48430. var name = extendOptions.name || Super.options.name;
  48431. if (name) {
  48432. validateComponentName(name);
  48433. }
  48434. var Sub = function VueComponent (options) {
  48435. this._init(options);
  48436. };
  48437. Sub.prototype = Object.create(Super.prototype);
  48438. Sub.prototype.constructor = Sub;
  48439. Sub.cid = cid++;
  48440. Sub.options = mergeOptions(
  48441. Super.options,
  48442. extendOptions
  48443. );
  48444. Sub['super'] = Super;
  48445. // For props and computed properties, we define the proxy getters on
  48446. // the Vue instances at extension time, on the extended prototype. This
  48447. // avoids Object.defineProperty calls for each instance created.
  48448. if (Sub.options.props) {
  48449. initProps$1(Sub);
  48450. }
  48451. if (Sub.options.computed) {
  48452. initComputed$1(Sub);
  48453. }
  48454. // allow further extension/mixin/plugin usage
  48455. Sub.extend = Super.extend;
  48456. Sub.mixin = Super.mixin;
  48457. Sub.use = Super.use;
  48458. // create asset registers, so extended classes
  48459. // can have their private assets too.
  48460. ASSET_TYPES.forEach(function (type) {
  48461. Sub[type] = Super[type];
  48462. });
  48463. // enable recursive self-lookup
  48464. if (name) {
  48465. Sub.options.components[name] = Sub;
  48466. }
  48467. // keep a reference to the super options at extension time.
  48468. // later at instantiation we can check if Super's options have
  48469. // been updated.
  48470. Sub.superOptions = Super.options;
  48471. Sub.extendOptions = extendOptions;
  48472. Sub.sealedOptions = extend({}, Sub.options);
  48473. // cache constructor
  48474. cachedCtors[SuperId] = Sub;
  48475. return Sub
  48476. };
  48477. }
  48478. function initProps$1 (Comp) {
  48479. var props = Comp.options.props;
  48480. for (var key in props) {
  48481. proxy(Comp.prototype, "_props", key);
  48482. }
  48483. }
  48484. function initComputed$1 (Comp) {
  48485. var computed = Comp.options.computed;
  48486. for (var key in computed) {
  48487. defineComputed(Comp.prototype, key, computed[key]);
  48488. }
  48489. }
  48490. /* */
  48491. function initAssetRegisters (Vue) {
  48492. /**
  48493. * Create asset registration methods.
  48494. */
  48495. ASSET_TYPES.forEach(function (type) {
  48496. Vue[type] = function (
  48497. id,
  48498. definition
  48499. ) {
  48500. if (!definition) {
  48501. return this.options[type + 's'][id]
  48502. } else {
  48503. /* istanbul ignore if */
  48504. if (type === 'component') {
  48505. validateComponentName(id);
  48506. }
  48507. if (type === 'component' && isPlainObject(definition)) {
  48508. definition.name = definition.name || id;
  48509. definition = this.options._base.extend(definition);
  48510. }
  48511. if (type === 'directive' && typeof definition === 'function') {
  48512. definition = { bind: definition, update: definition };
  48513. }
  48514. this.options[type + 's'][id] = definition;
  48515. return definition
  48516. }
  48517. };
  48518. });
  48519. }
  48520. /* */
  48521. function getComponentName (opts) {
  48522. return opts && (opts.Ctor.options.name || opts.tag)
  48523. }
  48524. function matches (pattern, name) {
  48525. if (Array.isArray(pattern)) {
  48526. return pattern.indexOf(name) > -1
  48527. } else if (typeof pattern === 'string') {
  48528. return pattern.split(',').indexOf(name) > -1
  48529. } else if (isRegExp(pattern)) {
  48530. return pattern.test(name)
  48531. }
  48532. /* istanbul ignore next */
  48533. return false
  48534. }
  48535. function pruneCache (keepAliveInstance, filter) {
  48536. var cache = keepAliveInstance.cache;
  48537. var keys = keepAliveInstance.keys;
  48538. var _vnode = keepAliveInstance._vnode;
  48539. for (var key in cache) {
  48540. var cachedNode = cache[key];
  48541. if (cachedNode) {
  48542. var name = getComponentName(cachedNode.componentOptions);
  48543. if (name && !filter(name)) {
  48544. pruneCacheEntry(cache, key, keys, _vnode);
  48545. }
  48546. }
  48547. }
  48548. }
  48549. function pruneCacheEntry (
  48550. cache,
  48551. key,
  48552. keys,
  48553. current
  48554. ) {
  48555. var cached$$1 = cache[key];
  48556. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48557. cached$$1.componentInstance.$destroy();
  48558. }
  48559. cache[key] = null;
  48560. remove(keys, key);
  48561. }
  48562. var patternTypes = [String, RegExp, Array];
  48563. var KeepAlive = {
  48564. name: 'keep-alive',
  48565. abstract: true,
  48566. props: {
  48567. include: patternTypes,
  48568. exclude: patternTypes,
  48569. max: [String, Number]
  48570. },
  48571. created: function created () {
  48572. this.cache = Object.create(null);
  48573. this.keys = [];
  48574. },
  48575. destroyed: function destroyed () {
  48576. for (var key in this.cache) {
  48577. pruneCacheEntry(this.cache, key, this.keys);
  48578. }
  48579. },
  48580. mounted: function mounted () {
  48581. var this$1 = this;
  48582. this.$watch('include', function (val) {
  48583. pruneCache(this$1, function (name) { return matches(val, name); });
  48584. });
  48585. this.$watch('exclude', function (val) {
  48586. pruneCache(this$1, function (name) { return !matches(val, name); });
  48587. });
  48588. },
  48589. render: function render () {
  48590. var slot = this.$slots.default;
  48591. var vnode = getFirstComponentChild(slot);
  48592. var componentOptions = vnode && vnode.componentOptions;
  48593. if (componentOptions) {
  48594. // check pattern
  48595. var name = getComponentName(componentOptions);
  48596. var ref = this;
  48597. var include = ref.include;
  48598. var exclude = ref.exclude;
  48599. if (
  48600. // not included
  48601. (include && (!name || !matches(include, name))) ||
  48602. // excluded
  48603. (exclude && name && matches(exclude, name))
  48604. ) {
  48605. return vnode
  48606. }
  48607. var ref$1 = this;
  48608. var cache = ref$1.cache;
  48609. var keys = ref$1.keys;
  48610. var key = vnode.key == null
  48611. // same constructor may get registered as different local components
  48612. // so cid alone is not enough (#3269)
  48613. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48614. : vnode.key;
  48615. if (cache[key]) {
  48616. vnode.componentInstance = cache[key].componentInstance;
  48617. // make current key freshest
  48618. remove(keys, key);
  48619. keys.push(key);
  48620. } else {
  48621. cache[key] = vnode;
  48622. keys.push(key);
  48623. // prune oldest entry
  48624. if (this.max && keys.length > parseInt(this.max)) {
  48625. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48626. }
  48627. }
  48628. vnode.data.keepAlive = true;
  48629. }
  48630. return vnode || (slot && slot[0])
  48631. }
  48632. };
  48633. var builtInComponents = {
  48634. KeepAlive: KeepAlive
  48635. };
  48636. /* */
  48637. function initGlobalAPI (Vue) {
  48638. // config
  48639. var configDef = {};
  48640. configDef.get = function () { return config; };
  48641. {
  48642. configDef.set = function () {
  48643. warn(
  48644. 'Do not replace the Vue.config object, set individual fields instead.'
  48645. );
  48646. };
  48647. }
  48648. Object.defineProperty(Vue, 'config', configDef);
  48649. // exposed util methods.
  48650. // NOTE: these are not considered part of the public API - avoid relying on
  48651. // them unless you are aware of the risk.
  48652. Vue.util = {
  48653. warn: warn,
  48654. extend: extend,
  48655. mergeOptions: mergeOptions,
  48656. defineReactive: defineReactive$$1
  48657. };
  48658. Vue.set = set;
  48659. Vue.delete = del;
  48660. Vue.nextTick = nextTick;
  48661. // 2.6 explicit observable API
  48662. Vue.observable = function (obj) {
  48663. observe(obj);
  48664. return obj
  48665. };
  48666. Vue.options = Object.create(null);
  48667. ASSET_TYPES.forEach(function (type) {
  48668. Vue.options[type + 's'] = Object.create(null);
  48669. });
  48670. // this is used to identify the "base" constructor to extend all plain-object
  48671. // components with in Weex's multi-instance scenarios.
  48672. Vue.options._base = Vue;
  48673. extend(Vue.options.components, builtInComponents);
  48674. initUse(Vue);
  48675. initMixin$1(Vue);
  48676. initExtend(Vue);
  48677. initAssetRegisters(Vue);
  48678. }
  48679. initGlobalAPI(Vue);
  48680. Object.defineProperty(Vue.prototype, '$isServer', {
  48681. get: isServerRendering
  48682. });
  48683. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48684. get: function get () {
  48685. /* istanbul ignore next */
  48686. return this.$vnode && this.$vnode.ssrContext
  48687. }
  48688. });
  48689. // expose FunctionalRenderContext for ssr runtime helper installation
  48690. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48691. value: FunctionalRenderContext
  48692. });
  48693. Vue.version = '2.6.11';
  48694. /* */
  48695. // these are reserved for web because they are directly compiled away
  48696. // during template compilation
  48697. var isReservedAttr = makeMap('style,class');
  48698. // attributes that should be using props for binding
  48699. var acceptValue = makeMap('input,textarea,option,select,progress');
  48700. var mustUseProp = function (tag, type, attr) {
  48701. return (
  48702. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48703. (attr === 'selected' && tag === 'option') ||
  48704. (attr === 'checked' && tag === 'input') ||
  48705. (attr === 'muted' && tag === 'video')
  48706. )
  48707. };
  48708. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48709. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48710. var convertEnumeratedValue = function (key, value) {
  48711. return isFalsyAttrValue(value) || value === 'false'
  48712. ? 'false'
  48713. // allow arbitrary string value for contenteditable
  48714. : key === 'contenteditable' && isValidContentEditableValue(value)
  48715. ? value
  48716. : 'true'
  48717. };
  48718. var isBooleanAttr = makeMap(
  48719. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48720. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48721. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48722. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48723. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48724. 'truespeed,typemustmatch,visible'
  48725. );
  48726. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48727. var isXlink = function (name) {
  48728. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48729. };
  48730. var getXlinkProp = function (name) {
  48731. return isXlink(name) ? name.slice(6, name.length) : ''
  48732. };
  48733. var isFalsyAttrValue = function (val) {
  48734. return val == null || val === false
  48735. };
  48736. /* */
  48737. function genClassForVnode (vnode) {
  48738. var data = vnode.data;
  48739. var parentNode = vnode;
  48740. var childNode = vnode;
  48741. while (isDef(childNode.componentInstance)) {
  48742. childNode = childNode.componentInstance._vnode;
  48743. if (childNode && childNode.data) {
  48744. data = mergeClassData(childNode.data, data);
  48745. }
  48746. }
  48747. while (isDef(parentNode = parentNode.parent)) {
  48748. if (parentNode && parentNode.data) {
  48749. data = mergeClassData(data, parentNode.data);
  48750. }
  48751. }
  48752. return renderClass(data.staticClass, data.class)
  48753. }
  48754. function mergeClassData (child, parent) {
  48755. return {
  48756. staticClass: concat(child.staticClass, parent.staticClass),
  48757. class: isDef(child.class)
  48758. ? [child.class, parent.class]
  48759. : parent.class
  48760. }
  48761. }
  48762. function renderClass (
  48763. staticClass,
  48764. dynamicClass
  48765. ) {
  48766. if (isDef(staticClass) || isDef(dynamicClass)) {
  48767. return concat(staticClass, stringifyClass(dynamicClass))
  48768. }
  48769. /* istanbul ignore next */
  48770. return ''
  48771. }
  48772. function concat (a, b) {
  48773. return a ? b ? (a + ' ' + b) : a : (b || '')
  48774. }
  48775. function stringifyClass (value) {
  48776. if (Array.isArray(value)) {
  48777. return stringifyArray(value)
  48778. }
  48779. if (isObject(value)) {
  48780. return stringifyObject(value)
  48781. }
  48782. if (typeof value === 'string') {
  48783. return value
  48784. }
  48785. /* istanbul ignore next */
  48786. return ''
  48787. }
  48788. function stringifyArray (value) {
  48789. var res = '';
  48790. var stringified;
  48791. for (var i = 0, l = value.length; i < l; i++) {
  48792. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  48793. if (res) { res += ' '; }
  48794. res += stringified;
  48795. }
  48796. }
  48797. return res
  48798. }
  48799. function stringifyObject (value) {
  48800. var res = '';
  48801. for (var key in value) {
  48802. if (value[key]) {
  48803. if (res) { res += ' '; }
  48804. res += key;
  48805. }
  48806. }
  48807. return res
  48808. }
  48809. /* */
  48810. var namespaceMap = {
  48811. svg: 'http://www.w3.org/2000/svg',
  48812. math: 'http://www.w3.org/1998/Math/MathML'
  48813. };
  48814. var isHTMLTag = makeMap(
  48815. 'html,body,base,head,link,meta,style,title,' +
  48816. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  48817. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  48818. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  48819. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  48820. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  48821. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  48822. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  48823. 'output,progress,select,textarea,' +
  48824. 'details,dialog,menu,menuitem,summary,' +
  48825. 'content,element,shadow,template,blockquote,iframe,tfoot'
  48826. );
  48827. // this map is intentionally selective, only covering SVG elements that may
  48828. // contain child elements.
  48829. var isSVG = makeMap(
  48830. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  48831. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  48832. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  48833. true
  48834. );
  48835. var isPreTag = function (tag) { return tag === 'pre'; };
  48836. var isReservedTag = function (tag) {
  48837. return isHTMLTag(tag) || isSVG(tag)
  48838. };
  48839. function getTagNamespace (tag) {
  48840. if (isSVG(tag)) {
  48841. return 'svg'
  48842. }
  48843. // basic support for MathML
  48844. // note it doesn't support other MathML elements being component roots
  48845. if (tag === 'math') {
  48846. return 'math'
  48847. }
  48848. }
  48849. var unknownElementCache = Object.create(null);
  48850. function isUnknownElement (tag) {
  48851. /* istanbul ignore if */
  48852. if (!inBrowser) {
  48853. return true
  48854. }
  48855. if (isReservedTag(tag)) {
  48856. return false
  48857. }
  48858. tag = tag.toLowerCase();
  48859. /* istanbul ignore if */
  48860. if (unknownElementCache[tag] != null) {
  48861. return unknownElementCache[tag]
  48862. }
  48863. var el = document.createElement(tag);
  48864. if (tag.indexOf('-') > -1) {
  48865. // http://stackoverflow.com/a/28210364/1070244
  48866. return (unknownElementCache[tag] = (
  48867. el.constructor === window.HTMLUnknownElement ||
  48868. el.constructor === window.HTMLElement
  48869. ))
  48870. } else {
  48871. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  48872. }
  48873. }
  48874. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  48875. /* */
  48876. /**
  48877. * Query an element selector if it's not an element already.
  48878. */
  48879. function query (el) {
  48880. if (typeof el === 'string') {
  48881. var selected = document.querySelector(el);
  48882. if (!selected) {
  48883. warn(
  48884. 'Cannot find element: ' + el
  48885. );
  48886. return document.createElement('div')
  48887. }
  48888. return selected
  48889. } else {
  48890. return el
  48891. }
  48892. }
  48893. /* */
  48894. function createElement$1 (tagName, vnode) {
  48895. var elm = document.createElement(tagName);
  48896. if (tagName !== 'select') {
  48897. return elm
  48898. }
  48899. // false or null will remove the attribute but undefined will not
  48900. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  48901. elm.setAttribute('multiple', 'multiple');
  48902. }
  48903. return elm
  48904. }
  48905. function createElementNS (namespace, tagName) {
  48906. return document.createElementNS(namespaceMap[namespace], tagName)
  48907. }
  48908. function createTextNode (text) {
  48909. return document.createTextNode(text)
  48910. }
  48911. function createComment (text) {
  48912. return document.createComment(text)
  48913. }
  48914. function insertBefore (parentNode, newNode, referenceNode) {
  48915. parentNode.insertBefore(newNode, referenceNode);
  48916. }
  48917. function removeChild (node, child) {
  48918. node.removeChild(child);
  48919. }
  48920. function appendChild (node, child) {
  48921. node.appendChild(child);
  48922. }
  48923. function parentNode (node) {
  48924. return node.parentNode
  48925. }
  48926. function nextSibling (node) {
  48927. return node.nextSibling
  48928. }
  48929. function tagName (node) {
  48930. return node.tagName
  48931. }
  48932. function setTextContent (node, text) {
  48933. node.textContent = text;
  48934. }
  48935. function setStyleScope (node, scopeId) {
  48936. node.setAttribute(scopeId, '');
  48937. }
  48938. var nodeOps = /*#__PURE__*/Object.freeze({
  48939. createElement: createElement$1,
  48940. createElementNS: createElementNS,
  48941. createTextNode: createTextNode,
  48942. createComment: createComment,
  48943. insertBefore: insertBefore,
  48944. removeChild: removeChild,
  48945. appendChild: appendChild,
  48946. parentNode: parentNode,
  48947. nextSibling: nextSibling,
  48948. tagName: tagName,
  48949. setTextContent: setTextContent,
  48950. setStyleScope: setStyleScope
  48951. });
  48952. /* */
  48953. var ref = {
  48954. create: function create (_, vnode) {
  48955. registerRef(vnode);
  48956. },
  48957. update: function update (oldVnode, vnode) {
  48958. if (oldVnode.data.ref !== vnode.data.ref) {
  48959. registerRef(oldVnode, true);
  48960. registerRef(vnode);
  48961. }
  48962. },
  48963. destroy: function destroy (vnode) {
  48964. registerRef(vnode, true);
  48965. }
  48966. };
  48967. function registerRef (vnode, isRemoval) {
  48968. var key = vnode.data.ref;
  48969. if (!isDef(key)) { return }
  48970. var vm = vnode.context;
  48971. var ref = vnode.componentInstance || vnode.elm;
  48972. var refs = vm.$refs;
  48973. if (isRemoval) {
  48974. if (Array.isArray(refs[key])) {
  48975. remove(refs[key], ref);
  48976. } else if (refs[key] === ref) {
  48977. refs[key] = undefined;
  48978. }
  48979. } else {
  48980. if (vnode.data.refInFor) {
  48981. if (!Array.isArray(refs[key])) {
  48982. refs[key] = [ref];
  48983. } else if (refs[key].indexOf(ref) < 0) {
  48984. // $flow-disable-line
  48985. refs[key].push(ref);
  48986. }
  48987. } else {
  48988. refs[key] = ref;
  48989. }
  48990. }
  48991. }
  48992. /**
  48993. * Virtual DOM patching algorithm based on Snabbdom by
  48994. * Simon Friis Vindum (@paldepind)
  48995. * Licensed under the MIT License
  48996. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  48997. *
  48998. * modified by Evan You (@yyx990803)
  48999. *
  49000. * Not type-checking this because this file is perf-critical and the cost
  49001. * of making flow understand it is not worth it.
  49002. */
  49003. var emptyNode = new VNode('', {}, []);
  49004. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49005. function sameVnode (a, b) {
  49006. return (
  49007. a.key === b.key && (
  49008. (
  49009. a.tag === b.tag &&
  49010. a.isComment === b.isComment &&
  49011. isDef(a.data) === isDef(b.data) &&
  49012. sameInputType(a, b)
  49013. ) || (
  49014. isTrue(a.isAsyncPlaceholder) &&
  49015. a.asyncFactory === b.asyncFactory &&
  49016. isUndef(b.asyncFactory.error)
  49017. )
  49018. )
  49019. )
  49020. }
  49021. function sameInputType (a, b) {
  49022. if (a.tag !== 'input') { return true }
  49023. var i;
  49024. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49025. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49026. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49027. }
  49028. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49029. var i, key;
  49030. var map = {};
  49031. for (i = beginIdx; i <= endIdx; ++i) {
  49032. key = children[i].key;
  49033. if (isDef(key)) { map[key] = i; }
  49034. }
  49035. return map
  49036. }
  49037. function createPatchFunction (backend) {
  49038. var i, j;
  49039. var cbs = {};
  49040. var modules = backend.modules;
  49041. var nodeOps = backend.nodeOps;
  49042. for (i = 0; i < hooks.length; ++i) {
  49043. cbs[hooks[i]] = [];
  49044. for (j = 0; j < modules.length; ++j) {
  49045. if (isDef(modules[j][hooks[i]])) {
  49046. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49047. }
  49048. }
  49049. }
  49050. function emptyNodeAt (elm) {
  49051. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49052. }
  49053. function createRmCb (childElm, listeners) {
  49054. function remove$$1 () {
  49055. if (--remove$$1.listeners === 0) {
  49056. removeNode(childElm);
  49057. }
  49058. }
  49059. remove$$1.listeners = listeners;
  49060. return remove$$1
  49061. }
  49062. function removeNode (el) {
  49063. var parent = nodeOps.parentNode(el);
  49064. // element may have already been removed due to v-html / v-text
  49065. if (isDef(parent)) {
  49066. nodeOps.removeChild(parent, el);
  49067. }
  49068. }
  49069. function isUnknownElement$$1 (vnode, inVPre) {
  49070. return (
  49071. !inVPre &&
  49072. !vnode.ns &&
  49073. !(
  49074. config.ignoredElements.length &&
  49075. config.ignoredElements.some(function (ignore) {
  49076. return isRegExp(ignore)
  49077. ? ignore.test(vnode.tag)
  49078. : ignore === vnode.tag
  49079. })
  49080. ) &&
  49081. config.isUnknownElement(vnode.tag)
  49082. )
  49083. }
  49084. var creatingElmInVPre = 0;
  49085. function createElm (
  49086. vnode,
  49087. insertedVnodeQueue,
  49088. parentElm,
  49089. refElm,
  49090. nested,
  49091. ownerArray,
  49092. index
  49093. ) {
  49094. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49095. // This vnode was used in a previous render!
  49096. // now it's used as a new node, overwriting its elm would cause
  49097. // potential patch errors down the road when it's used as an insertion
  49098. // reference node. Instead, we clone the node on-demand before creating
  49099. // associated DOM element for it.
  49100. vnode = ownerArray[index] = cloneVNode(vnode);
  49101. }
  49102. vnode.isRootInsert = !nested; // for transition enter check
  49103. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49104. return
  49105. }
  49106. var data = vnode.data;
  49107. var children = vnode.children;
  49108. var tag = vnode.tag;
  49109. if (isDef(tag)) {
  49110. {
  49111. if (data && data.pre) {
  49112. creatingElmInVPre++;
  49113. }
  49114. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49115. warn(
  49116. 'Unknown custom element: <' + tag + '> - did you ' +
  49117. 'register the component correctly? For recursive components, ' +
  49118. 'make sure to provide the "name" option.',
  49119. vnode.context
  49120. );
  49121. }
  49122. }
  49123. vnode.elm = vnode.ns
  49124. ? nodeOps.createElementNS(vnode.ns, tag)
  49125. : nodeOps.createElement(tag, vnode);
  49126. setScope(vnode);
  49127. /* istanbul ignore if */
  49128. {
  49129. createChildren(vnode, children, insertedVnodeQueue);
  49130. if (isDef(data)) {
  49131. invokeCreateHooks(vnode, insertedVnodeQueue);
  49132. }
  49133. insert(parentElm, vnode.elm, refElm);
  49134. }
  49135. if (data && data.pre) {
  49136. creatingElmInVPre--;
  49137. }
  49138. } else if (isTrue(vnode.isComment)) {
  49139. vnode.elm = nodeOps.createComment(vnode.text);
  49140. insert(parentElm, vnode.elm, refElm);
  49141. } else {
  49142. vnode.elm = nodeOps.createTextNode(vnode.text);
  49143. insert(parentElm, vnode.elm, refElm);
  49144. }
  49145. }
  49146. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49147. var i = vnode.data;
  49148. if (isDef(i)) {
  49149. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49150. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49151. i(vnode, false /* hydrating */);
  49152. }
  49153. // after calling the init hook, if the vnode is a child component
  49154. // it should've created a child instance and mounted it. the child
  49155. // component also has set the placeholder vnode's elm.
  49156. // in that case we can just return the element and be done.
  49157. if (isDef(vnode.componentInstance)) {
  49158. initComponent(vnode, insertedVnodeQueue);
  49159. insert(parentElm, vnode.elm, refElm);
  49160. if (isTrue(isReactivated)) {
  49161. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49162. }
  49163. return true
  49164. }
  49165. }
  49166. }
  49167. function initComponent (vnode, insertedVnodeQueue) {
  49168. if (isDef(vnode.data.pendingInsert)) {
  49169. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49170. vnode.data.pendingInsert = null;
  49171. }
  49172. vnode.elm = vnode.componentInstance.$el;
  49173. if (isPatchable(vnode)) {
  49174. invokeCreateHooks(vnode, insertedVnodeQueue);
  49175. setScope(vnode);
  49176. } else {
  49177. // empty component root.
  49178. // skip all element-related modules except for ref (#3455)
  49179. registerRef(vnode);
  49180. // make sure to invoke the insert hook
  49181. insertedVnodeQueue.push(vnode);
  49182. }
  49183. }
  49184. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49185. var i;
  49186. // hack for #4339: a reactivated component with inner transition
  49187. // does not trigger because the inner node's created hooks are not called
  49188. // again. It's not ideal to involve module-specific logic in here but
  49189. // there doesn't seem to be a better way to do it.
  49190. var innerNode = vnode;
  49191. while (innerNode.componentInstance) {
  49192. innerNode = innerNode.componentInstance._vnode;
  49193. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49194. for (i = 0; i < cbs.activate.length; ++i) {
  49195. cbs.activate[i](emptyNode, innerNode);
  49196. }
  49197. insertedVnodeQueue.push(innerNode);
  49198. break
  49199. }
  49200. }
  49201. // unlike a newly created component,
  49202. // a reactivated keep-alive component doesn't insert itself
  49203. insert(parentElm, vnode.elm, refElm);
  49204. }
  49205. function insert (parent, elm, ref$$1) {
  49206. if (isDef(parent)) {
  49207. if (isDef(ref$$1)) {
  49208. if (nodeOps.parentNode(ref$$1) === parent) {
  49209. nodeOps.insertBefore(parent, elm, ref$$1);
  49210. }
  49211. } else {
  49212. nodeOps.appendChild(parent, elm);
  49213. }
  49214. }
  49215. }
  49216. function createChildren (vnode, children, insertedVnodeQueue) {
  49217. if (Array.isArray(children)) {
  49218. {
  49219. checkDuplicateKeys(children);
  49220. }
  49221. for (var i = 0; i < children.length; ++i) {
  49222. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49223. }
  49224. } else if (isPrimitive(vnode.text)) {
  49225. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49226. }
  49227. }
  49228. function isPatchable (vnode) {
  49229. while (vnode.componentInstance) {
  49230. vnode = vnode.componentInstance._vnode;
  49231. }
  49232. return isDef(vnode.tag)
  49233. }
  49234. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49235. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49236. cbs.create[i$1](emptyNode, vnode);
  49237. }
  49238. i = vnode.data.hook; // Reuse variable
  49239. if (isDef(i)) {
  49240. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49241. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49242. }
  49243. }
  49244. // set scope id attribute for scoped CSS.
  49245. // this is implemented as a special case to avoid the overhead
  49246. // of going through the normal attribute patching process.
  49247. function setScope (vnode) {
  49248. var i;
  49249. if (isDef(i = vnode.fnScopeId)) {
  49250. nodeOps.setStyleScope(vnode.elm, i);
  49251. } else {
  49252. var ancestor = vnode;
  49253. while (ancestor) {
  49254. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49255. nodeOps.setStyleScope(vnode.elm, i);
  49256. }
  49257. ancestor = ancestor.parent;
  49258. }
  49259. }
  49260. // for slot content they should also get the scopeId from the host instance.
  49261. if (isDef(i = activeInstance) &&
  49262. i !== vnode.context &&
  49263. i !== vnode.fnContext &&
  49264. isDef(i = i.$options._scopeId)
  49265. ) {
  49266. nodeOps.setStyleScope(vnode.elm, i);
  49267. }
  49268. }
  49269. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49270. for (; startIdx <= endIdx; ++startIdx) {
  49271. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49272. }
  49273. }
  49274. function invokeDestroyHook (vnode) {
  49275. var i, j;
  49276. var data = vnode.data;
  49277. if (isDef(data)) {
  49278. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49279. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49280. }
  49281. if (isDef(i = vnode.children)) {
  49282. for (j = 0; j < vnode.children.length; ++j) {
  49283. invokeDestroyHook(vnode.children[j]);
  49284. }
  49285. }
  49286. }
  49287. function removeVnodes (vnodes, startIdx, endIdx) {
  49288. for (; startIdx <= endIdx; ++startIdx) {
  49289. var ch = vnodes[startIdx];
  49290. if (isDef(ch)) {
  49291. if (isDef(ch.tag)) {
  49292. removeAndInvokeRemoveHook(ch);
  49293. invokeDestroyHook(ch);
  49294. } else { // Text node
  49295. removeNode(ch.elm);
  49296. }
  49297. }
  49298. }
  49299. }
  49300. function removeAndInvokeRemoveHook (vnode, rm) {
  49301. if (isDef(rm) || isDef(vnode.data)) {
  49302. var i;
  49303. var listeners = cbs.remove.length + 1;
  49304. if (isDef(rm)) {
  49305. // we have a recursively passed down rm callback
  49306. // increase the listeners count
  49307. rm.listeners += listeners;
  49308. } else {
  49309. // directly removing
  49310. rm = createRmCb(vnode.elm, listeners);
  49311. }
  49312. // recursively invoke hooks on child component root node
  49313. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49314. removeAndInvokeRemoveHook(i, rm);
  49315. }
  49316. for (i = 0; i < cbs.remove.length; ++i) {
  49317. cbs.remove[i](vnode, rm);
  49318. }
  49319. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49320. i(vnode, rm);
  49321. } else {
  49322. rm();
  49323. }
  49324. } else {
  49325. removeNode(vnode.elm);
  49326. }
  49327. }
  49328. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49329. var oldStartIdx = 0;
  49330. var newStartIdx = 0;
  49331. var oldEndIdx = oldCh.length - 1;
  49332. var oldStartVnode = oldCh[0];
  49333. var oldEndVnode = oldCh[oldEndIdx];
  49334. var newEndIdx = newCh.length - 1;
  49335. var newStartVnode = newCh[0];
  49336. var newEndVnode = newCh[newEndIdx];
  49337. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49338. // removeOnly is a special flag used only by <transition-group>
  49339. // to ensure removed elements stay in correct relative positions
  49340. // during leaving transitions
  49341. var canMove = !removeOnly;
  49342. {
  49343. checkDuplicateKeys(newCh);
  49344. }
  49345. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49346. if (isUndef(oldStartVnode)) {
  49347. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49348. } else if (isUndef(oldEndVnode)) {
  49349. oldEndVnode = oldCh[--oldEndIdx];
  49350. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49351. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49352. oldStartVnode = oldCh[++oldStartIdx];
  49353. newStartVnode = newCh[++newStartIdx];
  49354. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49355. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49356. oldEndVnode = oldCh[--oldEndIdx];
  49357. newEndVnode = newCh[--newEndIdx];
  49358. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49359. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49360. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49361. oldStartVnode = oldCh[++oldStartIdx];
  49362. newEndVnode = newCh[--newEndIdx];
  49363. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49364. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49365. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49366. oldEndVnode = oldCh[--oldEndIdx];
  49367. newStartVnode = newCh[++newStartIdx];
  49368. } else {
  49369. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49370. idxInOld = isDef(newStartVnode.key)
  49371. ? oldKeyToIdx[newStartVnode.key]
  49372. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49373. if (isUndef(idxInOld)) { // New element
  49374. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49375. } else {
  49376. vnodeToMove = oldCh[idxInOld];
  49377. if (sameVnode(vnodeToMove, newStartVnode)) {
  49378. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49379. oldCh[idxInOld] = undefined;
  49380. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49381. } else {
  49382. // same key but different element. treat as new element
  49383. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49384. }
  49385. }
  49386. newStartVnode = newCh[++newStartIdx];
  49387. }
  49388. }
  49389. if (oldStartIdx > oldEndIdx) {
  49390. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49391. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49392. } else if (newStartIdx > newEndIdx) {
  49393. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49394. }
  49395. }
  49396. function checkDuplicateKeys (children) {
  49397. var seenKeys = {};
  49398. for (var i = 0; i < children.length; i++) {
  49399. var vnode = children[i];
  49400. var key = vnode.key;
  49401. if (isDef(key)) {
  49402. if (seenKeys[key]) {
  49403. warn(
  49404. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49405. vnode.context
  49406. );
  49407. } else {
  49408. seenKeys[key] = true;
  49409. }
  49410. }
  49411. }
  49412. }
  49413. function findIdxInOld (node, oldCh, start, end) {
  49414. for (var i = start; i < end; i++) {
  49415. var c = oldCh[i];
  49416. if (isDef(c) && sameVnode(node, c)) { return i }
  49417. }
  49418. }
  49419. function patchVnode (
  49420. oldVnode,
  49421. vnode,
  49422. insertedVnodeQueue,
  49423. ownerArray,
  49424. index,
  49425. removeOnly
  49426. ) {
  49427. if (oldVnode === vnode) {
  49428. return
  49429. }
  49430. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49431. // clone reused vnode
  49432. vnode = ownerArray[index] = cloneVNode(vnode);
  49433. }
  49434. var elm = vnode.elm = oldVnode.elm;
  49435. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49436. if (isDef(vnode.asyncFactory.resolved)) {
  49437. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49438. } else {
  49439. vnode.isAsyncPlaceholder = true;
  49440. }
  49441. return
  49442. }
  49443. // reuse element for static trees.
  49444. // note we only do this if the vnode is cloned -
  49445. // if the new node is not cloned it means the render functions have been
  49446. // reset by the hot-reload-api and we need to do a proper re-render.
  49447. if (isTrue(vnode.isStatic) &&
  49448. isTrue(oldVnode.isStatic) &&
  49449. vnode.key === oldVnode.key &&
  49450. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49451. ) {
  49452. vnode.componentInstance = oldVnode.componentInstance;
  49453. return
  49454. }
  49455. var i;
  49456. var data = vnode.data;
  49457. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49458. i(oldVnode, vnode);
  49459. }
  49460. var oldCh = oldVnode.children;
  49461. var ch = vnode.children;
  49462. if (isDef(data) && isPatchable(vnode)) {
  49463. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49464. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49465. }
  49466. if (isUndef(vnode.text)) {
  49467. if (isDef(oldCh) && isDef(ch)) {
  49468. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49469. } else if (isDef(ch)) {
  49470. {
  49471. checkDuplicateKeys(ch);
  49472. }
  49473. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49474. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49475. } else if (isDef(oldCh)) {
  49476. removeVnodes(oldCh, 0, oldCh.length - 1);
  49477. } else if (isDef(oldVnode.text)) {
  49478. nodeOps.setTextContent(elm, '');
  49479. }
  49480. } else if (oldVnode.text !== vnode.text) {
  49481. nodeOps.setTextContent(elm, vnode.text);
  49482. }
  49483. if (isDef(data)) {
  49484. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49485. }
  49486. }
  49487. function invokeInsertHook (vnode, queue, initial) {
  49488. // delay insert hooks for component root nodes, invoke them after the
  49489. // element is really inserted
  49490. if (isTrue(initial) && isDef(vnode.parent)) {
  49491. vnode.parent.data.pendingInsert = queue;
  49492. } else {
  49493. for (var i = 0; i < queue.length; ++i) {
  49494. queue[i].data.hook.insert(queue[i]);
  49495. }
  49496. }
  49497. }
  49498. var hydrationBailed = false;
  49499. // list of modules that can skip create hook during hydration because they
  49500. // are already rendered on the client or has no need for initialization
  49501. // Note: style is excluded because it relies on initial clone for future
  49502. // deep updates (#7063).
  49503. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49504. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49505. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49506. var i;
  49507. var tag = vnode.tag;
  49508. var data = vnode.data;
  49509. var children = vnode.children;
  49510. inVPre = inVPre || (data && data.pre);
  49511. vnode.elm = elm;
  49512. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49513. vnode.isAsyncPlaceholder = true;
  49514. return true
  49515. }
  49516. // assert node match
  49517. {
  49518. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49519. return false
  49520. }
  49521. }
  49522. if (isDef(data)) {
  49523. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49524. if (isDef(i = vnode.componentInstance)) {
  49525. // child component. it should have hydrated its own tree.
  49526. initComponent(vnode, insertedVnodeQueue);
  49527. return true
  49528. }
  49529. }
  49530. if (isDef(tag)) {
  49531. if (isDef(children)) {
  49532. // empty element, allow client to pick up and populate children
  49533. if (!elm.hasChildNodes()) {
  49534. createChildren(vnode, children, insertedVnodeQueue);
  49535. } else {
  49536. // v-html and domProps: innerHTML
  49537. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49538. if (i !== elm.innerHTML) {
  49539. /* istanbul ignore if */
  49540. if (typeof console !== 'undefined' &&
  49541. !hydrationBailed
  49542. ) {
  49543. hydrationBailed = true;
  49544. console.warn('Parent: ', elm);
  49545. console.warn('server innerHTML: ', i);
  49546. console.warn('client innerHTML: ', elm.innerHTML);
  49547. }
  49548. return false
  49549. }
  49550. } else {
  49551. // iterate and compare children lists
  49552. var childrenMatch = true;
  49553. var childNode = elm.firstChild;
  49554. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49555. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49556. childrenMatch = false;
  49557. break
  49558. }
  49559. childNode = childNode.nextSibling;
  49560. }
  49561. // if childNode is not null, it means the actual childNodes list is
  49562. // longer than the virtual children list.
  49563. if (!childrenMatch || childNode) {
  49564. /* istanbul ignore if */
  49565. if (typeof console !== 'undefined' &&
  49566. !hydrationBailed
  49567. ) {
  49568. hydrationBailed = true;
  49569. console.warn('Parent: ', elm);
  49570. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49571. }
  49572. return false
  49573. }
  49574. }
  49575. }
  49576. }
  49577. if (isDef(data)) {
  49578. var fullInvoke = false;
  49579. for (var key in data) {
  49580. if (!isRenderedModule(key)) {
  49581. fullInvoke = true;
  49582. invokeCreateHooks(vnode, insertedVnodeQueue);
  49583. break
  49584. }
  49585. }
  49586. if (!fullInvoke && data['class']) {
  49587. // ensure collecting deps for deep class bindings for future updates
  49588. traverse(data['class']);
  49589. }
  49590. }
  49591. } else if (elm.data !== vnode.text) {
  49592. elm.data = vnode.text;
  49593. }
  49594. return true
  49595. }
  49596. function assertNodeMatch (node, vnode, inVPre) {
  49597. if (isDef(vnode.tag)) {
  49598. return vnode.tag.indexOf('vue-component') === 0 || (
  49599. !isUnknownElement$$1(vnode, inVPre) &&
  49600. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49601. )
  49602. } else {
  49603. return node.nodeType === (vnode.isComment ? 8 : 3)
  49604. }
  49605. }
  49606. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49607. if (isUndef(vnode)) {
  49608. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49609. return
  49610. }
  49611. var isInitialPatch = false;
  49612. var insertedVnodeQueue = [];
  49613. if (isUndef(oldVnode)) {
  49614. // empty mount (likely as component), create new root element
  49615. isInitialPatch = true;
  49616. createElm(vnode, insertedVnodeQueue);
  49617. } else {
  49618. var isRealElement = isDef(oldVnode.nodeType);
  49619. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49620. // patch existing root node
  49621. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49622. } else {
  49623. if (isRealElement) {
  49624. // mounting to a real element
  49625. // check if this is server-rendered content and if we can perform
  49626. // a successful hydration.
  49627. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49628. oldVnode.removeAttribute(SSR_ATTR);
  49629. hydrating = true;
  49630. }
  49631. if (isTrue(hydrating)) {
  49632. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49633. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49634. return oldVnode
  49635. } else {
  49636. warn(
  49637. 'The client-side rendered virtual DOM tree is not matching ' +
  49638. 'server-rendered content. This is likely caused by incorrect ' +
  49639. 'HTML markup, for example nesting block-level elements inside ' +
  49640. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49641. 'full client-side render.'
  49642. );
  49643. }
  49644. }
  49645. // either not server-rendered, or hydration failed.
  49646. // create an empty node and replace it
  49647. oldVnode = emptyNodeAt(oldVnode);
  49648. }
  49649. // replacing existing element
  49650. var oldElm = oldVnode.elm;
  49651. var parentElm = nodeOps.parentNode(oldElm);
  49652. // create new node
  49653. createElm(
  49654. vnode,
  49655. insertedVnodeQueue,
  49656. // extremely rare edge case: do not insert if old element is in a
  49657. // leaving transition. Only happens when combining transition +
  49658. // keep-alive + HOCs. (#4590)
  49659. oldElm._leaveCb ? null : parentElm,
  49660. nodeOps.nextSibling(oldElm)
  49661. );
  49662. // update parent placeholder node element, recursively
  49663. if (isDef(vnode.parent)) {
  49664. var ancestor = vnode.parent;
  49665. var patchable = isPatchable(vnode);
  49666. while (ancestor) {
  49667. for (var i = 0; i < cbs.destroy.length; ++i) {
  49668. cbs.destroy[i](ancestor);
  49669. }
  49670. ancestor.elm = vnode.elm;
  49671. if (patchable) {
  49672. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49673. cbs.create[i$1](emptyNode, ancestor);
  49674. }
  49675. // #6513
  49676. // invoke insert hooks that may have been merged by create hooks.
  49677. // e.g. for directives that uses the "inserted" hook.
  49678. var insert = ancestor.data.hook.insert;
  49679. if (insert.merged) {
  49680. // start at index 1 to avoid re-invoking component mounted hook
  49681. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49682. insert.fns[i$2]();
  49683. }
  49684. }
  49685. } else {
  49686. registerRef(ancestor);
  49687. }
  49688. ancestor = ancestor.parent;
  49689. }
  49690. }
  49691. // destroy old node
  49692. if (isDef(parentElm)) {
  49693. removeVnodes([oldVnode], 0, 0);
  49694. } else if (isDef(oldVnode.tag)) {
  49695. invokeDestroyHook(oldVnode);
  49696. }
  49697. }
  49698. }
  49699. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49700. return vnode.elm
  49701. }
  49702. }
  49703. /* */
  49704. var directives = {
  49705. create: updateDirectives,
  49706. update: updateDirectives,
  49707. destroy: function unbindDirectives (vnode) {
  49708. updateDirectives(vnode, emptyNode);
  49709. }
  49710. };
  49711. function updateDirectives (oldVnode, vnode) {
  49712. if (oldVnode.data.directives || vnode.data.directives) {
  49713. _update(oldVnode, vnode);
  49714. }
  49715. }
  49716. function _update (oldVnode, vnode) {
  49717. var isCreate = oldVnode === emptyNode;
  49718. var isDestroy = vnode === emptyNode;
  49719. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49720. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49721. var dirsWithInsert = [];
  49722. var dirsWithPostpatch = [];
  49723. var key, oldDir, dir;
  49724. for (key in newDirs) {
  49725. oldDir = oldDirs[key];
  49726. dir = newDirs[key];
  49727. if (!oldDir) {
  49728. // new directive, bind
  49729. callHook$1(dir, 'bind', vnode, oldVnode);
  49730. if (dir.def && dir.def.inserted) {
  49731. dirsWithInsert.push(dir);
  49732. }
  49733. } else {
  49734. // existing directive, update
  49735. dir.oldValue = oldDir.value;
  49736. dir.oldArg = oldDir.arg;
  49737. callHook$1(dir, 'update', vnode, oldVnode);
  49738. if (dir.def && dir.def.componentUpdated) {
  49739. dirsWithPostpatch.push(dir);
  49740. }
  49741. }
  49742. }
  49743. if (dirsWithInsert.length) {
  49744. var callInsert = function () {
  49745. for (var i = 0; i < dirsWithInsert.length; i++) {
  49746. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49747. }
  49748. };
  49749. if (isCreate) {
  49750. mergeVNodeHook(vnode, 'insert', callInsert);
  49751. } else {
  49752. callInsert();
  49753. }
  49754. }
  49755. if (dirsWithPostpatch.length) {
  49756. mergeVNodeHook(vnode, 'postpatch', function () {
  49757. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49758. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49759. }
  49760. });
  49761. }
  49762. if (!isCreate) {
  49763. for (key in oldDirs) {
  49764. if (!newDirs[key]) {
  49765. // no longer present, unbind
  49766. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  49767. }
  49768. }
  49769. }
  49770. }
  49771. var emptyModifiers = Object.create(null);
  49772. function normalizeDirectives$1 (
  49773. dirs,
  49774. vm
  49775. ) {
  49776. var res = Object.create(null);
  49777. if (!dirs) {
  49778. // $flow-disable-line
  49779. return res
  49780. }
  49781. var i, dir;
  49782. for (i = 0; i < dirs.length; i++) {
  49783. dir = dirs[i];
  49784. if (!dir.modifiers) {
  49785. // $flow-disable-line
  49786. dir.modifiers = emptyModifiers;
  49787. }
  49788. res[getRawDirName(dir)] = dir;
  49789. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  49790. }
  49791. // $flow-disable-line
  49792. return res
  49793. }
  49794. function getRawDirName (dir) {
  49795. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  49796. }
  49797. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  49798. var fn = dir.def && dir.def[hook];
  49799. if (fn) {
  49800. try {
  49801. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  49802. } catch (e) {
  49803. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  49804. }
  49805. }
  49806. }
  49807. var baseModules = [
  49808. ref,
  49809. directives
  49810. ];
  49811. /* */
  49812. function updateAttrs (oldVnode, vnode) {
  49813. var opts = vnode.componentOptions;
  49814. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  49815. return
  49816. }
  49817. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  49818. return
  49819. }
  49820. var key, cur, old;
  49821. var elm = vnode.elm;
  49822. var oldAttrs = oldVnode.data.attrs || {};
  49823. var attrs = vnode.data.attrs || {};
  49824. // clone observed objects, as the user probably wants to mutate it
  49825. if (isDef(attrs.__ob__)) {
  49826. attrs = vnode.data.attrs = extend({}, attrs);
  49827. }
  49828. for (key in attrs) {
  49829. cur = attrs[key];
  49830. old = oldAttrs[key];
  49831. if (old !== cur) {
  49832. setAttr(elm, key, cur);
  49833. }
  49834. }
  49835. // #4391: in IE9, setting type can reset value for input[type=radio]
  49836. // #6666: IE/Edge forces progress value down to 1 before setting a max
  49837. /* istanbul ignore if */
  49838. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  49839. setAttr(elm, 'value', attrs.value);
  49840. }
  49841. for (key in oldAttrs) {
  49842. if (isUndef(attrs[key])) {
  49843. if (isXlink(key)) {
  49844. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49845. } else if (!isEnumeratedAttr(key)) {
  49846. elm.removeAttribute(key);
  49847. }
  49848. }
  49849. }
  49850. }
  49851. function setAttr (el, key, value) {
  49852. if (el.tagName.indexOf('-') > -1) {
  49853. baseSetAttr(el, key, value);
  49854. } else if (isBooleanAttr(key)) {
  49855. // set attribute for blank value
  49856. // e.g. <option disabled>Select one</option>
  49857. if (isFalsyAttrValue(value)) {
  49858. el.removeAttribute(key);
  49859. } else {
  49860. // technically allowfullscreen is a boolean attribute for <iframe>,
  49861. // but Flash expects a value of "true" when used on <embed> tag
  49862. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  49863. ? 'true'
  49864. : key;
  49865. el.setAttribute(key, value);
  49866. }
  49867. } else if (isEnumeratedAttr(key)) {
  49868. el.setAttribute(key, convertEnumeratedValue(key, value));
  49869. } else if (isXlink(key)) {
  49870. if (isFalsyAttrValue(value)) {
  49871. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49872. } else {
  49873. el.setAttributeNS(xlinkNS, key, value);
  49874. }
  49875. } else {
  49876. baseSetAttr(el, key, value);
  49877. }
  49878. }
  49879. function baseSetAttr (el, key, value) {
  49880. if (isFalsyAttrValue(value)) {
  49881. el.removeAttribute(key);
  49882. } else {
  49883. // #7138: IE10 & 11 fires input event when setting placeholder on
  49884. // <textarea>... block the first input event and remove the blocker
  49885. // immediately.
  49886. /* istanbul ignore if */
  49887. if (
  49888. isIE && !isIE9 &&
  49889. el.tagName === 'TEXTAREA' &&
  49890. key === 'placeholder' && value !== '' && !el.__ieph
  49891. ) {
  49892. var blocker = function (e) {
  49893. e.stopImmediatePropagation();
  49894. el.removeEventListener('input', blocker);
  49895. };
  49896. el.addEventListener('input', blocker);
  49897. // $flow-disable-line
  49898. el.__ieph = true; /* IE placeholder patched */
  49899. }
  49900. el.setAttribute(key, value);
  49901. }
  49902. }
  49903. var attrs = {
  49904. create: updateAttrs,
  49905. update: updateAttrs
  49906. };
  49907. /* */
  49908. function updateClass (oldVnode, vnode) {
  49909. var el = vnode.elm;
  49910. var data = vnode.data;
  49911. var oldData = oldVnode.data;
  49912. if (
  49913. isUndef(data.staticClass) &&
  49914. isUndef(data.class) && (
  49915. isUndef(oldData) || (
  49916. isUndef(oldData.staticClass) &&
  49917. isUndef(oldData.class)
  49918. )
  49919. )
  49920. ) {
  49921. return
  49922. }
  49923. var cls = genClassForVnode(vnode);
  49924. // handle transition classes
  49925. var transitionClass = el._transitionClasses;
  49926. if (isDef(transitionClass)) {
  49927. cls = concat(cls, stringifyClass(transitionClass));
  49928. }
  49929. // set the class
  49930. if (cls !== el._prevClass) {
  49931. el.setAttribute('class', cls);
  49932. el._prevClass = cls;
  49933. }
  49934. }
  49935. var klass = {
  49936. create: updateClass,
  49937. update: updateClass
  49938. };
  49939. /* */
  49940. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49941. function parseFilters (exp) {
  49942. var inSingle = false;
  49943. var inDouble = false;
  49944. var inTemplateString = false;
  49945. var inRegex = false;
  49946. var curly = 0;
  49947. var square = 0;
  49948. var paren = 0;
  49949. var lastFilterIndex = 0;
  49950. var c, prev, i, expression, filters;
  49951. for (i = 0; i < exp.length; i++) {
  49952. prev = c;
  49953. c = exp.charCodeAt(i);
  49954. if (inSingle) {
  49955. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49956. } else if (inDouble) {
  49957. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49958. } else if (inTemplateString) {
  49959. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49960. } else if (inRegex) {
  49961. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49962. } else if (
  49963. c === 0x7C && // pipe
  49964. exp.charCodeAt(i + 1) !== 0x7C &&
  49965. exp.charCodeAt(i - 1) !== 0x7C &&
  49966. !curly && !square && !paren
  49967. ) {
  49968. if (expression === undefined) {
  49969. // first filter, end of expression
  49970. lastFilterIndex = i + 1;
  49971. expression = exp.slice(0, i).trim();
  49972. } else {
  49973. pushFilter();
  49974. }
  49975. } else {
  49976. switch (c) {
  49977. case 0x22: inDouble = true; break // "
  49978. case 0x27: inSingle = true; break // '
  49979. case 0x60: inTemplateString = true; break // `
  49980. case 0x28: paren++; break // (
  49981. case 0x29: paren--; break // )
  49982. case 0x5B: square++; break // [
  49983. case 0x5D: square--; break // ]
  49984. case 0x7B: curly++; break // {
  49985. case 0x7D: curly--; break // }
  49986. }
  49987. if (c === 0x2f) { // /
  49988. var j = i - 1;
  49989. var p = (void 0);
  49990. // find first non-whitespace prev char
  49991. for (; j >= 0; j--) {
  49992. p = exp.charAt(j);
  49993. if (p !== ' ') { break }
  49994. }
  49995. if (!p || !validDivisionCharRE.test(p)) {
  49996. inRegex = true;
  49997. }
  49998. }
  49999. }
  50000. }
  50001. if (expression === undefined) {
  50002. expression = exp.slice(0, i).trim();
  50003. } else if (lastFilterIndex !== 0) {
  50004. pushFilter();
  50005. }
  50006. function pushFilter () {
  50007. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50008. lastFilterIndex = i + 1;
  50009. }
  50010. if (filters) {
  50011. for (i = 0; i < filters.length; i++) {
  50012. expression = wrapFilter(expression, filters[i]);
  50013. }
  50014. }
  50015. return expression
  50016. }
  50017. function wrapFilter (exp, filter) {
  50018. var i = filter.indexOf('(');
  50019. if (i < 0) {
  50020. // _f: resolveFilter
  50021. return ("_f(\"" + filter + "\")(" + exp + ")")
  50022. } else {
  50023. var name = filter.slice(0, i);
  50024. var args = filter.slice(i + 1);
  50025. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50026. }
  50027. }
  50028. /* */
  50029. /* eslint-disable no-unused-vars */
  50030. function baseWarn (msg, range) {
  50031. console.error(("[Vue compiler]: " + msg));
  50032. }
  50033. /* eslint-enable no-unused-vars */
  50034. function pluckModuleFunction (
  50035. modules,
  50036. key
  50037. ) {
  50038. return modules
  50039. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50040. : []
  50041. }
  50042. function addProp (el, name, value, range, dynamic) {
  50043. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50044. el.plain = false;
  50045. }
  50046. function addAttr (el, name, value, range, dynamic) {
  50047. var attrs = dynamic
  50048. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50049. : (el.attrs || (el.attrs = []));
  50050. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50051. el.plain = false;
  50052. }
  50053. // add a raw attr (use this in preTransforms)
  50054. function addRawAttr (el, name, value, range) {
  50055. el.attrsMap[name] = value;
  50056. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50057. }
  50058. function addDirective (
  50059. el,
  50060. name,
  50061. rawName,
  50062. value,
  50063. arg,
  50064. isDynamicArg,
  50065. modifiers,
  50066. range
  50067. ) {
  50068. (el.directives || (el.directives = [])).push(rangeSetItem({
  50069. name: name,
  50070. rawName: rawName,
  50071. value: value,
  50072. arg: arg,
  50073. isDynamicArg: isDynamicArg,
  50074. modifiers: modifiers
  50075. }, range));
  50076. el.plain = false;
  50077. }
  50078. function prependModifierMarker (symbol, name, dynamic) {
  50079. return dynamic
  50080. ? ("_p(" + name + ",\"" + symbol + "\")")
  50081. : symbol + name // mark the event as captured
  50082. }
  50083. function addHandler (
  50084. el,
  50085. name,
  50086. value,
  50087. modifiers,
  50088. important,
  50089. warn,
  50090. range,
  50091. dynamic
  50092. ) {
  50093. modifiers = modifiers || emptyObject;
  50094. // warn prevent and passive modifier
  50095. /* istanbul ignore if */
  50096. if (
  50097. warn &&
  50098. modifiers.prevent && modifiers.passive
  50099. ) {
  50100. warn(
  50101. 'passive and prevent can\'t be used together. ' +
  50102. 'Passive handler can\'t prevent default event.',
  50103. range
  50104. );
  50105. }
  50106. // normalize click.right and click.middle since they don't actually fire
  50107. // this is technically browser-specific, but at least for now browsers are
  50108. // the only target envs that have right/middle clicks.
  50109. if (modifiers.right) {
  50110. if (dynamic) {
  50111. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50112. } else if (name === 'click') {
  50113. name = 'contextmenu';
  50114. delete modifiers.right;
  50115. }
  50116. } else if (modifiers.middle) {
  50117. if (dynamic) {
  50118. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50119. } else if (name === 'click') {
  50120. name = 'mouseup';
  50121. }
  50122. }
  50123. // check capture modifier
  50124. if (modifiers.capture) {
  50125. delete modifiers.capture;
  50126. name = prependModifierMarker('!', name, dynamic);
  50127. }
  50128. if (modifiers.once) {
  50129. delete modifiers.once;
  50130. name = prependModifierMarker('~', name, dynamic);
  50131. }
  50132. /* istanbul ignore if */
  50133. if (modifiers.passive) {
  50134. delete modifiers.passive;
  50135. name = prependModifierMarker('&', name, dynamic);
  50136. }
  50137. var events;
  50138. if (modifiers.native) {
  50139. delete modifiers.native;
  50140. events = el.nativeEvents || (el.nativeEvents = {});
  50141. } else {
  50142. events = el.events || (el.events = {});
  50143. }
  50144. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50145. if (modifiers !== emptyObject) {
  50146. newHandler.modifiers = modifiers;
  50147. }
  50148. var handlers = events[name];
  50149. /* istanbul ignore if */
  50150. if (Array.isArray(handlers)) {
  50151. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50152. } else if (handlers) {
  50153. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50154. } else {
  50155. events[name] = newHandler;
  50156. }
  50157. el.plain = false;
  50158. }
  50159. function getRawBindingAttr (
  50160. el,
  50161. name
  50162. ) {
  50163. return el.rawAttrsMap[':' + name] ||
  50164. el.rawAttrsMap['v-bind:' + name] ||
  50165. el.rawAttrsMap[name]
  50166. }
  50167. function getBindingAttr (
  50168. el,
  50169. name,
  50170. getStatic
  50171. ) {
  50172. var dynamicValue =
  50173. getAndRemoveAttr(el, ':' + name) ||
  50174. getAndRemoveAttr(el, 'v-bind:' + name);
  50175. if (dynamicValue != null) {
  50176. return parseFilters(dynamicValue)
  50177. } else if (getStatic !== false) {
  50178. var staticValue = getAndRemoveAttr(el, name);
  50179. if (staticValue != null) {
  50180. return JSON.stringify(staticValue)
  50181. }
  50182. }
  50183. }
  50184. // note: this only removes the attr from the Array (attrsList) so that it
  50185. // doesn't get processed by processAttrs.
  50186. // By default it does NOT remove it from the map (attrsMap) because the map is
  50187. // needed during codegen.
  50188. function getAndRemoveAttr (
  50189. el,
  50190. name,
  50191. removeFromMap
  50192. ) {
  50193. var val;
  50194. if ((val = el.attrsMap[name]) != null) {
  50195. var list = el.attrsList;
  50196. for (var i = 0, l = list.length; i < l; i++) {
  50197. if (list[i].name === name) {
  50198. list.splice(i, 1);
  50199. break
  50200. }
  50201. }
  50202. }
  50203. if (removeFromMap) {
  50204. delete el.attrsMap[name];
  50205. }
  50206. return val
  50207. }
  50208. function getAndRemoveAttrByRegex (
  50209. el,
  50210. name
  50211. ) {
  50212. var list = el.attrsList;
  50213. for (var i = 0, l = list.length; i < l; i++) {
  50214. var attr = list[i];
  50215. if (name.test(attr.name)) {
  50216. list.splice(i, 1);
  50217. return attr
  50218. }
  50219. }
  50220. }
  50221. function rangeSetItem (
  50222. item,
  50223. range
  50224. ) {
  50225. if (range) {
  50226. if (range.start != null) {
  50227. item.start = range.start;
  50228. }
  50229. if (range.end != null) {
  50230. item.end = range.end;
  50231. }
  50232. }
  50233. return item
  50234. }
  50235. /* */
  50236. /**
  50237. * Cross-platform code generation for component v-model
  50238. */
  50239. function genComponentModel (
  50240. el,
  50241. value,
  50242. modifiers
  50243. ) {
  50244. var ref = modifiers || {};
  50245. var number = ref.number;
  50246. var trim = ref.trim;
  50247. var baseValueExpression = '$$v';
  50248. var valueExpression = baseValueExpression;
  50249. if (trim) {
  50250. valueExpression =
  50251. "(typeof " + baseValueExpression + " === 'string'" +
  50252. "? " + baseValueExpression + ".trim()" +
  50253. ": " + baseValueExpression + ")";
  50254. }
  50255. if (number) {
  50256. valueExpression = "_n(" + valueExpression + ")";
  50257. }
  50258. var assignment = genAssignmentCode(value, valueExpression);
  50259. el.model = {
  50260. value: ("(" + value + ")"),
  50261. expression: JSON.stringify(value),
  50262. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50263. };
  50264. }
  50265. /**
  50266. * Cross-platform codegen helper for generating v-model value assignment code.
  50267. */
  50268. function genAssignmentCode (
  50269. value,
  50270. assignment
  50271. ) {
  50272. var res = parseModel(value);
  50273. if (res.key === null) {
  50274. return (value + "=" + assignment)
  50275. } else {
  50276. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50277. }
  50278. }
  50279. /**
  50280. * Parse a v-model expression into a base path and a final key segment.
  50281. * Handles both dot-path and possible square brackets.
  50282. *
  50283. * Possible cases:
  50284. *
  50285. * - test
  50286. * - test[key]
  50287. * - test[test1[key]]
  50288. * - test["a"][key]
  50289. * - xxx.test[a[a].test1[key]]
  50290. * - test.xxx.a["asa"][test1[key]]
  50291. *
  50292. */
  50293. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50294. function parseModel (val) {
  50295. // Fix https://github.com/vuejs/vue/pull/7730
  50296. // allow v-model="obj.val " (trailing whitespace)
  50297. val = val.trim();
  50298. len = val.length;
  50299. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50300. index$1 = val.lastIndexOf('.');
  50301. if (index$1 > -1) {
  50302. return {
  50303. exp: val.slice(0, index$1),
  50304. key: '"' + val.slice(index$1 + 1) + '"'
  50305. }
  50306. } else {
  50307. return {
  50308. exp: val,
  50309. key: null
  50310. }
  50311. }
  50312. }
  50313. str = val;
  50314. index$1 = expressionPos = expressionEndPos = 0;
  50315. while (!eof()) {
  50316. chr = next();
  50317. /* istanbul ignore if */
  50318. if (isStringStart(chr)) {
  50319. parseString(chr);
  50320. } else if (chr === 0x5B) {
  50321. parseBracket(chr);
  50322. }
  50323. }
  50324. return {
  50325. exp: val.slice(0, expressionPos),
  50326. key: val.slice(expressionPos + 1, expressionEndPos)
  50327. }
  50328. }
  50329. function next () {
  50330. return str.charCodeAt(++index$1)
  50331. }
  50332. function eof () {
  50333. return index$1 >= len
  50334. }
  50335. function isStringStart (chr) {
  50336. return chr === 0x22 || chr === 0x27
  50337. }
  50338. function parseBracket (chr) {
  50339. var inBracket = 1;
  50340. expressionPos = index$1;
  50341. while (!eof()) {
  50342. chr = next();
  50343. if (isStringStart(chr)) {
  50344. parseString(chr);
  50345. continue
  50346. }
  50347. if (chr === 0x5B) { inBracket++; }
  50348. if (chr === 0x5D) { inBracket--; }
  50349. if (inBracket === 0) {
  50350. expressionEndPos = index$1;
  50351. break
  50352. }
  50353. }
  50354. }
  50355. function parseString (chr) {
  50356. var stringQuote = chr;
  50357. while (!eof()) {
  50358. chr = next();
  50359. if (chr === stringQuote) {
  50360. break
  50361. }
  50362. }
  50363. }
  50364. /* */
  50365. var warn$1;
  50366. // in some cases, the event used has to be determined at runtime
  50367. // so we used some reserved tokens during compile.
  50368. var RANGE_TOKEN = '__r';
  50369. var CHECKBOX_RADIO_TOKEN = '__c';
  50370. function model (
  50371. el,
  50372. dir,
  50373. _warn
  50374. ) {
  50375. warn$1 = _warn;
  50376. var value = dir.value;
  50377. var modifiers = dir.modifiers;
  50378. var tag = el.tag;
  50379. var type = el.attrsMap.type;
  50380. {
  50381. // inputs with type="file" are read only and setting the input's
  50382. // value will throw an error.
  50383. if (tag === 'input' && type === 'file') {
  50384. warn$1(
  50385. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50386. "File inputs are read only. Use a v-on:change listener instead.",
  50387. el.rawAttrsMap['v-model']
  50388. );
  50389. }
  50390. }
  50391. if (el.component) {
  50392. genComponentModel(el, value, modifiers);
  50393. // component v-model doesn't need extra runtime
  50394. return false
  50395. } else if (tag === 'select') {
  50396. genSelect(el, value, modifiers);
  50397. } else if (tag === 'input' && type === 'checkbox') {
  50398. genCheckboxModel(el, value, modifiers);
  50399. } else if (tag === 'input' && type === 'radio') {
  50400. genRadioModel(el, value, modifiers);
  50401. } else if (tag === 'input' || tag === 'textarea') {
  50402. genDefaultModel(el, value, modifiers);
  50403. } else if (!config.isReservedTag(tag)) {
  50404. genComponentModel(el, value, modifiers);
  50405. // component v-model doesn't need extra runtime
  50406. return false
  50407. } else {
  50408. warn$1(
  50409. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50410. "v-model is not supported on this element type. " +
  50411. 'If you are working with contenteditable, it\'s recommended to ' +
  50412. 'wrap a library dedicated for that purpose inside a custom component.',
  50413. el.rawAttrsMap['v-model']
  50414. );
  50415. }
  50416. // ensure runtime directive metadata
  50417. return true
  50418. }
  50419. function genCheckboxModel (
  50420. el,
  50421. value,
  50422. modifiers
  50423. ) {
  50424. var number = modifiers && modifiers.number;
  50425. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50426. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50427. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50428. addProp(el, 'checked',
  50429. "Array.isArray(" + value + ")" +
  50430. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50431. trueValueBinding === 'true'
  50432. ? (":(" + value + ")")
  50433. : (":_q(" + value + "," + trueValueBinding + ")")
  50434. )
  50435. );
  50436. addHandler(el, 'change',
  50437. "var $$a=" + value + "," +
  50438. '$$el=$event.target,' +
  50439. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50440. 'if(Array.isArray($$a)){' +
  50441. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50442. '$$i=_i($$a,$$v);' +
  50443. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50444. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50445. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50446. null, true
  50447. );
  50448. }
  50449. function genRadioModel (
  50450. el,
  50451. value,
  50452. modifiers
  50453. ) {
  50454. var number = modifiers && modifiers.number;
  50455. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50456. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50457. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50458. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50459. }
  50460. function genSelect (
  50461. el,
  50462. value,
  50463. modifiers
  50464. ) {
  50465. var number = modifiers && modifiers.number;
  50466. var selectedVal = "Array.prototype.filter" +
  50467. ".call($event.target.options,function(o){return o.selected})" +
  50468. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50469. "return " + (number ? '_n(val)' : 'val') + "})";
  50470. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50471. var code = "var $$selectedVal = " + selectedVal + ";";
  50472. code = code + " " + (genAssignmentCode(value, assignment));
  50473. addHandler(el, 'change', code, null, true);
  50474. }
  50475. function genDefaultModel (
  50476. el,
  50477. value,
  50478. modifiers
  50479. ) {
  50480. var type = el.attrsMap.type;
  50481. // warn if v-bind:value conflicts with v-model
  50482. // except for inputs with v-bind:type
  50483. {
  50484. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50485. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50486. if (value$1 && !typeBinding) {
  50487. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50488. warn$1(
  50489. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50490. 'because the latter already expands to a value binding internally',
  50491. el.rawAttrsMap[binding]
  50492. );
  50493. }
  50494. }
  50495. var ref = modifiers || {};
  50496. var lazy = ref.lazy;
  50497. var number = ref.number;
  50498. var trim = ref.trim;
  50499. var needCompositionGuard = !lazy && type !== 'range';
  50500. var event = lazy
  50501. ? 'change'
  50502. : type === 'range'
  50503. ? RANGE_TOKEN
  50504. : 'input';
  50505. var valueExpression = '$event.target.value';
  50506. if (trim) {
  50507. valueExpression = "$event.target.value.trim()";
  50508. }
  50509. if (number) {
  50510. valueExpression = "_n(" + valueExpression + ")";
  50511. }
  50512. var code = genAssignmentCode(value, valueExpression);
  50513. if (needCompositionGuard) {
  50514. code = "if($event.target.composing)return;" + code;
  50515. }
  50516. addProp(el, 'value', ("(" + value + ")"));
  50517. addHandler(el, event, code, null, true);
  50518. if (trim || number) {
  50519. addHandler(el, 'blur', '$forceUpdate()');
  50520. }
  50521. }
  50522. /* */
  50523. // normalize v-model event tokens that can only be determined at runtime.
  50524. // it's important to place the event as the first in the array because
  50525. // the whole point is ensuring the v-model callback gets called before
  50526. // user-attached handlers.
  50527. function normalizeEvents (on) {
  50528. /* istanbul ignore if */
  50529. if (isDef(on[RANGE_TOKEN])) {
  50530. // IE input[type=range] only supports `change` event
  50531. var event = isIE ? 'change' : 'input';
  50532. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50533. delete on[RANGE_TOKEN];
  50534. }
  50535. // This was originally intended to fix #4521 but no longer necessary
  50536. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50537. /* istanbul ignore if */
  50538. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50539. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50540. delete on[CHECKBOX_RADIO_TOKEN];
  50541. }
  50542. }
  50543. var target$1;
  50544. function createOnceHandler$1 (event, handler, capture) {
  50545. var _target = target$1; // save current target element in closure
  50546. return function onceHandler () {
  50547. var res = handler.apply(null, arguments);
  50548. if (res !== null) {
  50549. remove$2(event, onceHandler, capture, _target);
  50550. }
  50551. }
  50552. }
  50553. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50554. // implementation and does not fire microtasks in between event propagation, so
  50555. // safe to exclude.
  50556. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50557. function add$1 (
  50558. name,
  50559. handler,
  50560. capture,
  50561. passive
  50562. ) {
  50563. // async edge case #6566: inner click event triggers patch, event handler
  50564. // attached to outer element during patch, and triggered again. This
  50565. // happens because browsers fire microtask ticks between event propagation.
  50566. // the solution is simple: we save the timestamp when a handler is attached,
  50567. // and the handler would only fire if the event passed to it was fired
  50568. // AFTER it was attached.
  50569. if (useMicrotaskFix) {
  50570. var attachedTimestamp = currentFlushTimestamp;
  50571. var original = handler;
  50572. handler = original._wrapper = function (e) {
  50573. if (
  50574. // no bubbling, should always fire.
  50575. // this is just a safety net in case event.timeStamp is unreliable in
  50576. // certain weird environments...
  50577. e.target === e.currentTarget ||
  50578. // event is fired after handler attachment
  50579. e.timeStamp >= attachedTimestamp ||
  50580. // bail for environments that have buggy event.timeStamp implementations
  50581. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50582. // #9681 QtWebEngine event.timeStamp is negative value
  50583. e.timeStamp <= 0 ||
  50584. // #9448 bail if event is fired in another document in a multi-page
  50585. // electron/nw.js app, since event.timeStamp will be using a different
  50586. // starting reference
  50587. e.target.ownerDocument !== document
  50588. ) {
  50589. return original.apply(this, arguments)
  50590. }
  50591. };
  50592. }
  50593. target$1.addEventListener(
  50594. name,
  50595. handler,
  50596. supportsPassive
  50597. ? { capture: capture, passive: passive }
  50598. : capture
  50599. );
  50600. }
  50601. function remove$2 (
  50602. name,
  50603. handler,
  50604. capture,
  50605. _target
  50606. ) {
  50607. (_target || target$1).removeEventListener(
  50608. name,
  50609. handler._wrapper || handler,
  50610. capture
  50611. );
  50612. }
  50613. function updateDOMListeners (oldVnode, vnode) {
  50614. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50615. return
  50616. }
  50617. var on = vnode.data.on || {};
  50618. var oldOn = oldVnode.data.on || {};
  50619. target$1 = vnode.elm;
  50620. normalizeEvents(on);
  50621. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50622. target$1 = undefined;
  50623. }
  50624. var events = {
  50625. create: updateDOMListeners,
  50626. update: updateDOMListeners
  50627. };
  50628. /* */
  50629. var svgContainer;
  50630. function updateDOMProps (oldVnode, vnode) {
  50631. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50632. return
  50633. }
  50634. var key, cur;
  50635. var elm = vnode.elm;
  50636. var oldProps = oldVnode.data.domProps || {};
  50637. var props = vnode.data.domProps || {};
  50638. // clone observed objects, as the user probably wants to mutate it
  50639. if (isDef(props.__ob__)) {
  50640. props = vnode.data.domProps = extend({}, props);
  50641. }
  50642. for (key in oldProps) {
  50643. if (!(key in props)) {
  50644. elm[key] = '';
  50645. }
  50646. }
  50647. for (key in props) {
  50648. cur = props[key];
  50649. // ignore children if the node has textContent or innerHTML,
  50650. // as these will throw away existing DOM nodes and cause removal errors
  50651. // on subsequent patches (#3360)
  50652. if (key === 'textContent' || key === 'innerHTML') {
  50653. if (vnode.children) { vnode.children.length = 0; }
  50654. if (cur === oldProps[key]) { continue }
  50655. // #6601 work around Chrome version <= 55 bug where single textNode
  50656. // replaced by innerHTML/textContent retains its parentNode property
  50657. if (elm.childNodes.length === 1) {
  50658. elm.removeChild(elm.childNodes[0]);
  50659. }
  50660. }
  50661. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50662. // store value as _value as well since
  50663. // non-string values will be stringified
  50664. elm._value = cur;
  50665. // avoid resetting cursor position when value is the same
  50666. var strCur = isUndef(cur) ? '' : String(cur);
  50667. if (shouldUpdateValue(elm, strCur)) {
  50668. elm.value = strCur;
  50669. }
  50670. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50671. // IE doesn't support innerHTML for SVG elements
  50672. svgContainer = svgContainer || document.createElement('div');
  50673. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50674. var svg = svgContainer.firstChild;
  50675. while (elm.firstChild) {
  50676. elm.removeChild(elm.firstChild);
  50677. }
  50678. while (svg.firstChild) {
  50679. elm.appendChild(svg.firstChild);
  50680. }
  50681. } else if (
  50682. // skip the update if old and new VDOM state is the same.
  50683. // `value` is handled separately because the DOM value may be temporarily
  50684. // out of sync with VDOM state due to focus, composition and modifiers.
  50685. // This #4521 by skipping the unnecesarry `checked` update.
  50686. cur !== oldProps[key]
  50687. ) {
  50688. // some property updates can throw
  50689. // e.g. `value` on <progress> w/ non-finite value
  50690. try {
  50691. elm[key] = cur;
  50692. } catch (e) {}
  50693. }
  50694. }
  50695. }
  50696. // check platforms/web/util/attrs.js acceptValue
  50697. function shouldUpdateValue (elm, checkVal) {
  50698. return (!elm.composing && (
  50699. elm.tagName === 'OPTION' ||
  50700. isNotInFocusAndDirty(elm, checkVal) ||
  50701. isDirtyWithModifiers(elm, checkVal)
  50702. ))
  50703. }
  50704. function isNotInFocusAndDirty (elm, checkVal) {
  50705. // return true when textbox (.number and .trim) loses focus and its value is
  50706. // not equal to the updated value
  50707. var notInFocus = true;
  50708. // #6157
  50709. // work around IE bug when accessing document.activeElement in an iframe
  50710. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50711. return notInFocus && elm.value !== checkVal
  50712. }
  50713. function isDirtyWithModifiers (elm, newVal) {
  50714. var value = elm.value;
  50715. var modifiers = elm._vModifiers; // injected by v-model runtime
  50716. if (isDef(modifiers)) {
  50717. if (modifiers.number) {
  50718. return toNumber(value) !== toNumber(newVal)
  50719. }
  50720. if (modifiers.trim) {
  50721. return value.trim() !== newVal.trim()
  50722. }
  50723. }
  50724. return value !== newVal
  50725. }
  50726. var domProps = {
  50727. create: updateDOMProps,
  50728. update: updateDOMProps
  50729. };
  50730. /* */
  50731. var parseStyleText = cached(function (cssText) {
  50732. var res = {};
  50733. var listDelimiter = /;(?![^(]*\))/g;
  50734. var propertyDelimiter = /:(.+)/;
  50735. cssText.split(listDelimiter).forEach(function (item) {
  50736. if (item) {
  50737. var tmp = item.split(propertyDelimiter);
  50738. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50739. }
  50740. });
  50741. return res
  50742. });
  50743. // merge static and dynamic style data on the same vnode
  50744. function normalizeStyleData (data) {
  50745. var style = normalizeStyleBinding(data.style);
  50746. // static style is pre-processed into an object during compilation
  50747. // and is always a fresh object, so it's safe to merge into it
  50748. return data.staticStyle
  50749. ? extend(data.staticStyle, style)
  50750. : style
  50751. }
  50752. // normalize possible array / string values into Object
  50753. function normalizeStyleBinding (bindingStyle) {
  50754. if (Array.isArray(bindingStyle)) {
  50755. return toObject(bindingStyle)
  50756. }
  50757. if (typeof bindingStyle === 'string') {
  50758. return parseStyleText(bindingStyle)
  50759. }
  50760. return bindingStyle
  50761. }
  50762. /**
  50763. * parent component style should be after child's
  50764. * so that parent component's style could override it
  50765. */
  50766. function getStyle (vnode, checkChild) {
  50767. var res = {};
  50768. var styleData;
  50769. if (checkChild) {
  50770. var childNode = vnode;
  50771. while (childNode.componentInstance) {
  50772. childNode = childNode.componentInstance._vnode;
  50773. if (
  50774. childNode && childNode.data &&
  50775. (styleData = normalizeStyleData(childNode.data))
  50776. ) {
  50777. extend(res, styleData);
  50778. }
  50779. }
  50780. }
  50781. if ((styleData = normalizeStyleData(vnode.data))) {
  50782. extend(res, styleData);
  50783. }
  50784. var parentNode = vnode;
  50785. while ((parentNode = parentNode.parent)) {
  50786. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  50787. extend(res, styleData);
  50788. }
  50789. }
  50790. return res
  50791. }
  50792. /* */
  50793. var cssVarRE = /^--/;
  50794. var importantRE = /\s*!important$/;
  50795. var setProp = function (el, name, val) {
  50796. /* istanbul ignore if */
  50797. if (cssVarRE.test(name)) {
  50798. el.style.setProperty(name, val);
  50799. } else if (importantRE.test(val)) {
  50800. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  50801. } else {
  50802. var normalizedName = normalize(name);
  50803. if (Array.isArray(val)) {
  50804. // Support values array created by autoprefixer, e.g.
  50805. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  50806. // Set them one by one, and the browser will only set those it can recognize
  50807. for (var i = 0, len = val.length; i < len; i++) {
  50808. el.style[normalizedName] = val[i];
  50809. }
  50810. } else {
  50811. el.style[normalizedName] = val;
  50812. }
  50813. }
  50814. };
  50815. var vendorNames = ['Webkit', 'Moz', 'ms'];
  50816. var emptyStyle;
  50817. var normalize = cached(function (prop) {
  50818. emptyStyle = emptyStyle || document.createElement('div').style;
  50819. prop = camelize(prop);
  50820. if (prop !== 'filter' && (prop in emptyStyle)) {
  50821. return prop
  50822. }
  50823. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  50824. for (var i = 0; i < vendorNames.length; i++) {
  50825. var name = vendorNames[i] + capName;
  50826. if (name in emptyStyle) {
  50827. return name
  50828. }
  50829. }
  50830. });
  50831. function updateStyle (oldVnode, vnode) {
  50832. var data = vnode.data;
  50833. var oldData = oldVnode.data;
  50834. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  50835. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  50836. ) {
  50837. return
  50838. }
  50839. var cur, name;
  50840. var el = vnode.elm;
  50841. var oldStaticStyle = oldData.staticStyle;
  50842. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  50843. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  50844. var oldStyle = oldStaticStyle || oldStyleBinding;
  50845. var style = normalizeStyleBinding(vnode.data.style) || {};
  50846. // store normalized style under a different key for next diff
  50847. // make sure to clone it if it's reactive, since the user likely wants
  50848. // to mutate it.
  50849. vnode.data.normalizedStyle = isDef(style.__ob__)
  50850. ? extend({}, style)
  50851. : style;
  50852. var newStyle = getStyle(vnode, true);
  50853. for (name in oldStyle) {
  50854. if (isUndef(newStyle[name])) {
  50855. setProp(el, name, '');
  50856. }
  50857. }
  50858. for (name in newStyle) {
  50859. cur = newStyle[name];
  50860. if (cur !== oldStyle[name]) {
  50861. // ie9 setting to null has no effect, must use empty string
  50862. setProp(el, name, cur == null ? '' : cur);
  50863. }
  50864. }
  50865. }
  50866. var style = {
  50867. create: updateStyle,
  50868. update: updateStyle
  50869. };
  50870. /* */
  50871. var whitespaceRE = /\s+/;
  50872. /**
  50873. * Add class with compatibility for SVG since classList is not supported on
  50874. * SVG elements in IE
  50875. */
  50876. function addClass (el, cls) {
  50877. /* istanbul ignore if */
  50878. if (!cls || !(cls = cls.trim())) {
  50879. return
  50880. }
  50881. /* istanbul ignore else */
  50882. if (el.classList) {
  50883. if (cls.indexOf(' ') > -1) {
  50884. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  50885. } else {
  50886. el.classList.add(cls);
  50887. }
  50888. } else {
  50889. var cur = " " + (el.getAttribute('class') || '') + " ";
  50890. if (cur.indexOf(' ' + cls + ' ') < 0) {
  50891. el.setAttribute('class', (cur + cls).trim());
  50892. }
  50893. }
  50894. }
  50895. /**
  50896. * Remove class with compatibility for SVG since classList is not supported on
  50897. * SVG elements in IE
  50898. */
  50899. function removeClass (el, cls) {
  50900. /* istanbul ignore if */
  50901. if (!cls || !(cls = cls.trim())) {
  50902. return
  50903. }
  50904. /* istanbul ignore else */
  50905. if (el.classList) {
  50906. if (cls.indexOf(' ') > -1) {
  50907. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  50908. } else {
  50909. el.classList.remove(cls);
  50910. }
  50911. if (!el.classList.length) {
  50912. el.removeAttribute('class');
  50913. }
  50914. } else {
  50915. var cur = " " + (el.getAttribute('class') || '') + " ";
  50916. var tar = ' ' + cls + ' ';
  50917. while (cur.indexOf(tar) >= 0) {
  50918. cur = cur.replace(tar, ' ');
  50919. }
  50920. cur = cur.trim();
  50921. if (cur) {
  50922. el.setAttribute('class', cur);
  50923. } else {
  50924. el.removeAttribute('class');
  50925. }
  50926. }
  50927. }
  50928. /* */
  50929. function resolveTransition (def$$1) {
  50930. if (!def$$1) {
  50931. return
  50932. }
  50933. /* istanbul ignore else */
  50934. if (typeof def$$1 === 'object') {
  50935. var res = {};
  50936. if (def$$1.css !== false) {
  50937. extend(res, autoCssTransition(def$$1.name || 'v'));
  50938. }
  50939. extend(res, def$$1);
  50940. return res
  50941. } else if (typeof def$$1 === 'string') {
  50942. return autoCssTransition(def$$1)
  50943. }
  50944. }
  50945. var autoCssTransition = cached(function (name) {
  50946. return {
  50947. enterClass: (name + "-enter"),
  50948. enterToClass: (name + "-enter-to"),
  50949. enterActiveClass: (name + "-enter-active"),
  50950. leaveClass: (name + "-leave"),
  50951. leaveToClass: (name + "-leave-to"),
  50952. leaveActiveClass: (name + "-leave-active")
  50953. }
  50954. });
  50955. var hasTransition = inBrowser && !isIE9;
  50956. var TRANSITION = 'transition';
  50957. var ANIMATION = 'animation';
  50958. // Transition property/event sniffing
  50959. var transitionProp = 'transition';
  50960. var transitionEndEvent = 'transitionend';
  50961. var animationProp = 'animation';
  50962. var animationEndEvent = 'animationend';
  50963. if (hasTransition) {
  50964. /* istanbul ignore if */
  50965. if (window.ontransitionend === undefined &&
  50966. window.onwebkittransitionend !== undefined
  50967. ) {
  50968. transitionProp = 'WebkitTransition';
  50969. transitionEndEvent = 'webkitTransitionEnd';
  50970. }
  50971. if (window.onanimationend === undefined &&
  50972. window.onwebkitanimationend !== undefined
  50973. ) {
  50974. animationProp = 'WebkitAnimation';
  50975. animationEndEvent = 'webkitAnimationEnd';
  50976. }
  50977. }
  50978. // binding to window is necessary to make hot reload work in IE in strict mode
  50979. var raf = inBrowser
  50980. ? window.requestAnimationFrame
  50981. ? window.requestAnimationFrame.bind(window)
  50982. : setTimeout
  50983. : /* istanbul ignore next */ function (fn) { return fn(); };
  50984. function nextFrame (fn) {
  50985. raf(function () {
  50986. raf(fn);
  50987. });
  50988. }
  50989. function addTransitionClass (el, cls) {
  50990. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50991. if (transitionClasses.indexOf(cls) < 0) {
  50992. transitionClasses.push(cls);
  50993. addClass(el, cls);
  50994. }
  50995. }
  50996. function removeTransitionClass (el, cls) {
  50997. if (el._transitionClasses) {
  50998. remove(el._transitionClasses, cls);
  50999. }
  51000. removeClass(el, cls);
  51001. }
  51002. function whenTransitionEnds (
  51003. el,
  51004. expectedType,
  51005. cb
  51006. ) {
  51007. var ref = getTransitionInfo(el, expectedType);
  51008. var type = ref.type;
  51009. var timeout = ref.timeout;
  51010. var propCount = ref.propCount;
  51011. if (!type) { return cb() }
  51012. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51013. var ended = 0;
  51014. var end = function () {
  51015. el.removeEventListener(event, onEnd);
  51016. cb();
  51017. };
  51018. var onEnd = function (e) {
  51019. if (e.target === el) {
  51020. if (++ended >= propCount) {
  51021. end();
  51022. }
  51023. }
  51024. };
  51025. setTimeout(function () {
  51026. if (ended < propCount) {
  51027. end();
  51028. }
  51029. }, timeout + 1);
  51030. el.addEventListener(event, onEnd);
  51031. }
  51032. var transformRE = /\b(transform|all)(,|$)/;
  51033. function getTransitionInfo (el, expectedType) {
  51034. var styles = window.getComputedStyle(el);
  51035. // JSDOM may return undefined for transition properties
  51036. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51037. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51038. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51039. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51040. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51041. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51042. var type;
  51043. var timeout = 0;
  51044. var propCount = 0;
  51045. /* istanbul ignore if */
  51046. if (expectedType === TRANSITION) {
  51047. if (transitionTimeout > 0) {
  51048. type = TRANSITION;
  51049. timeout = transitionTimeout;
  51050. propCount = transitionDurations.length;
  51051. }
  51052. } else if (expectedType === ANIMATION) {
  51053. if (animationTimeout > 0) {
  51054. type = ANIMATION;
  51055. timeout = animationTimeout;
  51056. propCount = animationDurations.length;
  51057. }
  51058. } else {
  51059. timeout = Math.max(transitionTimeout, animationTimeout);
  51060. type = timeout > 0
  51061. ? transitionTimeout > animationTimeout
  51062. ? TRANSITION
  51063. : ANIMATION
  51064. : null;
  51065. propCount = type
  51066. ? type === TRANSITION
  51067. ? transitionDurations.length
  51068. : animationDurations.length
  51069. : 0;
  51070. }
  51071. var hasTransform =
  51072. type === TRANSITION &&
  51073. transformRE.test(styles[transitionProp + 'Property']);
  51074. return {
  51075. type: type,
  51076. timeout: timeout,
  51077. propCount: propCount,
  51078. hasTransform: hasTransform
  51079. }
  51080. }
  51081. function getTimeout (delays, durations) {
  51082. /* istanbul ignore next */
  51083. while (delays.length < durations.length) {
  51084. delays = delays.concat(delays);
  51085. }
  51086. return Math.max.apply(null, durations.map(function (d, i) {
  51087. return toMs(d) + toMs(delays[i])
  51088. }))
  51089. }
  51090. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51091. // in a locale-dependent way, using a comma instead of a dot.
  51092. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51093. // as a floor function) causing unexpected behaviors
  51094. function toMs (s) {
  51095. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51096. }
  51097. /* */
  51098. function enter (vnode, toggleDisplay) {
  51099. var el = vnode.elm;
  51100. // call leave callback now
  51101. if (isDef(el._leaveCb)) {
  51102. el._leaveCb.cancelled = true;
  51103. el._leaveCb();
  51104. }
  51105. var data = resolveTransition(vnode.data.transition);
  51106. if (isUndef(data)) {
  51107. return
  51108. }
  51109. /* istanbul ignore if */
  51110. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51111. return
  51112. }
  51113. var css = data.css;
  51114. var type = data.type;
  51115. var enterClass = data.enterClass;
  51116. var enterToClass = data.enterToClass;
  51117. var enterActiveClass = data.enterActiveClass;
  51118. var appearClass = data.appearClass;
  51119. var appearToClass = data.appearToClass;
  51120. var appearActiveClass = data.appearActiveClass;
  51121. var beforeEnter = data.beforeEnter;
  51122. var enter = data.enter;
  51123. var afterEnter = data.afterEnter;
  51124. var enterCancelled = data.enterCancelled;
  51125. var beforeAppear = data.beforeAppear;
  51126. var appear = data.appear;
  51127. var afterAppear = data.afterAppear;
  51128. var appearCancelled = data.appearCancelled;
  51129. var duration = data.duration;
  51130. // activeInstance will always be the <transition> component managing this
  51131. // transition. One edge case to check is when the <transition> is placed
  51132. // as the root node of a child component. In that case we need to check
  51133. // <transition>'s parent for appear check.
  51134. var context = activeInstance;
  51135. var transitionNode = activeInstance.$vnode;
  51136. while (transitionNode && transitionNode.parent) {
  51137. context = transitionNode.context;
  51138. transitionNode = transitionNode.parent;
  51139. }
  51140. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51141. if (isAppear && !appear && appear !== '') {
  51142. return
  51143. }
  51144. var startClass = isAppear && appearClass
  51145. ? appearClass
  51146. : enterClass;
  51147. var activeClass = isAppear && appearActiveClass
  51148. ? appearActiveClass
  51149. : enterActiveClass;
  51150. var toClass = isAppear && appearToClass
  51151. ? appearToClass
  51152. : enterToClass;
  51153. var beforeEnterHook = isAppear
  51154. ? (beforeAppear || beforeEnter)
  51155. : beforeEnter;
  51156. var enterHook = isAppear
  51157. ? (typeof appear === 'function' ? appear : enter)
  51158. : enter;
  51159. var afterEnterHook = isAppear
  51160. ? (afterAppear || afterEnter)
  51161. : afterEnter;
  51162. var enterCancelledHook = isAppear
  51163. ? (appearCancelled || enterCancelled)
  51164. : enterCancelled;
  51165. var explicitEnterDuration = toNumber(
  51166. isObject(duration)
  51167. ? duration.enter
  51168. : duration
  51169. );
  51170. if (explicitEnterDuration != null) {
  51171. checkDuration(explicitEnterDuration, 'enter', vnode);
  51172. }
  51173. var expectsCSS = css !== false && !isIE9;
  51174. var userWantsControl = getHookArgumentsLength(enterHook);
  51175. var cb = el._enterCb = once(function () {
  51176. if (expectsCSS) {
  51177. removeTransitionClass(el, toClass);
  51178. removeTransitionClass(el, activeClass);
  51179. }
  51180. if (cb.cancelled) {
  51181. if (expectsCSS) {
  51182. removeTransitionClass(el, startClass);
  51183. }
  51184. enterCancelledHook && enterCancelledHook(el);
  51185. } else {
  51186. afterEnterHook && afterEnterHook(el);
  51187. }
  51188. el._enterCb = null;
  51189. });
  51190. if (!vnode.data.show) {
  51191. // remove pending leave element on enter by injecting an insert hook
  51192. mergeVNodeHook(vnode, 'insert', function () {
  51193. var parent = el.parentNode;
  51194. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51195. if (pendingNode &&
  51196. pendingNode.tag === vnode.tag &&
  51197. pendingNode.elm._leaveCb
  51198. ) {
  51199. pendingNode.elm._leaveCb();
  51200. }
  51201. enterHook && enterHook(el, cb);
  51202. });
  51203. }
  51204. // start enter transition
  51205. beforeEnterHook && beforeEnterHook(el);
  51206. if (expectsCSS) {
  51207. addTransitionClass(el, startClass);
  51208. addTransitionClass(el, activeClass);
  51209. nextFrame(function () {
  51210. removeTransitionClass(el, startClass);
  51211. if (!cb.cancelled) {
  51212. addTransitionClass(el, toClass);
  51213. if (!userWantsControl) {
  51214. if (isValidDuration(explicitEnterDuration)) {
  51215. setTimeout(cb, explicitEnterDuration);
  51216. } else {
  51217. whenTransitionEnds(el, type, cb);
  51218. }
  51219. }
  51220. }
  51221. });
  51222. }
  51223. if (vnode.data.show) {
  51224. toggleDisplay && toggleDisplay();
  51225. enterHook && enterHook(el, cb);
  51226. }
  51227. if (!expectsCSS && !userWantsControl) {
  51228. cb();
  51229. }
  51230. }
  51231. function leave (vnode, rm) {
  51232. var el = vnode.elm;
  51233. // call enter callback now
  51234. if (isDef(el._enterCb)) {
  51235. el._enterCb.cancelled = true;
  51236. el._enterCb();
  51237. }
  51238. var data = resolveTransition(vnode.data.transition);
  51239. if (isUndef(data) || el.nodeType !== 1) {
  51240. return rm()
  51241. }
  51242. /* istanbul ignore if */
  51243. if (isDef(el._leaveCb)) {
  51244. return
  51245. }
  51246. var css = data.css;
  51247. var type = data.type;
  51248. var leaveClass = data.leaveClass;
  51249. var leaveToClass = data.leaveToClass;
  51250. var leaveActiveClass = data.leaveActiveClass;
  51251. var beforeLeave = data.beforeLeave;
  51252. var leave = data.leave;
  51253. var afterLeave = data.afterLeave;
  51254. var leaveCancelled = data.leaveCancelled;
  51255. var delayLeave = data.delayLeave;
  51256. var duration = data.duration;
  51257. var expectsCSS = css !== false && !isIE9;
  51258. var userWantsControl = getHookArgumentsLength(leave);
  51259. var explicitLeaveDuration = toNumber(
  51260. isObject(duration)
  51261. ? duration.leave
  51262. : duration
  51263. );
  51264. if (isDef(explicitLeaveDuration)) {
  51265. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51266. }
  51267. var cb = el._leaveCb = once(function () {
  51268. if (el.parentNode && el.parentNode._pending) {
  51269. el.parentNode._pending[vnode.key] = null;
  51270. }
  51271. if (expectsCSS) {
  51272. removeTransitionClass(el, leaveToClass);
  51273. removeTransitionClass(el, leaveActiveClass);
  51274. }
  51275. if (cb.cancelled) {
  51276. if (expectsCSS) {
  51277. removeTransitionClass(el, leaveClass);
  51278. }
  51279. leaveCancelled && leaveCancelled(el);
  51280. } else {
  51281. rm();
  51282. afterLeave && afterLeave(el);
  51283. }
  51284. el._leaveCb = null;
  51285. });
  51286. if (delayLeave) {
  51287. delayLeave(performLeave);
  51288. } else {
  51289. performLeave();
  51290. }
  51291. function performLeave () {
  51292. // the delayed leave may have already been cancelled
  51293. if (cb.cancelled) {
  51294. return
  51295. }
  51296. // record leaving element
  51297. if (!vnode.data.show && el.parentNode) {
  51298. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51299. }
  51300. beforeLeave && beforeLeave(el);
  51301. if (expectsCSS) {
  51302. addTransitionClass(el, leaveClass);
  51303. addTransitionClass(el, leaveActiveClass);
  51304. nextFrame(function () {
  51305. removeTransitionClass(el, leaveClass);
  51306. if (!cb.cancelled) {
  51307. addTransitionClass(el, leaveToClass);
  51308. if (!userWantsControl) {
  51309. if (isValidDuration(explicitLeaveDuration)) {
  51310. setTimeout(cb, explicitLeaveDuration);
  51311. } else {
  51312. whenTransitionEnds(el, type, cb);
  51313. }
  51314. }
  51315. }
  51316. });
  51317. }
  51318. leave && leave(el, cb);
  51319. if (!expectsCSS && !userWantsControl) {
  51320. cb();
  51321. }
  51322. }
  51323. }
  51324. // only used in dev mode
  51325. function checkDuration (val, name, vnode) {
  51326. if (typeof val !== 'number') {
  51327. warn(
  51328. "<transition> explicit " + name + " duration is not a valid number - " +
  51329. "got " + (JSON.stringify(val)) + ".",
  51330. vnode.context
  51331. );
  51332. } else if (isNaN(val)) {
  51333. warn(
  51334. "<transition> explicit " + name + " duration is NaN - " +
  51335. 'the duration expression might be incorrect.',
  51336. vnode.context
  51337. );
  51338. }
  51339. }
  51340. function isValidDuration (val) {
  51341. return typeof val === 'number' && !isNaN(val)
  51342. }
  51343. /**
  51344. * Normalize a transition hook's argument length. The hook may be:
  51345. * - a merged hook (invoker) with the original in .fns
  51346. * - a wrapped component method (check ._length)
  51347. * - a plain function (.length)
  51348. */
  51349. function getHookArgumentsLength (fn) {
  51350. if (isUndef(fn)) {
  51351. return false
  51352. }
  51353. var invokerFns = fn.fns;
  51354. if (isDef(invokerFns)) {
  51355. // invoker
  51356. return getHookArgumentsLength(
  51357. Array.isArray(invokerFns)
  51358. ? invokerFns[0]
  51359. : invokerFns
  51360. )
  51361. } else {
  51362. return (fn._length || fn.length) > 1
  51363. }
  51364. }
  51365. function _enter (_, vnode) {
  51366. if (vnode.data.show !== true) {
  51367. enter(vnode);
  51368. }
  51369. }
  51370. var transition = inBrowser ? {
  51371. create: _enter,
  51372. activate: _enter,
  51373. remove: function remove$$1 (vnode, rm) {
  51374. /* istanbul ignore else */
  51375. if (vnode.data.show !== true) {
  51376. leave(vnode, rm);
  51377. } else {
  51378. rm();
  51379. }
  51380. }
  51381. } : {};
  51382. var platformModules = [
  51383. attrs,
  51384. klass,
  51385. events,
  51386. domProps,
  51387. style,
  51388. transition
  51389. ];
  51390. /* */
  51391. // the directive module should be applied last, after all
  51392. // built-in modules have been applied.
  51393. var modules = platformModules.concat(baseModules);
  51394. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51395. /**
  51396. * Not type checking this file because flow doesn't like attaching
  51397. * properties to Elements.
  51398. */
  51399. /* istanbul ignore if */
  51400. if (isIE9) {
  51401. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51402. document.addEventListener('selectionchange', function () {
  51403. var el = document.activeElement;
  51404. if (el && el.vmodel) {
  51405. trigger(el, 'input');
  51406. }
  51407. });
  51408. }
  51409. var directive = {
  51410. inserted: function inserted (el, binding, vnode, oldVnode) {
  51411. if (vnode.tag === 'select') {
  51412. // #6903
  51413. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51414. mergeVNodeHook(vnode, 'postpatch', function () {
  51415. directive.componentUpdated(el, binding, vnode);
  51416. });
  51417. } else {
  51418. setSelected(el, binding, vnode.context);
  51419. }
  51420. el._vOptions = [].map.call(el.options, getValue);
  51421. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51422. el._vModifiers = binding.modifiers;
  51423. if (!binding.modifiers.lazy) {
  51424. el.addEventListener('compositionstart', onCompositionStart);
  51425. el.addEventListener('compositionend', onCompositionEnd);
  51426. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51427. // switching focus before confirming composition choice
  51428. // this also fixes the issue where some browsers e.g. iOS Chrome
  51429. // fires "change" instead of "input" on autocomplete.
  51430. el.addEventListener('change', onCompositionEnd);
  51431. /* istanbul ignore if */
  51432. if (isIE9) {
  51433. el.vmodel = true;
  51434. }
  51435. }
  51436. }
  51437. },
  51438. componentUpdated: function componentUpdated (el, binding, vnode) {
  51439. if (vnode.tag === 'select') {
  51440. setSelected(el, binding, vnode.context);
  51441. // in case the options rendered by v-for have changed,
  51442. // it's possible that the value is out-of-sync with the rendered options.
  51443. // detect such cases and filter out values that no longer has a matching
  51444. // option in the DOM.
  51445. var prevOptions = el._vOptions;
  51446. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51447. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51448. // trigger change event if
  51449. // no matching option found for at least one value
  51450. var needReset = el.multiple
  51451. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51452. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51453. if (needReset) {
  51454. trigger(el, 'change');
  51455. }
  51456. }
  51457. }
  51458. }
  51459. };
  51460. function setSelected (el, binding, vm) {
  51461. actuallySetSelected(el, binding, vm);
  51462. /* istanbul ignore if */
  51463. if (isIE || isEdge) {
  51464. setTimeout(function () {
  51465. actuallySetSelected(el, binding, vm);
  51466. }, 0);
  51467. }
  51468. }
  51469. function actuallySetSelected (el, binding, vm) {
  51470. var value = binding.value;
  51471. var isMultiple = el.multiple;
  51472. if (isMultiple && !Array.isArray(value)) {
  51473. warn(
  51474. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51475. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51476. vm
  51477. );
  51478. return
  51479. }
  51480. var selected, option;
  51481. for (var i = 0, l = el.options.length; i < l; i++) {
  51482. option = el.options[i];
  51483. if (isMultiple) {
  51484. selected = looseIndexOf(value, getValue(option)) > -1;
  51485. if (option.selected !== selected) {
  51486. option.selected = selected;
  51487. }
  51488. } else {
  51489. if (looseEqual(getValue(option), value)) {
  51490. if (el.selectedIndex !== i) {
  51491. el.selectedIndex = i;
  51492. }
  51493. return
  51494. }
  51495. }
  51496. }
  51497. if (!isMultiple) {
  51498. el.selectedIndex = -1;
  51499. }
  51500. }
  51501. function hasNoMatchingOption (value, options) {
  51502. return options.every(function (o) { return !looseEqual(o, value); })
  51503. }
  51504. function getValue (option) {
  51505. return '_value' in option
  51506. ? option._value
  51507. : option.value
  51508. }
  51509. function onCompositionStart (e) {
  51510. e.target.composing = true;
  51511. }
  51512. function onCompositionEnd (e) {
  51513. // prevent triggering an input event for no reason
  51514. if (!e.target.composing) { return }
  51515. e.target.composing = false;
  51516. trigger(e.target, 'input');
  51517. }
  51518. function trigger (el, type) {
  51519. var e = document.createEvent('HTMLEvents');
  51520. e.initEvent(type, true, true);
  51521. el.dispatchEvent(e);
  51522. }
  51523. /* */
  51524. // recursively search for possible transition defined inside the component root
  51525. function locateNode (vnode) {
  51526. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51527. ? locateNode(vnode.componentInstance._vnode)
  51528. : vnode
  51529. }
  51530. var show = {
  51531. bind: function bind (el, ref, vnode) {
  51532. var value = ref.value;
  51533. vnode = locateNode(vnode);
  51534. var transition$$1 = vnode.data && vnode.data.transition;
  51535. var originalDisplay = el.__vOriginalDisplay =
  51536. el.style.display === 'none' ? '' : el.style.display;
  51537. if (value && transition$$1) {
  51538. vnode.data.show = true;
  51539. enter(vnode, function () {
  51540. el.style.display = originalDisplay;
  51541. });
  51542. } else {
  51543. el.style.display = value ? originalDisplay : 'none';
  51544. }
  51545. },
  51546. update: function update (el, ref, vnode) {
  51547. var value = ref.value;
  51548. var oldValue = ref.oldValue;
  51549. /* istanbul ignore if */
  51550. if (!value === !oldValue) { return }
  51551. vnode = locateNode(vnode);
  51552. var transition$$1 = vnode.data && vnode.data.transition;
  51553. if (transition$$1) {
  51554. vnode.data.show = true;
  51555. if (value) {
  51556. enter(vnode, function () {
  51557. el.style.display = el.__vOriginalDisplay;
  51558. });
  51559. } else {
  51560. leave(vnode, function () {
  51561. el.style.display = 'none';
  51562. });
  51563. }
  51564. } else {
  51565. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51566. }
  51567. },
  51568. unbind: function unbind (
  51569. el,
  51570. binding,
  51571. vnode,
  51572. oldVnode,
  51573. isDestroy
  51574. ) {
  51575. if (!isDestroy) {
  51576. el.style.display = el.__vOriginalDisplay;
  51577. }
  51578. }
  51579. };
  51580. var platformDirectives = {
  51581. model: directive,
  51582. show: show
  51583. };
  51584. /* */
  51585. var transitionProps = {
  51586. name: String,
  51587. appear: Boolean,
  51588. css: Boolean,
  51589. mode: String,
  51590. type: String,
  51591. enterClass: String,
  51592. leaveClass: String,
  51593. enterToClass: String,
  51594. leaveToClass: String,
  51595. enterActiveClass: String,
  51596. leaveActiveClass: String,
  51597. appearClass: String,
  51598. appearActiveClass: String,
  51599. appearToClass: String,
  51600. duration: [Number, String, Object]
  51601. };
  51602. // in case the child is also an abstract component, e.g. <keep-alive>
  51603. // we want to recursively retrieve the real component to be rendered
  51604. function getRealChild (vnode) {
  51605. var compOptions = vnode && vnode.componentOptions;
  51606. if (compOptions && compOptions.Ctor.options.abstract) {
  51607. return getRealChild(getFirstComponentChild(compOptions.children))
  51608. } else {
  51609. return vnode
  51610. }
  51611. }
  51612. function extractTransitionData (comp) {
  51613. var data = {};
  51614. var options = comp.$options;
  51615. // props
  51616. for (var key in options.propsData) {
  51617. data[key] = comp[key];
  51618. }
  51619. // events.
  51620. // extract listeners and pass them directly to the transition methods
  51621. var listeners = options._parentListeners;
  51622. for (var key$1 in listeners) {
  51623. data[camelize(key$1)] = listeners[key$1];
  51624. }
  51625. return data
  51626. }
  51627. function placeholder (h, rawChild) {
  51628. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51629. return h('keep-alive', {
  51630. props: rawChild.componentOptions.propsData
  51631. })
  51632. }
  51633. }
  51634. function hasParentTransition (vnode) {
  51635. while ((vnode = vnode.parent)) {
  51636. if (vnode.data.transition) {
  51637. return true
  51638. }
  51639. }
  51640. }
  51641. function isSameChild (child, oldChild) {
  51642. return oldChild.key === child.key && oldChild.tag === child.tag
  51643. }
  51644. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51645. var isVShowDirective = function (d) { return d.name === 'show'; };
  51646. var Transition = {
  51647. name: 'transition',
  51648. props: transitionProps,
  51649. abstract: true,
  51650. render: function render (h) {
  51651. var this$1 = this;
  51652. var children = this.$slots.default;
  51653. if (!children) {
  51654. return
  51655. }
  51656. // filter out text nodes (possible whitespaces)
  51657. children = children.filter(isNotTextNode);
  51658. /* istanbul ignore if */
  51659. if (!children.length) {
  51660. return
  51661. }
  51662. // warn multiple elements
  51663. if (children.length > 1) {
  51664. warn(
  51665. '<transition> can only be used on a single element. Use ' +
  51666. '<transition-group> for lists.',
  51667. this.$parent
  51668. );
  51669. }
  51670. var mode = this.mode;
  51671. // warn invalid mode
  51672. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51673. ) {
  51674. warn(
  51675. 'invalid <transition> mode: ' + mode,
  51676. this.$parent
  51677. );
  51678. }
  51679. var rawChild = children[0];
  51680. // if this is a component root node and the component's
  51681. // parent container node also has transition, skip.
  51682. if (hasParentTransition(this.$vnode)) {
  51683. return rawChild
  51684. }
  51685. // apply transition data to child
  51686. // use getRealChild() to ignore abstract components e.g. keep-alive
  51687. var child = getRealChild(rawChild);
  51688. /* istanbul ignore if */
  51689. if (!child) {
  51690. return rawChild
  51691. }
  51692. if (this._leaving) {
  51693. return placeholder(h, rawChild)
  51694. }
  51695. // ensure a key that is unique to the vnode type and to this transition
  51696. // component instance. This key will be used to remove pending leaving nodes
  51697. // during entering.
  51698. var id = "__transition-" + (this._uid) + "-";
  51699. child.key = child.key == null
  51700. ? child.isComment
  51701. ? id + 'comment'
  51702. : id + child.tag
  51703. : isPrimitive(child.key)
  51704. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51705. : child.key;
  51706. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51707. var oldRawChild = this._vnode;
  51708. var oldChild = getRealChild(oldRawChild);
  51709. // mark v-show
  51710. // so that the transition module can hand over the control to the directive
  51711. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51712. child.data.show = true;
  51713. }
  51714. if (
  51715. oldChild &&
  51716. oldChild.data &&
  51717. !isSameChild(child, oldChild) &&
  51718. !isAsyncPlaceholder(oldChild) &&
  51719. // #6687 component root is a comment node
  51720. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51721. ) {
  51722. // replace old child transition data with fresh one
  51723. // important for dynamic transitions!
  51724. var oldData = oldChild.data.transition = extend({}, data);
  51725. // handle transition mode
  51726. if (mode === 'out-in') {
  51727. // return placeholder node and queue update when leave finishes
  51728. this._leaving = true;
  51729. mergeVNodeHook(oldData, 'afterLeave', function () {
  51730. this$1._leaving = false;
  51731. this$1.$forceUpdate();
  51732. });
  51733. return placeholder(h, rawChild)
  51734. } else if (mode === 'in-out') {
  51735. if (isAsyncPlaceholder(child)) {
  51736. return oldRawChild
  51737. }
  51738. var delayedLeave;
  51739. var performLeave = function () { delayedLeave(); };
  51740. mergeVNodeHook(data, 'afterEnter', performLeave);
  51741. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51742. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51743. }
  51744. }
  51745. return rawChild
  51746. }
  51747. };
  51748. /* */
  51749. var props = extend({
  51750. tag: String,
  51751. moveClass: String
  51752. }, transitionProps);
  51753. delete props.mode;
  51754. var TransitionGroup = {
  51755. props: props,
  51756. beforeMount: function beforeMount () {
  51757. var this$1 = this;
  51758. var update = this._update;
  51759. this._update = function (vnode, hydrating) {
  51760. var restoreActiveInstance = setActiveInstance(this$1);
  51761. // force removing pass
  51762. this$1.__patch__(
  51763. this$1._vnode,
  51764. this$1.kept,
  51765. false, // hydrating
  51766. true // removeOnly (!important, avoids unnecessary moves)
  51767. );
  51768. this$1._vnode = this$1.kept;
  51769. restoreActiveInstance();
  51770. update.call(this$1, vnode, hydrating);
  51771. };
  51772. },
  51773. render: function render (h) {
  51774. var tag = this.tag || this.$vnode.data.tag || 'span';
  51775. var map = Object.create(null);
  51776. var prevChildren = this.prevChildren = this.children;
  51777. var rawChildren = this.$slots.default || [];
  51778. var children = this.children = [];
  51779. var transitionData = extractTransitionData(this);
  51780. for (var i = 0; i < rawChildren.length; i++) {
  51781. var c = rawChildren[i];
  51782. if (c.tag) {
  51783. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  51784. children.push(c);
  51785. map[c.key] = c
  51786. ;(c.data || (c.data = {})).transition = transitionData;
  51787. } else {
  51788. var opts = c.componentOptions;
  51789. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  51790. warn(("<transition-group> children must be keyed: <" + name + ">"));
  51791. }
  51792. }
  51793. }
  51794. if (prevChildren) {
  51795. var kept = [];
  51796. var removed = [];
  51797. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  51798. var c$1 = prevChildren[i$1];
  51799. c$1.data.transition = transitionData;
  51800. c$1.data.pos = c$1.elm.getBoundingClientRect();
  51801. if (map[c$1.key]) {
  51802. kept.push(c$1);
  51803. } else {
  51804. removed.push(c$1);
  51805. }
  51806. }
  51807. this.kept = h(tag, null, kept);
  51808. this.removed = removed;
  51809. }
  51810. return h(tag, null, children)
  51811. },
  51812. updated: function updated () {
  51813. var children = this.prevChildren;
  51814. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  51815. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  51816. return
  51817. }
  51818. // we divide the work into three loops to avoid mixing DOM reads and writes
  51819. // in each iteration - which helps prevent layout thrashing.
  51820. children.forEach(callPendingCbs);
  51821. children.forEach(recordPosition);
  51822. children.forEach(applyTranslation);
  51823. // force reflow to put everything in position
  51824. // assign to this to avoid being removed in tree-shaking
  51825. // $flow-disable-line
  51826. this._reflow = document.body.offsetHeight;
  51827. children.forEach(function (c) {
  51828. if (c.data.moved) {
  51829. var el = c.elm;
  51830. var s = el.style;
  51831. addTransitionClass(el, moveClass);
  51832. s.transform = s.WebkitTransform = s.transitionDuration = '';
  51833. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  51834. if (e && e.target !== el) {
  51835. return
  51836. }
  51837. if (!e || /transform$/.test(e.propertyName)) {
  51838. el.removeEventListener(transitionEndEvent, cb);
  51839. el._moveCb = null;
  51840. removeTransitionClass(el, moveClass);
  51841. }
  51842. });
  51843. }
  51844. });
  51845. },
  51846. methods: {
  51847. hasMove: function hasMove (el, moveClass) {
  51848. /* istanbul ignore if */
  51849. if (!hasTransition) {
  51850. return false
  51851. }
  51852. /* istanbul ignore if */
  51853. if (this._hasMove) {
  51854. return this._hasMove
  51855. }
  51856. // Detect whether an element with the move class applied has
  51857. // CSS transitions. Since the element may be inside an entering
  51858. // transition at this very moment, we make a clone of it and remove
  51859. // all other transition classes applied to ensure only the move class
  51860. // is applied.
  51861. var clone = el.cloneNode();
  51862. if (el._transitionClasses) {
  51863. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  51864. }
  51865. addClass(clone, moveClass);
  51866. clone.style.display = 'none';
  51867. this.$el.appendChild(clone);
  51868. var info = getTransitionInfo(clone);
  51869. this.$el.removeChild(clone);
  51870. return (this._hasMove = info.hasTransform)
  51871. }
  51872. }
  51873. };
  51874. function callPendingCbs (c) {
  51875. /* istanbul ignore if */
  51876. if (c.elm._moveCb) {
  51877. c.elm._moveCb();
  51878. }
  51879. /* istanbul ignore if */
  51880. if (c.elm._enterCb) {
  51881. c.elm._enterCb();
  51882. }
  51883. }
  51884. function recordPosition (c) {
  51885. c.data.newPos = c.elm.getBoundingClientRect();
  51886. }
  51887. function applyTranslation (c) {
  51888. var oldPos = c.data.pos;
  51889. var newPos = c.data.newPos;
  51890. var dx = oldPos.left - newPos.left;
  51891. var dy = oldPos.top - newPos.top;
  51892. if (dx || dy) {
  51893. c.data.moved = true;
  51894. var s = c.elm.style;
  51895. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  51896. s.transitionDuration = '0s';
  51897. }
  51898. }
  51899. var platformComponents = {
  51900. Transition: Transition,
  51901. TransitionGroup: TransitionGroup
  51902. };
  51903. /* */
  51904. // install platform specific utils
  51905. Vue.config.mustUseProp = mustUseProp;
  51906. Vue.config.isReservedTag = isReservedTag;
  51907. Vue.config.isReservedAttr = isReservedAttr;
  51908. Vue.config.getTagNamespace = getTagNamespace;
  51909. Vue.config.isUnknownElement = isUnknownElement;
  51910. // install platform runtime directives & components
  51911. extend(Vue.options.directives, platformDirectives);
  51912. extend(Vue.options.components, platformComponents);
  51913. // install platform patch function
  51914. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  51915. // public mount method
  51916. Vue.prototype.$mount = function (
  51917. el,
  51918. hydrating
  51919. ) {
  51920. el = el && inBrowser ? query(el) : undefined;
  51921. return mountComponent(this, el, hydrating)
  51922. };
  51923. // devtools global hook
  51924. /* istanbul ignore next */
  51925. if (inBrowser) {
  51926. setTimeout(function () {
  51927. if (config.devtools) {
  51928. if (devtools) {
  51929. devtools.emit('init', Vue);
  51930. } else {
  51931. console[console.info ? 'info' : 'log'](
  51932. 'Download the Vue Devtools extension for a better development experience:\n' +
  51933. 'https://github.com/vuejs/vue-devtools'
  51934. );
  51935. }
  51936. }
  51937. if (config.productionTip !== false &&
  51938. typeof console !== 'undefined'
  51939. ) {
  51940. console[console.info ? 'info' : 'log'](
  51941. "You are running Vue in development mode.\n" +
  51942. "Make sure to turn on production mode when deploying for production.\n" +
  51943. "See more tips at https://vuejs.org/guide/deployment.html"
  51944. );
  51945. }
  51946. }, 0);
  51947. }
  51948. /* */
  51949. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51950. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51951. var buildRegex = cached(function (delimiters) {
  51952. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51953. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51954. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51955. });
  51956. function parseText (
  51957. text,
  51958. delimiters
  51959. ) {
  51960. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51961. if (!tagRE.test(text)) {
  51962. return
  51963. }
  51964. var tokens = [];
  51965. var rawTokens = [];
  51966. var lastIndex = tagRE.lastIndex = 0;
  51967. var match, index, tokenValue;
  51968. while ((match = tagRE.exec(text))) {
  51969. index = match.index;
  51970. // push text token
  51971. if (index > lastIndex) {
  51972. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51973. tokens.push(JSON.stringify(tokenValue));
  51974. }
  51975. // tag token
  51976. var exp = parseFilters(match[1].trim());
  51977. tokens.push(("_s(" + exp + ")"));
  51978. rawTokens.push({ '@binding': exp });
  51979. lastIndex = index + match[0].length;
  51980. }
  51981. if (lastIndex < text.length) {
  51982. rawTokens.push(tokenValue = text.slice(lastIndex));
  51983. tokens.push(JSON.stringify(tokenValue));
  51984. }
  51985. return {
  51986. expression: tokens.join('+'),
  51987. tokens: rawTokens
  51988. }
  51989. }
  51990. /* */
  51991. function transformNode (el, options) {
  51992. var warn = options.warn || baseWarn;
  51993. var staticClass = getAndRemoveAttr(el, 'class');
  51994. if (staticClass) {
  51995. var res = parseText(staticClass, options.delimiters);
  51996. if (res) {
  51997. warn(
  51998. "class=\"" + staticClass + "\": " +
  51999. 'Interpolation inside attributes has been removed. ' +
  52000. 'Use v-bind or the colon shorthand instead. For example, ' +
  52001. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52002. el.rawAttrsMap['class']
  52003. );
  52004. }
  52005. }
  52006. if (staticClass) {
  52007. el.staticClass = JSON.stringify(staticClass);
  52008. }
  52009. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52010. if (classBinding) {
  52011. el.classBinding = classBinding;
  52012. }
  52013. }
  52014. function genData (el) {
  52015. var data = '';
  52016. if (el.staticClass) {
  52017. data += "staticClass:" + (el.staticClass) + ",";
  52018. }
  52019. if (el.classBinding) {
  52020. data += "class:" + (el.classBinding) + ",";
  52021. }
  52022. return data
  52023. }
  52024. var klass$1 = {
  52025. staticKeys: ['staticClass'],
  52026. transformNode: transformNode,
  52027. genData: genData
  52028. };
  52029. /* */
  52030. function transformNode$1 (el, options) {
  52031. var warn = options.warn || baseWarn;
  52032. var staticStyle = getAndRemoveAttr(el, 'style');
  52033. if (staticStyle) {
  52034. /* istanbul ignore if */
  52035. {
  52036. var res = parseText(staticStyle, options.delimiters);
  52037. if (res) {
  52038. warn(
  52039. "style=\"" + staticStyle + "\": " +
  52040. 'Interpolation inside attributes has been removed. ' +
  52041. 'Use v-bind or the colon shorthand instead. For example, ' +
  52042. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52043. el.rawAttrsMap['style']
  52044. );
  52045. }
  52046. }
  52047. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52048. }
  52049. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52050. if (styleBinding) {
  52051. el.styleBinding = styleBinding;
  52052. }
  52053. }
  52054. function genData$1 (el) {
  52055. var data = '';
  52056. if (el.staticStyle) {
  52057. data += "staticStyle:" + (el.staticStyle) + ",";
  52058. }
  52059. if (el.styleBinding) {
  52060. data += "style:(" + (el.styleBinding) + "),";
  52061. }
  52062. return data
  52063. }
  52064. var style$1 = {
  52065. staticKeys: ['staticStyle'],
  52066. transformNode: transformNode$1,
  52067. genData: genData$1
  52068. };
  52069. /* */
  52070. var decoder;
  52071. var he = {
  52072. decode: function decode (html) {
  52073. decoder = decoder || document.createElement('div');
  52074. decoder.innerHTML = html;
  52075. return decoder.textContent
  52076. }
  52077. };
  52078. /* */
  52079. var isUnaryTag = makeMap(
  52080. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52081. 'link,meta,param,source,track,wbr'
  52082. );
  52083. // Elements that you can, intentionally, leave open
  52084. // (and which close themselves)
  52085. var canBeLeftOpenTag = makeMap(
  52086. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52087. );
  52088. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52089. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52090. var isNonPhrasingTag = makeMap(
  52091. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52092. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52093. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52094. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52095. 'title,tr,track'
  52096. );
  52097. /**
  52098. * Not type-checking this file because it's mostly vendor code.
  52099. */
  52100. // Regular Expressions for parsing tags and attributes
  52101. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52102. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52103. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52104. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52105. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52106. var startTagClose = /^\s*(\/?)>/;
  52107. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52108. var doctype = /^<!DOCTYPE [^>]+>/i;
  52109. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52110. var comment = /^<!\--/;
  52111. var conditionalComment = /^<!\[/;
  52112. // Special Elements (can contain anything)
  52113. var isPlainTextElement = makeMap('script,style,textarea', true);
  52114. var reCache = {};
  52115. var decodingMap = {
  52116. '&lt;': '<',
  52117. '&gt;': '>',
  52118. '&quot;': '"',
  52119. '&amp;': '&',
  52120. '&#10;': '\n',
  52121. '&#9;': '\t',
  52122. '&#39;': "'"
  52123. };
  52124. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52125. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52126. // #5992
  52127. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52128. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52129. function decodeAttr (value, shouldDecodeNewlines) {
  52130. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52131. return value.replace(re, function (match) { return decodingMap[match]; })
  52132. }
  52133. function parseHTML (html, options) {
  52134. var stack = [];
  52135. var expectHTML = options.expectHTML;
  52136. var isUnaryTag$$1 = options.isUnaryTag || no;
  52137. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52138. var index = 0;
  52139. var last, lastTag;
  52140. while (html) {
  52141. last = html;
  52142. // Make sure we're not in a plaintext content element like script/style
  52143. if (!lastTag || !isPlainTextElement(lastTag)) {
  52144. var textEnd = html.indexOf('<');
  52145. if (textEnd === 0) {
  52146. // Comment:
  52147. if (comment.test(html)) {
  52148. var commentEnd = html.indexOf('-->');
  52149. if (commentEnd >= 0) {
  52150. if (options.shouldKeepComment) {
  52151. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52152. }
  52153. advance(commentEnd + 3);
  52154. continue
  52155. }
  52156. }
  52157. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52158. if (conditionalComment.test(html)) {
  52159. var conditionalEnd = html.indexOf(']>');
  52160. if (conditionalEnd >= 0) {
  52161. advance(conditionalEnd + 2);
  52162. continue
  52163. }
  52164. }
  52165. // Doctype:
  52166. var doctypeMatch = html.match(doctype);
  52167. if (doctypeMatch) {
  52168. advance(doctypeMatch[0].length);
  52169. continue
  52170. }
  52171. // End tag:
  52172. var endTagMatch = html.match(endTag);
  52173. if (endTagMatch) {
  52174. var curIndex = index;
  52175. advance(endTagMatch[0].length);
  52176. parseEndTag(endTagMatch[1], curIndex, index);
  52177. continue
  52178. }
  52179. // Start tag:
  52180. var startTagMatch = parseStartTag();
  52181. if (startTagMatch) {
  52182. handleStartTag(startTagMatch);
  52183. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52184. advance(1);
  52185. }
  52186. continue
  52187. }
  52188. }
  52189. var text = (void 0), rest = (void 0), next = (void 0);
  52190. if (textEnd >= 0) {
  52191. rest = html.slice(textEnd);
  52192. while (
  52193. !endTag.test(rest) &&
  52194. !startTagOpen.test(rest) &&
  52195. !comment.test(rest) &&
  52196. !conditionalComment.test(rest)
  52197. ) {
  52198. // < in plain text, be forgiving and treat it as text
  52199. next = rest.indexOf('<', 1);
  52200. if (next < 0) { break }
  52201. textEnd += next;
  52202. rest = html.slice(textEnd);
  52203. }
  52204. text = html.substring(0, textEnd);
  52205. }
  52206. if (textEnd < 0) {
  52207. text = html;
  52208. }
  52209. if (text) {
  52210. advance(text.length);
  52211. }
  52212. if (options.chars && text) {
  52213. options.chars(text, index - text.length, index);
  52214. }
  52215. } else {
  52216. var endTagLength = 0;
  52217. var stackedTag = lastTag.toLowerCase();
  52218. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52219. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52220. endTagLength = endTag.length;
  52221. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52222. text = text
  52223. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52224. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52225. }
  52226. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52227. text = text.slice(1);
  52228. }
  52229. if (options.chars) {
  52230. options.chars(text);
  52231. }
  52232. return ''
  52233. });
  52234. index += html.length - rest$1.length;
  52235. html = rest$1;
  52236. parseEndTag(stackedTag, index - endTagLength, index);
  52237. }
  52238. if (html === last) {
  52239. options.chars && options.chars(html);
  52240. if (!stack.length && options.warn) {
  52241. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52242. }
  52243. break
  52244. }
  52245. }
  52246. // Clean up any remaining tags
  52247. parseEndTag();
  52248. function advance (n) {
  52249. index += n;
  52250. html = html.substring(n);
  52251. }
  52252. function parseStartTag () {
  52253. var start = html.match(startTagOpen);
  52254. if (start) {
  52255. var match = {
  52256. tagName: start[1],
  52257. attrs: [],
  52258. start: index
  52259. };
  52260. advance(start[0].length);
  52261. var end, attr;
  52262. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52263. attr.start = index;
  52264. advance(attr[0].length);
  52265. attr.end = index;
  52266. match.attrs.push(attr);
  52267. }
  52268. if (end) {
  52269. match.unarySlash = end[1];
  52270. advance(end[0].length);
  52271. match.end = index;
  52272. return match
  52273. }
  52274. }
  52275. }
  52276. function handleStartTag (match) {
  52277. var tagName = match.tagName;
  52278. var unarySlash = match.unarySlash;
  52279. if (expectHTML) {
  52280. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52281. parseEndTag(lastTag);
  52282. }
  52283. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52284. parseEndTag(tagName);
  52285. }
  52286. }
  52287. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52288. var l = match.attrs.length;
  52289. var attrs = new Array(l);
  52290. for (var i = 0; i < l; i++) {
  52291. var args = match.attrs[i];
  52292. var value = args[3] || args[4] || args[5] || '';
  52293. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52294. ? options.shouldDecodeNewlinesForHref
  52295. : options.shouldDecodeNewlines;
  52296. attrs[i] = {
  52297. name: args[1],
  52298. value: decodeAttr(value, shouldDecodeNewlines)
  52299. };
  52300. if (options.outputSourceRange) {
  52301. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52302. attrs[i].end = args.end;
  52303. }
  52304. }
  52305. if (!unary) {
  52306. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52307. lastTag = tagName;
  52308. }
  52309. if (options.start) {
  52310. options.start(tagName, attrs, unary, match.start, match.end);
  52311. }
  52312. }
  52313. function parseEndTag (tagName, start, end) {
  52314. var pos, lowerCasedTagName;
  52315. if (start == null) { start = index; }
  52316. if (end == null) { end = index; }
  52317. // Find the closest opened tag of the same type
  52318. if (tagName) {
  52319. lowerCasedTagName = tagName.toLowerCase();
  52320. for (pos = stack.length - 1; pos >= 0; pos--) {
  52321. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52322. break
  52323. }
  52324. }
  52325. } else {
  52326. // If no tag name is provided, clean shop
  52327. pos = 0;
  52328. }
  52329. if (pos >= 0) {
  52330. // Close all the open elements, up the stack
  52331. for (var i = stack.length - 1; i >= pos; i--) {
  52332. if (i > pos || !tagName &&
  52333. options.warn
  52334. ) {
  52335. options.warn(
  52336. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52337. { start: stack[i].start, end: stack[i].end }
  52338. );
  52339. }
  52340. if (options.end) {
  52341. options.end(stack[i].tag, start, end);
  52342. }
  52343. }
  52344. // Remove the open elements from the stack
  52345. stack.length = pos;
  52346. lastTag = pos && stack[pos - 1].tag;
  52347. } else if (lowerCasedTagName === 'br') {
  52348. if (options.start) {
  52349. options.start(tagName, [], true, start, end);
  52350. }
  52351. } else if (lowerCasedTagName === 'p') {
  52352. if (options.start) {
  52353. options.start(tagName, [], false, start, end);
  52354. }
  52355. if (options.end) {
  52356. options.end(tagName, start, end);
  52357. }
  52358. }
  52359. }
  52360. }
  52361. /* */
  52362. var onRE = /^@|^v-on:/;
  52363. var dirRE = /^v-|^@|^:|^#/;
  52364. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52365. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52366. var stripParensRE = /^\(|\)$/g;
  52367. var dynamicArgRE = /^\[.*\]$/;
  52368. var argRE = /:(.*)$/;
  52369. var bindRE = /^:|^\.|^v-bind:/;
  52370. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52371. var slotRE = /^v-slot(:|$)|^#/;
  52372. var lineBreakRE = /[\r\n]/;
  52373. var whitespaceRE$1 = /\s+/g;
  52374. var invalidAttributeRE = /[\s"'<>\/=]/;
  52375. var decodeHTMLCached = cached(he.decode);
  52376. var emptySlotScopeToken = "_empty_";
  52377. // configurable state
  52378. var warn$2;
  52379. var delimiters;
  52380. var transforms;
  52381. var preTransforms;
  52382. var postTransforms;
  52383. var platformIsPreTag;
  52384. var platformMustUseProp;
  52385. var platformGetTagNamespace;
  52386. var maybeComponent;
  52387. function createASTElement (
  52388. tag,
  52389. attrs,
  52390. parent
  52391. ) {
  52392. return {
  52393. type: 1,
  52394. tag: tag,
  52395. attrsList: attrs,
  52396. attrsMap: makeAttrsMap(attrs),
  52397. rawAttrsMap: {},
  52398. parent: parent,
  52399. children: []
  52400. }
  52401. }
  52402. /**
  52403. * Convert HTML string to AST.
  52404. */
  52405. function parse (
  52406. template,
  52407. options
  52408. ) {
  52409. warn$2 = options.warn || baseWarn;
  52410. platformIsPreTag = options.isPreTag || no;
  52411. platformMustUseProp = options.mustUseProp || no;
  52412. platformGetTagNamespace = options.getTagNamespace || no;
  52413. var isReservedTag = options.isReservedTag || no;
  52414. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52415. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52416. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52417. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52418. delimiters = options.delimiters;
  52419. var stack = [];
  52420. var preserveWhitespace = options.preserveWhitespace !== false;
  52421. var whitespaceOption = options.whitespace;
  52422. var root;
  52423. var currentParent;
  52424. var inVPre = false;
  52425. var inPre = false;
  52426. var warned = false;
  52427. function warnOnce (msg, range) {
  52428. if (!warned) {
  52429. warned = true;
  52430. warn$2(msg, range);
  52431. }
  52432. }
  52433. function closeElement (element) {
  52434. trimEndingWhitespace(element);
  52435. if (!inVPre && !element.processed) {
  52436. element = processElement(element, options);
  52437. }
  52438. // tree management
  52439. if (!stack.length && element !== root) {
  52440. // allow root elements with v-if, v-else-if and v-else
  52441. if (root.if && (element.elseif || element.else)) {
  52442. {
  52443. checkRootConstraints(element);
  52444. }
  52445. addIfCondition(root, {
  52446. exp: element.elseif,
  52447. block: element
  52448. });
  52449. } else {
  52450. warnOnce(
  52451. "Component template should contain exactly one root element. " +
  52452. "If you are using v-if on multiple elements, " +
  52453. "use v-else-if to chain them instead.",
  52454. { start: element.start }
  52455. );
  52456. }
  52457. }
  52458. if (currentParent && !element.forbidden) {
  52459. if (element.elseif || element.else) {
  52460. processIfConditions(element, currentParent);
  52461. } else {
  52462. if (element.slotScope) {
  52463. // scoped slot
  52464. // keep it in the children list so that v-else(-if) conditions can
  52465. // find it as the prev node.
  52466. var name = element.slotTarget || '"default"'
  52467. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52468. }
  52469. currentParent.children.push(element);
  52470. element.parent = currentParent;
  52471. }
  52472. }
  52473. // final children cleanup
  52474. // filter out scoped slots
  52475. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52476. // remove trailing whitespace node again
  52477. trimEndingWhitespace(element);
  52478. // check pre state
  52479. if (element.pre) {
  52480. inVPre = false;
  52481. }
  52482. if (platformIsPreTag(element.tag)) {
  52483. inPre = false;
  52484. }
  52485. // apply post-transforms
  52486. for (var i = 0; i < postTransforms.length; i++) {
  52487. postTransforms[i](element, options);
  52488. }
  52489. }
  52490. function trimEndingWhitespace (el) {
  52491. // remove trailing whitespace node
  52492. if (!inPre) {
  52493. var lastNode;
  52494. while (
  52495. (lastNode = el.children[el.children.length - 1]) &&
  52496. lastNode.type === 3 &&
  52497. lastNode.text === ' '
  52498. ) {
  52499. el.children.pop();
  52500. }
  52501. }
  52502. }
  52503. function checkRootConstraints (el) {
  52504. if (el.tag === 'slot' || el.tag === 'template') {
  52505. warnOnce(
  52506. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52507. 'contain multiple nodes.',
  52508. { start: el.start }
  52509. );
  52510. }
  52511. if (el.attrsMap.hasOwnProperty('v-for')) {
  52512. warnOnce(
  52513. 'Cannot use v-for on stateful component root element because ' +
  52514. 'it renders multiple elements.',
  52515. el.rawAttrsMap['v-for']
  52516. );
  52517. }
  52518. }
  52519. parseHTML(template, {
  52520. warn: warn$2,
  52521. expectHTML: options.expectHTML,
  52522. isUnaryTag: options.isUnaryTag,
  52523. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52524. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52525. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52526. shouldKeepComment: options.comments,
  52527. outputSourceRange: options.outputSourceRange,
  52528. start: function start (tag, attrs, unary, start$1, end) {
  52529. // check namespace.
  52530. // inherit parent ns if there is one
  52531. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52532. // handle IE svg bug
  52533. /* istanbul ignore if */
  52534. if (isIE && ns === 'svg') {
  52535. attrs = guardIESVGBug(attrs);
  52536. }
  52537. var element = createASTElement(tag, attrs, currentParent);
  52538. if (ns) {
  52539. element.ns = ns;
  52540. }
  52541. {
  52542. if (options.outputSourceRange) {
  52543. element.start = start$1;
  52544. element.end = end;
  52545. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52546. cumulated[attr.name] = attr;
  52547. return cumulated
  52548. }, {});
  52549. }
  52550. attrs.forEach(function (attr) {
  52551. if (invalidAttributeRE.test(attr.name)) {
  52552. warn$2(
  52553. "Invalid dynamic argument expression: attribute names cannot contain " +
  52554. "spaces, quotes, <, >, / or =.",
  52555. {
  52556. start: attr.start + attr.name.indexOf("["),
  52557. end: attr.start + attr.name.length
  52558. }
  52559. );
  52560. }
  52561. });
  52562. }
  52563. if (isForbiddenTag(element) && !isServerRendering()) {
  52564. element.forbidden = true;
  52565. warn$2(
  52566. 'Templates should only be responsible for mapping the state to the ' +
  52567. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52568. "<" + tag + ">" + ', as they will not be parsed.',
  52569. { start: element.start }
  52570. );
  52571. }
  52572. // apply pre-transforms
  52573. for (var i = 0; i < preTransforms.length; i++) {
  52574. element = preTransforms[i](element, options) || element;
  52575. }
  52576. if (!inVPre) {
  52577. processPre(element);
  52578. if (element.pre) {
  52579. inVPre = true;
  52580. }
  52581. }
  52582. if (platformIsPreTag(element.tag)) {
  52583. inPre = true;
  52584. }
  52585. if (inVPre) {
  52586. processRawAttrs(element);
  52587. } else if (!element.processed) {
  52588. // structural directives
  52589. processFor(element);
  52590. processIf(element);
  52591. processOnce(element);
  52592. }
  52593. if (!root) {
  52594. root = element;
  52595. {
  52596. checkRootConstraints(root);
  52597. }
  52598. }
  52599. if (!unary) {
  52600. currentParent = element;
  52601. stack.push(element);
  52602. } else {
  52603. closeElement(element);
  52604. }
  52605. },
  52606. end: function end (tag, start, end$1) {
  52607. var element = stack[stack.length - 1];
  52608. // pop stack
  52609. stack.length -= 1;
  52610. currentParent = stack[stack.length - 1];
  52611. if (options.outputSourceRange) {
  52612. element.end = end$1;
  52613. }
  52614. closeElement(element);
  52615. },
  52616. chars: function chars (text, start, end) {
  52617. if (!currentParent) {
  52618. {
  52619. if (text === template) {
  52620. warnOnce(
  52621. 'Component template requires a root element, rather than just text.',
  52622. { start: start }
  52623. );
  52624. } else if ((text = text.trim())) {
  52625. warnOnce(
  52626. ("text \"" + text + "\" outside root element will be ignored."),
  52627. { start: start }
  52628. );
  52629. }
  52630. }
  52631. return
  52632. }
  52633. // IE textarea placeholder bug
  52634. /* istanbul ignore if */
  52635. if (isIE &&
  52636. currentParent.tag === 'textarea' &&
  52637. currentParent.attrsMap.placeholder === text
  52638. ) {
  52639. return
  52640. }
  52641. var children = currentParent.children;
  52642. if (inPre || text.trim()) {
  52643. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52644. } else if (!children.length) {
  52645. // remove the whitespace-only node right after an opening tag
  52646. text = '';
  52647. } else if (whitespaceOption) {
  52648. if (whitespaceOption === 'condense') {
  52649. // in condense mode, remove the whitespace node if it contains
  52650. // line break, otherwise condense to a single space
  52651. text = lineBreakRE.test(text) ? '' : ' ';
  52652. } else {
  52653. text = ' ';
  52654. }
  52655. } else {
  52656. text = preserveWhitespace ? ' ' : '';
  52657. }
  52658. if (text) {
  52659. if (!inPre && whitespaceOption === 'condense') {
  52660. // condense consecutive whitespaces into single space
  52661. text = text.replace(whitespaceRE$1, ' ');
  52662. }
  52663. var res;
  52664. var child;
  52665. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52666. child = {
  52667. type: 2,
  52668. expression: res.expression,
  52669. tokens: res.tokens,
  52670. text: text
  52671. };
  52672. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52673. child = {
  52674. type: 3,
  52675. text: text
  52676. };
  52677. }
  52678. if (child) {
  52679. if (options.outputSourceRange) {
  52680. child.start = start;
  52681. child.end = end;
  52682. }
  52683. children.push(child);
  52684. }
  52685. }
  52686. },
  52687. comment: function comment (text, start, end) {
  52688. // adding anyting as a sibling to the root node is forbidden
  52689. // comments should still be allowed, but ignored
  52690. if (currentParent) {
  52691. var child = {
  52692. type: 3,
  52693. text: text,
  52694. isComment: true
  52695. };
  52696. if (options.outputSourceRange) {
  52697. child.start = start;
  52698. child.end = end;
  52699. }
  52700. currentParent.children.push(child);
  52701. }
  52702. }
  52703. });
  52704. return root
  52705. }
  52706. function processPre (el) {
  52707. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52708. el.pre = true;
  52709. }
  52710. }
  52711. function processRawAttrs (el) {
  52712. var list = el.attrsList;
  52713. var len = list.length;
  52714. if (len) {
  52715. var attrs = el.attrs = new Array(len);
  52716. for (var i = 0; i < len; i++) {
  52717. attrs[i] = {
  52718. name: list[i].name,
  52719. value: JSON.stringify(list[i].value)
  52720. };
  52721. if (list[i].start != null) {
  52722. attrs[i].start = list[i].start;
  52723. attrs[i].end = list[i].end;
  52724. }
  52725. }
  52726. } else if (!el.pre) {
  52727. // non root node in pre blocks with no attributes
  52728. el.plain = true;
  52729. }
  52730. }
  52731. function processElement (
  52732. element,
  52733. options
  52734. ) {
  52735. processKey(element);
  52736. // determine whether this is a plain element after
  52737. // removing structural attributes
  52738. element.plain = (
  52739. !element.key &&
  52740. !element.scopedSlots &&
  52741. !element.attrsList.length
  52742. );
  52743. processRef(element);
  52744. processSlotContent(element);
  52745. processSlotOutlet(element);
  52746. processComponent(element);
  52747. for (var i = 0; i < transforms.length; i++) {
  52748. element = transforms[i](element, options) || element;
  52749. }
  52750. processAttrs(element);
  52751. return element
  52752. }
  52753. function processKey (el) {
  52754. var exp = getBindingAttr(el, 'key');
  52755. if (exp) {
  52756. {
  52757. if (el.tag === 'template') {
  52758. warn$2(
  52759. "<template> cannot be keyed. Place the key on real elements instead.",
  52760. getRawBindingAttr(el, 'key')
  52761. );
  52762. }
  52763. if (el.for) {
  52764. var iterator = el.iterator2 || el.iterator1;
  52765. var parent = el.parent;
  52766. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  52767. warn$2(
  52768. "Do not use v-for index as key on <transition-group> children, " +
  52769. "this is the same as not using keys.",
  52770. getRawBindingAttr(el, 'key'),
  52771. true /* tip */
  52772. );
  52773. }
  52774. }
  52775. }
  52776. el.key = exp;
  52777. }
  52778. }
  52779. function processRef (el) {
  52780. var ref = getBindingAttr(el, 'ref');
  52781. if (ref) {
  52782. el.ref = ref;
  52783. el.refInFor = checkInFor(el);
  52784. }
  52785. }
  52786. function processFor (el) {
  52787. var exp;
  52788. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  52789. var res = parseFor(exp);
  52790. if (res) {
  52791. extend(el, res);
  52792. } else {
  52793. warn$2(
  52794. ("Invalid v-for expression: " + exp),
  52795. el.rawAttrsMap['v-for']
  52796. );
  52797. }
  52798. }
  52799. }
  52800. function parseFor (exp) {
  52801. var inMatch = exp.match(forAliasRE);
  52802. if (!inMatch) { return }
  52803. var res = {};
  52804. res.for = inMatch[2].trim();
  52805. var alias = inMatch[1].trim().replace(stripParensRE, '');
  52806. var iteratorMatch = alias.match(forIteratorRE);
  52807. if (iteratorMatch) {
  52808. res.alias = alias.replace(forIteratorRE, '').trim();
  52809. res.iterator1 = iteratorMatch[1].trim();
  52810. if (iteratorMatch[2]) {
  52811. res.iterator2 = iteratorMatch[2].trim();
  52812. }
  52813. } else {
  52814. res.alias = alias;
  52815. }
  52816. return res
  52817. }
  52818. function processIf (el) {
  52819. var exp = getAndRemoveAttr(el, 'v-if');
  52820. if (exp) {
  52821. el.if = exp;
  52822. addIfCondition(el, {
  52823. exp: exp,
  52824. block: el
  52825. });
  52826. } else {
  52827. if (getAndRemoveAttr(el, 'v-else') != null) {
  52828. el.else = true;
  52829. }
  52830. var elseif = getAndRemoveAttr(el, 'v-else-if');
  52831. if (elseif) {
  52832. el.elseif = elseif;
  52833. }
  52834. }
  52835. }
  52836. function processIfConditions (el, parent) {
  52837. var prev = findPrevElement(parent.children);
  52838. if (prev && prev.if) {
  52839. addIfCondition(prev, {
  52840. exp: el.elseif,
  52841. block: el
  52842. });
  52843. } else {
  52844. warn$2(
  52845. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  52846. "used on element <" + (el.tag) + "> without corresponding v-if.",
  52847. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  52848. );
  52849. }
  52850. }
  52851. function findPrevElement (children) {
  52852. var i = children.length;
  52853. while (i--) {
  52854. if (children[i].type === 1) {
  52855. return children[i]
  52856. } else {
  52857. if (children[i].text !== ' ') {
  52858. warn$2(
  52859. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  52860. "will be ignored.",
  52861. children[i]
  52862. );
  52863. }
  52864. children.pop();
  52865. }
  52866. }
  52867. }
  52868. function addIfCondition (el, condition) {
  52869. if (!el.ifConditions) {
  52870. el.ifConditions = [];
  52871. }
  52872. el.ifConditions.push(condition);
  52873. }
  52874. function processOnce (el) {
  52875. var once$$1 = getAndRemoveAttr(el, 'v-once');
  52876. if (once$$1 != null) {
  52877. el.once = true;
  52878. }
  52879. }
  52880. // handle content being passed to a component as slot,
  52881. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  52882. function processSlotContent (el) {
  52883. var slotScope;
  52884. if (el.tag === 'template') {
  52885. slotScope = getAndRemoveAttr(el, 'scope');
  52886. /* istanbul ignore if */
  52887. if (slotScope) {
  52888. warn$2(
  52889. "the \"scope\" attribute for scoped slots have been deprecated and " +
  52890. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  52891. "can also be used on plain elements in addition to <template> to " +
  52892. "denote scoped slots.",
  52893. el.rawAttrsMap['scope'],
  52894. true
  52895. );
  52896. }
  52897. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  52898. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  52899. /* istanbul ignore if */
  52900. if (el.attrsMap['v-for']) {
  52901. warn$2(
  52902. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  52903. "(v-for takes higher priority). Use a wrapper <template> for the " +
  52904. "scoped slot to make it clearer.",
  52905. el.rawAttrsMap['slot-scope'],
  52906. true
  52907. );
  52908. }
  52909. el.slotScope = slotScope;
  52910. }
  52911. // slot="xxx"
  52912. var slotTarget = getBindingAttr(el, 'slot');
  52913. if (slotTarget) {
  52914. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  52915. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  52916. // preserve slot as an attribute for native shadow DOM compat
  52917. // only for non-scoped slots.
  52918. if (el.tag !== 'template' && !el.slotScope) {
  52919. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  52920. }
  52921. }
  52922. // 2.6 v-slot syntax
  52923. {
  52924. if (el.tag === 'template') {
  52925. // v-slot on <template>
  52926. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  52927. if (slotBinding) {
  52928. {
  52929. if (el.slotTarget || el.slotScope) {
  52930. warn$2(
  52931. "Unexpected mixed usage of different slot syntaxes.",
  52932. el
  52933. );
  52934. }
  52935. if (el.parent && !maybeComponent(el.parent)) {
  52936. warn$2(
  52937. "<template v-slot> can only appear at the root level inside " +
  52938. "the receiving component",
  52939. el
  52940. );
  52941. }
  52942. }
  52943. var ref = getSlotName(slotBinding);
  52944. var name = ref.name;
  52945. var dynamic = ref.dynamic;
  52946. el.slotTarget = name;
  52947. el.slotTargetDynamic = dynamic;
  52948. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52949. }
  52950. } else {
  52951. // v-slot on component, denotes default slot
  52952. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52953. if (slotBinding$1) {
  52954. {
  52955. if (!maybeComponent(el)) {
  52956. warn$2(
  52957. "v-slot can only be used on components or <template>.",
  52958. slotBinding$1
  52959. );
  52960. }
  52961. if (el.slotScope || el.slotTarget) {
  52962. warn$2(
  52963. "Unexpected mixed usage of different slot syntaxes.",
  52964. el
  52965. );
  52966. }
  52967. if (el.scopedSlots) {
  52968. warn$2(
  52969. "To avoid scope ambiguity, the default slot should also use " +
  52970. "<template> syntax when there are other named slots.",
  52971. slotBinding$1
  52972. );
  52973. }
  52974. }
  52975. // add the component's children to its default slot
  52976. var slots = el.scopedSlots || (el.scopedSlots = {});
  52977. var ref$1 = getSlotName(slotBinding$1);
  52978. var name$1 = ref$1.name;
  52979. var dynamic$1 = ref$1.dynamic;
  52980. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52981. slotContainer.slotTarget = name$1;
  52982. slotContainer.slotTargetDynamic = dynamic$1;
  52983. slotContainer.children = el.children.filter(function (c) {
  52984. if (!c.slotScope) {
  52985. c.parent = slotContainer;
  52986. return true
  52987. }
  52988. });
  52989. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52990. // remove children as they are returned from scopedSlots now
  52991. el.children = [];
  52992. // mark el non-plain so data gets generated
  52993. el.plain = false;
  52994. }
  52995. }
  52996. }
  52997. }
  52998. function getSlotName (binding) {
  52999. var name = binding.name.replace(slotRE, '');
  53000. if (!name) {
  53001. if (binding.name[0] !== '#') {
  53002. name = 'default';
  53003. } else {
  53004. warn$2(
  53005. "v-slot shorthand syntax requires a slot name.",
  53006. binding
  53007. );
  53008. }
  53009. }
  53010. return dynamicArgRE.test(name)
  53011. // dynamic [name]
  53012. ? { name: name.slice(1, -1), dynamic: true }
  53013. // static name
  53014. : { name: ("\"" + name + "\""), dynamic: false }
  53015. }
  53016. // handle <slot/> outlets
  53017. function processSlotOutlet (el) {
  53018. if (el.tag === 'slot') {
  53019. el.slotName = getBindingAttr(el, 'name');
  53020. if (el.key) {
  53021. warn$2(
  53022. "`key` does not work on <slot> because slots are abstract outlets " +
  53023. "and can possibly expand into multiple elements. " +
  53024. "Use the key on a wrapping element instead.",
  53025. getRawBindingAttr(el, 'key')
  53026. );
  53027. }
  53028. }
  53029. }
  53030. function processComponent (el) {
  53031. var binding;
  53032. if ((binding = getBindingAttr(el, 'is'))) {
  53033. el.component = binding;
  53034. }
  53035. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53036. el.inlineTemplate = true;
  53037. }
  53038. }
  53039. function processAttrs (el) {
  53040. var list = el.attrsList;
  53041. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53042. for (i = 0, l = list.length; i < l; i++) {
  53043. name = rawName = list[i].name;
  53044. value = list[i].value;
  53045. if (dirRE.test(name)) {
  53046. // mark element as dynamic
  53047. el.hasBindings = true;
  53048. // modifiers
  53049. modifiers = parseModifiers(name.replace(dirRE, ''));
  53050. // support .foo shorthand syntax for the .prop modifier
  53051. if (modifiers) {
  53052. name = name.replace(modifierRE, '');
  53053. }
  53054. if (bindRE.test(name)) { // v-bind
  53055. name = name.replace(bindRE, '');
  53056. value = parseFilters(value);
  53057. isDynamic = dynamicArgRE.test(name);
  53058. if (isDynamic) {
  53059. name = name.slice(1, -1);
  53060. }
  53061. if (
  53062. value.trim().length === 0
  53063. ) {
  53064. warn$2(
  53065. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53066. );
  53067. }
  53068. if (modifiers) {
  53069. if (modifiers.prop && !isDynamic) {
  53070. name = camelize(name);
  53071. if (name === 'innerHtml') { name = 'innerHTML'; }
  53072. }
  53073. if (modifiers.camel && !isDynamic) {
  53074. name = camelize(name);
  53075. }
  53076. if (modifiers.sync) {
  53077. syncGen = genAssignmentCode(value, "$event");
  53078. if (!isDynamic) {
  53079. addHandler(
  53080. el,
  53081. ("update:" + (camelize(name))),
  53082. syncGen,
  53083. null,
  53084. false,
  53085. warn$2,
  53086. list[i]
  53087. );
  53088. if (hyphenate(name) !== camelize(name)) {
  53089. addHandler(
  53090. el,
  53091. ("update:" + (hyphenate(name))),
  53092. syncGen,
  53093. null,
  53094. false,
  53095. warn$2,
  53096. list[i]
  53097. );
  53098. }
  53099. } else {
  53100. // handler w/ dynamic event name
  53101. addHandler(
  53102. el,
  53103. ("\"update:\"+(" + name + ")"),
  53104. syncGen,
  53105. null,
  53106. false,
  53107. warn$2,
  53108. list[i],
  53109. true // dynamic
  53110. );
  53111. }
  53112. }
  53113. }
  53114. if ((modifiers && modifiers.prop) || (
  53115. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53116. )) {
  53117. addProp(el, name, value, list[i], isDynamic);
  53118. } else {
  53119. addAttr(el, name, value, list[i], isDynamic);
  53120. }
  53121. } else if (onRE.test(name)) { // v-on
  53122. name = name.replace(onRE, '');
  53123. isDynamic = dynamicArgRE.test(name);
  53124. if (isDynamic) {
  53125. name = name.slice(1, -1);
  53126. }
  53127. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53128. } else { // normal directives
  53129. name = name.replace(dirRE, '');
  53130. // parse arg
  53131. var argMatch = name.match(argRE);
  53132. var arg = argMatch && argMatch[1];
  53133. isDynamic = false;
  53134. if (arg) {
  53135. name = name.slice(0, -(arg.length + 1));
  53136. if (dynamicArgRE.test(arg)) {
  53137. arg = arg.slice(1, -1);
  53138. isDynamic = true;
  53139. }
  53140. }
  53141. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53142. if (name === 'model') {
  53143. checkForAliasModel(el, value);
  53144. }
  53145. }
  53146. } else {
  53147. // literal attribute
  53148. {
  53149. var res = parseText(value, delimiters);
  53150. if (res) {
  53151. warn$2(
  53152. name + "=\"" + value + "\": " +
  53153. 'Interpolation inside attributes has been removed. ' +
  53154. 'Use v-bind or the colon shorthand instead. For example, ' +
  53155. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53156. list[i]
  53157. );
  53158. }
  53159. }
  53160. addAttr(el, name, JSON.stringify(value), list[i]);
  53161. // #6887 firefox doesn't update muted state if set via attribute
  53162. // even immediately after element creation
  53163. if (!el.component &&
  53164. name === 'muted' &&
  53165. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53166. addProp(el, name, 'true', list[i]);
  53167. }
  53168. }
  53169. }
  53170. }
  53171. function checkInFor (el) {
  53172. var parent = el;
  53173. while (parent) {
  53174. if (parent.for !== undefined) {
  53175. return true
  53176. }
  53177. parent = parent.parent;
  53178. }
  53179. return false
  53180. }
  53181. function parseModifiers (name) {
  53182. var match = name.match(modifierRE);
  53183. if (match) {
  53184. var ret = {};
  53185. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53186. return ret
  53187. }
  53188. }
  53189. function makeAttrsMap (attrs) {
  53190. var map = {};
  53191. for (var i = 0, l = attrs.length; i < l; i++) {
  53192. if (
  53193. map[attrs[i].name] && !isIE && !isEdge
  53194. ) {
  53195. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53196. }
  53197. map[attrs[i].name] = attrs[i].value;
  53198. }
  53199. return map
  53200. }
  53201. // for script (e.g. type="x/template") or style, do not decode content
  53202. function isTextTag (el) {
  53203. return el.tag === 'script' || el.tag === 'style'
  53204. }
  53205. function isForbiddenTag (el) {
  53206. return (
  53207. el.tag === 'style' ||
  53208. (el.tag === 'script' && (
  53209. !el.attrsMap.type ||
  53210. el.attrsMap.type === 'text/javascript'
  53211. ))
  53212. )
  53213. }
  53214. var ieNSBug = /^xmlns:NS\d+/;
  53215. var ieNSPrefix = /^NS\d+:/;
  53216. /* istanbul ignore next */
  53217. function guardIESVGBug (attrs) {
  53218. var res = [];
  53219. for (var i = 0; i < attrs.length; i++) {
  53220. var attr = attrs[i];
  53221. if (!ieNSBug.test(attr.name)) {
  53222. attr.name = attr.name.replace(ieNSPrefix, '');
  53223. res.push(attr);
  53224. }
  53225. }
  53226. return res
  53227. }
  53228. function checkForAliasModel (el, value) {
  53229. var _el = el;
  53230. while (_el) {
  53231. if (_el.for && _el.alias === value) {
  53232. warn$2(
  53233. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53234. "You are binding v-model directly to a v-for iteration alias. " +
  53235. "This will not be able to modify the v-for source array because " +
  53236. "writing to the alias is like modifying a function local variable. " +
  53237. "Consider using an array of objects and use v-model on an object property instead.",
  53238. el.rawAttrsMap['v-model']
  53239. );
  53240. }
  53241. _el = _el.parent;
  53242. }
  53243. }
  53244. /* */
  53245. function preTransformNode (el, options) {
  53246. if (el.tag === 'input') {
  53247. var map = el.attrsMap;
  53248. if (!map['v-model']) {
  53249. return
  53250. }
  53251. var typeBinding;
  53252. if (map[':type'] || map['v-bind:type']) {
  53253. typeBinding = getBindingAttr(el, 'type');
  53254. }
  53255. if (!map.type && !typeBinding && map['v-bind']) {
  53256. typeBinding = "(" + (map['v-bind']) + ").type";
  53257. }
  53258. if (typeBinding) {
  53259. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53260. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53261. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53262. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53263. // 1. checkbox
  53264. var branch0 = cloneASTElement(el);
  53265. // process for on the main node
  53266. processFor(branch0);
  53267. addRawAttr(branch0, 'type', 'checkbox');
  53268. processElement(branch0, options);
  53269. branch0.processed = true; // prevent it from double-processed
  53270. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53271. addIfCondition(branch0, {
  53272. exp: branch0.if,
  53273. block: branch0
  53274. });
  53275. // 2. add radio else-if condition
  53276. var branch1 = cloneASTElement(el);
  53277. getAndRemoveAttr(branch1, 'v-for', true);
  53278. addRawAttr(branch1, 'type', 'radio');
  53279. processElement(branch1, options);
  53280. addIfCondition(branch0, {
  53281. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53282. block: branch1
  53283. });
  53284. // 3. other
  53285. var branch2 = cloneASTElement(el);
  53286. getAndRemoveAttr(branch2, 'v-for', true);
  53287. addRawAttr(branch2, ':type', typeBinding);
  53288. processElement(branch2, options);
  53289. addIfCondition(branch0, {
  53290. exp: ifCondition,
  53291. block: branch2
  53292. });
  53293. if (hasElse) {
  53294. branch0.else = true;
  53295. } else if (elseIfCondition) {
  53296. branch0.elseif = elseIfCondition;
  53297. }
  53298. return branch0
  53299. }
  53300. }
  53301. }
  53302. function cloneASTElement (el) {
  53303. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53304. }
  53305. var model$1 = {
  53306. preTransformNode: preTransformNode
  53307. };
  53308. var modules$1 = [
  53309. klass$1,
  53310. style$1,
  53311. model$1
  53312. ];
  53313. /* */
  53314. function text (el, dir) {
  53315. if (dir.value) {
  53316. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53317. }
  53318. }
  53319. /* */
  53320. function html (el, dir) {
  53321. if (dir.value) {
  53322. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53323. }
  53324. }
  53325. var directives$1 = {
  53326. model: model,
  53327. text: text,
  53328. html: html
  53329. };
  53330. /* */
  53331. var baseOptions = {
  53332. expectHTML: true,
  53333. modules: modules$1,
  53334. directives: directives$1,
  53335. isPreTag: isPreTag,
  53336. isUnaryTag: isUnaryTag,
  53337. mustUseProp: mustUseProp,
  53338. canBeLeftOpenTag: canBeLeftOpenTag,
  53339. isReservedTag: isReservedTag,
  53340. getTagNamespace: getTagNamespace,
  53341. staticKeys: genStaticKeys(modules$1)
  53342. };
  53343. /* */
  53344. var isStaticKey;
  53345. var isPlatformReservedTag;
  53346. var genStaticKeysCached = cached(genStaticKeys$1);
  53347. /**
  53348. * Goal of the optimizer: walk the generated template AST tree
  53349. * and detect sub-trees that are purely static, i.e. parts of
  53350. * the DOM that never needs to change.
  53351. *
  53352. * Once we detect these sub-trees, we can:
  53353. *
  53354. * 1. Hoist them into constants, so that we no longer need to
  53355. * create fresh nodes for them on each re-render;
  53356. * 2. Completely skip them in the patching process.
  53357. */
  53358. function optimize (root, options) {
  53359. if (!root) { return }
  53360. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53361. isPlatformReservedTag = options.isReservedTag || no;
  53362. // first pass: mark all non-static nodes.
  53363. markStatic$1(root);
  53364. // second pass: mark static roots.
  53365. markStaticRoots(root, false);
  53366. }
  53367. function genStaticKeys$1 (keys) {
  53368. return makeMap(
  53369. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53370. (keys ? ',' + keys : '')
  53371. )
  53372. }
  53373. function markStatic$1 (node) {
  53374. node.static = isStatic(node);
  53375. if (node.type === 1) {
  53376. // do not make component slot content static. this avoids
  53377. // 1. components not able to mutate slot nodes
  53378. // 2. static slot content fails for hot-reloading
  53379. if (
  53380. !isPlatformReservedTag(node.tag) &&
  53381. node.tag !== 'slot' &&
  53382. node.attrsMap['inline-template'] == null
  53383. ) {
  53384. return
  53385. }
  53386. for (var i = 0, l = node.children.length; i < l; i++) {
  53387. var child = node.children[i];
  53388. markStatic$1(child);
  53389. if (!child.static) {
  53390. node.static = false;
  53391. }
  53392. }
  53393. if (node.ifConditions) {
  53394. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53395. var block = node.ifConditions[i$1].block;
  53396. markStatic$1(block);
  53397. if (!block.static) {
  53398. node.static = false;
  53399. }
  53400. }
  53401. }
  53402. }
  53403. }
  53404. function markStaticRoots (node, isInFor) {
  53405. if (node.type === 1) {
  53406. if (node.static || node.once) {
  53407. node.staticInFor = isInFor;
  53408. }
  53409. // For a node to qualify as a static root, it should have children that
  53410. // are not just static text. Otherwise the cost of hoisting out will
  53411. // outweigh the benefits and it's better off to just always render it fresh.
  53412. if (node.static && node.children.length && !(
  53413. node.children.length === 1 &&
  53414. node.children[0].type === 3
  53415. )) {
  53416. node.staticRoot = true;
  53417. return
  53418. } else {
  53419. node.staticRoot = false;
  53420. }
  53421. if (node.children) {
  53422. for (var i = 0, l = node.children.length; i < l; i++) {
  53423. markStaticRoots(node.children[i], isInFor || !!node.for);
  53424. }
  53425. }
  53426. if (node.ifConditions) {
  53427. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53428. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53429. }
  53430. }
  53431. }
  53432. }
  53433. function isStatic (node) {
  53434. if (node.type === 2) { // expression
  53435. return false
  53436. }
  53437. if (node.type === 3) { // text
  53438. return true
  53439. }
  53440. return !!(node.pre || (
  53441. !node.hasBindings && // no dynamic bindings
  53442. !node.if && !node.for && // not v-if or v-for or v-else
  53443. !isBuiltInTag(node.tag) && // not a built-in
  53444. isPlatformReservedTag(node.tag) && // not a component
  53445. !isDirectChildOfTemplateFor(node) &&
  53446. Object.keys(node).every(isStaticKey)
  53447. ))
  53448. }
  53449. function isDirectChildOfTemplateFor (node) {
  53450. while (node.parent) {
  53451. node = node.parent;
  53452. if (node.tag !== 'template') {
  53453. return false
  53454. }
  53455. if (node.for) {
  53456. return true
  53457. }
  53458. }
  53459. return false
  53460. }
  53461. /* */
  53462. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53463. var fnInvokeRE = /\([^)]*?\);*$/;
  53464. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53465. // KeyboardEvent.keyCode aliases
  53466. var keyCodes = {
  53467. esc: 27,
  53468. tab: 9,
  53469. enter: 13,
  53470. space: 32,
  53471. up: 38,
  53472. left: 37,
  53473. right: 39,
  53474. down: 40,
  53475. 'delete': [8, 46]
  53476. };
  53477. // KeyboardEvent.key aliases
  53478. var keyNames = {
  53479. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53480. esc: ['Esc', 'Escape'],
  53481. tab: 'Tab',
  53482. enter: 'Enter',
  53483. // #9112: IE11 uses `Spacebar` for Space key name.
  53484. space: [' ', 'Spacebar'],
  53485. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53486. up: ['Up', 'ArrowUp'],
  53487. left: ['Left', 'ArrowLeft'],
  53488. right: ['Right', 'ArrowRight'],
  53489. down: ['Down', 'ArrowDown'],
  53490. // #9112: IE11 uses `Del` for Delete key name.
  53491. 'delete': ['Backspace', 'Delete', 'Del']
  53492. };
  53493. // #4868: modifiers that prevent the execution of the listener
  53494. // need to explicitly return null so that we can determine whether to remove
  53495. // the listener for .once
  53496. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53497. var modifierCode = {
  53498. stop: '$event.stopPropagation();',
  53499. prevent: '$event.preventDefault();',
  53500. self: genGuard("$event.target !== $event.currentTarget"),
  53501. ctrl: genGuard("!$event.ctrlKey"),
  53502. shift: genGuard("!$event.shiftKey"),
  53503. alt: genGuard("!$event.altKey"),
  53504. meta: genGuard("!$event.metaKey"),
  53505. left: genGuard("'button' in $event && $event.button !== 0"),
  53506. middle: genGuard("'button' in $event && $event.button !== 1"),
  53507. right: genGuard("'button' in $event && $event.button !== 2")
  53508. };
  53509. function genHandlers (
  53510. events,
  53511. isNative
  53512. ) {
  53513. var prefix = isNative ? 'nativeOn:' : 'on:';
  53514. var staticHandlers = "";
  53515. var dynamicHandlers = "";
  53516. for (var name in events) {
  53517. var handlerCode = genHandler(events[name]);
  53518. if (events[name] && events[name].dynamic) {
  53519. dynamicHandlers += name + "," + handlerCode + ",";
  53520. } else {
  53521. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53522. }
  53523. }
  53524. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53525. if (dynamicHandlers) {
  53526. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53527. } else {
  53528. return prefix + staticHandlers
  53529. }
  53530. }
  53531. function genHandler (handler) {
  53532. if (!handler) {
  53533. return 'function(){}'
  53534. }
  53535. if (Array.isArray(handler)) {
  53536. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53537. }
  53538. var isMethodPath = simplePathRE.test(handler.value);
  53539. var isFunctionExpression = fnExpRE.test(handler.value);
  53540. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53541. if (!handler.modifiers) {
  53542. if (isMethodPath || isFunctionExpression) {
  53543. return handler.value
  53544. }
  53545. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53546. } else {
  53547. var code = '';
  53548. var genModifierCode = '';
  53549. var keys = [];
  53550. for (var key in handler.modifiers) {
  53551. if (modifierCode[key]) {
  53552. genModifierCode += modifierCode[key];
  53553. // left/right
  53554. if (keyCodes[key]) {
  53555. keys.push(key);
  53556. }
  53557. } else if (key === 'exact') {
  53558. var modifiers = (handler.modifiers);
  53559. genModifierCode += genGuard(
  53560. ['ctrl', 'shift', 'alt', 'meta']
  53561. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53562. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53563. .join('||')
  53564. );
  53565. } else {
  53566. keys.push(key);
  53567. }
  53568. }
  53569. if (keys.length) {
  53570. code += genKeyFilter(keys);
  53571. }
  53572. // Make sure modifiers like prevent and stop get executed after key filtering
  53573. if (genModifierCode) {
  53574. code += genModifierCode;
  53575. }
  53576. var handlerCode = isMethodPath
  53577. ? ("return " + (handler.value) + "($event)")
  53578. : isFunctionExpression
  53579. ? ("return (" + (handler.value) + ")($event)")
  53580. : isFunctionInvocation
  53581. ? ("return " + (handler.value))
  53582. : handler.value;
  53583. return ("function($event){" + code + handlerCode + "}")
  53584. }
  53585. }
  53586. function genKeyFilter (keys) {
  53587. return (
  53588. // make sure the key filters only apply to KeyboardEvents
  53589. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53590. // key events that do not have keyCode property...
  53591. "if(!$event.type.indexOf('key')&&" +
  53592. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53593. )
  53594. }
  53595. function genFilterCode (key) {
  53596. var keyVal = parseInt(key, 10);
  53597. if (keyVal) {
  53598. return ("$event.keyCode!==" + keyVal)
  53599. }
  53600. var keyCode = keyCodes[key];
  53601. var keyName = keyNames[key];
  53602. return (
  53603. "_k($event.keyCode," +
  53604. (JSON.stringify(key)) + "," +
  53605. (JSON.stringify(keyCode)) + "," +
  53606. "$event.key," +
  53607. "" + (JSON.stringify(keyName)) +
  53608. ")"
  53609. )
  53610. }
  53611. /* */
  53612. function on (el, dir) {
  53613. if (dir.modifiers) {
  53614. warn("v-on without argument does not support modifiers.");
  53615. }
  53616. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53617. }
  53618. /* */
  53619. function bind$1 (el, dir) {
  53620. el.wrapData = function (code) {
  53621. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53622. };
  53623. }
  53624. /* */
  53625. var baseDirectives = {
  53626. on: on,
  53627. bind: bind$1,
  53628. cloak: noop
  53629. };
  53630. /* */
  53631. var CodegenState = function CodegenState (options) {
  53632. this.options = options;
  53633. this.warn = options.warn || baseWarn;
  53634. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53635. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53636. this.directives = extend(extend({}, baseDirectives), options.directives);
  53637. var isReservedTag = options.isReservedTag || no;
  53638. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53639. this.onceId = 0;
  53640. this.staticRenderFns = [];
  53641. this.pre = false;
  53642. };
  53643. function generate (
  53644. ast,
  53645. options
  53646. ) {
  53647. var state = new CodegenState(options);
  53648. var code = ast ? genElement(ast, state) : '_c("div")';
  53649. return {
  53650. render: ("with(this){return " + code + "}"),
  53651. staticRenderFns: state.staticRenderFns
  53652. }
  53653. }
  53654. function genElement (el, state) {
  53655. if (el.parent) {
  53656. el.pre = el.pre || el.parent.pre;
  53657. }
  53658. if (el.staticRoot && !el.staticProcessed) {
  53659. return genStatic(el, state)
  53660. } else if (el.once && !el.onceProcessed) {
  53661. return genOnce(el, state)
  53662. } else if (el.for && !el.forProcessed) {
  53663. return genFor(el, state)
  53664. } else if (el.if && !el.ifProcessed) {
  53665. return genIf(el, state)
  53666. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53667. return genChildren(el, state) || 'void 0'
  53668. } else if (el.tag === 'slot') {
  53669. return genSlot(el, state)
  53670. } else {
  53671. // component or element
  53672. var code;
  53673. if (el.component) {
  53674. code = genComponent(el.component, el, state);
  53675. } else {
  53676. var data;
  53677. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53678. data = genData$2(el, state);
  53679. }
  53680. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53681. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53682. }
  53683. // module transforms
  53684. for (var i = 0; i < state.transforms.length; i++) {
  53685. code = state.transforms[i](el, code);
  53686. }
  53687. return code
  53688. }
  53689. }
  53690. // hoist static sub-trees out
  53691. function genStatic (el, state) {
  53692. el.staticProcessed = true;
  53693. // Some elements (templates) need to behave differently inside of a v-pre
  53694. // node. All pre nodes are static roots, so we can use this as a location to
  53695. // wrap a state change and reset it upon exiting the pre node.
  53696. var originalPreState = state.pre;
  53697. if (el.pre) {
  53698. state.pre = el.pre;
  53699. }
  53700. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53701. state.pre = originalPreState;
  53702. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53703. }
  53704. // v-once
  53705. function genOnce (el, state) {
  53706. el.onceProcessed = true;
  53707. if (el.if && !el.ifProcessed) {
  53708. return genIf(el, state)
  53709. } else if (el.staticInFor) {
  53710. var key = '';
  53711. var parent = el.parent;
  53712. while (parent) {
  53713. if (parent.for) {
  53714. key = parent.key;
  53715. break
  53716. }
  53717. parent = parent.parent;
  53718. }
  53719. if (!key) {
  53720. state.warn(
  53721. "v-once can only be used inside v-for that is keyed. ",
  53722. el.rawAttrsMap['v-once']
  53723. );
  53724. return genElement(el, state)
  53725. }
  53726. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53727. } else {
  53728. return genStatic(el, state)
  53729. }
  53730. }
  53731. function genIf (
  53732. el,
  53733. state,
  53734. altGen,
  53735. altEmpty
  53736. ) {
  53737. el.ifProcessed = true; // avoid recursion
  53738. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53739. }
  53740. function genIfConditions (
  53741. conditions,
  53742. state,
  53743. altGen,
  53744. altEmpty
  53745. ) {
  53746. if (!conditions.length) {
  53747. return altEmpty || '_e()'
  53748. }
  53749. var condition = conditions.shift();
  53750. if (condition.exp) {
  53751. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53752. } else {
  53753. return ("" + (genTernaryExp(condition.block)))
  53754. }
  53755. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53756. function genTernaryExp (el) {
  53757. return altGen
  53758. ? altGen(el, state)
  53759. : el.once
  53760. ? genOnce(el, state)
  53761. : genElement(el, state)
  53762. }
  53763. }
  53764. function genFor (
  53765. el,
  53766. state,
  53767. altGen,
  53768. altHelper
  53769. ) {
  53770. var exp = el.for;
  53771. var alias = el.alias;
  53772. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  53773. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  53774. if (state.maybeComponent(el) &&
  53775. el.tag !== 'slot' &&
  53776. el.tag !== 'template' &&
  53777. !el.key
  53778. ) {
  53779. state.warn(
  53780. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  53781. "v-for should have explicit keys. " +
  53782. "See https://vuejs.org/guide/list.html#key for more info.",
  53783. el.rawAttrsMap['v-for'],
  53784. true /* tip */
  53785. );
  53786. }
  53787. el.forProcessed = true; // avoid recursion
  53788. return (altHelper || '_l') + "((" + exp + ")," +
  53789. "function(" + alias + iterator1 + iterator2 + "){" +
  53790. "return " + ((altGen || genElement)(el, state)) +
  53791. '})'
  53792. }
  53793. function genData$2 (el, state) {
  53794. var data = '{';
  53795. // directives first.
  53796. // directives may mutate the el's other properties before they are generated.
  53797. var dirs = genDirectives(el, state);
  53798. if (dirs) { data += dirs + ','; }
  53799. // key
  53800. if (el.key) {
  53801. data += "key:" + (el.key) + ",";
  53802. }
  53803. // ref
  53804. if (el.ref) {
  53805. data += "ref:" + (el.ref) + ",";
  53806. }
  53807. if (el.refInFor) {
  53808. data += "refInFor:true,";
  53809. }
  53810. // pre
  53811. if (el.pre) {
  53812. data += "pre:true,";
  53813. }
  53814. // record original tag name for components using "is" attribute
  53815. if (el.component) {
  53816. data += "tag:\"" + (el.tag) + "\",";
  53817. }
  53818. // module data generation functions
  53819. for (var i = 0; i < state.dataGenFns.length; i++) {
  53820. data += state.dataGenFns[i](el);
  53821. }
  53822. // attributes
  53823. if (el.attrs) {
  53824. data += "attrs:" + (genProps(el.attrs)) + ",";
  53825. }
  53826. // DOM props
  53827. if (el.props) {
  53828. data += "domProps:" + (genProps(el.props)) + ",";
  53829. }
  53830. // event handlers
  53831. if (el.events) {
  53832. data += (genHandlers(el.events, false)) + ",";
  53833. }
  53834. if (el.nativeEvents) {
  53835. data += (genHandlers(el.nativeEvents, true)) + ",";
  53836. }
  53837. // slot target
  53838. // only for non-scoped slots
  53839. if (el.slotTarget && !el.slotScope) {
  53840. data += "slot:" + (el.slotTarget) + ",";
  53841. }
  53842. // scoped slots
  53843. if (el.scopedSlots) {
  53844. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  53845. }
  53846. // component v-model
  53847. if (el.model) {
  53848. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  53849. }
  53850. // inline-template
  53851. if (el.inlineTemplate) {
  53852. var inlineTemplate = genInlineTemplate(el, state);
  53853. if (inlineTemplate) {
  53854. data += inlineTemplate + ",";
  53855. }
  53856. }
  53857. data = data.replace(/,$/, '') + '}';
  53858. // v-bind dynamic argument wrap
  53859. // v-bind with dynamic arguments must be applied using the same v-bind object
  53860. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  53861. if (el.dynamicAttrs) {
  53862. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  53863. }
  53864. // v-bind data wrap
  53865. if (el.wrapData) {
  53866. data = el.wrapData(data);
  53867. }
  53868. // v-on data wrap
  53869. if (el.wrapListeners) {
  53870. data = el.wrapListeners(data);
  53871. }
  53872. return data
  53873. }
  53874. function genDirectives (el, state) {
  53875. var dirs = el.directives;
  53876. if (!dirs) { return }
  53877. var res = 'directives:[';
  53878. var hasRuntime = false;
  53879. var i, l, dir, needRuntime;
  53880. for (i = 0, l = dirs.length; i < l; i++) {
  53881. dir = dirs[i];
  53882. needRuntime = true;
  53883. var gen = state.directives[dir.name];
  53884. if (gen) {
  53885. // compile-time directive that manipulates AST.
  53886. // returns true if it also needs a runtime counterpart.
  53887. needRuntime = !!gen(el, dir, state.warn);
  53888. }
  53889. if (needRuntime) {
  53890. hasRuntime = true;
  53891. 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))) : '') + "},";
  53892. }
  53893. }
  53894. if (hasRuntime) {
  53895. return res.slice(0, -1) + ']'
  53896. }
  53897. }
  53898. function genInlineTemplate (el, state) {
  53899. var ast = el.children[0];
  53900. if (el.children.length !== 1 || ast.type !== 1) {
  53901. state.warn(
  53902. 'Inline-template components must have exactly one child element.',
  53903. { start: el.start }
  53904. );
  53905. }
  53906. if (ast && ast.type === 1) {
  53907. var inlineRenderFns = generate(ast, state.options);
  53908. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  53909. }
  53910. }
  53911. function genScopedSlots (
  53912. el,
  53913. slots,
  53914. state
  53915. ) {
  53916. // by default scoped slots are considered "stable", this allows child
  53917. // components with only scoped slots to skip forced updates from parent.
  53918. // but in some cases we have to bail-out of this optimization
  53919. // for example if the slot contains dynamic names, has v-if or v-for on them...
  53920. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  53921. var slot = slots[key];
  53922. return (
  53923. slot.slotTargetDynamic ||
  53924. slot.if ||
  53925. slot.for ||
  53926. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  53927. )
  53928. });
  53929. // #9534: if a component with scoped slots is inside a conditional branch,
  53930. // it's possible for the same component to be reused but with different
  53931. // compiled slot content. To avoid that, we generate a unique key based on
  53932. // the generated code of all the slot contents.
  53933. var needsKey = !!el.if;
  53934. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53935. // disconnected due to the intermediate scope variable)
  53936. // #9438, #9506
  53937. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53938. // and skip force updating ones that do not actually use scope variables.
  53939. if (!needsForceUpdate) {
  53940. var parent = el.parent;
  53941. while (parent) {
  53942. if (
  53943. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53944. parent.for
  53945. ) {
  53946. needsForceUpdate = true;
  53947. break
  53948. }
  53949. if (parent.if) {
  53950. needsKey = true;
  53951. }
  53952. parent = parent.parent;
  53953. }
  53954. }
  53955. var generatedSlots = Object.keys(slots)
  53956. .map(function (key) { return genScopedSlot(slots[key], state); })
  53957. .join(',');
  53958. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53959. }
  53960. function hash(str) {
  53961. var hash = 5381;
  53962. var i = str.length;
  53963. while(i) {
  53964. hash = (hash * 33) ^ str.charCodeAt(--i);
  53965. }
  53966. return hash >>> 0
  53967. }
  53968. function containsSlotChild (el) {
  53969. if (el.type === 1) {
  53970. if (el.tag === 'slot') {
  53971. return true
  53972. }
  53973. return el.children.some(containsSlotChild)
  53974. }
  53975. return false
  53976. }
  53977. function genScopedSlot (
  53978. el,
  53979. state
  53980. ) {
  53981. var isLegacySyntax = el.attrsMap['slot-scope'];
  53982. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53983. return genIf(el, state, genScopedSlot, "null")
  53984. }
  53985. if (el.for && !el.forProcessed) {
  53986. return genFor(el, state, genScopedSlot)
  53987. }
  53988. var slotScope = el.slotScope === emptySlotScopeToken
  53989. ? ""
  53990. : String(el.slotScope);
  53991. var fn = "function(" + slotScope + "){" +
  53992. "return " + (el.tag === 'template'
  53993. ? el.if && isLegacySyntax
  53994. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  53995. : genChildren(el, state) || 'undefined'
  53996. : genElement(el, state)) + "}";
  53997. // reverse proxy v-slot without scope on this.$slots
  53998. var reverseProxy = slotScope ? "" : ",proxy:true";
  53999. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54000. }
  54001. function genChildren (
  54002. el,
  54003. state,
  54004. checkSkip,
  54005. altGenElement,
  54006. altGenNode
  54007. ) {
  54008. var children = el.children;
  54009. if (children.length) {
  54010. var el$1 = children[0];
  54011. // optimize single v-for
  54012. if (children.length === 1 &&
  54013. el$1.for &&
  54014. el$1.tag !== 'template' &&
  54015. el$1.tag !== 'slot'
  54016. ) {
  54017. var normalizationType = checkSkip
  54018. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54019. : "";
  54020. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54021. }
  54022. var normalizationType$1 = checkSkip
  54023. ? getNormalizationType(children, state.maybeComponent)
  54024. : 0;
  54025. var gen = altGenNode || genNode;
  54026. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54027. }
  54028. }
  54029. // determine the normalization needed for the children array.
  54030. // 0: no normalization needed
  54031. // 1: simple normalization needed (possible 1-level deep nested array)
  54032. // 2: full normalization needed
  54033. function getNormalizationType (
  54034. children,
  54035. maybeComponent
  54036. ) {
  54037. var res = 0;
  54038. for (var i = 0; i < children.length; i++) {
  54039. var el = children[i];
  54040. if (el.type !== 1) {
  54041. continue
  54042. }
  54043. if (needsNormalization(el) ||
  54044. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54045. res = 2;
  54046. break
  54047. }
  54048. if (maybeComponent(el) ||
  54049. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54050. res = 1;
  54051. }
  54052. }
  54053. return res
  54054. }
  54055. function needsNormalization (el) {
  54056. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54057. }
  54058. function genNode (node, state) {
  54059. if (node.type === 1) {
  54060. return genElement(node, state)
  54061. } else if (node.type === 3 && node.isComment) {
  54062. return genComment(node)
  54063. } else {
  54064. return genText(node)
  54065. }
  54066. }
  54067. function genText (text) {
  54068. return ("_v(" + (text.type === 2
  54069. ? text.expression // no need for () because already wrapped in _s()
  54070. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54071. }
  54072. function genComment (comment) {
  54073. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54074. }
  54075. function genSlot (el, state) {
  54076. var slotName = el.slotName || '"default"';
  54077. var children = genChildren(el, state);
  54078. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54079. var attrs = el.attrs || el.dynamicAttrs
  54080. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54081. // slot props are camelized
  54082. name: camelize(attr.name),
  54083. value: attr.value,
  54084. dynamic: attr.dynamic
  54085. }); }))
  54086. : null;
  54087. var bind$$1 = el.attrsMap['v-bind'];
  54088. if ((attrs || bind$$1) && !children) {
  54089. res += ",null";
  54090. }
  54091. if (attrs) {
  54092. res += "," + attrs;
  54093. }
  54094. if (bind$$1) {
  54095. res += (attrs ? '' : ',null') + "," + bind$$1;
  54096. }
  54097. return res + ')'
  54098. }
  54099. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54100. function genComponent (
  54101. componentName,
  54102. el,
  54103. state
  54104. ) {
  54105. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54106. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54107. }
  54108. function genProps (props) {
  54109. var staticProps = "";
  54110. var dynamicProps = "";
  54111. for (var i = 0; i < props.length; i++) {
  54112. var prop = props[i];
  54113. var value = transformSpecialNewlines(prop.value);
  54114. if (prop.dynamic) {
  54115. dynamicProps += (prop.name) + "," + value + ",";
  54116. } else {
  54117. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54118. }
  54119. }
  54120. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54121. if (dynamicProps) {
  54122. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54123. } else {
  54124. return staticProps
  54125. }
  54126. }
  54127. // #3895, #4268
  54128. function transformSpecialNewlines (text) {
  54129. return text
  54130. .replace(/\u2028/g, '\\u2028')
  54131. .replace(/\u2029/g, '\\u2029')
  54132. }
  54133. /* */
  54134. // these keywords should not appear inside expressions, but operators like
  54135. // typeof, instanceof and in are allowed
  54136. var prohibitedKeywordRE = new RegExp('\\b' + (
  54137. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54138. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54139. 'extends,finally,continue,debugger,function,arguments'
  54140. ).split(',').join('\\b|\\b') + '\\b');
  54141. // these unary operators should not be used as property/method names
  54142. var unaryOperatorsRE = new RegExp('\\b' + (
  54143. 'delete,typeof,void'
  54144. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54145. // strip strings in expressions
  54146. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54147. // detect problematic expressions in a template
  54148. function detectErrors (ast, warn) {
  54149. if (ast) {
  54150. checkNode(ast, warn);
  54151. }
  54152. }
  54153. function checkNode (node, warn) {
  54154. if (node.type === 1) {
  54155. for (var name in node.attrsMap) {
  54156. if (dirRE.test(name)) {
  54157. var value = node.attrsMap[name];
  54158. if (value) {
  54159. var range = node.rawAttrsMap[name];
  54160. if (name === 'v-for') {
  54161. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54162. } else if (name === 'v-slot' || name[0] === '#') {
  54163. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54164. } else if (onRE.test(name)) {
  54165. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54166. } else {
  54167. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54168. }
  54169. }
  54170. }
  54171. }
  54172. if (node.children) {
  54173. for (var i = 0; i < node.children.length; i++) {
  54174. checkNode(node.children[i], warn);
  54175. }
  54176. }
  54177. } else if (node.type === 2) {
  54178. checkExpression(node.expression, node.text, warn, node);
  54179. }
  54180. }
  54181. function checkEvent (exp, text, warn, range) {
  54182. var stripped = exp.replace(stripStringRE, '');
  54183. var keywordMatch = stripped.match(unaryOperatorsRE);
  54184. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54185. warn(
  54186. "avoid using JavaScript unary operator as property name: " +
  54187. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54188. range
  54189. );
  54190. }
  54191. checkExpression(exp, text, warn, range);
  54192. }
  54193. function checkFor (node, text, warn, range) {
  54194. checkExpression(node.for || '', text, warn, range);
  54195. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54196. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54197. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54198. }
  54199. function checkIdentifier (
  54200. ident,
  54201. type,
  54202. text,
  54203. warn,
  54204. range
  54205. ) {
  54206. if (typeof ident === 'string') {
  54207. try {
  54208. new Function(("var " + ident + "=_"));
  54209. } catch (e) {
  54210. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54211. }
  54212. }
  54213. }
  54214. function checkExpression (exp, text, warn, range) {
  54215. try {
  54216. new Function(("return " + exp));
  54217. } catch (e) {
  54218. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54219. if (keywordMatch) {
  54220. warn(
  54221. "avoid using JavaScript keyword as property name: " +
  54222. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54223. range
  54224. );
  54225. } else {
  54226. warn(
  54227. "invalid expression: " + (e.message) + " in\n\n" +
  54228. " " + exp + "\n\n" +
  54229. " Raw expression: " + (text.trim()) + "\n",
  54230. range
  54231. );
  54232. }
  54233. }
  54234. }
  54235. function checkFunctionParameterExpression (exp, text, warn, range) {
  54236. try {
  54237. new Function(exp, '');
  54238. } catch (e) {
  54239. warn(
  54240. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54241. " " + exp + "\n\n" +
  54242. " Raw expression: " + (text.trim()) + "\n",
  54243. range
  54244. );
  54245. }
  54246. }
  54247. /* */
  54248. var range = 2;
  54249. function generateCodeFrame (
  54250. source,
  54251. start,
  54252. end
  54253. ) {
  54254. if ( start === void 0 ) start = 0;
  54255. if ( end === void 0 ) end = source.length;
  54256. var lines = source.split(/\r?\n/);
  54257. var count = 0;
  54258. var res = [];
  54259. for (var i = 0; i < lines.length; i++) {
  54260. count += lines[i].length + 1;
  54261. if (count >= start) {
  54262. for (var j = i - range; j <= i + range || end > count; j++) {
  54263. if (j < 0 || j >= lines.length) { continue }
  54264. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54265. var lineLength = lines[j].length;
  54266. if (j === i) {
  54267. // push underline
  54268. var pad = start - (count - lineLength) + 1;
  54269. var length = end > count ? lineLength - pad : end - start;
  54270. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54271. } else if (j > i) {
  54272. if (end > count) {
  54273. var length$1 = Math.min(end - count, lineLength);
  54274. res.push(" | " + repeat$1("^", length$1));
  54275. }
  54276. count += lineLength + 1;
  54277. }
  54278. }
  54279. break
  54280. }
  54281. }
  54282. return res.join('\n')
  54283. }
  54284. function repeat$1 (str, n) {
  54285. var result = '';
  54286. if (n > 0) {
  54287. while (true) { // eslint-disable-line
  54288. if (n & 1) { result += str; }
  54289. n >>>= 1;
  54290. if (n <= 0) { break }
  54291. str += str;
  54292. }
  54293. }
  54294. return result
  54295. }
  54296. /* */
  54297. function createFunction (code, errors) {
  54298. try {
  54299. return new Function(code)
  54300. } catch (err) {
  54301. errors.push({ err: err, code: code });
  54302. return noop
  54303. }
  54304. }
  54305. function createCompileToFunctionFn (compile) {
  54306. var cache = Object.create(null);
  54307. return function compileToFunctions (
  54308. template,
  54309. options,
  54310. vm
  54311. ) {
  54312. options = extend({}, options);
  54313. var warn$$1 = options.warn || warn;
  54314. delete options.warn;
  54315. /* istanbul ignore if */
  54316. {
  54317. // detect possible CSP restriction
  54318. try {
  54319. new Function('return 1');
  54320. } catch (e) {
  54321. if (e.toString().match(/unsafe-eval|CSP/)) {
  54322. warn$$1(
  54323. 'It seems you are using the standalone build of Vue.js in an ' +
  54324. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54325. 'The template compiler cannot work in this environment. Consider ' +
  54326. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54327. 'templates into render functions.'
  54328. );
  54329. }
  54330. }
  54331. }
  54332. // check cache
  54333. var key = options.delimiters
  54334. ? String(options.delimiters) + template
  54335. : template;
  54336. if (cache[key]) {
  54337. return cache[key]
  54338. }
  54339. // compile
  54340. var compiled = compile(template, options);
  54341. // check compilation errors/tips
  54342. {
  54343. if (compiled.errors && compiled.errors.length) {
  54344. if (options.outputSourceRange) {
  54345. compiled.errors.forEach(function (e) {
  54346. warn$$1(
  54347. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54348. generateCodeFrame(template, e.start, e.end),
  54349. vm
  54350. );
  54351. });
  54352. } else {
  54353. warn$$1(
  54354. "Error compiling template:\n\n" + template + "\n\n" +
  54355. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54356. vm
  54357. );
  54358. }
  54359. }
  54360. if (compiled.tips && compiled.tips.length) {
  54361. if (options.outputSourceRange) {
  54362. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54363. } else {
  54364. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54365. }
  54366. }
  54367. }
  54368. // turn code into functions
  54369. var res = {};
  54370. var fnGenErrors = [];
  54371. res.render = createFunction(compiled.render, fnGenErrors);
  54372. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54373. return createFunction(code, fnGenErrors)
  54374. });
  54375. // check function generation errors.
  54376. // this should only happen if there is a bug in the compiler itself.
  54377. // mostly for codegen development use
  54378. /* istanbul ignore if */
  54379. {
  54380. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54381. warn$$1(
  54382. "Failed to generate render function:\n\n" +
  54383. fnGenErrors.map(function (ref) {
  54384. var err = ref.err;
  54385. var code = ref.code;
  54386. return ((err.toString()) + " in\n\n" + code + "\n");
  54387. }).join('\n'),
  54388. vm
  54389. );
  54390. }
  54391. }
  54392. return (cache[key] = res)
  54393. }
  54394. }
  54395. /* */
  54396. function createCompilerCreator (baseCompile) {
  54397. return function createCompiler (baseOptions) {
  54398. function compile (
  54399. template,
  54400. options
  54401. ) {
  54402. var finalOptions = Object.create(baseOptions);
  54403. var errors = [];
  54404. var tips = [];
  54405. var warn = function (msg, range, tip) {
  54406. (tip ? tips : errors).push(msg);
  54407. };
  54408. if (options) {
  54409. if (options.outputSourceRange) {
  54410. // $flow-disable-line
  54411. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54412. warn = function (msg, range, tip) {
  54413. var data = { msg: msg };
  54414. if (range) {
  54415. if (range.start != null) {
  54416. data.start = range.start + leadingSpaceLength;
  54417. }
  54418. if (range.end != null) {
  54419. data.end = range.end + leadingSpaceLength;
  54420. }
  54421. }
  54422. (tip ? tips : errors).push(data);
  54423. };
  54424. }
  54425. // merge custom modules
  54426. if (options.modules) {
  54427. finalOptions.modules =
  54428. (baseOptions.modules || []).concat(options.modules);
  54429. }
  54430. // merge custom directives
  54431. if (options.directives) {
  54432. finalOptions.directives = extend(
  54433. Object.create(baseOptions.directives || null),
  54434. options.directives
  54435. );
  54436. }
  54437. // copy other options
  54438. for (var key in options) {
  54439. if (key !== 'modules' && key !== 'directives') {
  54440. finalOptions[key] = options[key];
  54441. }
  54442. }
  54443. }
  54444. finalOptions.warn = warn;
  54445. var compiled = baseCompile(template.trim(), finalOptions);
  54446. {
  54447. detectErrors(compiled.ast, warn);
  54448. }
  54449. compiled.errors = errors;
  54450. compiled.tips = tips;
  54451. return compiled
  54452. }
  54453. return {
  54454. compile: compile,
  54455. compileToFunctions: createCompileToFunctionFn(compile)
  54456. }
  54457. }
  54458. }
  54459. /* */
  54460. // `createCompilerCreator` allows creating compilers that use alternative
  54461. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54462. // Here we just export a default compiler using the default parts.
  54463. var createCompiler = createCompilerCreator(function baseCompile (
  54464. template,
  54465. options
  54466. ) {
  54467. var ast = parse(template.trim(), options);
  54468. if (options.optimize !== false) {
  54469. optimize(ast, options);
  54470. }
  54471. var code = generate(ast, options);
  54472. return {
  54473. ast: ast,
  54474. render: code.render,
  54475. staticRenderFns: code.staticRenderFns
  54476. }
  54477. });
  54478. /* */
  54479. var ref$1 = createCompiler(baseOptions);
  54480. var compile = ref$1.compile;
  54481. var compileToFunctions = ref$1.compileToFunctions;
  54482. /* */
  54483. // check whether current browser encodes a char inside attribute values
  54484. var div;
  54485. function getShouldDecode (href) {
  54486. div = div || document.createElement('div');
  54487. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54488. return div.innerHTML.indexOf('&#10;') > 0
  54489. }
  54490. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54491. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54492. // #6828: chrome encodes content in a[href]
  54493. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54494. /* */
  54495. var idToTemplate = cached(function (id) {
  54496. var el = query(id);
  54497. return el && el.innerHTML
  54498. });
  54499. var mount = Vue.prototype.$mount;
  54500. Vue.prototype.$mount = function (
  54501. el,
  54502. hydrating
  54503. ) {
  54504. el = el && query(el);
  54505. /* istanbul ignore if */
  54506. if (el === document.body || el === document.documentElement) {
  54507. warn(
  54508. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54509. );
  54510. return this
  54511. }
  54512. var options = this.$options;
  54513. // resolve template/el and convert to render function
  54514. if (!options.render) {
  54515. var template = options.template;
  54516. if (template) {
  54517. if (typeof template === 'string') {
  54518. if (template.charAt(0) === '#') {
  54519. template = idToTemplate(template);
  54520. /* istanbul ignore if */
  54521. if (!template) {
  54522. warn(
  54523. ("Template element not found or is empty: " + (options.template)),
  54524. this
  54525. );
  54526. }
  54527. }
  54528. } else if (template.nodeType) {
  54529. template = template.innerHTML;
  54530. } else {
  54531. {
  54532. warn('invalid template option:' + template, this);
  54533. }
  54534. return this
  54535. }
  54536. } else if (el) {
  54537. template = getOuterHTML(el);
  54538. }
  54539. if (template) {
  54540. /* istanbul ignore if */
  54541. if (config.performance && mark) {
  54542. mark('compile');
  54543. }
  54544. var ref = compileToFunctions(template, {
  54545. outputSourceRange: "development" !== 'production',
  54546. shouldDecodeNewlines: shouldDecodeNewlines,
  54547. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54548. delimiters: options.delimiters,
  54549. comments: options.comments
  54550. }, this);
  54551. var render = ref.render;
  54552. var staticRenderFns = ref.staticRenderFns;
  54553. options.render = render;
  54554. options.staticRenderFns = staticRenderFns;
  54555. /* istanbul ignore if */
  54556. if (config.performance && mark) {
  54557. mark('compile end');
  54558. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54559. }
  54560. }
  54561. }
  54562. return mount.call(this, el, hydrating)
  54563. };
  54564. /**
  54565. * Get outerHTML of elements, taking care
  54566. * of SVG elements in IE as well.
  54567. */
  54568. function getOuterHTML (el) {
  54569. if (el.outerHTML) {
  54570. return el.outerHTML
  54571. } else {
  54572. var container = document.createElement('div');
  54573. container.appendChild(el.cloneNode(true));
  54574. return container.innerHTML
  54575. }
  54576. }
  54577. Vue.compile = compileToFunctions;
  54578. module.exports = Vue;
  54579. /* 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))
  54580. /***/ }),
  54581. /***/ "./node_modules/vue/dist/vue.common.js":
  54582. /*!*********************************************!*\
  54583. !*** ./node_modules/vue/dist/vue.common.js ***!
  54584. \*********************************************/
  54585. /*! no static exports found */
  54586. /***/ (function(module, exports, __webpack_require__) {
  54587. if (false) {} else {
  54588. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54589. }
  54590. /***/ }),
  54591. /***/ "./node_modules/webpack/buildin/global.js":
  54592. /*!***********************************!*\
  54593. !*** (webpack)/buildin/global.js ***!
  54594. \***********************************/
  54595. /*! no static exports found */
  54596. /***/ (function(module, exports) {
  54597. var g;
  54598. // This works in non-strict mode
  54599. g = (function() {
  54600. return this;
  54601. })();
  54602. try {
  54603. // This works if eval is allowed (see CSP)
  54604. g = g || new Function("return this")();
  54605. } catch (e) {
  54606. // This works if the window reference is available
  54607. if (typeof window === "object") g = window;
  54608. }
  54609. // g can still be undefined, but nothing to do about it...
  54610. // We return undefined, instead of nothing here, so it's
  54611. // easier to handle this case. if(!global) { ...}
  54612. module.exports = g;
  54613. /***/ }),
  54614. /***/ "./node_modules/webpack/buildin/module.js":
  54615. /*!***********************************!*\
  54616. !*** (webpack)/buildin/module.js ***!
  54617. \***********************************/
  54618. /*! no static exports found */
  54619. /***/ (function(module, exports) {
  54620. module.exports = function(module) {
  54621. if (!module.webpackPolyfill) {
  54622. module.deprecate = function() {};
  54623. module.paths = [];
  54624. // module.parent = undefined by default
  54625. if (!module.children) module.children = [];
  54626. Object.defineProperty(module, "loaded", {
  54627. enumerable: true,
  54628. get: function() {
  54629. return module.l;
  54630. }
  54631. });
  54632. Object.defineProperty(module, "id", {
  54633. enumerable: true,
  54634. get: function() {
  54635. return module.i;
  54636. }
  54637. });
  54638. module.webpackPolyfill = 1;
  54639. }
  54640. return module;
  54641. };
  54642. /***/ }),
  54643. /***/ "./resources/js/app.js":
  54644. /*!*****************************!*\
  54645. !*** ./resources/js/app.js ***!
  54646. \*****************************/
  54647. /*! no static exports found */
  54648. /***/ (function(module, exports, __webpack_require__) {
  54649. /**
  54650. * First we will load all of this project's JavaScript dependencies which
  54651. * includes Vue and other libraries. It is a great starting point when
  54652. * building robust, powerful web applications using Vue and Laravel.
  54653. */
  54654. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54655. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54656. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54657. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54658. /**
  54659. * The following block of code may be used to automatically register your
  54660. * Vue components. It will recursively scan this directory for the Vue
  54661. * components and automatically register them with their "basename".
  54662. *
  54663. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54664. */
  54665. // const files = require.context('./', true, /\.vue$/i)
  54666. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54667. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54668. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54669. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54670. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54671. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54672. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54673. /**
  54674. * Next, we will create a fresh Vue application instance and attach it to
  54675. * the page. Then, you may begin adding components to this application
  54676. * or customize the JavaScript scaffolding to fit your unique needs.
  54677. */
  54678. var app = new Vue({
  54679. el: '#app'
  54680. });
  54681. $(function () {
  54682. $('[data-toggle="tooltip"]').tooltip();
  54683. });
  54684. var clipboard = new Clipboard('.btn-clip');
  54685. clipboard.on('success', function (e) {
  54686. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54687. position: "right",
  54688. className: 'success'
  54689. });
  54690. e.clearSelection();
  54691. });
  54692. /***/ }),
  54693. /***/ "./resources/js/bootstrap.js":
  54694. /*!***********************************!*\
  54695. !*** ./resources/js/bootstrap.js ***!
  54696. \***********************************/
  54697. /*! no exports provided */
  54698. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54699. "use strict";
  54700. __webpack_require__.r(__webpack_exports__);
  54701. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54702. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54703. /**
  54704. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54705. * for JavaScript based Bootstrap features such as modals and tabs. This
  54706. * code may be modified to fit the specific needs of your application.
  54707. */
  54708. try {
  54709. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54710. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54711. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54712. } catch (e) {}
  54713. /**
  54714. * We'll load the axios HTTP library which allows us to easily issue requests
  54715. * to our Laravel back-end. This library automatically handles sending the
  54716. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54717. */
  54718. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54719. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54720. /**
  54721. * Echo exposes an expressive API for subscribing to channels and listening
  54722. * for events that are broadcast by Laravel. Echo and event broadcasting
  54723. * allows your team to easily build robust real-time web applications.
  54724. */
  54725. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54726. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54727. broadcaster: 'pusher',
  54728. key: "upccrt",
  54729. wsHost: window.location.hostname,
  54730. wsPort: 6001,
  54731. disableStats: true
  54732. });
  54733. /***/ }),
  54734. /***/ "./resources/js/components/ExampleComponent.vue":
  54735. /*!******************************************************!*\
  54736. !*** ./resources/js/components/ExampleComponent.vue ***!
  54737. \******************************************************/
  54738. /*! exports provided: default */
  54739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54740. "use strict";
  54741. __webpack_require__.r(__webpack_exports__);
  54742. /* 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&");
  54743. /* 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&");
  54744. /* 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");
  54745. /* normalize component */
  54746. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54747. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54748. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54749. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54750. false,
  54751. null,
  54752. null,
  54753. null
  54754. )
  54755. /* hot reload */
  54756. if (false) { var api; }
  54757. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54758. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54759. /***/ }),
  54760. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54761. /*!*******************************************************************************!*\
  54762. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  54763. \*******************************************************************************/
  54764. /*! exports provided: default */
  54765. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54766. "use strict";
  54767. __webpack_require__.r(__webpack_exports__);
  54768. /* 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&");
  54769. /* 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"]);
  54770. /***/ }),
  54771. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  54772. /*!*************************************************************************************!*\
  54773. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  54774. \*************************************************************************************/
  54775. /*! exports provided: render, staticRenderFns */
  54776. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54777. "use strict";
  54778. __webpack_require__.r(__webpack_exports__);
  54779. /* 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&");
  54780. /* 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"]; });
  54781. /* 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"]; });
  54782. /***/ }),
  54783. /***/ "./resources/js/components/assetinfo.vue":
  54784. /*!***********************************************!*\
  54785. !*** ./resources/js/components/assetinfo.vue ***!
  54786. \***********************************************/
  54787. /*! exports provided: default */
  54788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54789. "use strict";
  54790. __webpack_require__.r(__webpack_exports__);
  54791. /* 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&");
  54792. /* 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&");
  54793. /* 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");
  54794. /* normalize component */
  54795. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54796. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54797. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  54798. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54799. false,
  54800. null,
  54801. null,
  54802. null
  54803. )
  54804. /* hot reload */
  54805. if (false) { var api; }
  54806. component.options.__file = "resources/js/components/assetinfo.vue"
  54807. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54808. /***/ }),
  54809. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  54810. /*!************************************************************************!*\
  54811. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  54812. \************************************************************************/
  54813. /*! exports provided: default */
  54814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54815. "use strict";
  54816. __webpack_require__.r(__webpack_exports__);
  54817. /* 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&");
  54818. /* 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"]);
  54819. /***/ }),
  54820. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  54821. /*!******************************************************************************!*\
  54822. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  54823. \******************************************************************************/
  54824. /*! exports provided: render, staticRenderFns */
  54825. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54826. "use strict";
  54827. __webpack_require__.r(__webpack_exports__);
  54828. /* 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&");
  54829. /* 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"]; });
  54830. /* 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"]; });
  54831. /***/ }),
  54832. /***/ "./resources/js/components/credential.vue":
  54833. /*!************************************************!*\
  54834. !*** ./resources/js/components/credential.vue ***!
  54835. \************************************************/
  54836. /*! exports provided: default */
  54837. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54838. "use strict";
  54839. __webpack_require__.r(__webpack_exports__);
  54840. /* 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&");
  54841. /* 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&");
  54842. /* 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");
  54843. /* normalize component */
  54844. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54845. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54846. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  54847. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54848. false,
  54849. null,
  54850. null,
  54851. null
  54852. )
  54853. /* hot reload */
  54854. if (false) { var api; }
  54855. component.options.__file = "resources/js/components/credential.vue"
  54856. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54857. /***/ }),
  54858. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  54859. /*!*************************************************************************!*\
  54860. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  54861. \*************************************************************************/
  54862. /*! exports provided: default */
  54863. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54864. "use strict";
  54865. __webpack_require__.r(__webpack_exports__);
  54866. /* 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&");
  54867. /* 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"]);
  54868. /***/ }),
  54869. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  54870. /*!*******************************************************************************!*\
  54871. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  54872. \*******************************************************************************/
  54873. /*! exports provided: render, staticRenderFns */
  54874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54875. "use strict";
  54876. __webpack_require__.r(__webpack_exports__);
  54877. /* 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&");
  54878. /* 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"]; });
  54879. /* 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"]; });
  54880. /***/ }),
  54881. /***/ "./resources/js/components/modal.vue":
  54882. /*!*******************************************!*\
  54883. !*** ./resources/js/components/modal.vue ***!
  54884. \*******************************************/
  54885. /*! exports provided: default */
  54886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54887. "use strict";
  54888. __webpack_require__.r(__webpack_exports__);
  54889. /* 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&");
  54890. /* 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");
  54891. var script = {}
  54892. /* normalize component */
  54893. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  54894. script,
  54895. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  54896. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54897. false,
  54898. null,
  54899. null,
  54900. null
  54901. )
  54902. /* hot reload */
  54903. if (false) { var api; }
  54904. component.options.__file = "resources/js/components/modal.vue"
  54905. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54906. /***/ }),
  54907. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  54908. /*!**************************************************************************!*\
  54909. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  54910. \**************************************************************************/
  54911. /*! exports provided: render, staticRenderFns */
  54912. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54913. "use strict";
  54914. __webpack_require__.r(__webpack_exports__);
  54915. /* 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&");
  54916. /* 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"]; });
  54917. /* 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"]; });
  54918. /***/ }),
  54919. /***/ "./resources/js/components/notes.vue":
  54920. /*!*******************************************!*\
  54921. !*** ./resources/js/components/notes.vue ***!
  54922. \*******************************************/
  54923. /*! exports provided: default */
  54924. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54925. "use strict";
  54926. __webpack_require__.r(__webpack_exports__);
  54927. /* 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&");
  54928. /* 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&");
  54929. /* 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");
  54930. /* normalize component */
  54931. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54932. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54933. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  54934. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54935. false,
  54936. null,
  54937. null,
  54938. null
  54939. )
  54940. /* hot reload */
  54941. if (false) { var api; }
  54942. component.options.__file = "resources/js/components/notes.vue"
  54943. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54944. /***/ }),
  54945. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  54946. /*!********************************************************************!*\
  54947. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  54948. \********************************************************************/
  54949. /*! exports provided: default */
  54950. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54951. "use strict";
  54952. __webpack_require__.r(__webpack_exports__);
  54953. /* 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&");
  54954. /* 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"]);
  54955. /***/ }),
  54956. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  54957. /*!**************************************************************************!*\
  54958. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  54959. \**************************************************************************/
  54960. /*! exports provided: render, staticRenderFns */
  54961. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54962. "use strict";
  54963. __webpack_require__.r(__webpack_exports__);
  54964. /* 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&");
  54965. /* 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"]; });
  54966. /* 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"]; });
  54967. /***/ }),
  54968. /***/ "./resources/js/components/woinfo.vue":
  54969. /*!********************************************!*\
  54970. !*** ./resources/js/components/woinfo.vue ***!
  54971. \********************************************/
  54972. /*! exports provided: default */
  54973. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54974. "use strict";
  54975. __webpack_require__.r(__webpack_exports__);
  54976. /* 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&");
  54977. /* 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&");
  54978. /* 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");
  54979. /* normalize component */
  54980. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54981. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54982. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  54983. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54984. false,
  54985. null,
  54986. null,
  54987. null
  54988. )
  54989. /* hot reload */
  54990. if (false) { var api; }
  54991. component.options.__file = "resources/js/components/woinfo.vue"
  54992. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54993. /***/ }),
  54994. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  54995. /*!*********************************************************************!*\
  54996. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  54997. \*********************************************************************/
  54998. /*! exports provided: default */
  54999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55000. "use strict";
  55001. __webpack_require__.r(__webpack_exports__);
  55002. /* 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&");
  55003. /* 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"]);
  55004. /***/ }),
  55005. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55006. /*!***************************************************************************!*\
  55007. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55008. \***************************************************************************/
  55009. /*! exports provided: render, staticRenderFns */
  55010. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55011. "use strict";
  55012. __webpack_require__.r(__webpack_exports__);
  55013. /* 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&");
  55014. /* 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"]; });
  55015. /* 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"]; });
  55016. /***/ }),
  55017. /***/ "./resources/js/mixins/dateMixin.js":
  55018. /*!******************************************!*\
  55019. !*** ./resources/js/mixins/dateMixin.js ***!
  55020. \******************************************/
  55021. /*! exports provided: default */
  55022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55023. "use strict";
  55024. __webpack_require__.r(__webpack_exports__);
  55025. /* harmony default export */ __webpack_exports__["default"] = ({
  55026. methods: {
  55027. treatAsUTC: function treatAsUTC(date) {
  55028. var result = new Date(date);
  55029. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55030. return result;
  55031. },
  55032. daysSinceToday: function daysSinceToday(date) {
  55033. var currentDate = new Date();
  55034. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55035. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55036. },
  55037. getHRDate: function getHRDate(dateString) {
  55038. var date = new Date(dateString);
  55039. return date.toLocaleString('default', {
  55040. month: 'short',
  55041. day: 'numeric',
  55042. year: 'numeric',
  55043. hour: 'numeric',
  55044. minute: 'numeric'
  55045. });
  55046. },
  55047. isZero: function isZero(dateString) {
  55048. return dateString === '0000-00-00 00:00:00';
  55049. }
  55050. }
  55051. });
  55052. /***/ }),
  55053. /***/ "./resources/js/notify.min.js":
  55054. /*!************************************!*\
  55055. !*** ./resources/js/notify.min.js ***!
  55056. \************************************/
  55057. /*! no static exports found */
  55058. /***/ (function(module, exports, __webpack_require__) {
  55059. 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); }
  55060. (function (e) {
  55061. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55062. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55063. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55064. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55065. })(function (e) {
  55066. function A(t, n, i) {
  55067. typeof i == "string" && (i = {
  55068. className: i
  55069. }), 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);
  55070. }
  55071. var t = [].indexOf || function (e) {
  55072. for (var t = 0, n = this.length; t < n; t++) {
  55073. if (t in this && this[t] === e) return t;
  55074. }
  55075. return -1;
  55076. },
  55077. n = "notify",
  55078. r = n + "js",
  55079. i = n + "!blank",
  55080. s = {
  55081. t: "top",
  55082. m: "middle",
  55083. b: "bottom",
  55084. l: "left",
  55085. c: "center",
  55086. r: "right"
  55087. },
  55088. o = ["l", "c", "r"],
  55089. u = ["t", "m", "b"],
  55090. a = ["t", "b", "l", "r"],
  55091. f = {
  55092. t: "b",
  55093. m: null,
  55094. b: "t",
  55095. l: "r",
  55096. c: null,
  55097. r: "l"
  55098. },
  55099. l = function l(t) {
  55100. var n;
  55101. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55102. var r;
  55103. r = t.toLowerCase().charAt(0);
  55104. if (s[r]) return n.push(r);
  55105. }), n;
  55106. },
  55107. c = {},
  55108. h = {
  55109. name: "core",
  55110. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55111. 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}"
  55112. },
  55113. p = {
  55114. "border-radius": ["-webkit-", "-moz-"]
  55115. },
  55116. d = function d(e) {
  55117. return c[e];
  55118. },
  55119. v = function v(e) {
  55120. if (!e) throw "Missing Style name";
  55121. c[e] && delete c[e];
  55122. },
  55123. m = function m(t, i) {
  55124. if (!t) throw "Missing Style name";
  55125. if (!i) throw "Missing Style definition";
  55126. if (!i.html) throw "Missing Style HTML";
  55127. var s = c[t];
  55128. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55129. var o = "";
  55130. i.classes && e.each(i.classes, function (t, n) {
  55131. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55132. return p[t] && e.each(p[t], function (e, r) {
  55133. return o += " " + r + t + ": " + n + ";\n";
  55134. }), o += " " + t + ": " + n + ";\n";
  55135. }), o += "}\n";
  55136. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55137. var u = {},
  55138. a = e(i.html);
  55139. y("html", a, u), y("text", a, u), i.fields = u;
  55140. },
  55141. g = function g(t) {
  55142. var n, r, i;
  55143. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55144. try {
  55145. r.html(t);
  55146. } catch (s) {
  55147. r[0].styleSheet.cssText = t;
  55148. }
  55149. return r;
  55150. },
  55151. y = function y(t, n, r) {
  55152. var s;
  55153. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55154. var n;
  55155. n = e(this).attr(s), n || (n = i), r[n] = t;
  55156. });
  55157. },
  55158. b = function b(e, t) {
  55159. return e.is(t) ? e : e.find(t);
  55160. },
  55161. w = {
  55162. clickToHide: !0,
  55163. autoHide: !0,
  55164. autoHideDelay: 5e3,
  55165. arrowShow: !0,
  55166. arrowSize: 5,
  55167. breakNewLines: !0,
  55168. elementPosition: "bottom",
  55169. globalPosition: "top right",
  55170. style: "bootstrap",
  55171. className: "error",
  55172. showAnimation: "slideDown",
  55173. showDuration: 400,
  55174. hideAnimation: "slideUp",
  55175. hideDuration: 200,
  55176. gap: 5
  55177. },
  55178. E = function E(t, n) {
  55179. var r;
  55180. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55181. },
  55182. S = function S(t) {
  55183. return e.extend(w, t);
  55184. },
  55185. x = function x(t) {
  55186. return e("<" + t + "></" + t + ">");
  55187. },
  55188. T = {},
  55189. N = function N(t) {
  55190. var n;
  55191. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55192. return e(r).attr("name") === t.attr("name");
  55193. }), t = n.first()), t;
  55194. },
  55195. C = function C(e, t, n) {
  55196. var r, i;
  55197. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55198. if (isNaN(n)) return;
  55199. 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;
  55200. },
  55201. k = function k(e, t, n) {
  55202. if (e === "l" || e === "t") return 0;
  55203. if (e === "c" || e === "m") return n / 2 - t / 2;
  55204. if (e === "r" || e === "b") return n - t;
  55205. throw "Invalid alignment";
  55206. },
  55207. L = function L(e) {
  55208. return L.e = L.e || x("div"), L.e.text(e).html();
  55209. };
  55210. A.prototype.loadHTML = function () {
  55211. var t;
  55212. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55213. }, A.prototype.show = function (e, t) {
  55214. var n, r, i, s, o;
  55215. r = function (n) {
  55216. return function () {
  55217. !e && !n.elem && n.destroy();
  55218. if (t) return t();
  55219. };
  55220. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55221. 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 {
  55222. if (!!o || !!e) return r();
  55223. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55224. }
  55225. return n.push(r), i[s].apply(i, n);
  55226. }, A.prototype.setGlobalPosition = function () {
  55227. var t = this.getPosition(),
  55228. n = t[0],
  55229. i = t[1],
  55230. o = s[n],
  55231. u = s[i],
  55232. a = n + "|" + i,
  55233. f = T[a];
  55234. if (!f || !document.body.contains(f[0])) {
  55235. f = T[a] = x("div");
  55236. var l = {};
  55237. 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);
  55238. }
  55239. return f.prepend(this.wrapper);
  55240. }, A.prototype.setElementPosition = function () {
  55241. 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;
  55242. 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"];
  55243. for (w = 0, S = B.length; w < S; w++) {
  55244. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55245. }
  55246. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55247. if (!this.options.arrowShow) this.arrow.hide();else {
  55248. 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";
  55249. for (E = 0, x = a.length; E < x; E++) {
  55250. D = a[E], P = s[D];
  55251. if (D === L) continue;
  55252. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55253. }
  55254. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55255. }
  55256. 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);
  55257. if (r) return this.arrow.removeAttr("style").css(r);
  55258. }, A.prototype.getPosition = function () {
  55259. var e, n, r, i, s, f, c, h;
  55260. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55261. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55262. 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";
  55263. return e.length === 2 && (e[2] = e[1]), e;
  55264. }, A.prototype.getStyle = function (e) {
  55265. var t;
  55266. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55267. if (!t) throw "Missing style: " + e;
  55268. return t;
  55269. }, A.prototype.updateClasses = function () {
  55270. var t, n;
  55271. 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) {
  55272. return r + "-" + n.name + "-" + e;
  55273. }).join(" "), this.userContainer.attr("class", t);
  55274. }, A.prototype.run = function (t, n) {
  55275. var r, s, o, u, a;
  55276. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55277. if (this.container && !t) {
  55278. this.show(!1);
  55279. return;
  55280. }
  55281. if (!this.container && !t) return;
  55282. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55283. for (o in s) {
  55284. r = s[o], u = this.userFields[o];
  55285. if (!u) continue;
  55286. 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);
  55287. }
  55288. 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));
  55289. }, A.prototype.destroy = function () {
  55290. this.wrapper.data(r, null), this.wrapper.remove();
  55291. }, e[n] = function (t, r, i) {
  55292. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55293. }, e.fn[n] = function (t, n) {
  55294. return e(this).each(function () {
  55295. var i = N(e(this)).data(r);
  55296. i && i.destroy();
  55297. var s = new A(e(this), t, n);
  55298. }), this;
  55299. }, e.extend(e[n], {
  55300. defaults: S,
  55301. addStyle: m,
  55302. removeStyle: v,
  55303. pluginOptions: w,
  55304. getStyle: d,
  55305. insertCSS: g
  55306. }), m("bootstrap", {
  55307. html: "<div>\n<span data-notify-text></span>\n</div>",
  55308. classes: {
  55309. base: {
  55310. "font-weight": "bold",
  55311. padding: "8px 15px 8px 14px",
  55312. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55313. "background-color": "#fcf8e3",
  55314. border: "1px solid #fbeed5",
  55315. "border-radius": "4px",
  55316. "white-space": "nowrap",
  55317. "padding-left": "25px",
  55318. "background-repeat": "no-repeat",
  55319. "background-position": "3px 7px"
  55320. },
  55321. error: {
  55322. color: "#B94A48",
  55323. "background-color": "#F2DEDE",
  55324. "border-color": "#EED3D7",
  55325. "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=)"
  55326. },
  55327. success: {
  55328. color: "#468847",
  55329. "background-color": "#DFF0D8",
  55330. "border-color": "#D6E9C6",
  55331. "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==)"
  55332. },
  55333. info: {
  55334. color: "#3A87AD",
  55335. "background-color": "#D9EDF7",
  55336. "border-color": "#BCE8F1",
  55337. "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=)"
  55338. },
  55339. warn: {
  55340. color: "#C09853",
  55341. "background-color": "#FCF8E3",
  55342. "border-color": "#FBEED5",
  55343. "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)"
  55344. }
  55345. }
  55346. }), e(function () {
  55347. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55348. e(this).trigger("notify-hide");
  55349. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55350. var n = e(this).data(r);
  55351. n && n.show(!1);
  55352. });
  55353. });
  55354. });
  55355. /***/ }),
  55356. /***/ "./resources/sass/app.scss":
  55357. /*!*********************************!*\
  55358. !*** ./resources/sass/app.scss ***!
  55359. \*********************************/
  55360. /*! no static exports found */
  55361. /***/ (function(module, exports) {
  55362. // removed by extract-text-webpack-plugin
  55363. /***/ }),
  55364. /***/ 0:
  55365. /*!*************************************************************!*\
  55366. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55367. \*************************************************************/
  55368. /*! no static exports found */
  55369. /***/ (function(module, exports, __webpack_require__) {
  55370. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55371. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55372. /***/ })
  55373. /******/ });